Diff
Modified: trunk/LayoutTests/ChangeLog (243704 => 243705)
--- trunk/LayoutTests/ChangeLog 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/LayoutTests/ChangeLog 2019-04-01 19:05:17 UTC (rev 243705)
@@ -1,3 +1,17 @@
+2019-04-01 Chris Dumez <[email protected]>
+
+ Support "noreferrer" for window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=194533
+
+ Reviewed by Geoffrey Garen.
+
+ Add equivalent test to imported/w3c/web-platform-tests/html/browsers/the-window-object/window-open-noopener.html
+ but which relies on localStorage instead of BroadcastChannel so that it works with WebKit.
+
+ * http/wpt/html/browsers/the-window-object/support/noreferrer-target-webkit.html: Added.
+ * http/wpt/html/browsers/the-window-object/window-open-noopener-webkit-expected.txt: Added.
+ * http/wpt/html/browsers/the-window-object/window-open-noopener-webkit.html: Added.
+
2019-04-01 Said Abou-Hallawa <[email protected]>
SVGMatrix.IDL methods do not conform to the specs
Added: trunk/LayoutTests/http/wpt/html/browsers/the-window-object/support/noreferrer-target-webkit.html (0 => 243705)
--- trunk/LayoutTests/http/wpt/html/browsers/the-window-object/support/noreferrer-target-webkit.html (rev 0)
+++ trunk/LayoutTests/http/wpt/html/browsers/the-window-object/support/noreferrer-target-webkit.html 2019-04-01 19:05:17 UTC (rev 243705)
@@ -0,0 +1,6 @@
+<script>
+const uniqueTestId = location.search.substr(1);
+localStorage.setItem(uniqueTestId + "-referrer", document.referrer);
+localStorage.setItem(uniqueTestId + "-hasOpener", window.opener !== null);
+localStorage.setItem(uniqueTestId + "-name", window.name);
+</script>
Added: trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit-expected.txt (0 => 243705)
--- trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit-expected.txt (rev 0)
+++ trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit-expected.txt 2019-04-01 19:05:17 UTC (rev 243705)
@@ -0,0 +1,3 @@
+
+PASS window.open() with "noreferrer" tests
+
Added: trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit.html (0 => 243705)
--- trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit.html (rev 0)
+++ trunk/LayoutTests/http/wpt/html/browsers/the-window-object/window-open-noopener-webkit.html 2019-04-01 19:05:17 UTC (rev 243705)
@@ -0,0 +1,23 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>window.open() with "noreferrer" tests</title>
+<script src=""
+<script src=""
+<script>
+async_test(t => {
+ var uniqueTestId = Math.floor((Math.random() * 1000000000000));
+ w = window.open("support/noreferrer-target-webkit.html?" + uniqueTestId, "", "noreferrer");
+ assert_equals(w, null);
+ handle = setInterval(() => {
+ if (localStorage.getItem(uniqueTestId + "-name") === null)
+ return;
+
+ clearInterval(handle);
+ assert_equals(localStorage.getItem(uniqueTestId + "-name"), "");
+ assert_equals(localStorage.getItem(uniqueTestId + "-referrer"), "");
+ assert_equals(localStorage.getItem(uniqueTestId + "-hasOpener"), "false");
+
+ t.done();
+ }, 10);
+});
+</script>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243704 => 243705)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-04-01 19:05:17 UTC (rev 243705)
@@ -1,3 +1,14 @@
+2019-04-01 Chris Dumez <[email protected]>
+
+ Support "noreferrer" for window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=194533
+
+ Reviewed by Geoffrey Garen.
+
+ Rebaseline WPT test now that all checks are passing.
+
+ * web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt:
+
2019-04-01 Emilio Cobos Álvarez <[email protected]>
Be less strict about closing blocks in attribute and functional pseudo-element selectors.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt (243704 => 243705)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer-expected.txt 2019-04-01 19:05:17 UTC (rev 243705)
@@ -1,10 +1,10 @@
-FAIL Tokenization of "noreferrer" should skip window features separators before feature assert_equals: " noreferrer" should activate feature "noreferrer" expected null but got object "[object Window]"
-FAIL Feature "noreferrer" should be converted to ASCII lowercase assert_equals: "NOREFERRER" should activate feature "noreferrer" expected null but got object "[object Window]"
-FAIL After "noreferrer", tokenization should skip window features separators that are not "=" or "," assert_equals: "noreferrer" should activate feature "noreferrer" expected null but got object "[object Window]"
-FAIL Tokenizing "noreferrer" should ignore window feature separators except "," after initial "=" and before value assert_equals: "noreferrer= yes" should activate feature "noreferrer" expected null but got object "[object Window]"
-FAIL Tokenizing "noreferrer" should read characters until first window feature separator as `value` assert_equals: "noreferrer=1" should set "noreferrer" expected null but got object "[object Window]"
-FAIL Integer values other than 0 should activate the feature assert_equals: "noreferrer=1" should activate feature "noreferrer" expected null but got object "[object Window]"
+PASS Tokenization of "noreferrer" should skip window features separators before feature
+PASS Feature "noreferrer" should be converted to ASCII lowercase
+PASS After "noreferrer", tokenization should skip window features separators that are not "=" or ","
+PASS Tokenizing "noreferrer" should ignore window feature separators except "," after initial "=" and before value
+PASS Tokenizing "noreferrer" should read characters until first window feature separator as `value`
+PASS Integer values other than 0 should activate the feature
PASS Integer value of 0 should not activate "noreferrer"
PASS Invalid feature names should not tokenize as "noreferrer"
Modified: trunk/Source/WebCore/ChangeLog (243704 => 243705)
--- trunk/Source/WebCore/ChangeLog 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/Source/WebCore/ChangeLog 2019-04-01 19:05:17 UTC (rev 243705)
@@ -1,3 +1,22 @@
+2019-04-01 Chris Dumez <[email protected]>
+
+ Support "noreferrer" for window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=194533
+
+ Reviewed by Geoffrey Garen.
+
+ Support "noreferrer" for window.open() as per:
+ - https://github.com/whatwg/html/pull/4331
+
+ Tests: imported/w3c/web-platform-tests/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-noreferrer.html
+ http/wpt/html/browsers/the-window-object/window-open-noopener-webkit.html
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::createWindow):
+ * page/WindowFeatures.cpp:
+ (WebCore::setWindowFeature):
+ * page/WindowFeatures.h:
+
2019-04-01 Said Abou-Hallawa <[email protected]>
SVGMatrix.IDL methods do not conform to the specs
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (243704 => 243705)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2019-04-01 19:05:17 UTC (rev 243705)
@@ -2288,7 +2288,7 @@
return Exception { SyntaxError };
// For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here.
- String referrer = SecurityPolicy::generateReferrerHeader(firstFrame.document()->referrerPolicy(), completedURL, firstFrame.loader().outgoingReferrer());
+ String referrer = windowFeatures.noreferrer ? String() : SecurityPolicy::generateReferrerHeader(firstFrame.document()->referrerPolicy(), completedURL, firstFrame.loader().outgoingReferrer());
auto initiatedByMainFrame = activeFrame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown;
ResourceRequest resourceRequest { completedURL, referrer };
@@ -2302,7 +2302,8 @@
if (!newFrame)
return RefPtr<Frame> { nullptr };
- if (!windowFeatures.noopener)
+ bool noopener = windowFeatures.noopener || windowFeatures.noreferrer;
+ if (!noopener)
newFrame->loader().setOpener(&openerFrame);
if (created)
@@ -2309,7 +2310,7 @@
newFrame->page()->setOpenedByDOM();
if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
- return windowFeatures.noopener ? RefPtr<Frame> { nullptr } : newFrame;
+ return noopener ? RefPtr<Frame> { nullptr } : newFrame;
if (prepareDialogFunction)
prepareDialogFunction(*newFrame->document()->domWindow());
@@ -2328,7 +2329,7 @@
if (!newFrame->page())
return RefPtr<Frame> { nullptr };
- return windowFeatures.noopener ? RefPtr<Frame> { nullptr } : newFrame;
+ return noopener ? RefPtr<Frame> { nullptr } : newFrame;
}
ExceptionOr<RefPtr<WindowProxy>> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomicString& frameName, const String& windowFeaturesString)
Modified: trunk/Source/WebCore/page/WindowFeatures.cpp (243704 => 243705)
--- trunk/Source/WebCore/page/WindowFeatures.cpp 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/Source/WebCore/page/WindowFeatures.cpp 2019-04-01 19:05:17 UTC (rev 243705)
@@ -159,6 +159,8 @@
features.scrollbarsVisible = numericValue;
else if (equalLettersIgnoringASCIICase(key, "noopener"))
features.noopener = numericValue;
+ else if (equalLettersIgnoringASCIICase(key, "noreferrer"))
+ features.noreferrer = numericValue;
else if (numericValue == 1)
features.additionalFeatures.append(key.toString());
}
Modified: trunk/Source/WebCore/page/WindowFeatures.h (243704 => 243705)
--- trunk/Source/WebCore/page/WindowFeatures.h 2019-04-01 18:54:36 UTC (rev 243704)
+++ trunk/Source/WebCore/page/WindowFeatures.h 2019-04-01 19:05:17 UTC (rev 243705)
@@ -55,6 +55,7 @@
bool fullscreen { false };
bool dialog { false };
bool noopener { false };
+ bool noreferrer { false };
Vector<String> additionalFeatures;
};