mirror of
https://github.com/servo/servo.git
synced 2025-08-16 02:45:36 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -17,7 +17,7 @@ log = function(t) {l.textContent += ("\n" + t)}
|
|||
var steps = [
|
||||
function() {f.src = "browsing_context_name-1.html"},
|
||||
function() {
|
||||
var navigated = true;
|
||||
navigated = true;
|
||||
assert_equals(f.contentWindow.name, "test", "Initial load");
|
||||
setTimeout(next, 0);
|
||||
},
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set location from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.contentWindow.location = "support/dummy.html"
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set src from a function called from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/set-parent-src.html"></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.contentWindow.go()
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,18 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set location from a function called from a parent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe src="support/location-set.html"></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
var url = fr.contentDocument.URL
|
||||
fr.contentWindow.go()
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, url)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Set the src attribute to about:blank and check referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe></iframe>
|
||||
<script>
|
||||
onload = function() {
|
||||
var fr = document.querySelector("iframe")
|
||||
fr.src = "about:blank"
|
||||
fr.onload = function() {
|
||||
assert_equals(fr.contentDocument.referrer, document.URL)
|
||||
done()
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<p>Hello.
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
function go() {
|
||||
location.href = "support/dummy.html"
|
||||
}
|
||||
</script>
|
||||
<p>Hello. Go.
|
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script>
|
||||
function go() {
|
||||
frameElement.src = "support/dummy.html"
|
||||
}
|
||||
</script>
|
||||
<p>Hello. Go.
|
|
@ -0,0 +1,11 @@
|
|||
var beforehref = location.href;
|
||||
|
||||
test(function () {
|
||||
history.pushState('','','/testing_ignore_me_404');
|
||||
assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404'));
|
||||
}, 'history.pushState URL resolving should be done relative to the document, not the script');
|
||||
|
||||
test(function () {
|
||||
history.replaceState('','','/testing_ignore_me_404_2');
|
||||
assert_equals(location.href,beforehref.replace(/^(\w*:\/\/[^\/]*\/)[\w\W]*$/,'$1testing_ignore_me_404_2'));
|
||||
}, 'history.replaceState URL resolving should be done relative to the document, not the script');
|
|
@ -11,13 +11,17 @@
|
|||
<body>
|
||||
<p>Access location object from different origins doesn't raise SECURITY_ERR exception</p>
|
||||
<div id=log></div>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script>
|
||||
var runTest = async_test("Accessing location object from different origins doesn't raise SECURITY_ERR exception").step_func_done(function() {
|
||||
var frame = document.getElementById('testframe');
|
||||
frame.setAttribute('onload', '');
|
||||
frame.contentWindow.location = 'http://{{domains[www1]}}:{{ports[http][0]}}/'
|
||||
frame.contentWindow.location = get_host_info().HTTP_REMOTE_ORIGIN + "/";
|
||||
});
|
||||
</script>
|
||||
<iframe id='testframe' src="http://{{domains[www]}}:{{ports[http][0]}}/" onload="runTest()">Test Frame</iframe>
|
||||
<iframe id='testframe' onload="runTest()">Test Frame</iframe>
|
||||
<script>
|
||||
document.getElementById('testframe').setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + '/');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<meta name="timeout" content="long">
|
||||
<title>Cross-origin behavior of Window and Location on new Window</title>
|
||||
<link rel="author" title="Bobby Holley (:bholley)" href="bobbyholley@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-window">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({explicit_done: true});
|
||||
|
||||
window.addEventListener('message', function onmessage(evt) {
|
||||
window.removeEventListener('message', onmessage);
|
||||
test(function() {
|
||||
var results = evt.data;
|
||||
assert_true(results.length > 0, 'Need results');
|
||||
results.forEach(function(r) { assert_true(r.pass, r.message); });
|
||||
}, "Cross-origin object identity preserved across document.domain");
|
||||
win.close();
|
||||
done();
|
||||
});
|
||||
var win = window.open('win-documentdomain.sub.html');
|
||||
</script>
|
|
@ -7,6 +7,7 @@
|
|||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#security-location">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<div id=log></div>
|
||||
<iframe id="B"></iframe>
|
||||
<iframe id="C"></iframe>
|
||||
|
@ -16,13 +17,14 @@
|
|||
* Setup boilerplate. This gives us a same-origin window "B" and a cross-origin
|
||||
* window "C".
|
||||
*/
|
||||
var host_info = get_host_info();
|
||||
|
||||
setup({explicit_done: true});
|
||||
path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
|
||||
var B = document.getElementById('B').contentWindow;
|
||||
var C = document.getElementById('C').contentWindow;
|
||||
B.frameElement.uriToLoad = path;
|
||||
C.frameElement.uriToLoad = '//{{domains[www1]}}:' + location.port + path;
|
||||
C.frameElement.uriToLoad = get_host_info().HTTP_REMOTE_ORIGIN + path;
|
||||
|
||||
function reloadSubframes(cb) {
|
||||
var iframes = document.getElementsByTagName('iframe');
|
||||
|
@ -51,7 +53,9 @@ function addTest(fun, desc) { testList.push([fun, desc]); }
|
|||
*/
|
||||
|
||||
addTest(function() {
|
||||
assert_equals(location.host, '{{domains[]}}:{{location[port]}}', 'Need to run the top-level test from {{domains[]}}:{{location[port]}}');
|
||||
// Note: we do not check location.host as its default port semantics are hard to reflect statically
|
||||
assert_equals(location.hostname, host_info.ORIGINAL_HOST, 'Need to run the top-level test from domain ' + host_info.ORIGINAL_HOST);
|
||||
assert_equals(location.port, host_info.HTTP_PORT, 'Need to run the top-level test from port ' + host_info.HTTP_PORT);
|
||||
assert_equals(B.parent, window, "window.parent works same-origin");
|
||||
assert_equals(C.parent, window, "window.parent works cross-origin");
|
||||
assert_equals(B.location.pathname, path, "location.href works same-origin");
|
||||
|
@ -189,6 +193,8 @@ addTest(function() {
|
|||
* [[Delete]]
|
||||
*/
|
||||
addTest(function() {
|
||||
assert_throws(null, function() { delete C[0]; }, "Can't delete cross-origin indexed property");
|
||||
assert_throws(null, function() { delete C[100]; }, "Can't delete cross-origin indexed property");
|
||||
assert_throws(null, function() { delete C.location; }, "Can't delete cross-origin property");
|
||||
assert_throws(null, function() { delete C.parent; }, "Can't delete cross-origin property");
|
||||
assert_throws(null, function() { delete C.length; }, "Can't delete cross-origin property");
|
||||
|
@ -306,20 +312,6 @@ addTest(function() {
|
|||
checkFunction(set_href_B, B.Function.prototype);
|
||||
}, "Same-origin observers get different accessors for cross-origin Location");
|
||||
|
||||
function doDocumentDomainTest(cb) {
|
||||
window.addEventListener('message', function onmessage(evt) {
|
||||
window.removeEventListener('message', onmessage);
|
||||
test(function() {
|
||||
var results = evt.data;
|
||||
assert_true(results.length > 0, 'Need results');
|
||||
results.forEach(function(r) { assert_true(r.pass, r.message); });
|
||||
}, "Cross-origin object identity preserved across document.domain");
|
||||
win.close();
|
||||
cb();
|
||||
});
|
||||
var win = window.open('win-documentdomain.sub.html');
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
@ -329,7 +321,7 @@ function runNextTest() {
|
|||
if (testList.length != 0)
|
||||
reloadSubframes(runNextTest);
|
||||
else
|
||||
doDocumentDomainTest(done); // Asynchronous.
|
||||
done();
|
||||
}
|
||||
reloadSubframes(runNextTest);
|
||||
|
|
@ -15,8 +15,12 @@
|
|||
windowReferences.push(parent[i]);
|
||||
locationReferences.push(parent[i].location);
|
||||
}
|
||||
document.domain = document.domain.substring(document.domain.indexOf('.') + 1);
|
||||
evt.source.postMessage('', '*');
|
||||
try {
|
||||
document.domain = document.domain.substring(document.domain.indexOf('.') + 1);
|
||||
evt.source.postMessage('PASS', '*');
|
||||
} catch (e) {
|
||||
evt.source.postMessage('FAIL: cannot trim off document.domain: ' + e, '*');
|
||||
}
|
||||
}
|
||||
|
||||
function checkWindowReferences() {
|
||||
|
|
|
@ -19,23 +19,30 @@
|
|||
if (++loadCount == 4)
|
||||
go();
|
||||
}
|
||||
Array.forEach(document.getElementsByTagName('iframe'), function(ifr) { ifr.onload = frameLoaded; });
|
||||
var iframes = document.getElementsByTagName('iframe');
|
||||
for (var i = 0; i < iframes.length; i++) {
|
||||
iframes[i].onload = frameLoaded;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var results = [];
|
||||
function assert(cond, msg) {
|
||||
results.push({pass: !!cond, message: msg});
|
||||
}
|
||||
|
||||
function go() {
|
||||
window.onmessage = function() {
|
||||
assert(B.checkWindowReferences(), "B's Window references are still self-consistent after document.domain");
|
||||
for (var i = 0; i < window.length; ++i) {
|
||||
assert(window[i] === B.windowReferences[i],
|
||||
"Window reference " + i + " consistent between globals after document.domain");
|
||||
assert(window[i].location === B.locationReferences[i],
|
||||
"Location reference " + i + " consistent between globals after document.domain");
|
||||
window.onmessage = function(evt) {
|
||||
try {
|
||||
assert(evt.data == "PASS", "frame.html processing should be PASS but got " + evt.data);
|
||||
assert(B.checkWindowReferences(), "B's Window references are still self-consistent after document.domain");
|
||||
for (var i = 0; i < window.length; ++i) {
|
||||
assert(window[i] === B.windowReferences[i],
|
||||
"Window reference " + i + " consistent between globals after document.domain");
|
||||
assert(window[i].location === B.locationReferences[i],
|
||||
"Location reference " + i + " consistent between globals after document.domain");
|
||||
}
|
||||
} catch(e) {
|
||||
assert(false, "Should not receive exception: " + e);
|
||||
}
|
||||
opener.postMessage(results, '*');
|
||||
};
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
<link rel="help" href="http://dev.w3.org/csswg/cssom-view/#extensions-to-the-window-interface" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe id="fr" src="http://{{domains[www1]}}:{{ports[http][0]}}/" onload="fr_load()" style="display:none"></iframe>
|
||||
<script>
|
||||
|
||||
var t = async_test("Window Security testing");
|
||||
|
||||
function fr_load() {
|
||||
|
@ -192,3 +191,13 @@ function fr_load() {
|
|||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
onload = function() {
|
||||
var frame = document.createElement('iframe');
|
||||
frame.id = "fr";
|
||||
frame.setAttribute("style", "display:none");
|
||||
frame.setAttribute('src', get_host_info().HTTP_REMOTE_ORIGIN + "/");
|
||||
frame.setAttribute("onload", "fr_load()");
|
||||
document.body.appendChild(frame);
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<link rel="author" title="Intel" href="http://www.intel.com/" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script>
|
||||
|
||||
var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
|
||||
|
@ -58,7 +59,7 @@ function on_load() {
|
|||
<script>
|
||||
|
||||
setup(function () {
|
||||
var src_base = "http://{{domains[www1]}}:{{ports[http][0]}}";
|
||||
var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
|
||||
src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
|
||||
document.getElementById("fr2").src = src_base + "test.html";
|
||||
document.getElementById("fr5").src = src_base + "testcase3.html";
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script>
|
||||
async_test(function (t) {
|
||||
var windowsToClose = [];
|
||||
|
@ -30,7 +31,7 @@
|
|||
|
||||
var a = document.body.appendChild(document.createElement('a'));
|
||||
a.target = "openee";
|
||||
a.href = "http://{{domains[www2]}}:{{location[port]}}/html/browsers/windows/support-nested-browsing-contexts.html";
|
||||
a.href = get_host_info().HTTP_REMOTE_ORIGIN + "/html/browsers/windows/support-nested-browsing-contexts.html";
|
||||
a.click();
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue