Diff
Modified: trunk/LayoutTests/ChangeLog (251505 => 251506)
--- trunk/LayoutTests/ChangeLog 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/LayoutTests/ChangeLog 2019-10-23 23:02:32 UTC (rev 251506)
@@ -1,3 +1,16 @@
+2019-10-23 Chris Dumez <cdu...@apple.com>
+
+ Ignore document.open/write after the active parser has been aborted
+ https://bugs.webkit.org/show_bug.cgi?id=203028
+
+ Reviewed by Geoffrey Garen.
+
+ Import test from blink.
+
+ * imported/blink/fast/loader/document-write-after-location-change-expected.txt: Added.
+ * imported/blink/fast/loader/document-write-after-location-change.html: Added.
+ * imported/blink/fast/loader/resources/pass-and-notify-done.html: Added.
+
2019-10-23 Russell Epstein <repst...@apple.com>
REGRESSION (r250936?) [ iOS ]: Layout Test http/tests/IndexedDB/storage-limit-1.https.html is a Flaky Failure (203275)
Added: trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change-expected.txt (0 => 251506)
--- trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change-expected.txt 2019-10-23 23:02:32 UTC (rev 251506)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change.html (0 => 251506)
--- trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change.html (rev 0)
+++ trunk/LayoutTests/imported/blink/fast/loader/document-write-after-location-change.html 2019-10-23 23:02:32 UTC (rev 251506)
@@ -0,0 +1,11 @@
+<body>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+location.replace("resources/pass-and-notify-done.html");
+document.open();
+document.write("This should not cancel the navigation");
+</script>
+</body>
Added: trunk/LayoutTests/imported/blink/fast/loader/resources/pass-and-notify-done.html (0 => 251506)
--- trunk/LayoutTests/imported/blink/fast/loader/resources/pass-and-notify-done.html (rev 0)
+++ trunk/LayoutTests/imported/blink/fast/loader/resources/pass-and-notify-done.html 2019-10-23 23:02:32 UTC (rev 251506)
@@ -0,0 +1,6 @@
+<body>
+PASS
+<script>
+if (window.testRunner)
+ testRunner.notifyDone()
+</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (251505 => 251506)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-10-23 23:02:32 UTC (rev 251506)
@@ -1,3 +1,14 @@
+2019-10-23 Chris Dumez <cdu...@apple.com>
+
+ Ignore document.open/write after the active parser has been aborted
+ https://bugs.webkit.org/show_bug.cgi?id=203028
+
+ Reviewed by Geoffrey Garen.
+
+ Rebaseline WPT test that is now passing.
+
+ * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt:
+
2019-10-23 Said Abou-Hallawa <sabouhall...@apple.com>
[SVG2] Fix SVGElement to conform with SVG2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt (251505 => 251506)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window-expected.txt 2019-10-23 23:02:32 UTC (rev 251506)
@@ -1,4 +1,4 @@
-FAIL document.open() after parser is aborted assert_false: child document should not be empty expected false got true
-FAIL async document.open() after parser is aborted assert_false: child document should not be empty expected false got true
+PASS document.open() after parser is aborted
+PASS async document.open() after parser is aborted
Modified: trunk/Source/WebCore/ChangeLog (251505 => 251506)
--- trunk/Source/WebCore/ChangeLog 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/Source/WebCore/ChangeLog 2019-10-23 23:02:32 UTC (rev 251506)
@@ -1,3 +1,22 @@
+2019-10-23 Chris Dumez <cdu...@apple.com>
+
+ Ignore document.open/write after the active parser has been aborted
+ https://bugs.webkit.org/show_bug.cgi?id=203028
+
+ Reviewed by Geoffrey Garen.
+
+ Ignore document.open/write after the active parser has been aborted, as per:
+ - https://github.com/whatwg/html/pull/4907
+
+ Test: imported/blink/fast/loader/document-write-after-location-change.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::open):
+ (WebCore::Document::cancelParsing):
+ (WebCore::Document::implicitOpen):
+ (WebCore::Document::write):
+ * dom/Document.h:
+
2019-10-23 Andy Estes <aes...@apple.com>
[Quick Look] Move PreviewConverter from platform/network/ to platform/
Modified: trunk/Source/WebCore/dom/Document.cpp (251505 => 251506)
--- trunk/Source/WebCore/dom/Document.cpp 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/Source/WebCore/dom/Document.cpp 2019-10-23 23:02:32 UTC (rev 251506)
@@ -2732,6 +2732,9 @@
if (m_ignoreOpensDuringUnloadCount)
return { };
+ if (m_activeParserWasAborted)
+ return { };
+
if (m_frame) {
if (ScriptableDocumentParser* parser = scriptableDocumentParser()) {
if (parser->isParsing()) {
@@ -2801,6 +2804,9 @@
if (!m_parser)
return;
+ if (m_parser->processingData())
+ m_activeParserWasAborted = true;
+
// We have to clear the parser to avoid possibly triggering
// the onload handler when closing as a side effect of a cancel-style
// change, such as opening a new document or closing the window while
@@ -2815,7 +2821,7 @@
setCompatibilityMode(DocumentCompatibilityMode::NoQuirksMode);
- cancelParsing();
+ detachParser();
m_parser = createParser();
if (hasActiveParserYieldToken())
@@ -3085,6 +3091,9 @@
ExceptionOr<void> Document::write(Document* responsibleDocument, SegmentedString&& text)
{
+ if (m_activeParserWasAborted)
+ return { };
+
NestingLevelIncrementer nestingLevelIncrementer(m_writeRecursionDepth);
m_writeRecursionIsTooDeep = (m_writeRecursionDepth > 1) && m_writeRecursionIsTooDeep;
Modified: trunk/Source/WebCore/dom/Document.h (251505 => 251506)
--- trunk/Source/WebCore/dom/Document.h 2019-10-23 22:47:38 UTC (rev 251505)
+++ trunk/Source/WebCore/dom/Document.h 2019-10-23 23:02:32 UTC (rev 251506)
@@ -1962,6 +1962,7 @@
MutationObserverOptions m_mutationObserverTypes { 0 };
+ bool m_activeParserWasAborted { false };
bool m_writeRecursionIsTooDeep { false };
bool m_wellFormed { false };
bool m_createRenderers { true };