[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:18:17 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 68f366a29815ae76e6731bd83b6315f8ed7817c9
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Dec 4 11:30:41 2009 +0000

    2009-12-04  Steve Block  <steveblock at google.com>
    
            Reviewed by Darin Adler.
    
            Fixes a crashing bug in Geolocation when a watch is cleared from some callbacks.
            https://bugs.webkit.org/show_bug.cgi?id=32111
    
            * fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js: Added. Tests clearing the watch from the error callback after a permission denied message when permissions have already been denied.
            * fast/dom/Geolocation/permission-denied-already-clear-watch.html: Added. HTML wrapper for above test.
            * fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt: Added. Expected result for above test.
    
            * fast/dom/Geolocation/resources/timeout-clear-watch.js: Added. Tests clearing the watch from the error callback due to a timeout.
            * fast/dom/Geolocation/timeout-clear-watch.html: Added. HTML wrapper for above test.
            * fast/dom/Geolocation/timeout-clear-watch-expected.txt: Added. Expected result for above test.
    
            * platform/gtk/Skipped: Modified. Skips new tests.
    2009-12-04  Steve Block  <steveblock at google.com>
    
            Reviewed by Darin Adler.
    
            Fixes a crashing bug in Geolocation when a watch is cleared from some callbacks.
            https://bugs.webkit.org/show_bug.cgi?id=32111
    
            In Geolocation::GeoNotifier::timerFired, a JS callback may be invoked if a
            fatal error was registered on this GeoNotifier or if this request has timed
            out. If the request is a watch, and is cleared by a call to clearWatch in the
            callback, the GeoNotifier object will be destroyed. We must therefore cache the
            m_geolocation member to allow us to call Geolocation::fatalErrorOccurred or
            Geolocation::requestTimedOut.
    
            Tests: fast/dom/Geolocation/permission-denied-already-clear-watch.html
                   fast/dom/Geolocation/timeout-clear-watch.html
    
            * page/Geolocation.cpp: Modified.
            (WebCore::Geolocation::GeoNotifier::timerFired): Modified. Cache the m_geolocation member before invoking the JS callback.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51692 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a466aea..3edcda7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2009-12-04  Steve Block  <steveblock at google.com>
+
+        Reviewed by Darin Adler.
+
+        Fixes a crashing bug in Geolocation when a watch is cleared from some callbacks. 
+        https://bugs.webkit.org/show_bug.cgi?id=32111
+
+        * fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js: Added. Tests clearing the watch from the error callback after a permission denied message when permissions have already been denied.
+        * fast/dom/Geolocation/permission-denied-already-clear-watch.html: Added. HTML wrapper for above test.
+        * fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt: Added. Expected result for above test.
+
+        * fast/dom/Geolocation/resources/timeout-clear-watch.js: Added. Tests clearing the watch from the error callback due to a timeout.
+        * fast/dom/Geolocation/timeout-clear-watch.html: Added. HTML wrapper for above test.
+        * fast/dom/Geolocation/timeout-clear-watch-expected.txt: Added. Expected result for above test.
+
+        * platform/gtk/Skipped: Modified. Skips new tests.
+
 2009-12-04  Csaba Osztrogonác  <ossy at webkit.org>
 
         Reviewed by Simon Hausmann.
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
new file mode 100644
index 0000000..63195b2
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch-expected.txt
@@ -0,0 +1,14 @@
+Tests that when Geolocation permission has been denied prior to a call to watchPosition, and the watch is cleared in the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
new file mode 100644
index 0000000..2db2637
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/permission-denied-already-clear-watch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/permission-denied-already-clear-watch.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js
new file mode 100644
index 0000000..1e980a5
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/permission-denied-already-clear-watch.js
@@ -0,0 +1,42 @@
+description("Tests that when Geolocation permission has been denied prior to a call to watchPosition, and the watch is cleared in the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
+
+// Prime the Geolocation instance by denying permission.
+window.layoutTestController.setGeolocationPermission(false);
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+
+var error;
+navigator.geolocation.getCurrentPosition(function(p) {
+    testFailed('Success callback invoked unexpectedly');
+    window.layoutTestController.notifyDone();
+}, function(e) {
+    error = e
+    shouldBe('error.code', 'error.PERMISSION_DENIED');
+    shouldBe('error.message', '"User denied Geolocation"');
+    debug('');
+    continueTest();
+});
+
+function continueTest()
+{
+    // Make another request, with permission already denied.
+    var watchId = navigator.geolocation.watchPosition(function(p) {
+        testFailed('Success callback invoked unexpectedly');
+        window.layoutTestController.notifyDone();
+    }, function(e) {
+        error = e
+        shouldBe('error.code', 'error.PERMISSION_DENIED');
+        shouldBe('error.message', '"User denied Geolocation"');
+        navigator.geolocation.clearWatch(watchId);
+        window.setTimeout(completeTest, 0);
+    });
+}
+
+function completeTest()
+{
+    debug('<br /><span class="pass">TEST COMPLETE</span>');
+    window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js b/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js
new file mode 100644
index 0000000..e9d247a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/timeout-clear-watch.js
@@ -0,0 +1,27 @@
+description("Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.");
+
+window.layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100.0);
+
+var error;
+var watchId = navigator.geolocation.watchPosition(function() {
+    testFailed('Success callback invoked unexpectedly');
+    window.layoutTestController.notifyDone();
+}, function(e) {
+    error = e
+    shouldBe('error.code', 'error.TIMEOUT');
+    shouldBe('error.message', '"Timeout expired"');
+    navigator.geolocation.clearWatch(watchId);
+    window.setTimeout(completeTest, 0);
+}, {
+    timeout: 0
+});
+
+function completeTest()
+{
+    debug('<br /><span class="pass">TEST COMPLETE</span>');
+    window.layoutTestController.notifyDone();
+}
+window.layoutTestController.waitUntilDone();
+
+var isAsynchronous = true;
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
new file mode 100644
index 0000000..e97fccd
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch-expected.txt
@@ -0,0 +1,11 @@
+Tests that when a watch times out and is cleared from the error callback, there is no crash. This a regression test for https://bugs.webkit.org/show_bug.cgi?id=32111.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+PASS error.code is error.TIMEOUT
+PASS error.message is "Timeout expired"
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
new file mode 100644
index 0000000..45c7735
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/timeout-clear-watch.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/timeout-clear-watch.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 45b3544..b1f0653 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1283,14 +1283,16 @@ fast/dom/cssTarget-crash.html
 fast/dom/frame-loading-via-document-write.html
 fast/dom/Geolocation/callback-exception.html
 fast/dom/Geolocation/error.html
-fast/dom/Geolocation/permission-denied.html
+fast/dom/Geolocation/permission-denied-already-clear-watch.html
 fast/dom/Geolocation/permission-denied-already-error.html
 fast/dom/Geolocation/permission-denied-already-success.html
 fast/dom/Geolocation/permission-denied-stops-watches.html
+fast/dom/Geolocation/permission-denied.html
 fast/dom/Geolocation/position-string.html
 fast/dom/Geolocation/reentrant-error.html
 fast/dom/Geolocation/reentrant-success.html
 fast/dom/Geolocation/success.html
+fast/dom/Geolocation/timeout-clear-watch.html
 fast/dom/Geolocation/timeout-zero.html
 fast/dom/Geolocation/timeout.html
 fast/dom/Geolocation/watch.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 76e47f9..ef76806 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-12-04  Steve Block  <steveblock at google.com>
+
+        Reviewed by Darin Adler.
+
+        Fixes a crashing bug in Geolocation when a watch is cleared from some callbacks. 
+        https://bugs.webkit.org/show_bug.cgi?id=32111
+
+        In Geolocation::GeoNotifier::timerFired, a JS callback may be invoked if a
+        fatal error was registered on this GeoNotifier or if this request has timed
+        out. If the request is a watch, and is cleared by a call to clearWatch in the
+        callback, the GeoNotifier object will be destroyed. We must therefore cache the
+        m_geolocation member to allow us to call Geolocation::fatalErrorOccurred or
+        Geolocation::requestTimedOut.
+
+        Tests: fast/dom/Geolocation/permission-denied-already-clear-watch.html
+               fast/dom/Geolocation/timeout-clear-watch.html
+
+        * page/Geolocation.cpp: Modified.
+        (WebCore::Geolocation::GeoNotifier::timerFired): Modified. Cache the m_geolocation member before invoking the JS callback.
+
 2009-12-04  Zoltan Horvath  <zoltan at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index d69b2de..c4fac86 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -73,11 +73,15 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*)
 {
     m_timer.stop();
 
+    // Cache our pointer to the Geolocation object, as this GeoNotifier object
+    // could be deleted by a call to clearWatch in a callback.
+    Geolocation* geolocation = m_geolocation;
+
     if (m_fatalError) {
         if (m_errorCallback)
             m_errorCallback->handleEvent(m_fatalError.get());
         // This will cause this notifier to be deleted.
-        m_geolocation->fatalErrorOccurred(this);
+        geolocation->fatalErrorOccurred(this);
         return;
     }
 
@@ -85,7 +89,7 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*)
         RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timeout expired");
         m_errorCallback->handleEvent(error.get());
     }
-    m_geolocation->requestTimedOut(this);
+    geolocation->requestTimedOut(this);
 }
 
 void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> prpNotifier)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list