<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[214251] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/214251">214251</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2017-03-22 09:15:16 -0700 (Wed, 22 Mar 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement the "noopener" feature for window.open()
https://bugs.webkit.org/show_bug.cgi?id=163960
<rdar://problem/28941679>
Reviewed by Sam Weinig.
LayoutTests/imported/w3c:
Import test coverage from WPT upstream.
* resources/import-expectations.json:
* web-platform-tests/common/PrefixedLocalStorage.js: Added.
(PrefixedLocalStorage):
(PrefixedLocalStorage.prototype.clear):
(PrefixedLocalStorage.prototype.url):
(PrefixedLocalStorage.prototype.prefixedKey):
(PrefixedLocalStorage.prototype.setItem):
(PrefixedLocalStorage.prototype.onSet):
(PrefixedLocalStorageTest):
(PrefixedLocalStorageTest.prototype.cleanup):
(PrefixedLocalStorageResource):
* web-platform-tests/common/w3c-import.log:
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html: Added.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log.
* web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log:
Source/WebCore:
Implement the "noopener" feature for window.open(). If 'noopener' is passed to window.open()
then the new Window's opener property will be null.
Tests: imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html
imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html
imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html
imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
* page/WindowFeatures.cpp:
(WebCore::parseWindowFeatures):
(WebCore::setWindowFeature):
* page/WindowFeatures.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cresourcesimportexpectationsjson">trunk/LayoutTests/imported/w3c/resources/import-expectations.json</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscommonw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/common/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageWindowFeaturescpp">trunk/Source/WebCore/page/WindowFeatures.cpp</a></li>
<li><a href="#trunkSourceWebCorepageWindowFeaturesh">trunk/Source/WebCore/page/WindowFeatures.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscommonPrefixedLocalStoragejs">trunk/LayoutTests/imported/w3c/web-platform-tests/common/PrefixedLocalStorage.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerclosedexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerclosedhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenermultipleexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenermultiplehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoopenerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoreferrerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoreferrerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcescloseopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesmessagewindowopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesmultipleopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesnoopenerhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesopencloserhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2017-03-22 Chris Dumez <cdumez@apple.com>
+
+ Implement the "noopener" feature for window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=163960
+ <rdar://problem/28941679>
+
+ Reviewed by Sam Weinig.
+
+ Import test coverage from WPT upstream.
+
+ * resources/import-expectations.json:
+ * web-platform-tests/common/PrefixedLocalStorage.js: Added.
+ (PrefixedLocalStorage):
+ (PrefixedLocalStorage.prototype.clear):
+ (PrefixedLocalStorage.prototype.url):
+ (PrefixedLocalStorage.prototype.prefixedKey):
+ (PrefixedLocalStorage.prototype.setItem):
+ (PrefixedLocalStorage.prototype.onSet):
+ (PrefixedLocalStorageTest):
+ (PrefixedLocalStorageTest.prototype.cleanup):
+ (PrefixedLocalStorageResource):
+ * web-platform-tests/common/w3c-import.log:
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html: Added.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log.
+ * web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log:
+
</ins><span class="cx"> 2017-03-20 Jon Lee <jonlee@apple.com>
</span><span class="cx">
</span><span class="cx"> Update progression in wpt test for WebRTC.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cresourcesimportexpectationsjson"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx"> "web-platform-tests/browser-payment-api": "skip",
</span><span class="cx"> "web-platform-tests/clear-site-data": "skip",
</span><span class="cx"> "web-platform-tests/clipboard": "skip",
</span><ins>+ "web-platform-tests/common/": "import",
</ins><span class="cx"> "web-platform-tests/compat": "skip",
</span><span class="cx"> "web-platform-tests/console": "skip",
</span><span class="cx"> "web-platform-tests/content-security-policy": "skip",
</span><span class="lines">@@ -195,6 +196,7 @@
</span><span class="cx"> "web-platform-tests/html/browsers/offline/application-cache-api": "skip",
</span><span class="cx"> "web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.sub.html": "skip",
</span><span class="cx"> "web-platform-tests/html/browsers/sandboxing": "skip",
</span><ins>+ "web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/": "import",
</ins><span class="cx"> "web-platform-tests/html/browsers/windows/browsing-context-first-created.xhtml": "skip",
</span><span class="cx"> "web-platform-tests/html/browsers/windows/nested-browsing-contexts/frameElement.html": "skip",
</span><span class="cx"> "web-platform-tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.html": "skip",
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscommonPrefixedLocalStoragejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/common/PrefixedLocalStorage.js (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/common/PrefixedLocalStorage.js         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/common/PrefixedLocalStorage.js        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+/**
+ * Supports pseudo-"namespacing" localStorage for a given test
+ * by generating and using a unique prefix for keys. Why trounce on other
+ * tests' localStorage items when you can keep it "separated"?
+ *
+ * PrefixedLocalStorageTest: Instantiate in testharness.js tests to generate
+ * a new unique-ish prefix
+ * PrefixedLocalStorageResource: Instantiate in supporting test resource
+ * files to use/share a prefix generated by a test.
+ */
+var PrefixedLocalStorage = function () {
+ this.prefix = ''; // Prefix for localStorage keys
+ this.param = 'prefixedLocalStorage'; // Param to use in querystrings
+};
+
+PrefixedLocalStorage.prototype.clear = function () {
+ if (this.prefix === '') { return; }
+ Object.keys(localStorage).forEach(sKey => {
+ if (sKey.indexOf(this.prefix) === 0) {
+ localStorage.removeItem(sKey);
+ }
+ });
+};
+
+/**
+ * Append/replace prefix parameter and value in URI querystring
+ * Use to generate URLs to resource files that will share the prefix.
+ */
+PrefixedLocalStorage.prototype.url = function (uri) {
+ function updateUrlParameter (uri, key, value) {
+ var i = uri.indexOf('#');
+ var hash = (i === -1) ? '' : uri.substr(i);
+ uri = (i === -1) ? uri : uri.substr(0, i);
+ var re = new RegExp(`([?&])${key}=.*?(&|$)`, 'i');
+ var separator = uri.indexOf('?') !== -1 ? '&' : '?';
+ uri = (uri.match(re)) ? uri.replace(re, `$1${key}=${value}$2`) :
+ `${uri}${separator}${key}=${value}`;
+ return uri + hash;
+ }
+ return updateUrlParameter(uri, this.param, this.prefix);
+};
+
+PrefixedLocalStorage.prototype.prefixedKey = function (baseKey) {
+ return `${this.prefix}${baseKey}`;
+};
+
+PrefixedLocalStorage.prototype.setItem = function (baseKey, value) {
+ localStorage.setItem(this.prefixedKey(baseKey), value);
+};
+
+/**
+ * Listen for `storage` events pertaining to a particular key,
+ * prefixed with this object's prefix. Ignore when value is being set to null
+ * (i.e. removeItem).
+ */
+PrefixedLocalStorage.prototype.onSet = function (baseKey, fn) {
+ window.addEventListener('storage', e => {
+ var match = this.prefixedKey(baseKey);
+ if (e.newValue !== null && e.key.indexOf(match) === 0) {
+ fn.call(this, e);
+ }
+ });
+};
+
+/*****************************************************************************
+ * Use in a testharnessjs test to generate a new key prefix.
+ * async_test(t => {
+ * var prefixedStorage = new PrefixedLocalStorageTest();
+ * t.add_cleanup(() => prefixedStorage.cleanup());
+ * /...
+ * });
+ */
+var PrefixedLocalStorageTest = function () {
+ PrefixedLocalStorage.call(this);
+ this.prefix = `${document.location.pathname}-${Math.random()}-${Date.now()}-`;
+};
+PrefixedLocalStorageTest.prototype = Object.create(PrefixedLocalStorage.prototype);
+PrefixedLocalStorageTest.prototype.constructor = PrefixedLocalStorageTest;
+
+/**
+ * Use in a cleanup function to clear out prefixed entries in localStorage
+ */
+PrefixedLocalStorageTest.prototype.cleanup = function () {
+ this.setItem('closeAll', 'true');
+ this.clear();
+};
+
+/*****************************************************************************
+ * Use in test resource files to share a prefix generated by a
+ * PrefixedLocalStorageTest. Will look in URL querystring for prefix.
+ * Setting `close_on_cleanup` opt truthy will make this script's window listen
+ * for storage `closeAll` event from controlling test and close itself.
+ *
+ * var PrefixedLocalStorageResource({ close_on_cleanup: true });
+ */
+var PrefixedLocalStorageResource = function (options) {
+ PrefixedLocalStorage.call(this);
+ this.options = Object.assign({}, {
+ close_on_cleanup: false
+ }, options || {});
+ // Check URL querystring for prefix to use
+ var regex = new RegExp(`[?&]${this.param}(=([^&#]*)|&|#|$)`),
+ results = regex.exec(document.location.href);
+ if (results && results[2]) {
+ this.prefix = results[2];
+ }
+ // Optionally have this window close itself when the PrefixedLocalStorageTest
+ // sets a `closeAll` item.
+ if (this.options.close_on_cleanup) {
+ this.onSet('closeAll', () => {
+ window.close();
+ });
+ }
+};
+PrefixedLocalStorageResource.prototype = Object.create(PrefixedLocalStorage.prototype);
+PrefixedLocalStorageResource.prototype.constructor = PrefixedLocalStorageResource;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscommonw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/common/w3c-import.log (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/common/w3c-import.log        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/common/w3c-import.log        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> ------------------------------------------------------------------------
</span><span class="cx"> List of files:
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/common/OWNERS
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/common/PrefixedLocalStorage.js
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/common/blank.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/common/canvas-frame.css
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/common/canvas-index.css
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerclosedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed-expected.txt        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerclosedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<html>
+ <head>
+ <title>Auxiliary Browing Contexts: window.opener when Opener Removed/Closed</title>
+ <script src="../../../../../../../resources/testharness.js"></script>
+ <script src="../../../../../../../resources/testharnessreport.js"></script>
+ <script src="/common/PrefixedLocalStorage.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var prefixedLocalStorage;
+ setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
+ async_test(t => {
+ t.add_cleanup (() => prefixedLocalStorage.cleanup());
+ var a = document.createElement('a');
+ a.href = prefixedLocalStorage.url('resources/open-closer.html');
+ a.target = '_blank';
+ prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
+ // The window for this auxiliary browsing context's opener
+ // has been closed and discarded, so the aux browsing context
+ // should now report `null` for `window.opener`
+ assert_equals(e.newValue, 'true');
+ }));
+ document.body.append(a);
+ a.click();
+ }, 'An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded');
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-expected.txt        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS Newly-created auxiliary browsing context should report `window.opener`
+PASS Browsing context created with `window.open` should report `window.opener`
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenermultipleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple-expected.txt        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS An auxiliary browsing context should be able to open another auxiliary browsing context
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenermultiplehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Auxiliary Browing Contexts: window.opener, multiple</title>
+ <script src="../../../../../../../resources/testharness.js"></script>
+ <script src="../../../../../../../resources/testharnessreport.js"></script>
+ <script src="/common/PrefixedLocalStorage.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var prefixedLocalStorage;
+ setup (() => prefixedLocalStorage = new PrefixedLocalStorageTest());
+ async_test(t => {
+ t.add_cleanup (() => prefixedLocalStorage.cleanup());
+ var a = document.createElement('a');
+ a.href = prefixedLocalStorage.url('resources/multiple-opener.html');
+ a.target = 'multipleOpener';
+ window.name = 'topOpener';
+ document.body.appendChild(a);
+ window.addEventListener('message', t.step_func_done(e => {
+ var aux1 = e.data.aux1; // First opened context
+ var aux2 = e.data.aux2; // Context opened by first-opened context
+ assert_equals(aux1.name, 'multipleOpener');
+ assert_equals(aux1.openerName, window.name);
+ assert_equals(aux1.isTop, true);
+ assert_equals(aux2.name, 'multipleOpenee');
+ assert_equals(aux2.openerName, aux1.name);
+ assert_equals(aux2.isTop, true);
+ }));
+ a.click();
+ }, 'An auxiliary browsing context should be able to open another auxiliary browsing context');
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoopenerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener-expected.txt        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Auxiliary browsing context created via `window.open` setting `noopener` should report `window.opener` `null`
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Auxiliary Browing Contexts: window.opener noopener</title>
+ <script src="../../../../../../../resources/testharness.js"></script>
+ <script src="../../../../../../../resources/testharnessreport.js"></script>
+ <script src="/common/PrefixedLocalStorage.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var prefixedLocalStorage;
+ setup(() => prefixedLocalStorage = new PrefixedLocalStorageTest());
+ async_test(t => {
+ t.add_cleanup(() => prefixedLocalStorage.cleanup());
+ prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
+ assert_equals(e.newValue, 'true');
+ }));
+ window.open(prefixedLocalStorage.url('resources/no-opener.html'),
+ 'iShouldNotHaveAnOpener',
+ 'noopener');
+ }, 'Auxiliary browsing context created via `window.open` setting `noopener` should report `window.opener` `null`');
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoreferrerexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer-expected.txt        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Auxiliary browsing context created with `rel="noreferrer"` should report `window.opener` `null`
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenernoreferrerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Auxiliary Browing Contexts: window.opener noreferrer</title>
+ <script src="../../../../../../../resources/testharness.js"></script>
+ <script src="../../../../../../../resources/testharnessreport.js"></script>
+ <script src="/common/PrefixedLocalStorage.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var prefixedLocalStorage;
+ setup(() => prefixedLocalStorage = new PrefixedLocalStorageTest());
+ async_test(t => {
+ t.add_cleanup(() => prefixedLocalStorage.cleanup());
+ var a = document.createElement('a');
+ a.href = prefixedLocalStorage.url('resources/no-opener.html');
+ a.target = '_blank';
+ a.rel = 'noreferrer';
+ window.name = 'topWindow';
+ document.body.appendChild(a);
+ prefixedLocalStorage.onSet('openerIsNull', t.step_func_done(e => {
+ assert_equals(e.newValue, 'true');
+ }));
+ a.click();
+ }, 'Auxiliary browsing context created with `rel="noreferrer"` should report `window.opener` `null`');
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+<!doctype html>
+<html>
+ <head>
+ <title>Auxiliary Browing Contexts: window.opener</title>
+ <script src="../../../../../../../resources/testharness.js"></script>
+ <script src="../../../../../../../resources/testharnessreport.js"></script>
+ <script src="/common/PrefixedLocalStorage.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var prefixedLocalStorage;
+ setup (() => {
+ window.name = 'topWindow';
+ prefixedLocalStorage = new PrefixedLocalStorageTest();
+ });
+
+ function cleanup () {
+ prefixedLocalStorage.setItem('closeAll', 'true');
+ prefixedLocalStorage.clear();
+ }
+
+ function testOpener (t, target) {
+ t.add_cleanup(cleanup);
+ window.addEventListener('message', t.step_func(e => {
+ if (e.data.name === target) {
+ // The opener IDL attribute...must return the WindowProxy object of the
+ // browsing context from which the current browsing context was created
+ assert_equals(e.data.openerName, 'topWindow');
+ // Auxiliary browsing contexts are always top-level browsing contexts
+ assert_equals(e.data.isTop, true);
+ t.done();
+ }
+ }));
+ }
+
+ async_test(t => {
+ var target = 'windowOpenerA';
+ var a = document.createElement('a');
+ a.href = prefixedLocalStorage.url('resources/message-window-opener.html');
+ a.target = target;
+ document.body.appendChild(a);
+ testOpener(t, target);
+ a.click();
+ }, 'Newly-created auxiliary browsing context should report `window.opener`');
+
+ async_test(t => {
+ var target = 'windowOpenerB';
+ testOpener(t, target);
+ window.open(prefixedLocalStorage.url('resources/message-window-opener.html'),
+ target);
+ }, 'Browsing context created with `window.open` should report `window.opener`');
+ </script>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcescloseopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<html>
+<body onload="closeOpener()">
+<p>This window should close its opener.</p>
+<script src="/common/PrefixedLocalStorage.js"></script>
+<script>
+var prefixedLocalStorage = new PrefixedLocalStorageResource({
+ close_on_cleanup: true
+});
+var prefixedLocalStorage = new PrefixedLocalStorageResource({
+ close_on_cleanup: true
+});
+function closeOpener () {
+ if (window.opener) {
+ window.opener.close();
+
+ // Give the browsing context a chance to dispose of itself
+ function waitForContextDiscard () {
+ if (window.opener === null) {
+ return prefixedLocalStorage.setItem('openerIsNull', 'true');
+ }
+ return setTimeout(waitForContextDiscard, 0);
+ }
+ waitForContextDiscard();
+ }
+}
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesmessagewindowopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+<script src="/common/PrefixedLocalStorage.js"></script>
+<script>
+var prefixedLocalStorage = new PrefixedLocalStorageResource({
+ close_on_cleanup: true
+});
+
+if (window.opener) {
+ window.opener.postMessage ({
+ name : window.name,
+ openerName: window.opener.name,
+ isTop : window.top === window
+ }, '*');
+}
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesmultipleopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!doctype html>
+<html>
+<script src="/common/PrefixedLocalStorage.js"></script>
+<body onload="openNested()">
+<script>
+var prefixedLocalStorage = new PrefixedLocalStorageResource({
+ close_on_cleanup: true
+});
+function openNested () {
+ // Listen for message from opened context and pass through to this
+ // context's opener
+ window.addEventListener('message', (e) => {
+ if (window.opener) {
+ window.opener.postMessage({
+ aux2: e.data, // From multipleOpenee
+ aux1: { // This context
+ name : window.name,
+ openerName : window.opener.name,
+ isTop : window.top === window
+ }
+ }, '*');
+ }
+ });
+ var a = document.createElement('a');
+ a.target = 'multipleOpenee';
+ a.href = prefixedLocalStorage.url('message-window-opener.html');
+ document.body.appendChild(a);
+ a.click();
+}
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesnoopenerhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<html>
+<p>This window should have no opener.</p>
+<script src="/common/PrefixedLocalStorage.js"></script>
+<script>
+var prefixedLocalStorage = new PrefixedLocalStorageResource({
+ close_on_cleanup: true
+});
+function checkOpener () {
+ return prefixedLocalStorage.setItem('openerIsNull', window.opener === null);
+}
+</script>
+<body onload="checkOpener()">
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesopencloserhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+<!doctype html>
+<meta charset="utf-8">
+<html>
+<body onload="openAuxiliary()">
+<a target="_blank">Open auxiliary context that will close this window (its opener)</a>
+<script src="/common/PrefixedLocalStorage.js"></script>
+<script>
+function openAuxiliary () {
+ var prefixedLocalStorage = new PrefixedLocalStorageResource();
+ var a = document.body.querySelector('a');
+ a.href = prefixedLocalStorage.url('close-opener.html');
+ document.body.append(a);
+ a.click();
+}
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsresourcesw3cimportlogfromrev214250trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsw3cimportlog"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log (from rev 214250, trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log) (0 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/w3c-import.log        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/message-window-opener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/multiple-opener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/no-opener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/resources/open-closer.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlbrowserswindowsauxiliarybrowsingcontextsw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/w3c-import.log        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -16,3 +16,8 @@
</span><span class="cx"> ------------------------------------------------------------------------
</span><span class="cx"> List of files:
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html
+/LayoutTests/imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/Source/WebCore/ChangeLog        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-03-22 Chris Dumez <cdumez@apple.com>
+
+ Implement the "noopener" feature for window.open()
+ https://bugs.webkit.org/show_bug.cgi?id=163960
+ <rdar://problem/28941679>
+
+ Reviewed by Sam Weinig.
+
+ Implement the "noopener" feature for window.open(). If 'noopener' is passed to window.open()
+ then the new Window's opener property will be null.
+
+ Tests: imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html
+ imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
+ imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html
+ imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html
+ imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::createWindow):
+ * page/WindowFeatures.cpp:
+ (WebCore::parseWindowFeatures):
+ (WebCore::setWindowFeature):
+ * page/WindowFeatures.h:
+
</ins><span class="cx"> 2017-03-21 Sergio Villar Senin <svillar@igalia.com>
</span><span class="cx">
</span><span class="cx"> [Soup] "Only from websites I visit" cookie policy is broken
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -2198,7 +2198,8 @@
</span><span class="cx"> if (!newFrame)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- newFrame->loader().setOpener(&openerFrame);
</del><ins>+ if (!windowFeatures.noopener)
+ newFrame->loader().setOpener(&openerFrame);
</ins><span class="cx"> newFrame->page()->setOpenedByDOM();
</span><span class="cx">
</span><span class="cx"> if (newFrame->document()->domWindow()->isInsecureScriptAccess(activeWindow, completedURL))
</span></span></pre></div>
<a id="trunkSourceWebCorepageWindowFeaturescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/WindowFeatures.cpp (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WindowFeatures.cpp        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/Source/WebCore/page/WindowFeatures.cpp        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> features.toolBarVisible = false;
</span><span class="cx"> features.locationBarVisible = false;
</span><span class="cx"> features.scrollbarsVisible = false;
</span><ins>+ features.noopener = false;
</ins><span class="cx">
</span><span class="cx"> processFeaturesString(featuresString, [&features](StringView key, StringView value) {
</span><span class="cx"> setWindowFeature(features, key, value);
</span><span class="lines">@@ -135,6 +136,8 @@
</span><span class="cx"> features.fullscreen = numericValue;
</span><span class="cx"> else if (equalLettersIgnoringASCIICase(key, "scrollbars"))
</span><span class="cx"> features.scrollbarsVisible = numericValue;
</span><ins>+ else if (equalLettersIgnoringASCIICase(key, "noopener"))
+ features.noopener = numericValue;
</ins><span class="cx"> else if (numericValue == 1)
</span><span class="cx"> features.additionalFeatures.append(key.toString());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageWindowFeaturesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/WindowFeatures.h (214250 => 214251)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/WindowFeatures.h        2017-03-22 14:36:32 UTC (rev 214250)
+++ trunk/Source/WebCore/page/WindowFeatures.h        2017-03-22 16:15:16 UTC (rev 214251)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx">
</span><span class="cx"> bool fullscreen { false };
</span><span class="cx"> bool dialog { false };
</span><ins>+ bool noopener { false };
</ins><span class="cx">
</span><span class="cx"> Vector<String> additionalFeatures;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>