Title: [253340] trunk/LayoutTests/imported/w3c
Revision
253340
Author
[email protected]
Date
2019-12-10 12:19:09 -0800 (Tue, 10 Dec 2019)

Log Message

Re-sync imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html from usptream
https://bugs.webkit.org/show_bug.cgi?id=205070

Reviewed by Alex Christensen.

Re-sync imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html from usptream
ab28e18f067f17a76d9c32.

* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
* web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (253339 => 253340)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-10 20:10:44 UTC (rev 253339)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2019-12-10 20:19:09 UTC (rev 253340)
@@ -1,3 +1,16 @@
+2019-12-10  Chris Dumez  <[email protected]>
+
+        Re-sync imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html from usptream
+        https://bugs.webkit.org/show_bug.cgi?id=205070
+
+        Reviewed by Alex Christensen.
+
+        Re-sync imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html from usptream
+        ab28e18f067f17a76d9c32.
+
+        * web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:
+        * web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html:
+
 2019-12-10  youenn fablet  <[email protected]>
 
         Mark some WPT test folders as DumpJSConsoleLogInStdErr

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt (253339 => 253340)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt	2019-12-10 20:10:44 UTC (rev 253339)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt	2019-12-10 20:19:09 UTC (rev 253340)
@@ -1,10 +1,28 @@
+CONSOLE MESSAGE: line 302: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 287: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 302: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 287: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://localhost:8800". The frame being accessed set "document.domain" to "localhost", but the frame requesting access did not. Both must set "document.domain" to the same value to allow access.
+CONSOLE MESSAGE: line 302: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://localhost:8800". The frame being accessed set "document.domain" to "localhost", but the frame requesting access did not. Both must set "document.domain" to the same value to allow access.
+CONSOLE MESSAGE: line 287: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: line 302: Blocked a frame with origin "http://localhost:8800" from accessing a frame with origin "http://127.0.0.1:8800". Protocols, domains, and ports must match.
+CONSOLE MESSAGE: Unable to post message to http://does-not.exist. Recipient has origin http://127.0.0.1:8800.
 
-PASS Basic sanity-checking (cross-origin) 
-PASS Basic sanity-checking (same-origin + document.domain) 
-PASS Basic sanity-checking (cross-site) 
+
+FAIL Basic sanity-checking (cross-origin) assert_equals: Overrides visible in the same-origin case expected (string) "override" but got (function) function "function focus() {
+    [native code]
+}"
+FAIL Basic sanity-checking (same-origin + document.domain) assert_equals: Overrides visible in the same-origin case expected (string) "override" but got (function) function "function focus() {
+    [native code]
+}"
+FAIL Basic sanity-checking (cross-site) assert_equals: Overrides visible in the same-origin case expected (string) "override" but got (function) function "function focus() {
+    [native code]
+}"
 FAIL Only whitelisted properties are accessible cross-origin (cross-origin) assert_throws: Should throw when writing to toString on Location function "function () { win.location[prop] = undefined; }" did not throw
 FAIL Only whitelisted properties are accessible cross-origin (same-origin + document.domain) assert_throws: Should throw when writing to toString on Location function "function () { win.location[prop] = undefined; }" did not throw
 FAIL Only whitelisted properties are accessible cross-origin (cross-site) assert_throws: Should throw when writing to toString on Location function "function () { win.location[prop] = undefined; }" did not throw
+FAIL Only whitelisted properties are usable as cross-origin this objects (cross-origin) promise_test: Unhandled rejection with value: object "SyntaxError: The string did not match the expected pattern."
+FAIL Only whitelisted properties are usable as cross-origin this objects (same-origin + document.domain) assert_throws: Should throw when calling window.createImageBitmap with cross-origin this object function "function () { throw e }" threw object "TypeError: Not enough arguments" that is not a DOMException SecurityError: property "code" is equal to undefined, expected 18
+FAIL Only whitelisted properties are usable as cross-origin this objects (cross-site) assert_throws: Should throw when calling window.createImageBitmap with cross-origin this object function "function () { throw e }" threw object "TypeError: Not enough arguments" that is not a DOMException SecurityError: property "code" is equal to undefined, expected 18
 PASS [[GetPrototypeOf]] should return null (cross-origin) 
 PASS [[GetPrototypeOf]] should return null (same-origin + document.domain) 
 PASS [[GetPrototypeOf]] should return null (cross-site) 
@@ -98,22 +116,16 @@
 PASS {}.toString.call() does the right thing on cross-origin objects (cross-origin) 
 PASS {}.toString.call() does the right thing on cross-origin objects (same-origin + document.domain) 
 PASS {}.toString.call() does the right thing on cross-origin objects (cross-site) 
-PASS Cross-origin behavior of Window and Location 
-PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-origin). 
-PASS Cross-origin behavior of Window and Location 1 
-PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (same-origin + document.domain). 
-PASS Cross-origin behavior of Window and Location 2 
-PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-site). 
-PASS Cross-origin behavior of Window and Location 3 
-PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-origin). 
-PASS Cross-origin behavior of Window and Location 4 
-PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (same-origin + document.domain). 
-PASS Cross-origin behavior of Window and Location 5 
-PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-site). 
-PASS Cross-origin behavior of Window and Location 6 
-PASS Resolving a promise with a cross-origin location should work (cross-origin). 
-PASS Cross-origin behavior of Window and Location 7 
-PASS Resolving a promise with a cross-origin location should work (same-origin + document.domain). 
-PASS Cross-origin behavior of Window and Location 8 
-PASS Resolving a promise with a cross-origin location should work (cross-site). 
+PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-origin) 
+PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (same-origin + document.domain) 
+PASS Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-site) 
+PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-origin) 
+PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (same-origin + document.domain) 
+PASS Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-site) 
+PASS Resolving a promise with a cross-origin location should work (cross-origin) 
+PASS Resolving a promise with a cross-origin location should work (same-origin + document.domain) 
+PASS Resolving a promise with a cross-origin location should work (cross-site) 
+PASS LenientThis behavior (cross-origin) 
+PASS LenientThis behavior (same-origin + document.domain) 
+PASS LenientThis behavior (cross-site) 
       

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html (253339 => 253340)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html	2019-12-10 20:10:44 UTC (rev 253339)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html	2019-12-10 20:19:09 UTC (rev 253340)
@@ -95,8 +95,20 @@
      promiseTest: false});
 }
 
+function addPromiseTest(func, desc) {
+  testList.push(
+    {tests: [
+      {func: func.bind(null, C),
+       desc: desc + " (cross-origin)"},
+      {func: func.bind(null, E),
+       desc: desc + " (same-origin + document.domain)"},
+      {func: func.bind(null, G),
+       desc: desc + " (cross-site)"}],
+     promiseTest: true});
+}
+
 /**
- * A similar helper, but for the subframes that load frame-with-then.html
+ * Similar helpers, but for the subframes that load frame-with-then.html
  */
 function addThenTest(func, desc) {
   testList.push(
@@ -110,8 +122,17 @@
      promiseTest: false});
 }
 
-function addPromiseTest(func, desc) {
-  testList.push({tests:[{func, desc}], promiseTest: true}); }
+function addPromiseThenTest(func, desc) {
+  testList.push(
+    {tests: [
+      {func: func.bind(null, D),
+       desc: desc + " (cross-origin)"},
+      {func: func.bind(null, F),
+       desc: desc + " (same-origin + document.domain)"},
+      {func: func.bind(null, H),
+       desc: desc + " (cross-site)"}],
+     promiseTest: true});
+}
 
 /*
  * Basic sanity testing.
@@ -127,6 +148,9 @@
   assert_throws("SecurityError", function() { win.location.pathname; }, "location.pathname throws cross-origin");
   assert_equals(B.frames, 'override', "Overrides visible in the same-origin case");
   assert_equals(win.frames, win, "Overrides invisible in the cross-origin case");
+  assert_equals(B.focus, 'override', "Overrides visible in the same-origin case");
+  checkFunction(win.focus, Function.prototype);
+  assert_not_equals(win.focus, focus, "Overrides invisible in the cross-origin case");
 }, "Basic sanity-checking");
 
 /*
@@ -135,20 +159,64 @@
  * Also tests for [[GetOwnProperty]] and [[HasOwnProperty]] behavior.
  */
 
-var whitelistedWindowIndices = ['0', '1'];
-var whitelistedWindowPropNames = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
-                                  'opener', 'closed', 'close', 'blur', 'focus', 'length', 'then'];
-whitelistedWindowPropNames = whitelistedWindowPropNames.concat(whitelistedWindowIndices);
-whitelistedWindowPropNames.sort();
-var whitelistedLocationPropNames = ['href', 'replace', 'then'];
-whitelistedLocationPropNames.sort();
 var whitelistedSymbols = [Symbol.toStringTag, Symbol.hasInstance,
                           Symbol.isConcatSpreadable];
-var whitelistedWindowProps = whitelistedWindowPropNames.concat(whitelistedSymbols);
+var windowWhitelists = {
+  namedFrames: ['donotleakme'],
+  indices: ['0', '1'],
+  getters: ['location', 'window', 'frames', 'self', 'top', 'parent',
+            'opener', 'closed', 'length'],
+  setters: ['location'],
+  methods: ['postMessage', 'close', 'blur', 'focus'],
+  // These are methods which return promises and, therefore, when called with a
+  // cross-origin `this` object, do not throw immediately, but instead return a
+  // Promise which rejects with the same SecurityError that they would
+  // otherwise throw. They are not, however, cross-origin accessible.
+  promiseMethods: ['createImageBitmap', 'fetch'],
+}
+windowWhitelists.propNames = Array.from(new Set([...windowWhitelists.indices,
+                                                 ...windowWhitelists.getters,
+                                                 ...windowWhitelists.setters,
+                                                 ...windowWhitelists.methods,
+                                                 'then'])).sort();
+windowWhitelists.props = windowWhitelists.propNames.concat(whitelistedSymbols);
 
+var locationWhitelists = {
+  getters: [],
+  setters: ['href'],
+  methods: ['replace'],
+  promiseMethods: [],
+}
+locationWhitelists.propNames = Array.from(new Set([...locationWhitelists.getters,
+                                                   ...locationWhitelists.setters,
+                                                   ...locationWhitelists.methods,
+                                                   'then'])).sort();
+
+// Define various sets of arguments to call cross-origin methods with. Arguments
+// for any cross-origin-callable method must be valid, and should aim to have no
+// side-effects. Any method without an entry in this list will be called with
+// an empty arguments list.
+var methodArgs = new Map(Object.entries({
+  // As a basic smoke test, we call one cross-origin-inaccessible method with
+  // both valid and invalid arguments to make sure that it rejects with the
+  // same SecurityError regardless.
+  assign: [
+    [],
+    ["_javascript_:undefined"],
+  ],
+  // Note: If we post a message to frame.html with a matching origin, its
+  // "onmessage" handler will change its `document.domain`, and potentially
+  // invalidate subsequent tests, so be sure to only pass non-matching origins.
+  postMessage: [
+    ["foo", "http://does-not.exist/"],
+    ["foo", {}],
+  ],
+  replace: [["_javascript_:undefined"]],
+}));
+
 addTest(function(win) {
   for (var prop in window) {
-    if (whitelistedWindowProps.indexOf(prop) != -1) {
+    if (windowWhitelists.props.indexOf(prop) != -1) {
       win[prop]; // Shouldn't throw.
       Object.getOwnPropertyDescriptor(win, prop); // Shouldn't throw.
       assert_true(Object.prototype.hasOwnProperty.call(win, prop), "hasOwnProperty for " + String(prop));
@@ -162,6 +230,11 @@
     if (prop != 'location')
       assert_throws("SecurityError", function() { win[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
   }
+  for (var prop of windowWhitelists.namedFrames) {
+    win[prop]; // Shouldn't throw.
+    Object.getOwnPropertyDescriptor(win, prop); // Shouldn't throw.
+    assert_true(Object.prototype.hasOwnProperty.call(win, prop), "hasOwnProperty for " + String(prop));
+  }
   for (var prop in location) {
     if (prop == 'replace') {
       win.location[prop]; // Shouldn't throw.
@@ -186,6 +259,60 @@
   }
 }, "Only whitelisted properties are accessible cross-origin");
 
+addPromiseTest(async function(win, test_obj) {
+  async function checkProperties(objName, whitelists) {
+    var localObj = window[objName];
+    var otherObj = win[objName];
+
+    for (var prop in localObj) {
+      let desc;
+      for (let obj = localObj; !desc; obj = Object.getPrototypeOf(obj)) {
+        desc = Object.getOwnPropertyDescriptor(obj, prop);
+
+      }
+
+      if ("value" in desc) {
+        if (typeof desc.value === "function" && String(desc.value).includes("[native code]")) {
+          if (whitelists.promiseMethods.includes(prop)) {
+            await promise_rejects(test_obj, "SecurityError", desc.value.call(otherObj),
+                                  `Should throw when calling ${objName}.${prop} with cross-origin this object`);
+          } else if (!whitelists.methods.includes(prop)) {
+            for (let args of methodArgs.get(prop) || [[]]) {
+              assert_throws("SecurityError", desc.value.bind(otherObj, ...args),
+                            `Should throw when calling ${objName}.${prop} with cross-origin this object`);
+            }
+
+          } else {
+            for (let args of methodArgs.get(prop) || [[]]) {
+              desc.value.apply(otherObj, args); // Shouldn't throw.
+            }
+          }
+        }
+      } else {
+        if (desc.get) {
+          if (whitelists.getters.includes(prop)) {
+            desc.get.call(otherObj); // Shouldn't throw.
+          } else {
+            assert_throws("SecurityError", desc.get.bind(otherObj),
+                          `Should throw when calling ${objName}.${prop} getter with cross-origin this object`);
+          }
+        }
+        if (desc.set) {
+          if (whitelists.setters.includes(prop)) {
+            desc.set.call(otherObj, "_javascript_:undefined"); // Shouldn't throw.
+          } else {
+            assert_throws("SecurityError", desc.set.bind(otherObj, "foo"),
+                          `Should throw when calling ${objName}.${prop} setter with cross-origin this object`);
+          }
+        }
+      }
+    }
+  }
+
+  await checkProperties("location", locationWhitelists);
+  await checkProperties("window", windowWhitelists);
+}, "Only whitelisted properties are usable as cross-origin this objects");
+
 /*
  * ES Internal Methods.
  */
@@ -291,7 +418,7 @@
 }
 
 addTest(function(win) {
-  whitelistedWindowProps.forEach(function(prop) {
+  windowWhitelists.props.forEach(function(prop) {
     var desc = Object.getOwnPropertyDescriptor(win, prop);
     checkPropertyDescriptor(desc, prop, prop == 'location');
   });
@@ -367,9 +494,9 @@
   let i = 0;
   for (var prop in win) {
     i++;
-    assert_true(whitelistedWindowIndices.includes(prop), prop + " is not safelisted for a cross-origin Window");
+    assert_true(windowWhitelists.indices.includes(prop), prop + " is not safelisted for a cross-origin Window");
   }
-  assert_equals(i, whitelistedWindowIndices.length, "Enumerate all enumerable safelisted cross-origin Window properties");
+  assert_equals(i, windowWhitelists.indices.length, "Enumerate all enumerable safelisted cross-origin Window properties");
   i = 0;
   for (var prop in win.location) {
     i++;
@@ -383,13 +510,13 @@
 
 addTest(function(win) {
   assert_array_equals(Object.getOwnPropertyNames(win).sort(),
-                      whitelistedWindowPropNames,
+                      windowWhitelists.propNames,
                       "Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
   assert_array_equals(Object.keys(win).sort(),
-                      whitelistedWindowIndices,
+                      windowWhitelists.indices,
                       "Object.keys() gives the right answer for cross-origin Window");
   assert_array_equals(Object.getOwnPropertyNames(win.location).sort(),
-                      whitelistedLocationPropNames,
+                      locationWhitelists.propNames,
                       "Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
   assert_equals(Object.keys(win.location).length, 0,
                       "Object.keys() gives the right answer for cross-origin Location");
@@ -405,7 +532,7 @@
 
 addTest(function(win) {
   var allWindowProps = Reflect.ownKeys(win);
-  indexedWindowProps = allWindowProps.slice(0, whitelistedWindowIndices.length);
+  indexedWindowProps = allWindowProps.slice(0, windowWhitelists.indices.length);
   stringWindowProps = allWindowProps.slice(0, -1 * whitelistedSymbols.length);
   symbolWindowProps = allWindowProps.slice(-1 * whitelistedSymbols.length);
   // stringWindowProps should have "then" last in this case.  Do this
@@ -412,9 +539,9 @@
   // check before we call stringWindowProps.sort() below.
   assert_equals(stringWindowProps[stringWindowProps.length - 1], "then",
                 "'then' property should be added to the end of the string list if not there");
-  assert_array_equals(indexedWindowProps, whitelistedWindowIndices,
+  assert_array_equals(indexedWindowProps, windowWhitelists.indices,
                       "Reflect.ownKeys should start with the indices exposed on the cross-origin window.");
-  assert_array_equals(stringWindowProps.sort(), whitelistedWindowPropNames,
+  assert_array_equals(stringWindowProps.sort(), windowWhitelists.propNames,
                       "Reflect.ownKeys should continue with the cross-origin window properties for a cross-origin Window.");
   assert_array_equals(symbolWindowProps, whitelistedSymbols,
                       "Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Window.");
@@ -422,7 +549,7 @@
   var allLocationProps = Reflect.ownKeys(win.location);
   stringLocationProps = allLocationProps.slice(0, -1 * whitelistedSymbols.length);
   symbolLocationProps = allLocationProps.slice(-1 * whitelistedSymbols.length);
-  assert_array_equals(stringLocationProps.sort(), whitelistedLocationPropNames,
+  assert_array_equals(stringLocationProps.sort(), locationWhitelists.propNames,
                       "Reflect.ownKeys should start with the cross-origin window properties for a cross-origin Location.")
   assert_array_equals(symbolLocationProps, whitelistedSymbols,
                       "Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Location.")
@@ -507,60 +634,50 @@
   assert_equals({}.toString.call(win.location), "[object Object]");
 }, "{}.toString.call() does the right thing on cross-origin objects");
 
-addPromiseTest(function() {
-  return Promise.resolve(C).then((arg) => {
-    assert_equals(arg, C);
+addPromiseTest(function(win) {
+  return Promise.resolve(win).then((arg) => {
+    assert_equals(arg, win);
   });
-}, "Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-origin).");
+}, "Resolving a promise with a cross-origin window without a 'then' subframe should work");
 
-addPromiseTest(function() {
-  return Promise.resolve(E).then((arg) => {
-    assert_equals(arg, E);
+addPromiseThenTest(function(win) {
+  return Promise.resolve(win).then((arg) => {
+    assert_equals(arg, win);
   });
-}, "Resolving a promise with a cross-origin window without a 'then' subframe should work (same-origin + document.domain).");
+}, "Resolving a promise with a cross-origin window with a 'then' subframe should work");
 
-addPromiseTest(function() {
-  return Promise.resolve(G).then((arg) => {
-    assert_equals(arg, G);
+addPromiseThenTest(function(win) {
+  return Promise.resolve(win.location).then((arg) => {
+    assert_equals(arg, win.location);
   });
-}, "Resolving a promise with a cross-origin window without a 'then' subframe should work (cross-site).");
+}, "Resolving a promise with a cross-origin location should work");
 
-addPromiseTest(function() {
-  return Promise.resolve(D).then((arg) => {
-    assert_equals(arg, D);
-  });
-}, "Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-origin).");
+addTest(function(win) {
+  var desc = Object.getOwnPropertyDescriptor(window, "onmouseenter");
+  var f = () => {};
 
-addPromiseTest(function() {
-  return Promise.resolve(F).then((arg) => {
-    assert_equals(arg, F);
-  });
-}, "Resolving a promise with a cross-origin window with a 'then' subframe should work (same-origin + document.domain).");
+  // Check that it has [LenientThis] behavior
+  assert_equals(desc.get.call({}), undefined, "getter should return undefined");
+  desc.set.call({}, f); // Should not throw.
 
-addPromiseTest(function() {
-  return Promise.resolve(H).then((arg) => {
-    assert_equals(arg, H);
-  });
-}, "Resolving a promise with a cross-origin window with a 'then' subframe should work (cross-site).");
+  // Check that we can apply it to a same-origin window.
+  assert_equals(desc.get.call(B), null, "Should be able to read the value");
+  desc.set.call(B, f);
+  assert_equals(desc.get.call(B), f, "Value should have updated");
+  // And reset it for our next test
+  desc.set.call(B, null);
+  assert_equals(desc.get.call(B), null, "Should have been reset");
 
-addPromiseTest(function() {
-  return Promise.resolve(D.location).then((arg) => {
-    assert_equals(arg, D.location);
-  });
-}, "Resolving a promise with a cross-origin location should work (cross-origin).");
+  // Check that applying it to a cross-origin window throws instead of doing
+  // the [LenientThis] behavior.
+  assert_throws("SecurityError", () => {
+    desc.get.call(win);
+  }, "Should throw when getting cross-origin");
+  assert_throws("SecurityError", () => {
+    desc.set.call(win, f);
+  }, "Should throw when setting cross-origin");
+}, "LenientThis behavior");
 
-addPromiseTest(function() {
-  return Promise.resolve(F.location).then((arg) => {
-    assert_equals(arg, F.location);
-  });
-}, "Resolving a promise with a cross-origin location should work (same-origin + document.domain).");
-
-addPromiseTest(function() {
-  return Promise.resolve(H.location).then((arg) => {
-    assert_equals(arg, H.location);
-  });
-}, "Resolving a promise with a cross-origin location should work (cross-site).");
-
 // We do a fresh load of the subframes for each test to minimize side-effects.
 // It would be nice to reload ourselves as well, but we can't do that without
 // disrupting the test harness.
@@ -572,19 +689,22 @@
   }
 }
 
-function runNextTest() {
+async function runNextTest() {
   var entry = testList.shift();
   if (entry.promiseTest) {
-    test(function() {
-      assert_equals(entry.tests.length, 1, "We can't handle this yet");
-    });
-    promise_test(() => entry.tests[0].func().finally(testDone), entry.tests[0].desc);
+    for (let t of entry.tests) {
+      await new Promise(resolve => {
+        promise_test(test_obj => {
+          return new Promise(res => res(t.func(test_obj))).finally(resolve);
+        }, t.desc);
+      });
+    }
   } else {
-    for (t of entry.tests) {
+    for (let t of entry.tests) {
       test(t.func, t.desc);
     }
-    testDone();
   }
+  testDone();
 }
 reloadSubframes(runNextTest);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to