mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision e3cf1284464a4a3e46fd15e4138f8e32c6cecdd8
This commit is contained in:
parent
b20333a324
commit
c5c325d8bb
57 changed files with 1422 additions and 493 deletions
|
@ -0,0 +1,23 @@
|
|||
const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
|
||||
|
||||
test(() => {
|
||||
for(const prop of barProps) {
|
||||
assert_true(window[prop].visible);
|
||||
}
|
||||
}, "All bars visible");
|
||||
|
||||
["noopener", "noreferrer"].forEach(openerStyle => {
|
||||
async_test(t => {
|
||||
const channelName = "5454" + openerStyle + "34324";
|
||||
const channel = new BroadcastChannel(channelName);
|
||||
window.open("support/BarProp-target.html?" + channelName, "", openerStyle);
|
||||
channel.onmessage = t.step_func_done(e => {
|
||||
// Send message first so if asserts throw the popup is still closed
|
||||
channel.postMessage(null);
|
||||
|
||||
for(const prop of barProps) {
|
||||
assert_true(e.data[prop]);
|
||||
}
|
||||
});
|
||||
}, `window.open() with ${openerStyle} should have all bars visible`);
|
||||
});
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
const barProps = ["locationbar", "menubar", "personalbar", "scrollbars", "statusbar", "toolbar"];
|
||||
const barPropsObj = {};
|
||||
const channelName = location.search.substr(1);
|
||||
const channel = new BroadcastChannel(channelName);
|
||||
for (const prop of barProps) {
|
||||
barPropsObj[prop] = window[prop].visible;
|
||||
}
|
||||
channel.postMessage(barPropsObj);
|
||||
|
||||
// Because messages are not delivered synchronously and because closing a
|
||||
// browsing context prompts the eventual clearing of all task sources, this
|
||||
// document should not be closed until the opener document has confirmed
|
||||
// receipt.
|
||||
channel.onmessage = () => { window.close() };
|
||||
</script>
|
|
@ -21,16 +21,27 @@
|
|||
|
||||
<img src="/images/green-2x2.png" data-desc="src set to same value">
|
||||
|
||||
<img data-desc="crossorigin absent to empty">
|
||||
<img data-desc="crossorigin absent to anonymous">
|
||||
<img data-desc="crossorigin absent to use-credentials">
|
||||
<img crossorigin data-desc="crossorigin empty to absent">
|
||||
<img crossorigin data-desc="crossorigin empty to use-credentials">
|
||||
<img crossorigin=anonymous data-desc="crossorigin anonymous to absent">
|
||||
<img crossorigin=anonymous data-desc="crossorigin anonymous to use-credentials">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to absent">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to empty">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to anonymous">
|
||||
<img data-desc="crossorigin absent to empty, src absent">
|
||||
<img data-desc="crossorigin absent to anonymous, src absent">
|
||||
<img data-desc="crossorigin absent to use-credentials, src absent">
|
||||
<img crossorigin data-desc="crossorigin empty to absent, src absent">
|
||||
<img crossorigin data-desc="crossorigin empty to use-credentials, src absent">
|
||||
<img crossorigin=anonymous data-desc="crossorigin anonymous to absent, src absent">
|
||||
<img crossorigin=anonymous data-desc="crossorigin anonymous to use-credentials, src absent">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to absent, src absent">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to empty, src absent">
|
||||
<img crossorigin=use-credentials data-desc="crossorigin use-credentials to anonymous, src absent">
|
||||
|
||||
<img src="/images/green-2x2.png" data-desc="crossorigin absent to empty, src already set">
|
||||
<img src="/images/green-2x2.png" data-desc="crossorigin absent to anonymous, src already set">
|
||||
<img src="/images/green-2x2.png" data-desc="crossorigin absent to use-credentials, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin data-desc="crossorigin empty to absent, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin data-desc="crossorigin empty to use-credentials, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin=anonymous data-desc="crossorigin anonymous to absent, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin=anonymous data-desc="crossorigin anonymous to use-credentials, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin=use-credentials data-desc="crossorigin use-credentials to absent, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin=use-credentials data-desc="crossorigin use-credentials to empty, src already set">
|
||||
<img src="/images/green-2x2.png" crossorigin=use-credentials data-desc="crossorigin use-credentials to anonymous, src already set">
|
||||
|
||||
<img src="/images/green-2x2.png" data-desc="inserted into picture"><picture></picture>
|
||||
|
||||
|
@ -165,46 +176,92 @@ onload = function() {
|
|||
img.src = '/images/green-2x2.png';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin absent to empty', function(img) {
|
||||
// When src is absent, changing the crossorigin attribute state MUST NOT
|
||||
// generate events.
|
||||
|
||||
t('crossorigin absent to empty, src absent', function(img) {
|
||||
img.crossOrigin = '';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin absent to anonymous', function(img) {
|
||||
t('crossorigin absent to anonymous, src absent', function(img) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin absent to use-credentials', function(img) {
|
||||
t('crossorigin absent to use-credentials, src absent', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin empty to absent', function(img) {
|
||||
t('crossorigin empty to absent, src absent', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin empty to use-credentials', function(img) {
|
||||
t('crossorigin empty to use-credentials, src absent', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin anonymous to absent', function(img) {
|
||||
t('crossorigin anonymous to absent, src absent', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin anonymous to use-credentials', function(img) {
|
||||
t('crossorigin anonymous to use-credentials, src absent', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin use-credentials to absent', function(img) {
|
||||
t('crossorigin use-credentials to absent, src absent', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin use-credentials to empty', function(img) {
|
||||
t('crossorigin use-credentials to empty, src absent', function(img) {
|
||||
img.crossOrigin = '';
|
||||
}, 'timeout');
|
||||
|
||||
t('crossorigin use-credentials to anonymous', function(img) {
|
||||
t('crossorigin use-credentials to anonymous, src absent', function(img) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}, 'timeout');
|
||||
|
||||
// When src is set, changing the crossorigin attribute state MUST generate
|
||||
// events.
|
||||
|
||||
t('crossorigin absent to empty, src already set', function(img) {
|
||||
img.crossOrigin = '';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin absent to anonymous, src already set', function(img) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin absent to use-credentials, src already set', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin empty to absent, src already set', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin empty to use-credentials, src already set', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin anonymous to absent, src already set', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin anonymous to use-credentials, src already set', function(img) {
|
||||
img.crossOrigin = 'use-credentials';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin use-credentials to absent, src already set', function(img) {
|
||||
img.removeAttribute('crossorigin');
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin use-credentials to empty, src already set', function(img) {
|
||||
img.crossOrigin = '';
|
||||
}, 'load');
|
||||
|
||||
t('crossorigin use-credentials to anonymous, src already set', function(img) {
|
||||
img.crossOrigin = 'anonymous';
|
||||
}, 'load');
|
||||
|
||||
t('inserted into picture', function(img) {
|
||||
img.nextSibling.appendChild(img);
|
||||
}, 'load');
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
Tentative due to:
|
||||
https://github.com/whatwg/html/issues/4364
|
||||
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/testdriver.js"></script>
|
||||
<script src="/resources/testdriver-vendor.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>User activation can be transferred to a cross-origin child frame
|
||||
via a postMessage option.</h1>
|
||||
<ol id="instructions">
|
||||
<li>Click this instruction text.
|
||||
</ol>
|
||||
<iframe id="child1" width="200" height="200"></iframe>
|
||||
<iframe id="child2" width="200" height="200"></iframe>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var child1 = document.getElementById("child1");
|
||||
var child2 = document.getElementById("child2");
|
||||
var is_child_four_loaded = false;
|
||||
var is_child_five_loaded = false;
|
||||
assert_false(navigator.userActivation.isActive);
|
||||
assert_false(navigator.userActivation.hasBeenActive);
|
||||
|
||||
function tryClickInstructions() {
|
||||
if (is_child_four_loaded && is_child_five_loaded)
|
||||
test_driver.click(document.getElementById('instructions'));
|
||||
}
|
||||
|
||||
window.addEventListener("message", t.step_func(event => {
|
||||
var msg = JSON.parse(event.data);
|
||||
if (msg.type == 'child-four-loaded') {
|
||||
// state should be false after load
|
||||
assert_false(msg.isActive);
|
||||
assert_false(msg.hasBeenActive);
|
||||
|
||||
// click in parent document after both child frames load
|
||||
is_child_four_loaded = true;
|
||||
tryClickInstructions();
|
||||
} else if (msg.type == 'child-four-report') {
|
||||
assert_true(msg.isActive);
|
||||
assert_true(msg.hasBeenActive);
|
||||
|
||||
// check sender's activation state again
|
||||
assert_false(navigator.userActivation.isActive);
|
||||
assert_false(navigator.userActivation.hasBeenActive);
|
||||
|
||||
child2.contentWindow.postMessage('report', '*');
|
||||
} else if (msg.type == 'child-five-loaded') {
|
||||
// state should be false after load
|
||||
assert_false(msg.isActive);
|
||||
assert_false(msg.hasBeenActive);
|
||||
|
||||
// click in parent document after both child frames load
|
||||
is_child_five_loaded = true;
|
||||
tryClickInstructions();
|
||||
} else if (msg.type == 'child-five-report') {
|
||||
assert_false(msg.isActive);
|
||||
assert_false(msg.hasBeenActive);
|
||||
|
||||
// check sender's activation state again
|
||||
assert_false(navigator.userActivation.isActive);
|
||||
assert_false(navigator.userActivation.hasBeenActive);
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
window.addEventListener("click", t.step_func(event => {
|
||||
assert_true(navigator.userActivation.isActive);
|
||||
assert_true(navigator.userActivation.hasBeenActive);
|
||||
|
||||
// transfer user activation to the child frame
|
||||
child1.contentWindow.postMessage("transfer_user_activation",
|
||||
{targetOrigin: "*", transferUserActivation: true});
|
||||
|
||||
// sender's activation state is updated synchronously
|
||||
assert_false(navigator.userActivation.isActive);
|
||||
assert_false(navigator.userActivation.hasBeenActive);
|
||||
}));
|
||||
child1.src = "http://{{domains[www]}}:{{ports[http][0]}}/html/user-activation/resources/child-four.html";
|
||||
child2.src = "http://{{domains[www1]}}:{{ports[http][0]}}/html/user-activation/resources/child-five.html";
|
||||
}, "Cross-origin user activation transfer through postMessages");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<body style="background: red;">
|
||||
<script>
|
||||
window.parent.postMessage(JSON.stringify({"type": "child-five-loaded", "isActive": navigator.userActivation.isActive,
|
||||
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
if (event.source === window.parent && event.data == "report") {
|
||||
window.parent.postMessage(JSON.stringify({"type": "child-five-report", "isActive": navigator.userActivation.isActive,
|
||||
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -1,6 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<body style="background: lightgrey;">
|
||||
<script>
|
||||
<script>
|
||||
window.parent.postMessage(JSON.stringify({"type": "child-four-loaded", "isActive": navigator.userActivation.isActive,
|
||||
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue