Title: [280491] trunk
Revision
280491
Author
cdu...@apple.com
Date
2021-07-30 13:25:46 -0700 (Fri, 30 Jul 2021)

Log Message

Document's fallback base URL should be deduced from its creator when URL is about:blank
https://bugs.webkit.org/show_bug.cgi?id=228624

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Rebaseline WPT test now that one more check is passing.

* web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt:

Source/WebCore:

Document's fallback base URL should be deduced from its creator when URL is about:blank:
- https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url

Chrome and Firefox match the specification here.

Tests: http/tests/dom/iframe-no-src-local-origin-allow.html
       http/tests/dom/iframe-no-src-set-location.html

* dom/Document.cpp:
(WebCore::Document::updateBaseURL):

LayoutTests:

Update existing tests to reflect behavior change. I have verified that those tests were failing in Firefox & Chrome and
are now passing in those browsers.

* http/tests/dom/iframe-no-src-local-origin-allow-expected.txt: Renamed from LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt.
* http/tests/dom/iframe-no-src-local-origin-allow.html: Renamed from LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html.
* http/tests/dom/iframe-no-src-set-location-expected.txt: Renamed from LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt.
* http/tests/dom/iframe-no-src-set-location.html: Renamed from LayoutTests/fast/frames/iframe-no-src-set-location.html.
* http/tests/dom/resources/iframe-no-src-set-location-pass.html: Renamed from LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html.
* http/tests/security/aboutBlank/security-context-expected.txt:
* http/tests/security/aboutBlank/security-context-grandchildren-expected.txt:
* http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt:
* http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt:
* http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt:
* http/tests/security/aboutBlank/security-context-window-open-expected.txt:
* http/tests/security/aboutBlank/security-context-with-base-tag-expected.txt:
* http/tests/security/aboutBlank/security-context-write-expected.txt:
* http/tests/security/aboutBlank/security-context-writeln-expected.txt:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (280490 => 280491)


--- trunk/LayoutTests/ChangeLog	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/ChangeLog	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,5 +1,30 @@
 2021-07-30  Chris Dumez  <cdu...@apple.com>
 
+        Document's fallback base URL should be deduced from its creator when URL is about:blank
+        https://bugs.webkit.org/show_bug.cgi?id=228624
+
+        Reviewed by Geoffrey Garen.
+
+        Update existing tests to reflect behavior change. I have verified that those tests were failing in Firefox & Chrome and
+        are now passing in those browsers.
+
+        * http/tests/dom/iframe-no-src-local-origin-allow-expected.txt: Renamed from LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt.
+        * http/tests/dom/iframe-no-src-local-origin-allow.html: Renamed from LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html.
+        * http/tests/dom/iframe-no-src-set-location-expected.txt: Renamed from LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt.
+        * http/tests/dom/iframe-no-src-set-location.html: Renamed from LayoutTests/fast/frames/iframe-no-src-set-location.html.
+        * http/tests/dom/resources/iframe-no-src-set-location-pass.html: Renamed from LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html.
+        * http/tests/security/aboutBlank/security-context-expected.txt:
+        * http/tests/security/aboutBlank/security-context-grandchildren-expected.txt:
+        * http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt:
+        * http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt:
+        * http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt:
+        * http/tests/security/aboutBlank/security-context-window-open-expected.txt:
+        * http/tests/security/aboutBlank/security-context-with-base-tag-expected.txt:
+        * http/tests/security/aboutBlank/security-context-write-expected.txt:
+        * http/tests/security/aboutBlank/security-context-writeln-expected.txt:
+
+2021-07-30  Chris Dumez  <cdu...@apple.com>
+
         HTMLElement.innerText setter should convert new lines to <br>
         https://bugs.webkit.org/show_bug.cgi?id=228605
 

Modified: trunk/LayoutTests/fast/dom/Window/open-invalid-url.html (280490 => 280491)


--- trunk/LayoutTests/fast/dom/Window/open-invalid-url.html	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/dom/Window/open-invalid-url.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -11,7 +11,7 @@
 
 var a = window.open("about:blank","moonshine")
 function mountainGoat() {
-        a.window.eval('setTimeout("try { window.open(\'/\'); alert(\'FAIL\'); } catch(ex) { alert(\'PASS\'); }; if (window.testRunner) testRunner.notifyDone()", 0)')
+        a.window.eval('setTimeout("try { window.open(\'http://invalid:url\'); alert(\'FAIL\'); } catch(ex) { alert(\'PASS\'); }; if (window.testRunner) testRunner.notifyDone()", 0)')
 }
 setTimeout("mountainGoat()", 0)
 </script>

Deleted: trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt (280490 => 280491)


--- trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,11 +0,0 @@
-This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via _javascript_.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS document.getElementById('theFrame').contentDocument.baseURI is 'about:blank'
-PASS document.getElementById('theFrame').contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML is 'PASS\n'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html (280490 => 280491)


--- trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,36 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var iframeHasLoadedFirstPage = false;
-
-function runTest()
-{
-    shouldBe("document.getElementById('theFrame').contentDocument.baseURI", "'about:blank'");
-    var frameDoc = document.getElementById('theFrame').contentWindow.document;
-    var innerFrame = frameDoc.createElement("iframe");
-    innerFrame.src = ""
-    innerFrame.id = "innerFrame";
-    innerFrame._onload_ = function() {
-        shouldBe("document.getElementById('theFrame').contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML", "'PASS\\n'");
-        isSuccessfullyParsed();
-        if (window.testRunner)
-            testRunner.notifyDone();
-    }
-    frameDoc.body.appendChild(innerFrame);
-}
-
-</script>
-</head>
-<body>
-<script>
-description("This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via _javascript_.");
-</script>
-<iframe id="theFrame" _onload_="runTest()"></iframe>
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt (280490 => 280491)


--- trunk/LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,11 +0,0 @@
-This tests that an iframe with no src attribute uses the parent document's URL as a base when resolving non-fully-qualified URLs set by _javascript_.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS document.getElementById('theFrame').contentDocument.baseURI is 'about:blank'
-PASS document.getElementById('theFrame').contentDocument.body.innerHTML is 'PASS\n'
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/frames/iframe-no-src-set-location.html (280490 => 280491)


--- trunk/LayoutTests/fast/frames/iframe-no-src-set-location.html	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/frames/iframe-no-src-set-location.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,39 +0,0 @@
-<html>
-<head>
-<script src=""
-<script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
-
-var iframeHasLoadedFirstPage = false;
-
-function runTest()
-{
-    if (!iframeHasLoadedFirstPage) {
-        iframeHasLoadedFirstPage = true;
-
-        shouldBe("document.getElementById('theFrame').contentDocument.baseURI", "'about:blank'");
-        var iframe = document.getElementById('theFrame');
-        iframe.src = ""
-    } else {
-        shouldBe("document.getElementById('theFrame').contentDocument.body.innerHTML", "'PASS\\n'");
-
-        isSuccessfullyParsed();
-
-        if (window.testRunner) {
-            testRunner.notifyDone();
-        }
-    }
-}
-
-</script>
-</head>
-<body>
-<script>
-description("This tests that an iframe with no src attribute uses the parent document's URL as a base when resolving non-fully-qualified URLs set by _javascript_.");
-</script>
-<iframe id="theFrame" _onload_="runTest()"></iframe>
-</body>
-</html>

Deleted: trunk/LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html (280490 => 280491)


--- trunk/LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1 +0,0 @@
-PASS

Copied: trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow-expected.txt (from rev 280490, trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow-expected.txt) (0 => 280491)


--- trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -0,0 +1,11 @@
+This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via _javascript_.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('theFrame').contentDocument.baseURI is "http://127.0.0.1:8000/dom/iframe-no-src-local-origin-allow.html"
+PASS document.getElementById('theFrame').contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML is 'PASS\n'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow.html (from rev 280490, trunk/LayoutTests/fast/frames/iframe-no-src-local-origin-allow.html) (0 => 280491)


--- trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/iframe-no-src-local-origin-allow.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script src=""
+<script>
+var iframeHasLoadedFirstPage = false;
+
+function runTest()
+{
+    shouldBeEqualToString("document.getElementById('theFrame').contentDocument.baseURI", "http://127.0.0.1:8000/dom/iframe-no-src-local-origin-allow.html");
+    var frameDoc = document.getElementById('theFrame').contentWindow.document;
+    var innerFrame = frameDoc.createElement("iframe");
+    innerFrame.src = ""
+    innerFrame.id = "innerFrame";
+    innerFrame._onload_ = function() {
+        shouldBe("document.getElementById('theFrame').contentDocument.getElementById('innerFrame').contentDocument.body.innerHTML", "'PASS\\n'");
+        finishJSTest();
+    }
+    frameDoc.body.appendChild(innerFrame);
+}
+
+</script>
+</head>
+<body>
+<script>
+description("This tests that an iframe with no src attribute uses the parent document's origin when resolving links inserted into the frame via _javascript_.");
+jsTestIsAsync = true;
+</script>
+<iframe id="theFrame" _onload_="runTest()"></iframe>
+</body>
+</html>

Copied: trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location-expected.txt (from rev 280490, trunk/LayoutTests/fast/frames/iframe-no-src-set-location-expected.txt) (0 => 280491)


--- trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -0,0 +1,11 @@
+This tests that an iframe with no src attribute uses the parent document's URL as a base when resolving non-fully-qualified URLs set by _javascript_.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('theFrame').contentDocument.baseURI is "http://127.0.0.1:8000/dom/iframe-no-src-set-location.html"
+PASS document.getElementById('theFrame').contentDocument.body.innerHTML is 'PASS\n'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location.html (from rev 280490, trunk/LayoutTests/fast/frames/iframe-no-src-set-location.html) (0 => 280491)


--- trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/iframe-no-src-set-location.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script>
+var iframeHasLoadedFirstPage = false;
+
+function runTest()
+{
+    if (!iframeHasLoadedFirstPage) {
+        iframeHasLoadedFirstPage = true;
+
+        shouldBeEqualToString("document.getElementById('theFrame').contentDocument.baseURI", "http://127.0.0.1:8000/dom/iframe-no-src-set-location.html");
+        var iframe = document.getElementById('theFrame');
+        iframe.src = ""
+    } else {
+        shouldBe("document.getElementById('theFrame').contentDocument.body.innerHTML", "'PASS\\n'");
+
+        finishJSTest();
+    }
+}
+
+</script>
+</head>
+<body>
+<script>
+description("This tests that an iframe with no src attribute uses the parent document's URL as a base when resolving non-fully-qualified URLs set by _javascript_.");
+jsTestIsAsync = true;
+</script>
+<iframe id="theFrame" _onload_="runTest()"></iframe>
+</body>
+</html>

Copied: trunk/LayoutTests/http/tests/dom/resources/iframe-no-src-set-location-pass.html (from rev 280490, trunk/LayoutTests/fast/frames/resources/iframe-no-src-set-location-pass.html) (0 => 280491)


--- trunk/LayoutTests/http/tests/dom/resources/iframe-no-src-set-location-pass.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/dom/resources/iframe-no-src-set-location-pass.html	2021-07-30 20:25:46 UTC (rev 280491)
@@ -0,0 +1 @@
+PASS

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context.html
 document.cookie = cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context.html
 document.cookie = cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -2,11 +2,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
 document.cookie = cookie=resources; cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-window-open-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-window-open-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-window-open-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,11 +1,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-window-open.html
 document.cookie = cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-window-open.html
 document.cookie = cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-with-base-tag-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-with-base-tag-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-with-base-tag-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://set-by-base.example.com/
 document.cookie = cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://set-by-base.example.com/
 document.cookie = cookie=parent
 --- After document.open() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-write-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-write-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-write-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-write.html
 document.cookie = cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-write.html
 document.cookie = cookie=parent
 --- After document.write() ---
 * "about:blank"

Modified: trunk/LayoutTests/http/tests/security/aboutBlank/security-context-writeln-expected.txt (280490 => 280491)


--- trunk/LayoutTests/http/tests/security/aboutBlank/security-context-writeln-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/http/tests/security/aboutBlank/security-context-writeln-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3,11 +3,11 @@
 --- Test begins ---
 * "about:blank"
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-writeln.html
 document.cookie = cookie=parent
 * ""
 document.URL = ""
-document.baseURI = about:blank
+document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-writeln.html
 document.cookie = cookie=parent
 --- After document.writeln() ---
 * "about:blank"

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280490 => 280491)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,3 +1,14 @@
+2021-07-30  Chris Dumez  <cdu...@apple.com>
+
+        Document's fallback base URL should be deduced from its creator when URL is about:blank
+        https://bugs.webkit.org/show_bug.cgi?id=228624
+
+        Reviewed by Geoffrey Garen.
+
+        Rebaseline WPT test now that one more check is passing.
+
+        * web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt:
+
 2021-07-30  Jer Noble  <jer.no...@apple.com>
 
         [Cocoa] Remove support for AVAssetImageGenerator

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt (280490 => 280491)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/urls/terminology-0/document-base-url-expected.txt	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,7 +1,7 @@
 
 PASS The document base URL of a document containing one or more base elements with href attributes is the frozen base URL of the first base element in the document that has an href attribute, in tree order.
 PASS The fallback base URL of a document containing no base element is the document's address.
-FAIL The fallback base URL of a document whose address is about:blank is the document base URL of the creator document. assert_equals: The document base URL should be the creator document's base URL. expected "http://localhost:8800/html/infrastructure/urls/terminology-0/document-base-url.html" but got "about:blank"
+PASS The fallback base URL of a document whose address is about:blank is the document base URL of the creator document.
 FAIL about:blank with a base element. assert_equals: img src should resolve correctly expected "http://localhost:8800/html/infrastructure/urls/terminology-0/sub/foo" but got "http://localhost:8800/html/infrastructure/urls/terminology-0/foo"
 PASS The fallback base URL of an iframe srcdoc document is the document base URL of the document's browsing context's browsing context container's document.
 FAIL The base URL of an iframe srcdoc document with a <base> tag should be set by that tag. assert_equals: img src should resolve correctly expected "http://localhost:8800/html/infrastructure/urls/terminology-0/sub/foo" but got "http://localhost:8800/html/infrastructure/urls/terminology-0/foo"

Modified: trunk/Source/WebCore/ChangeLog (280490 => 280491)


--- trunk/Source/WebCore/ChangeLog	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/Source/WebCore/ChangeLog	2021-07-30 20:25:46 UTC (rev 280491)
@@ -1,3 +1,21 @@
+2021-07-30  Chris Dumez  <cdu...@apple.com>
+
+        Document's fallback base URL should be deduced from its creator when URL is about:blank
+        https://bugs.webkit.org/show_bug.cgi?id=228624
+
+        Reviewed by Geoffrey Garen.
+
+        Document's fallback base URL should be deduced from its creator when URL is about:blank:
+        - https://html.spec.whatwg.org/multipage/urls-and-fetching.html#fallback-base-url
+
+        Chrome and Firefox match the specification here.
+
+        Tests: http/tests/dom/iframe-no-src-local-origin-allow.html
+               http/tests/dom/iframe-no-src-set-location.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateBaseURL):
+
 2021-07-30  Jer Noble  <jer.no...@apple.com>
 
         [Cocoa] Remove support for AVAssetImageGenerator

Modified: trunk/Source/WebCore/dom/Document.cpp (280490 => 280491)


--- trunk/Source/WebCore/dom/Document.cpp	2021-07-30 19:49:26 UTC (rev 280490)
+++ trunk/Source/WebCore/dom/Document.cpp	2021-07-30 20:25:46 UTC (rev 280491)
@@ -3406,7 +3406,6 @@
 
 void Document::updateBaseURL()
 {
-    URL oldBaseURL = m_baseURL;
     // DOM 3 Core: When the Document supports the feature "HTML" [DOM Level 2 HTML], the base URI is computed using
     // first the value of the href attribute of the HTML BASE element if any, and the value of the documentURI attribute
     // from the Document interface otherwise.
@@ -3419,6 +3418,14 @@
         // this fallback behavior. We use a null base URL, since the documentURI attribute is an arbitrary string
         // and DOM 3 Core does not specify how it should be resolved.
         m_baseURL = URL({ }, documentURI());
+
+        if (m_baseURL == aboutBlankURL()) {
+            auto* creator = parentDocument();
+            if (!creator && frame() && frame()->loader().opener())
+                creator = frame()->loader().opener()->document();
+            if (creator)
+                m_baseURL = creator->baseURL();
+        }
     }
 
     clearSelectorQueryCache();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to