Title: [237702] trunk
Revision
237702
Author
cdu...@apple.com
Date
2018-11-01 14:40:16 -0700 (Thu, 01 Nov 2018)

Log Message

Location object sans browsing context
https://bugs.webkit.org/show_bug.cgi?id=191060

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

* web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window-expected.txt:
Rebase WPT test now that all checks are passing.

* web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window.js:
Fix bug in WPT test (https://github.com/web-platform-tests/wpt/pull/13854)

* web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:

Source/WebCore:

As per https://github.com/whatwg/html/pull/4076, a Location object's URL should be "about:blank" when
it does not have a browsing context (Frame), not "".

No new tests, rebaselined existing tests.

* page/Location.cpp:
(WebCore::Location::url const):
(WebCore::Location::href const):
(WebCore::Location::protocol const):
(WebCore::Location::host const):
(WebCore::Location::hostname const):
(WebCore::Location::port const):
(WebCore::Location::pathname const):
(WebCore::Location::search const):
(WebCore::Location::origin const):
(WebCore::Location::hash const):

LayoutTests:

Update existing tests to reflect behavior change.

* http/tests/dom/same-origin-detached-window-properties-expected.txt:
* http/tests/dom/same-origin-detached-window-properties.html:
* http/tests/security/xss-DENIED-script-inject-into-inactive-window.html:
* http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html:
* http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html:
* http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237701 => 237702)


--- trunk/LayoutTests/ChangeLog	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/ChangeLog	2018-11-01 21:40:16 UTC (rev 237702)
@@ -1,3 +1,19 @@
+2018-11-01  Chris Dumez  <cdu...@apple.com>
+
+        Location object sans browsing context
+        https://bugs.webkit.org/show_bug.cgi?id=191060
+
+        Reviewed by Geoffrey Garen.
+
+        Update existing tests to reflect behavior change.
+
+        * http/tests/dom/same-origin-detached-window-properties-expected.txt:
+        * http/tests/dom/same-origin-detached-window-properties.html:
+        * http/tests/security/xss-DENIED-script-inject-into-inactive-window.html:
+        * http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html:
+        * http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html:
+        * http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html:
+
 2018-11-01  Ross Kirsling  <ross.kirsl...@sony.com>
 
         [WinCairo] Unreviewed layout test gardening.

Modified: trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties-expected.txt (237701 => 237702)


--- trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties-expected.txt	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties-expected.txt	2018-11-01 21:40:16 UTC (rev 237702)
@@ -5,15 +5,15 @@
 
 * Before GC
 PASS !!w.location is true
-PASS w.location.href is ""
-PASS w.location.protocol is ""
+PASS w.location.href is "about:blank"
+PASS w.location.protocol is "about:"
 PASS w.location.host is ""
 PASS w.location.hostname is ""
 PASS w.location.port is ""
-PASS w.location.pathname is ""
+PASS w.location.pathname is "blank"
 PASS w.location.search is ""
 PASS w.location.hash is ""
-PASS w.location.origin is ""
+PASS w.location.origin is "null"
 PASS w.location.assign('') did not throw exception.
 PASS w.location.replace('') did not throw exception.
 PASS w.location.reload('') did not throw exception.
@@ -80,15 +80,15 @@
 
 * After GC
 PASS !!w.location is true
-PASS w.location.href is ""
-PASS w.location.protocol is ""
+PASS w.location.href is "about:blank"
+PASS w.location.protocol is "about:"
 PASS w.location.host is ""
 PASS w.location.hostname is ""
 PASS w.location.port is ""
-PASS w.location.pathname is ""
+PASS w.location.pathname is "blank"
 PASS w.location.search is ""
 PASS w.location.hash is ""
-PASS w.location.origin is ""
+PASS w.location.origin is "null"
 PASS w.location.assign('') did not throw exception.
 PASS w.location.replace('') did not throw exception.
 PASS w.location.reload('') did not throw exception.

Modified: trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties.html (237701 => 237702)


--- trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties.html	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/dom/same-origin-detached-window-properties.html	2018-11-01 21:40:16 UTC (rev 237702)
@@ -15,15 +15,15 @@
     try {
     shouldBeTrue("!!w.location");
     if (w.location) {
-        shouldBeEqualToString("w.location.href", "");
-        shouldBeEqualToString("w.location.protocol", "");
+        shouldBeEqualToString("w.location.href", "about:blank");
+        shouldBeEqualToString("w.location.protocol", "about:");
         shouldBeEqualToString("w.location.host", "");
         shouldBeEqualToString("w.location.hostname", "");
         shouldBeEqualToString("w.location.port", "");
-        shouldBeEqualToString("w.location.pathname", "");
+        shouldBeEqualToString("w.location.pathname", "blank");
         shouldBeEqualToString("w.location.search", "");
         shouldBeEqualToString("w.location.hash", "");
-        shouldBeEqualToString("w.location.origin", "");
+        shouldBeEqualToString("w.location.origin", "null");
         shouldNotThrow("w.location.assign('')");
         shouldNotThrow("w.location.replace('')");
         shouldNotThrow("w.location.reload('')");

Modified: trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window.html (237701 => 237702)


--- trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window.html	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window.html	2018-11-01 21:40:16 UTC (rev 237702)
@@ -16,7 +16,7 @@
 
 function checkDidLoadVictim()
 {
-    if (_openedWindowDocument.location.href == "") {
+    if (_openedWindowDocument.location.href == "about:blank") {
         // Victim loaded; |_openedWindowDocument| is an inactive document.
         window.clearInterval(intervalId);
 

Modified: trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html (237701 => 237702)


--- trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html	2018-11-01 21:40:16 UTC (rev 237702)
@@ -42,7 +42,7 @@
 
 function checkDidLoadVictim()
 {
-    if (openerDocument.location.href == "") {
+    if (openerDocument.location.href == "about:blank") {
         // Victim loaded.
         window.clearInterval(intervalId);
 

Modified: trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html (237701 => 237702)


--- trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html	2018-11-01 21:40:16 UTC (rev 237702)
@@ -42,7 +42,7 @@
 
 function checkDidLoadVictim()
 {
-    if (openerDocument.location.href == "") {
+    if (openerDocument.location.href == "about:blank") {
         // Victim loaded.
         window.clearInterval(intervalId);
 

Modified: trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html (237701 => 237702)


--- trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/http/tests/security/xss-DENIED-script-inject-into-inactive-window3.html	2018-11-01 21:40:16 UTC (rev 237702)
@@ -60,7 +60,7 @@
 
 function checkDidLoadVictim()
 {
-    if (secondOpenerDocument.location.href == "") {
+    if (secondOpenerDocument.location.href == "about:blank") {
         // Victim loaded.
         window.clearInterval(intervalId);
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (237701 => 237702)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-01 21:40:16 UTC (rev 237702)
@@ -1,3 +1,18 @@
+2018-11-01  Chris Dumez  <cdu...@apple.com>
+
+        Location object sans browsing context
+        https://bugs.webkit.org/show_bug.cgi?id=191060
+
+        Reviewed by Geoffrey Garen.
+
+        * web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window-expected.txt:
+        Rebase WPT test now that all checks are passing.
+
+        * web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window.js:
+        Fix bug in WPT test (https://github.com/web-platform-tests/wpt/pull/13854)
+
+        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt:
+
 2018-11-01  Justin Michaud  <justin_mich...@apple.com>
 
         CSS Custom Properties API Should Support syntax="*" and "<length>", and handle cycles properly

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window-expected.txt (237701 => 237702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window-expected.txt	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window-expected.txt	2018-11-01 21:40:16 UTC (rev 237702)
@@ -1,14 +1,14 @@
 
 PASS Window and Location are 1:1 after browsing context removal 
-FAIL Setting `href` to `https://example.com/` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `href` to `/` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `href` to `http://test:test/` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `href` to `test test` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `href` to `test:test` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `href` to `chrome:fail` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Setting `protocol` to `http` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:" but got ""
-FAIL Setting `protocol` to `about` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:" but got ""
-FAIL Setting `protocol` to `test` of a `Location` object sans browsing context is a no-op assert_equals: expected "about:" but got ""
+PASS Setting `href` to `https://example.com/` of a `Location` object sans browsing context is a no-op 
+PASS Setting `href` to `/` of a `Location` object sans browsing context is a no-op 
+PASS Setting `href` to `http://test:test/` of a `Location` object sans browsing context is a no-op 
+PASS Setting `href` to `test test` of a `Location` object sans browsing context is a no-op 
+PASS Setting `href` to `test:test` of a `Location` object sans browsing context is a no-op 
+PASS Setting `href` to `chrome:fail` of a `Location` object sans browsing context is a no-op 
+PASS Setting `protocol` to `http` of a `Location` object sans browsing context is a no-op 
+PASS Setting `protocol` to `about` of a `Location` object sans browsing context is a no-op 
+PASS Setting `protocol` to `test` of a `Location` object sans browsing context is a no-op 
 PASS Setting `host` to `example.com` of a `Location` object sans browsing context is a no-op 
 PASS Setting `host` to `test test` of a `Location` object sans browsing context is a no-op 
 PASS Setting `host` to `()` of a `Location` object sans browsing context is a no-op 
@@ -22,27 +22,27 @@
 PASS Setting `search` to `test` of a `Location` object sans browsing context is a no-op 
 PASS Setting `hash` to `test` of a `Location` object sans browsing context is a no-op 
 PASS Setting `hash` to `#` of a `Location` object sans browsing context is a no-op 
-FAIL Getting `origin` of a `Location` object sans browsing context should be "null" assert_equals: expected "null" but got ""
-FAIL Invoking `assign` with `about:blank` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `https://example.com/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `http://test:test/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `test test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `test:test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `assign` with `chrome:fail` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `about:blank` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `https://example.com/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `http://test:test/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `test test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `test:test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `replace` with `chrome:fail` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `about:blank` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `https://example.com/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `http://test:test/` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `test test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `test:test` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
-FAIL Invoking `reload` with `chrome:fail` on a `Location` object sans browsing context is a no-op assert_equals: expected "about:blank" but got ""
+PASS Getting `origin` of a `Location` object sans browsing context should be "null" 
+PASS Invoking `assign` with `about:blank` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `https://example.com/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `http://test:test/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `test test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `test:test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `assign` with `chrome:fail` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `about:blank` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `https://example.com/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `http://test:test/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `test test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `test:test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `replace` with `chrome:fail` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `about:blank` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `https://example.com/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `http://test:test/` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `test test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `test:test` on a `Location` object sans browsing context is a no-op 
+PASS Invoking `reload` with `chrome:fail` on a `Location` object sans browsing context is a no-op 
 PASS Getting `ancestorOrigins` of a `Location` object sans browsing context should be [] 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window.js (237701 => 237702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window.js	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/no-browsing-context.window.js	2018-11-01 21:40:16 UTC (rev 237702)
@@ -42,7 +42,7 @@
   },
   {
     "property": "pathname",
-    "expected": "",
+    "expected": "blank",
     "values": ["/", "x"]
   },
   {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt (237701 => 237702)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url.window-expected.txt	2018-11-01 21:40:16 UTC (rev 237702)
@@ -1,6 +1,6 @@
 
 PASS document.open() changes document's URL (fully active document) 
-FAIL document.open() does not change document's URL (active but not fully active document) assert_equals: expected "http://localhost:8800/common/blank.html" but got ""
+FAIL document.open() does not change document's URL (active but not fully active document) assert_equals: expected "http://localhost:8800/common/blank.html" but got "about:blank"
 PASS document.open() does not change document's URL (non-active document with an associated Window object; frame is removed) 
 PASS document.open() does not change document's URL (non-active document with an associated Window object; navigated away) 
 PASS document.open() does not change document's URL (non-active document without an associated Window object) 

Modified: trunk/Source/WebCore/ChangeLog (237701 => 237702)


--- trunk/Source/WebCore/ChangeLog	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/Source/WebCore/ChangeLog	2018-11-01 21:40:16 UTC (rev 237702)
@@ -1,3 +1,27 @@
+2018-11-01  Chris Dumez  <cdu...@apple.com>
+
+        Location object sans browsing context
+        https://bugs.webkit.org/show_bug.cgi?id=191060
+
+        Reviewed by Geoffrey Garen.
+
+        As per https://github.com/whatwg/html/pull/4076, a Location object's URL should be "about:blank" when
+        it does not have a browsing context (Frame), not "".
+
+        No new tests, rebaselined existing tests.
+
+        * page/Location.cpp:
+        (WebCore::Location::url const):
+        (WebCore::Location::href const):
+        (WebCore::Location::protocol const):
+        (WebCore::Location::host const):
+        (WebCore::Location::hostname const):
+        (WebCore::Location::port const):
+        (WebCore::Location::pathname const):
+        (WebCore::Location::search const):
+        (WebCore::Location::origin const):
+        (WebCore::Location::hash const):
+
 2018-11-01  Sihui Liu  <sihui_...@apple.com>
 
         Add a storage limit for IndexedDB

Modified: trunk/Source/WebCore/page/Location.cpp (237701 => 237702)


--- trunk/Source/WebCore/page/Location.cpp	2018-11-01 21:19:12 UTC (rev 237701)
+++ trunk/Source/WebCore/page/Location.cpp	2018-11-01 21:40:16 UTC (rev 237702)
@@ -46,7 +46,8 @@
 
 inline const URL& Location::url() const
 {
-    ASSERT(frame());
+    if (!frame())
+        return blankURL();
 
     const URL& url = ""
     if (!url.isValid())
@@ -57,9 +58,6 @@
 
 String Location::href() const
 {
-    if (!frame())
-        return String();
-
     auto& url = ""
 
     if (!url.hasUsername() && !url.hasPassword())
@@ -73,17 +71,11 @@
 
 String Location::protocol() const
 {
-    if (!frame())
-        return String();
-
     return makeString(url().protocol(), ":");
 }
 
 String Location::host() const
 {
-    if (!frame())
-        return String();
-
     // Note: this is the IE spec. The NS spec swaps the two, it says
     // "The hostname property is the concatenation of the host and port properties, separated by a colon."
     return url().hostAndPort();
@@ -91,17 +83,11 @@
 
 String Location::hostname() const
 {
-    if (!frame())
-        return String();
-
     return url().host().toString();
 }
 
 String Location::port() const
 {
-    if (!frame())
-        return String();
-
     const URL& url = ""
     return url.port() ? String::number(url.port().value()) : emptyString();
 }
@@ -108,9 +94,6 @@
 
 String Location::pathname() const
 {
-    if (!frame())
-        return String();
-
     const URL& url = ""
     return url.path().isEmpty() ? "/" : url.path();
 }
@@ -117,9 +100,6 @@
 
 String Location::search() const
 {
-    if (!frame())
-        return String();
-
     const URL& url = ""
     return url.query().isEmpty() ? emptyString() : "?" + url.query();
 }
@@ -126,8 +106,6 @@
 
 String Location::origin() const
 {
-    if (!frame())
-        return String();
     return SecurityOrigin::create(url())->toString();
 }
 
@@ -144,9 +122,6 @@
 
 String Location::hash() const
 {
-    if (!frame())
-        return String();
-
     const String& fragmentIdentifier = url().fragmentIdentifier();
     return fragmentIdentifier.isEmpty() ? emptyString() : "#" + fragmentIdentifier;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to