[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 14:33:50 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 1606c4fe1f35f07fcff63634c76324efed5269ac
Author: steveblock at google.com <steveblock at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 10:00:34 2010 +0000

    2010-10-13  Steve Block  <steveblock at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Pages using DeviceOrientation and DeviceMotion should not go into the page cache
            https://bugs.webkit.org/show_bug.cgi?id=47408
    
            * fast/dom/DeviceMotion/no-page-cache-expected.txt: Added.
            * fast/dom/DeviceMotion/no-page-cache.html: Added.
            * fast/dom/DeviceMotion/resources: Added.
            * fast/dom/DeviceMotion/resources/cached-page-1.html: Added.
            * fast/dom/DeviceMotion/resources/cached-page-2.html: Added.
            * fast/dom/DeviceMotion/script-tests/no-page-cache.js: Added.
            (reportPageOneOnload):
            * fast/dom/DeviceOrientation/no-page-cache-expected.txt: Added.
            * fast/dom/DeviceOrientation/no-page-cache.html: Added.
            * fast/dom/DeviceOrientation/resources: Added.
            * fast/dom/DeviceOrientation/resources/cached-page-1.html: Added.
            * fast/dom/DeviceOrientation/resources/cached-page-2.html: Added.
            * fast/dom/DeviceOrientation/script-tests/no-page-cache.js: Added.
            (reportPageOneOnload):
    2010-10-13  Steve Block  <steveblock at google.com>
    
            Reviewed by Alexey Proskuryakov.
    
            Pages using DeviceOrientation and DeviceMotion should not go into the page cache
            https://bugs.webkit.org/show_bug.cgi?id=47408
    
            Tests: fast/dom/DeviceMotion/no-page-cache.html
                   fast/dom/DeviceOrientation/no-page-cache.html
    
            * dom/DeviceMotionController.h:
            (WebCore::DeviceMotionController::isActive):
            * dom/DeviceOrientationController.h:
            (WebCore::DeviceOrientationController::isActive):
            * history/PageCache.cpp:
            (WebCore::logCanCachePageDecision):
            (WebCore::PageCache::canCache):
            * page/Page.cpp:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69646 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 27b3fae..2955bf2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2010-10-13  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Pages using DeviceOrientation and DeviceMotion should not go into the page cache
+        https://bugs.webkit.org/show_bug.cgi?id=47408
+
+        * fast/dom/DeviceMotion/no-page-cache-expected.txt: Added.
+        * fast/dom/DeviceMotion/no-page-cache.html: Added.
+        * fast/dom/DeviceMotion/resources: Added.
+        * fast/dom/DeviceMotion/resources/cached-page-1.html: Added.
+        * fast/dom/DeviceMotion/resources/cached-page-2.html: Added.
+        * fast/dom/DeviceMotion/script-tests/no-page-cache.js: Added.
+        (reportPageOneOnload):
+        * fast/dom/DeviceOrientation/no-page-cache-expected.txt: Added.
+        * fast/dom/DeviceOrientation/no-page-cache.html: Added.
+        * fast/dom/DeviceOrientation/resources: Added.
+        * fast/dom/DeviceOrientation/resources/cached-page-1.html: Added.
+        * fast/dom/DeviceOrientation/resources/cached-page-2.html: Added.
+        * fast/dom/DeviceOrientation/script-tests/no-page-cache.js: Added.
+        (reportPageOneOnload):
+
 2010-10-13  Alexander Pavlov  <apavlov at chromium.org>
 
         [Chromium] Unreviewed, build fix.
diff --git a/LayoutTests/fast/dom/DeviceMotion/no-page-cache-expected.txt b/LayoutTests/fast/dom/DeviceMotion/no-page-cache-expected.txt
new file mode 100644
index 0000000..1dee7cd
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/no-page-cache-expected.txt
@@ -0,0 +1,14 @@
+Tests that pages that use DeviceMotion are not put in the page cache.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Main page opening resources/cached-page-1.html
+resources/cached-page-1.html onload fired, count = 1
+resources/cached-page-1.html about to navigate to resources/cached-page-2.html
+resources/cached-page-2.html about to go back to resources/cached-page-1.html
+resources/cached-page-1.html onload fired, count = 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceMotion/no-page-cache.html b/LayoutTests/fast/dom/DeviceMotion/no-page-cache.html
new file mode 100644
index 0000000..2e09eac
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/no-page-cache.html
@@ -0,0 +1,12 @@
+<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/no-page-cache.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/DeviceMotion/resources/cached-page-1.html b/LayoutTests/fast/dom/DeviceMotion/resources/cached-page-1.html
new file mode 100644
index 0000000..759fbf9
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/resources/cached-page-1.html
@@ -0,0 +1,11 @@
+<script>
+function loadNext() {
+    window.addEventListener('devicemotion', function() {});
+    if (window.opener.reportPageOneOnload() == 1) {
+        window.opener.debug('resources/cached-page-1.html about to navigate to resources/cached-page-2.html')
+        // Location changes need to happen outside the onload handler to generate history entries.
+        setTimeout(function() { location.href = 'cached-page-2.html'; }, 0);
+    }
+}
+</script>
+<body onload="loadNext()"></body>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html b/LayoutTests/fast/dom/DeviceMotion/resources/cached-page-2.html
similarity index 100%
copy from LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html
copy to LayoutTests/fast/dom/DeviceMotion/resources/cached-page-2.html
diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/no-page-cache.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/no-page-cache.js
new file mode 100644
index 0000000..67cfcf6
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/no-page-cache.js
@@ -0,0 +1,24 @@
+description('Tests that pages that use DeviceMotion are not put in the page cache.');
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.setCanOpenWindows();
+    layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
+} else
+    debug('This test can not be run without the LayoutTestController');
+
+var pageOneOnloadCount = 0;
+function reportPageOneOnload() {
+    ++pageOneOnloadCount;
+    debug('resources/cached-page-1.html onload fired, count = ' + pageOneOnloadCount);
+    if (pageOneOnloadCount == 2) {
+        finishJSTest();
+    }
+    return pageOneOnloadCount;
+}
+
+debug("Main page opening resources/cached-page-1.html");
+window.open("resources/cached-page-1.html");
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-page-cache-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/no-page-cache-expected.txt
new file mode 100644
index 0000000..0217208
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/no-page-cache-expected.txt
@@ -0,0 +1,14 @@
+Tests that pages that use DeviceOrientation are not put in the page cache.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Main page opening resources/cached-page-1.html
+resources/cached-page-1.html onload fired, count = 1
+resources/cached-page-1.html about to navigate to resources/cached-page-2.html
+resources/cached-page-2.html about to go back to resources/cached-page-1.html
+resources/cached-page-1.html onload fired, count = 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-page-cache.html b/LayoutTests/fast/dom/DeviceOrientation/no-page-cache.html
new file mode 100644
index 0000000..2e09eac
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/no-page-cache.html
@@ -0,0 +1,12 @@
+<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/no-page-cache.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/DeviceOrientation/resources/cached-page-1.html b/LayoutTests/fast/dom/DeviceOrientation/resources/cached-page-1.html
new file mode 100644
index 0000000..2d76889
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/resources/cached-page-1.html
@@ -0,0 +1,11 @@
+<script>
+function loadNext() {
+    window.addEventListener('deviceorientation', function() {});
+    if (window.opener.reportPageOneOnload() == 1) {
+        window.opener.debug('resources/cached-page-1.html about to navigate to resources/cached-page-2.html')
+        // Location changes need to happen outside the onload handler to generate history entries.
+        setTimeout(function() { location.href = 'cached-page-2.html'; }, 0);
+    }
+}
+</script>
+<body onload="loadNext()"></body>
diff --git a/LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html b/LayoutTests/fast/dom/DeviceOrientation/resources/cached-page-2.html
similarity index 100%
copy from LayoutTests/fast/dom/Geolocation/resources/cached-page-2.html
copy to LayoutTests/fast/dom/DeviceOrientation/resources/cached-page-2.html
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-page-cache.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-page-cache.js
new file mode 100644
index 0000000..cbfb501
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-page-cache.js
@@ -0,0 +1,24 @@
+description('Tests that pages that use DeviceOrientation are not put in the page cache.');
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.setCanOpenWindows();
+    layoutTestController.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
+} else
+    debug('This test can not be run without the LayoutTestController');
+
+var pageOneOnloadCount = 0;
+function reportPageOneOnload() {
+    ++pageOneOnloadCount;
+    debug('resources/cached-page-1.html onload fired, count = ' + pageOneOnloadCount);
+    if (pageOneOnloadCount == 2) {
+        finishJSTest();
+    }
+    return pageOneOnloadCount;
+}
+
+debug("Main page opening resources/cached-page-1.html");
+window.open("resources/cached-page-1.html");
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 130bde4..7cfa45b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-13  Steve Block  <steveblock at google.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Pages using DeviceOrientation and DeviceMotion should not go into the page cache
+        https://bugs.webkit.org/show_bug.cgi?id=47408
+
+        Tests: fast/dom/DeviceMotion/no-page-cache.html
+               fast/dom/DeviceOrientation/no-page-cache.html
+
+        * dom/DeviceMotionController.h:
+        (WebCore::DeviceMotionController::isActive):
+        * dom/DeviceOrientationController.h:
+        (WebCore::DeviceOrientationController::isActive):
+        * history/PageCache.cpp:
+        (WebCore::logCanCachePageDecision):
+        (WebCore::PageCache::canCache):
+        * page/Page.cpp:
+
 2010-10-13  Jenn Braithwaite  <jennb at chromium.org>
 
         Reviewed by Dmitry Titov.
diff --git a/WebCore/dom/DeviceMotionController.h b/WebCore/dom/DeviceMotionController.h
index 422be73..70c948e 100644
--- a/WebCore/dom/DeviceMotionController.h
+++ b/WebCore/dom/DeviceMotionController.h
@@ -46,6 +46,8 @@ public:
 
     void didChangeDeviceMotion(DeviceMotionData*);
 
+    bool isActive() { return !m_listeners.isEmpty(); }
+
 private:
     void timerFired(Timer<DeviceMotionController>*);
     
diff --git a/WebCore/dom/DeviceOrientationController.h b/WebCore/dom/DeviceOrientationController.h
index 53b80f8..4fa9006 100644
--- a/WebCore/dom/DeviceOrientationController.h
+++ b/WebCore/dom/DeviceOrientationController.h
@@ -48,6 +48,8 @@ public:
 
     void didChangeDeviceOrientation(DeviceOrientation*);
 
+    bool isActive() { return !m_listeners.isEmpty(); }
+
 private:
     void timerFired(Timer<DeviceOrientationController>*);
 
diff --git a/WebCore/history/PageCache.cpp b/WebCore/history/PageCache.cpp
index a5b29ce..0bce3af 100644
--- a/WebCore/history/PageCache.cpp
+++ b/WebCore/history/PageCache.cpp
@@ -31,6 +31,8 @@
 #include "Cache.h"
 #include "CachedPage.h"
 #include "DOMWindow.h"
+#include "DeviceMotionController.h"
+#include "DeviceOrientationController.h"
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
@@ -201,6 +203,16 @@ static void logCanCachePageDecision(Page* page)
         PCLOG("   -Page settings says b/f cache disabled");
         cannotCache = true;
     }
+#if ENABLE(DEVICE_ORIENTATION)
+    if (!page->deviceMotionController()->isActive()) {
+        PCLOG("   -Page is using DeviceMotion");
+        cannotCache = true;
+    }
+    if (!page->deviceOrientationController()->isActive()) {
+        PCLOG("   -Page is using DeviceOrientation");
+        cannotCache = true;
+    }
+#endif
     if (loadType == FrameLoadTypeReload) {
         PCLOG("   -Load type is: Reload");
         cannotCache = true;
@@ -297,7 +309,11 @@ bool PageCache::canCache(Page* page)
         && page->backForwardList()->enabled()
         && page->backForwardList()->capacity() > 0
         && page->settings()->usesPageCache()
-        && loadType != FrameLoadTypeReload 
+#if ENABLE(DEVICE_ORIENTATION)
+        && !page->deviceMotionController()->isActive()
+        && !page->deviceOrientationController()->isActive()
+#endif
+        && loadType != FrameLoadTypeReload
         && loadType != FrameLoadTypeReloadFromOrigin
         && loadType != FrameLoadTypeSame;
 }
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index e38657c..d84d4a6 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -20,7 +20,6 @@
 #include "config.h"
 #include "Page.h"
 
-#include "DeviceMotionController.h"
 #include "BackForwardController.h"
 #include "BackForwardList.h"
 #include "Base64.h"
@@ -30,6 +29,7 @@
 #include "ContextMenuClient.h"
 #include "ContextMenuController.h"
 #include "DOMWindow.h"
+#include "DeviceMotionController.h"
 #include "DeviceOrientationController.h"
 #include "DragController.h"
 #include "EditorClient.h"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list