mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision 1e4fe87a7f01c0b5c614c8f601ffa68b4a00662a
This commit is contained in:
parent
4c3f1756da
commit
432648745e
164 changed files with 8354 additions and 595 deletions
|
@ -11,6 +11,7 @@
|
|||
<div id=log></div>
|
||||
<iframe id="B"></iframe>
|
||||
<iframe id="C"></iframe>
|
||||
<iframe id="D"></iframe>
|
||||
<script>
|
||||
|
||||
/*
|
||||
|
@ -21,10 +22,13 @@ var host_info = get_host_info();
|
|||
|
||||
setup({explicit_done: true});
|
||||
path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
|
||||
pathWithThen = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame-with-then.html';
|
||||
var B = document.getElementById('B').contentWindow;
|
||||
var C = document.getElementById('C').contentWindow;
|
||||
var D = document.getElementById('D').contentWindow;
|
||||
B.frameElement.uriToLoad = path;
|
||||
C.frameElement.uriToLoad = get_host_info().HTTP_REMOTE_ORIGIN + path;
|
||||
D.frameElement.uriToLoad = get_host_info().HTTP_REMOTE_ORIGIN + pathWithThen;
|
||||
|
||||
function reloadSubframes(cb) {
|
||||
var iframes = document.getElementsByTagName('iframe');
|
||||
|
@ -45,8 +49,8 @@ function isObject(x) { return Object(x) === x; }
|
|||
*/
|
||||
|
||||
var testList = [];
|
||||
function addTest(fun, desc) { testList.push([fun, desc]); }
|
||||
|
||||
function addTest(func, desc) { testList.push({func, desc, promiseTest: false}); }
|
||||
function addPromiseTest(func, desc) { testList.push({func, desc, promiseTest: true}); }
|
||||
|
||||
/*
|
||||
* Basic sanity testing.
|
||||
|
@ -72,10 +76,10 @@ addTest(function() {
|
|||
|
||||
var whitelistedWindowIndices = ['0', '1'];
|
||||
var whitelistedWindowPropNames = ['location', 'postMessage', 'window', 'frames', 'self', 'top', 'parent',
|
||||
'opener', 'closed', 'close', 'blur', 'focus', 'length'];
|
||||
'opener', 'closed', 'close', 'blur', 'focus', 'length', 'then'];
|
||||
whitelistedWindowPropNames = whitelistedWindowPropNames.concat(whitelistedWindowIndices);
|
||||
whitelistedWindowPropNames.sort();
|
||||
var whitelistedLocationPropNames = ['href', 'replace'];
|
||||
var whitelistedLocationPropNames = ['href', 'replace', 'then'];
|
||||
whitelistedLocationPropNames.sort();
|
||||
var whitelistedSymbols = [Symbol.toStringTag, Symbol.hasInstance,
|
||||
Symbol.isConcatSpreadable];
|
||||
|
@ -191,7 +195,7 @@ function checkPropertyDescriptor(desc, propName, expectWritable) {
|
|||
assert_equals(desc.configurable, true, "property descriptor for " + propName + " should be configurable");
|
||||
if (!isArrayIndexPropertyName) {
|
||||
assert_equals(desc.enumerable, false, "property descriptor for " + propName + " should not be enumerable");
|
||||
if(isSymbol) {
|
||||
if (isSymbol || propName == "then") {
|
||||
assert_true("value" in desc,
|
||||
"property descriptor for " + propName + " should be a value descriptor");
|
||||
assert_equals(desc.value, undefined,
|
||||
|
@ -222,6 +226,10 @@ addTest(function() {
|
|||
});
|
||||
}, "[[GetOwnProperty]] - Property descriptors for cross-origin properties should be set up correctly");
|
||||
|
||||
addTest(function() {
|
||||
assert_equals(typeof D.then, "object");
|
||||
}, "[[GetOwnProperty]] - Subframe named 'then' should shadow the default 'then' value");
|
||||
|
||||
/*
|
||||
* [[Delete]]
|
||||
*/
|
||||
|
@ -309,6 +317,10 @@ addTest(function() {
|
|||
indexedWindowProps = allWindowProps.slice(0, whitelistedWindowIndices.length);
|
||||
stringWindowProps = allWindowProps.slice(0, -1 * whitelistedSymbols.length);
|
||||
symbolWindowProps = allWindowProps.slice(-1 * whitelistedSymbols.length);
|
||||
// stringWindowProps should have "then" last in this case. Do this
|
||||
// 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,
|
||||
"Reflect.ownKeys should start with the indices exposed on the cross-origin window.");
|
||||
assert_array_equals(stringWindowProps.sort(), whitelistedWindowPropNames,
|
||||
|
@ -325,6 +337,17 @@ addTest(function() {
|
|||
"Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Location.")
|
||||
}, "[[OwnPropertyKeys]] should place the symbols after the property names after the subframe indices");
|
||||
|
||||
addTest(function() {
|
||||
var stringProps = Object.getOwnPropertyNames(D);
|
||||
// Named frames are not exposed via [[OwnPropertyKeys]].
|
||||
assert_equals(stringProps.indexOf("a"), -1);
|
||||
assert_equals(stringProps.indexOf("b"), -1);
|
||||
assert_equals(typeof D.a, "object");
|
||||
assert_equals(typeof D.b, "object");
|
||||
assert_equals(stringProps[stringProps.length - 1], "then");
|
||||
assert_equals(stringProps.indexOf("then"), stringProps.lastIndexOf("then"));
|
||||
}, "[[OwnPropertyKeys]] should not reorder where 'then' appears if it's a named subframe, nor add another copy of 'then'");
|
||||
|
||||
addTest(function() {
|
||||
assert_true(B.eval('parent.C') === C, "A and B observe the same identity for C's Window");
|
||||
assert_true(B.eval('parent.C.location') === C.location, "A and B observe the same identity for C's Location");
|
||||
|
@ -393,16 +416,43 @@ addTest(function() {
|
|||
assert_equals({}.toString.call(C.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);
|
||||
});
|
||||
}, "Resolving a promise with a cross-origin window without a 'then' subframe 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.");
|
||||
|
||||
addPromiseTest(function() {
|
||||
return Promise.resolve(D.location).then((arg) => {
|
||||
assert_equals(arg, D.location);
|
||||
});
|
||||
}, "Resolving a promise with a cross-origin location should work.");
|
||||
|
||||
// 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.
|
||||
function testDone() {
|
||||
if (testList.length != 0) {
|
||||
reloadSubframes(runNextTest);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
var entry = testList.shift();
|
||||
test(() => entry[0](), entry[1])
|
||||
if (testList.length != 0)
|
||||
reloadSubframes(runNextTest);
|
||||
else
|
||||
done();
|
||||
if (entry.promiseTest) {
|
||||
promise_test(() => entry.func().finally(testDone), entry.desc);
|
||||
} else {
|
||||
test(entry.func, entry.desc);
|
||||
testDone();
|
||||
}
|
||||
}
|
||||
reloadSubframes(runNextTest);
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<!--- Some frames to test ordering -->
|
||||
<iframe name="a"></iframe>
|
||||
<!-- A subframe to test "then" behavior -->
|
||||
<iframe name="then"></iframe>
|
||||
<iframe name="b"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -6,6 +6,10 @@
|
|||
// properly ignored cross-origin.
|
||||
window.frames = "override";
|
||||
|
||||
// Also add a |then| property to test that it doesn't get exposed.
|
||||
window.then = "something";
|
||||
window.location.then = "something-else";
|
||||
|
||||
// If we get a postMessage, we grab references to everything and set
|
||||
// document.domain to trim off our topmost subdomain.
|
||||
window.onmessage = function(evt) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue