[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

steveblock at google.com steveblock at google.com
Wed Dec 22 12:09:05 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f68fb81ab88d5fff9264ae05fddf319ebe911d51
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 16 12:30:05 2010 +0000

    2010-08-13  Steve Block  <steveblock at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Geolocation requests in progress when the frame is disconnected should invoke the error callback
            https://bugs.webkit.org/show_bug.cgi?id=43974
    
            If requests are ongoing when the Frame is disconnected, we abort them with a fatal error.
            To do this, when Geolocation::disconnectFrame() is called we call cancelAllRequests() to
            set a fatal error on all ongoing requests. Once the requests have made their error
            callbacks, they are deleted. Note that we check at callback time that the script
            execution context for the callback is still valid, so it's safe to attempt these
            callbacks even after the Geolocation object's Frame has gone.
    
            This requires a change to allow multiple calls to GeoNotifier::setFatalError().
            For repeated calls, we do not replace the existing error. This ensures that when
            permission has been denied and the frame is then disconnected, the error callback
            reports the permission error, as required by the spec.
    
            Tests: fast/dom/Geolocation/disconnected-frame.html
                   fast/dom/Geolocation/disconnected-frame-permission-denied.html
    
            * page/Geolocation.cpp:
            (WebCore::Geolocation::GeoNotifier::setFatalError):
            (WebCore::Geolocation::disconnectFrame):
            (WebCore::Geolocation::startRequest):
            (WebCore::Geolocation::cancelAllRequests):
            * page/Geolocation.h:
    2010-08-13  Steve Block  <steveblock at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Geolocation requests in progress when the frame is disconnected should invoke the error callback
            https://bugs.webkit.org/show_bug.cgi?id=43974
    
            Added new tests to GTK skipped list.
    
            * fast/dom/Geolocation/disconnected-frame.html: Added.
            * fast/dom/Geolocation/disconnected-frame-expected.txt: Added.
            * fast/dom/Geolocation/script-tests/disconnected-frame.js: Added.
            * fast/dom/Geolocation/resources/disconnected-frame-inner.html: Added.
            * fast/dom/Geolocation/disconnected-frame-permission-denied.html: Added.
            * fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt: Added.
            * fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js: Added.
            * platform/gtk/Skipped:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65416 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 93e2e43..72f3add 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-13  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Geolocation requests in progress when the frame is disconnected should invoke the error callback
+        https://bugs.webkit.org/show_bug.cgi?id=43974
+
+        Added new tests to GTK skipped list.
+
+        * fast/dom/Geolocation/disconnected-frame.html: Added.
+        * fast/dom/Geolocation/disconnected-frame-expected.txt: Added.
+        * fast/dom/Geolocation/script-tests/disconnected-frame.js: Added.
+        * fast/dom/Geolocation/resources/disconnected-frame-inner.html: Added.
+        * fast/dom/Geolocation/disconnected-frame-permission-denied.html: Added.
+        * fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt: Added.
+        * fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js: Added.
+        * platform/gtk/Skipped:
+
 2010-08-16  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Joseph Pecoraro.
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt b/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt
new file mode 100644
index 0000000..33c17d3
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-expected.txt
@@ -0,0 +1,12 @@
+frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
+Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is 2
+PASS error.message is "Geolocation cannot be used in frameless documents"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
new file mode 100644
index 0000000..f4e936f
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
@@ -0,0 +1,12 @@
+frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
+Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.html
new file mode 100644
index 0000000..d9b51c1
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame-permission-denied.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="script-tests/disconnected-frame-permission-denied.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/disconnected-frame.html b/LayoutTests/fast/dom/Geolocation/disconnected-frame.html
new file mode 100644
index 0000000..b91eade
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/disconnected-frame.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="script-tests/disconnected-frame.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html
new file mode 100644
index 0000000..4819351
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/resources/disconnected-frame-inner.html
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+  </head>
+  <body onload="window.parent.onIframeLoaded()", onunload="window.parent.onIframeUnloaded();">
+    <p>This frame should be replaced before the test ends</p>
+  </body>
+</html>
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
new file mode 100644
index 0000000..4dc68af
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame-permission-denied.js
@@ -0,0 +1,29 @@
+description("Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.");
+
+if (window.layoutTestController)
+    layoutTestController.setGeolocationPermission(false);
+
+function onIframeLoaded() {
+    iframeGeolocation = iframe.contentWindow.navigator.geolocation;
+    iframe.src = 'data:text/html,This frame should be visible when the test completes';
+}
+
+var error;
+function onIframeUnloaded() {
+    iframeGeolocation.getCurrentPosition(function () {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        error = e;
+        shouldBe('error.code', 'error.PERMISSION_DENIED');
+        shouldBe('error.message', '"User denied Geolocation"');
+        finishJSTest();
+    });
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js
new file mode 100644
index 0000000..50d377a
--- /dev/null
+++ b/LayoutTests/fast/dom/Geolocation/script-tests/disconnected-frame.js
@@ -0,0 +1,31 @@
+description("Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.");
+
+if (window.layoutTestController) {
+    layoutTestController.setGeolocationPermission(true);
+    layoutTestController.setMockGeolocationPosition(51.478, -0.166, 100);
+}
+
+function onIframeLoaded() {
+    iframeGeolocation = iframe.contentWindow.navigator.geolocation;
+    iframe.src = 'data:text/html,This frame should be visible when the test completes';
+}
+
+var error;
+function onIframeUnloaded() {
+    iframeGeolocation.getCurrentPosition(function () {
+        testFailed('Success callback invoked unexpectedly');
+        finishJSTest();
+    }, function(e) {
+        error = e;
+        shouldBe('error.code', '2');
+        shouldBe('error.message', '"Geolocation cannot be used in frameless documents"');
+        finishJSTest();
+    });
+}
+
+var iframe = document.createElement('iframe');
+iframe.src = 'resources/disconnected-frame-inner.html';
+document.body.appendChild(iframe);
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index e8f0c94..8f56138 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5682,7 +5682,9 @@ storage/indexeddb
 fast/dom/Geolocation/callback-to-remote-context.html
 fast/dom/Geolocation/callback-to-remote-context2.html
 fast/dom/Geolocation/callback-to-deleted-context.html
+fast/dom/Geolocation/disconnected-frame.html
 fast/dom/Geolocation/disconnected-frame-already.html
+fast/dom/Geolocation/disconnected-frame-permission-denied.html
 
 # GTK+ theme-rendered widgets do not support CSS transforms
 # https://bugs.webkit.org/show_bug.cgi?id=40139
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 97de904..3adff1d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-08-13  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Geolocation requests in progress when the frame is disconnected should invoke the error callback
+        https://bugs.webkit.org/show_bug.cgi?id=43974
+
+        If requests are ongoing when the Frame is disconnected, we abort them with a fatal error.
+        To do this, when Geolocation::disconnectFrame() is called we call cancelAllRequests() to
+        set a fatal error on all ongoing requests. Once the requests have made their error
+        callbacks, they are deleted. Note that we check at callback time that the script
+        execution context for the callback is still valid, so it's safe to attempt these
+        callbacks even after the Geolocation object's Frame has gone.
+
+        This requires a change to allow multiple calls to GeoNotifier::setFatalError().
+        For repeated calls, we do not replace the existing error. This ensures that when
+        permission has been denied and the frame is then disconnected, the error callback
+        reports the permission error, as required by the spec.
+
+        Tests: fast/dom/Geolocation/disconnected-frame.html
+               fast/dom/Geolocation/disconnected-frame-permission-denied.html
+
+        * page/Geolocation.cpp:
+        (WebCore::Geolocation::GeoNotifier::setFatalError):
+        (WebCore::Geolocation::disconnectFrame):
+        (WebCore::Geolocation::startRequest):
+        (WebCore::Geolocation::cancelAllRequests):
+        * page/Geolocation.h:
+
 2010-08-16  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Joseph Pecoraro.
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index bb55e3e..ce034f3 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -47,6 +47,7 @@ namespace WebCore {
 
 static const char permissionDeniedErrorMessage[] = "User denied Geolocation";
 static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service";
+static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used in frameless documents";
 
 #if ENABLE(CLIENT_BASED_GEOLOCATION)
 
@@ -94,9 +95,15 @@ Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<Posit
 
 void Geolocation::GeoNotifier::setFatalError(PassRefPtr<PositionError> error)
 {
-    // This method is called at most once on a given GeoNotifier object.
-    ASSERT(!m_fatalError);
+    // If a fatal error has already been set, stick with it. This makes sure that
+    // when permission is denied, this is the error reported, as required by the
+    // spec.
+    if (m_fatalError)
+        return;
+
     m_fatalError = error;
+    // An existing timer may not have a zero timeout.
+    m_timer.stop();
     m_timer.startOneShot(0);
 }
 
@@ -130,6 +137,8 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*)
     // could be deleted by a call to clearWatch in a callback.
     RefPtr<GeoNotifier> protect(this);
 
+    // Test for fatal error first. This is required for the case where the Frame is
+    // disconnected and requests are cancelled.
     if (m_fatalError) {
         if (m_errorCallback)
             m_errorCallback->handleEvent(m_fatalError.get());
@@ -222,7 +231,7 @@ void Geolocation::disconnectFrame()
 {
     if (m_frame && m_frame->page() && m_allowGeolocation == InProgress)
         m_frame->page()->chrome()->cancelGeolocationPermissionRequestForFrame(m_frame, this);
-    stopTimers();
+    cancelAllRequests();
     stopUpdating();
     if (m_frame && m_frame->document())
         m_frame->document()->setUsingGeolocation(false);
@@ -503,6 +512,22 @@ void Geolocation::stopTimers()
     stopTimersForWatchers();
 }
 
+void Geolocation::cancelRequests(Vector<RefPtr<GeoNotifier> >& notifiers)
+{
+    Vector<RefPtr<GeoNotifier> >::const_iterator end = notifiers.end();
+    for (Vector<RefPtr<GeoNotifier> >::const_iterator it = notifiers.begin(); it != end; ++it)
+        (*it)->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, framelessDocumentErrorMessage));
+}
+
+void Geolocation::cancelAllRequests()
+{
+    Vector<RefPtr<GeoNotifier> > copy;
+    copyToVector(m_oneShots, copy);
+    cancelRequests(copy);
+    m_watchers.getNotifiersVector(copy);
+    cancelRequests(copy);
+}
+
 void Geolocation::handleError(PositionError* error)
 {
     ASSERT(error);
diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h
index 8c47d9c..5f1e4df 100644
--- a/WebCore/page/Geolocation.h
+++ b/WebCore/page/Geolocation.h
@@ -135,6 +135,9 @@ private:
     void stopTimersForWatchers();
     void stopTimers();
 
+    void cancelRequests(Vector<RefPtr<GeoNotifier> >&);
+    void cancelAllRequests();
+
     void positionChangedInternal();
     void makeSuccessCallbacks();
     void handleError(PositionError*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list