Skip to content

Commit 13af3b5

Browse files
committed
Geolocation: Do nothing when its execution context is already gone.
GeoNotifier's underlying callback functions are made alive by its execution context. Thus, when the execution context is gone, the underlying callback functions are also gone. Also, it doesn't make sense anyway to invoke a callback when its own execution context is already gone. Thus, this patch adds the check of the execution context before doing anything. [email protected] (cherry picked from commit f7c95d3) Bug: 788975 Change-Id: I39bcbcbbe9df201924427f9d2341ba6724b5b79c Reviewed-on: https://chromium-review.googlesource.com/798996 Commit-Queue: Yuki Shiino <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Hitoshi Yoshida <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#520909} Reviewed-on: https://chromium-review.googlesource.com/816639 Reviewed-by: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/branch-heads/3282@{#94} Cr-Branched-From: 5fdc0fa-refs/heads/master@{#520840}
1 parent 9091216 commit 13af3b5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

third_party/WebKit/LayoutTests/geolocation-api/disconnected-frame-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Tests that when a request is made on a Geolocation object and its Frame is disco
33
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
44

55

6-
FAIL Error callback invoked unexpectedly
6+
PASS No callbacks invoked
77
PASS successfullyParsed is true
88

99
TEST COMPLETE

third_party/WebKit/LayoutTests/geolocation-api/disconnected-frame-permission-denied-expected.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
66
PASS error.code is error.PERMISSION_DENIED
77
PASS error.message is "User denied Geolocation"
88

9-
FAIL Error callback invoked unexpectedly
9+
PASS No callbacks invoked
1010
PASS successfullyParsed is true
1111

1212
TEST COMPLETE

third_party/WebKit/Source/modules/geolocation/GeoNotifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ void GeoNotifier::StopTimer() {
8585
void GeoNotifier::TimerFired(TimerBase*) {
8686
timer_.Stop();
8787

88+
// As the timer fires asynchronously, it's possible that the execution context
89+
// has already gone. Check it first.
90+
if (!geolocation_->GetExecutionContext()) {
91+
return; // Do not invoke anything because of no execution context.
92+
}
93+
8894
// Test for fatal error first. This is required for the case where the
8995
// LocalFrame is disconnected and requests are cancelled.
9096
if (fatal_error_) {

0 commit comments

Comments
 (0)