Title: [248260] releases/WebKitGTK/webkit-2.24
- Revision
- 248260
- Author
- [email protected]
- Date
- 2019-08-03 20:24:25 -0700 (Sat, 03 Aug 2019)
Log Message
Merge r248172 - Document::resume should delay resetting of form control elements.
https://bugs.webkit.org/show_bug.cgi?id=200376
Reviewed by Geoffrey Garen.
Source/WebCore:
Delay the execution of form control element resets until the next task
to avoid synchronously mutating DOM during page cache restoration.
Test: fast/frames/restoring-page-cache-should-not-run-scripts.html
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::resumeFromDocumentSuspension):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::resumeFromDocumentSuspension):
LayoutTests:
Added a regression test.
* fast/frames/restoring-page-cache-should-not-run-scripts-expected.txt: Added.
* fast/frames/restoring-page-cache-should-not-run-scripts.html: Added.
* platform/win/TestExpectations: Skip this test on Windows since navigating to blob fails on Windows.
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog (248259 => 248260)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog 2019-08-04 03:24:21 UTC (rev 248259)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog 2019-08-04 03:24:25 UTC (rev 248260)
@@ -1,3 +1,16 @@
+2019-08-02 Ryosuke Niwa <[email protected]>
+
+ Document::resume should delay resetting of form control elements.
+ https://bugs.webkit.org/show_bug.cgi?id=200376
+
+ Reviewed by Geoffrey Garen.
+
+ Added a regression test.
+
+ * fast/frames/restoring-page-cache-should-not-run-scripts-expected.txt: Added.
+ * fast/frames/restoring-page-cache-should-not-run-scripts.html: Added.
+ * platform/win/TestExpectations: Skip this test on Windows since navigating to blob fails on Windows.
+
2019-07-17 Olivier Blin <[email protected]>
Web Inspector: application/xml content not shown
Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts-expected.txt (0 => 248260)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts-expected.txt 2019-08-04 03:24:25 UTC (rev 248260)
@@ -0,0 +1,3 @@
+This tests that pageshow event is fired before the focus elements are reset when a document in the page cache is restored.
+
+PASS
Added: releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts.html (0 => 248260)
--- releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts.html (rev 0)
+++ releases/WebKitGTK/webkit-2.24/LayoutTests/fast/frames/restoring-page-cache-should-not-run-scripts.html 2019-08-04 03:24:25 UTC (rev 248260)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests that pageshow event is fired before the focus elements are reset when a document in the page cache is restored.</p>
+<div id="result"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.setCanOpenWindows();
+ testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
+}
+
+let newWindow;
+function start() {
+ result.textContent = 'Running...';
+ newWindow = window.open(URL.createObjectURL(newPage));
+}
+
+const newPage = new Blob([`<!DOCTYPE html>
+<html>
+<body>
+<p>hello, this is a test.</p>
+<form autocomplete="off"><output id="output"></output></form>
+<script>
+output.value = 'foo';
+_onload_ = () => opener.postMessage({step: 'opened'}, '*');
+_onmessage_ = () => {
+ let pageShowed = false;
+ document.addEventListener('DOMSubtreeModified', () => opener.postMessage({step: 'check', pageShowed}, '*'), {once: true});
+ window.addEventListener('pageshow', () => pageShowed = true);
+ opener.postMessage({step: 'ready'}, '*');
+}
+</scr` + `ipt>
+</body>
+</html>`], {'type': 'text/html'});
+
+const secondPage = new Blob([`<!DOCTYPE html>
+<html>
+<body _onload_="opener.postMessage({step: 'navigated'}, '*')">
+<p>second page.</p>
+</body>
+</html>`], {'type': 'text/html'});
+
+_onmessage_ = (event) => {
+ switch (event.data.step) {
+ case 'opened':
+ newWindow.postMessage('getready', '*');
+ break;
+ case 'ready':
+ newWindow.location = URL.createObjectURL(secondPage);
+ break;
+ case 'navigated':
+ newWindow.history.back();
+ break;
+ case 'check':
+ result.textContent = event.data.pageShowed ? 'PASS' : 'FAIL';
+ newWindow.close();
+ if (window.testRunner)
+ testRunner.notifyDone();
+ break;
+ }
+}
+
+if (window.testRunner)
+ start();
+else
+ document.write('<button _onclick_="start()">Start</button>');
+
+</script>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (248259 => 248260)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-08-04 03:24:21 UTC (rev 248259)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog 2019-08-04 03:24:25 UTC (rev 248260)
@@ -1,3 +1,20 @@
+2019-08-02 Ryosuke Niwa <[email protected]>
+
+ Document::resume should delay resetting of form control elements.
+ https://bugs.webkit.org/show_bug.cgi?id=200376
+
+ Reviewed by Geoffrey Garen.
+
+ Delay the execution of form control element resets until the next task
+ to avoid synchronously mutating DOM during page cache restoration.
+
+ Test: fast/frames/restoring-page-cache-should-not-run-scripts.html
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::resumeFromDocumentSuspension):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::resumeFromDocumentSuspension):
+
2019-07-30 Michael Catanzaro <[email protected]>
[GTK] Compilation errors when GL is disabled
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp (248259 => 248260)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp 2019-08-04 03:24:21 UTC (rev 248259)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLFormElement.cpp 2019-08-04 03:24:25 UTC (rev 248260)
@@ -837,9 +837,9 @@
{
ASSERT(!shouldAutocomplete());
- Ref<HTMLFormElement> protectedThis(*this);
-
- resetAssociatedFormControlElements();
+ document().postTask([formElement = makeRef(*this)] (ScriptExecutionContext&) {
+ formElement->resetAssociatedFormControlElements();
+ });
}
void HTMLFormElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLInputElement.cpp (248259 => 248260)
--- releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLInputElement.cpp 2019-08-04 03:24:21 UTC (rev 248259)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/html/HTMLInputElement.cpp 2019-08-04 03:24:25 UTC (rev 248260)
@@ -1482,10 +1482,12 @@
#if ENABLE(INPUT_TYPE_COLOR)
// <input type=color> uses prepareForDocumentSuspension to detach the color picker UI,
// so it should not be reset when being loaded from page cache.
- if (isColorControl())
+ if (isColorControl())
return;
#endif // ENABLE(INPUT_TYPE_COLOR)
- reset();
+ document().postTask([inputElement = makeRef(*this)] (ScriptExecutionContext&) {
+ inputElement->reset();
+ });
}
#if ENABLE(INPUT_TYPE_COLOR)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes