REGRESSION: Inline PDF that are cached fail to appear in iframe.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2013 15:46:54 +0000 (15:46 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Sep 2013 15:46:54 +0000 (15:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75449

Reviewed by Darin Adler.

Make sure 'frame is from page cache' flag is set for subframes too.

WebFrameLoaderClient::m_frameCameFromPageCache == true forces plugins
to be loaded manually. It ensures that the plugin raw data is fetched again
while the containing frame is being restored from the page cache.
(Plugins get destroyed when the frame goes to page cache.)

Source/WebKit2:

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
This gets called only on the frame where the actual history navigation happens.
(WebKit::WebFrameLoaderClient::didRestoreFromPageCache):
This gets called for all the restored frames.

LayoutTests:

* fast/history/history-back-while-pdf-in-pagecache-expected.html: Added.
* fast/history/history-back-while-pdf-in-pagecache.html: Added.
* fast/history/resources/history-back-for-pfd-test.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/history/history-back-while-pdf-in-pagecache-expected.html [new file with mode: 0644]
LayoutTests/fast/history/history-back-while-pdf-in-pagecache.html [new file with mode: 0644]
LayoutTests/fast/history/resources/history-back-for-pfd-test.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

index 816f2af..b57a196 100644 (file)
@@ -1,3 +1,21 @@
+2013-09-12  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION: Inline PDF that are cached fail to appear in iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=75449
+
+        Reviewed by Darin Adler.
+
+        Make sure 'frame is from page cache' flag is set for subframes too.
+
+        WebFrameLoaderClient::m_frameCameFromPageCache == true forces plugins
+        to be loaded manually. It ensures that the plugin raw data is fetched again
+        while the containing frame is being restored from the page cache.
+        (Plugins get destroyed when the frame goes to page cache.)
+
+        * fast/history/history-back-while-pdf-in-pagecache-expected.html: Added.
+        * fast/history/history-back-while-pdf-in-pagecache.html: Added.
+        * fast/history/resources/history-back-for-pfd-test.html: Added.
+
 2013-09-12  Gabor Abraham  <abrhm@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening. Rebase after r155253.
diff --git a/LayoutTests/fast/history/history-back-while-pdf-in-pagecache-expected.html b/LayoutTests/fast/history/history-back-while-pdf-in-pagecache-expected.html
new file mode 100644 (file)
index 0000000..c17317d
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    if (window.testRunner)
+        testRunner.waitUntilDone();
+
+    function runTest() {
+        setTimeout(function () {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 200);
+    }
+</script>
+</head>
+<body onload='runTest();'>
+    <!-- This tests if plugins from page cache show up after history navigation. -->
+    <iframe src='../images/resources/green_rectangle.pdf'></iframe>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/history/history-back-while-pdf-in-pagecache.html b/LayoutTests/fast/history/history-back-while-pdf-in-pagecache.html
new file mode 100644 (file)
index 0000000..5cbbb4f
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    function done() {
+        setTimeout(function () {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 200);
+    }
+
+    function runTest() {
+        if (location.hash == "") {
+            if (window.testRunner) {
+                testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+                testRunner.waitUntilDone();
+            }
+
+            history.pushState({ }, "", window.location + "#1");
+            setTimeout("window.location.href = 'resources/history-back-for-pfd-test.html'", 0);
+
+            // This is for WK2.
+            done();
+        } else {
+            // This is for WK1.
+            done();
+        }
+    }
+</script>
+</head>
+<body onload='runTest();'>
+    <!-- This tests if plugins from page cache show up after history navigation. -->
+    <iframe src='../images/resources/green_rectangle.pdf'></iframe>
+</body>
+</html>
diff --git a/LayoutTests/fast/history/resources/history-back-for-pfd-test.html b/LayoutTests/fast/history/resources/history-back-for-pfd-test.html
new file mode 100644 (file)
index 0000000..b4b7d36
--- /dev/null
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html>
+<body onload="history.back()"></body>
+</html>
index 7e67607..84e1511 100644 (file)
@@ -1,3 +1,23 @@
+2013-09-12  Zalan Bujtas  <zalan@apple.com>
+
+        REGRESSION: Inline PDF that are cached fail to appear in iframe.
+        https://bugs.webkit.org/show_bug.cgi?id=75449
+
+        Reviewed by Darin Adler.
+
+        Make sure 'frame is from page cache' flag is set for subframes too.
+
+        WebFrameLoaderClient::m_frameCameFromPageCache == true forces plugins
+        to be loaded manually. It ensures that the plugin raw data is fetched again
+        while the containing frame is being restored from the page cache.
+        (Plugins get destroyed when the frame goes to page cache.)
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::transitionToCommittedFromCachedFrame):
+        This gets called only on the frame where the actual history navigation happens.
+        (WebKit::WebFrameLoaderClient::didRestoreFromPageCache):
+        This gets called for all the restored frames.
+
 2013-09-11  Simon Fraser  <simon.fraser@apple.com>
 
         Make sure that layout is up-to-date when moving a WKView into a window, to avoid !needsLayout() assertions in RenderView::paint()
index 981fef6..9b6090e 100644 (file)
@@ -1184,7 +1184,6 @@ void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
 
 void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*)
 {
-    m_frameCameFromPageCache = true;
 }
 
 void WebFrameLoaderClient::transitionToCommittedForNewPage()
@@ -1240,6 +1239,7 @@ void WebFrameLoaderClient::didSaveToPageCache()
 
 void WebFrameLoaderClient::didRestoreFromPageCache()
 {
+    m_frameCameFromPageCache = true;
 }
 
 void WebFrameLoaderClient::dispatchDidBecomeFrameset(bool value)