mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180. - Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
parent
fb4f421c8b
commit
296fa2512b
21852 changed files with 2080936 additions and 892894 deletions
|
@ -0,0 +1,35 @@
|
|||
<iframe id="test"></iframe>
|
||||
<script>
|
||||
var opener = window.opener;
|
||||
var t = opener.t;
|
||||
var f = document.getElementById("test");
|
||||
var l = opener.document.getElementById("step_log");
|
||||
|
||||
log = function(t) {l.textContent += ("\n" + t)}
|
||||
var navigated = false;
|
||||
var steps = [
|
||||
() => f.src = "browsing_context_name-1.html",
|
||||
() => {
|
||||
navigated = true;
|
||||
opener.assert_equals(f.contentWindow.name, "test", "Initial load");
|
||||
f.src = "browsing_context_name-2.html"
|
||||
},
|
||||
() => {
|
||||
opener.assert_equals(f.contentWindow.name, "test1");
|
||||
opener.assert_equals(history.length, 2);
|
||||
history.back()
|
||||
},
|
||||
() => {
|
||||
opener.assert_equals(f.contentWindow.name, "test1", "After navigation");
|
||||
t.done();
|
||||
}
|
||||
].map((x, i) => t.step_func(() => {log("Step " + (i+1)); x()}));
|
||||
|
||||
next = () => steps.shift()();
|
||||
|
||||
onload = () => {
|
||||
log("page load");
|
||||
f.onload = () => {log("iframe onload"); next()};
|
||||
setTimeout(next, 0);
|
||||
};
|
||||
</script>
|
|
@ -2,41 +2,12 @@
|
|||
<title>Retaining window.name on history traversal</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<pre id="step_log"></pre>
|
||||
<iframe id="test"></iframe>
|
||||
|
||||
<script>
|
||||
|
||||
var t = async_test(undefined, {timeout:10000});
|
||||
var f = document.getElementById("test");
|
||||
var l = document.getElementById("step_log");
|
||||
var navigated = false;
|
||||
|
||||
log = function(t) {l.textContent += ("\n" + t)}
|
||||
|
||||
var steps = [
|
||||
function() {f.src = "browsing_context_name-1.html"},
|
||||
function() {
|
||||
navigated = true;
|
||||
assert_equals(f.contentWindow.name, "test", "Initial load");
|
||||
setTimeout(next, 0);
|
||||
},
|
||||
function() {f.src = "browsing_context_name-2.html"; setTimeout(next, 500)},
|
||||
function() {
|
||||
assert_equals(f.contentWindow.name, "test1");
|
||||
setTimeout(next, 0);
|
||||
},
|
||||
function() {history.back(); setTimeout(next, 500)},
|
||||
function() {
|
||||
assert_equals(f.contentWindow.name, "test1", "After navigation");
|
||||
t.done();
|
||||
}
|
||||
].map(function(x) {return t.step_func(function() {log("Step " + step); x()})});
|
||||
|
||||
var step = 0;
|
||||
next = t.step_func(function() {steps[step++]()});
|
||||
|
||||
f.onload=next;
|
||||
|
||||
onload = setTimeout(next, 0);
|
||||
var t = async_test();
|
||||
t.step(() => {
|
||||
win = window.open("browsing_context_name-0.html");
|
||||
t.add_cleanup(() => win.close());
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
@ -37,5 +37,5 @@ next = t.step_func(function() {steps[step++]()});
|
|||
|
||||
f.onload=next;
|
||||
|
||||
onload = setTimeout(next, 0);
|
||||
onload = function() { setTimeout(next, 0); };
|
||||
</script>
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
@ -43,5 +43,5 @@ next = t.step_func(function() {steps[step++]()});
|
|||
|
||||
f.onload=next;
|
||||
|
||||
onload = setTimeout(next, 0);
|
||||
onload = function() { setTimeout(next, 0); };
|
||||
</script>
|
||||
|
|
|
@ -16,7 +16,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);
|
||||
},
|
||||
|
@ -43,5 +43,5 @@ next = t.step_func(function() {steps[step++]()});
|
|||
|
||||
f.onload=next;
|
||||
|
||||
onload = setTimeout(next, 0);
|
||||
onload = function() { setTimeout(next, 0); };
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<!doctype html>
|
||||
<script>
|
||||
addEventListener('load', _ => {
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
window.opener.postMessage(params.get('name'), '*');
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,145 @@
|
|||
<!doctype html>
|
||||
<title>Verify history.back() on a persisted page resumes timers</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
function make_post_back_url(name) {
|
||||
return new URL('resources/post_name_on_load.html?name=' + name,
|
||||
window.location).href;
|
||||
}
|
||||
|
||||
function wait_for_message(name) {
|
||||
return new Promise(resolve => {
|
||||
addEventListener('message', function onMsg(evt) {
|
||||
if (evt.data !== name) {
|
||||
return;
|
||||
}
|
||||
removeEventListener('message', onMsg);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function with_window_by_name(name) {
|
||||
let win = window.open(make_post_back_url(name));
|
||||
return wait_for_message(name).then(_ => {
|
||||
return win;
|
||||
});
|
||||
}
|
||||
|
||||
function with_nested_frame(win, url) {
|
||||
return new Promise(resolve => {
|
||||
let frame = win.document.createElement('iframe');
|
||||
frame.addEventListener('load', function onLoad(evt) {
|
||||
removeEventListener('load', onLoad);
|
||||
resolve(frame);
|
||||
});
|
||||
frame.src = url;
|
||||
win.document.body.appendChild(frame);
|
||||
});
|
||||
}
|
||||
|
||||
function delay(win, delay) {
|
||||
return new Promise(resolve => {
|
||||
win.setTimeout(_ => {
|
||||
resolve(win);
|
||||
}, delay);
|
||||
});
|
||||
}
|
||||
|
||||
function navigate_by_name(win, name) {
|
||||
win.location = make_post_back_url(name);
|
||||
return wait_for_message(name).then(_ => {
|
||||
return win;
|
||||
});
|
||||
}
|
||||
|
||||
function go_back(win) {
|
||||
return new Promise(resolve => {
|
||||
win.onpagehide = e => resolve(win);
|
||||
win.history.back();
|
||||
});
|
||||
}
|
||||
|
||||
let DELAY = 500;
|
||||
|
||||
promise_test(t => {
|
||||
// Create a new window so we can navigate it later.
|
||||
return with_window_by_name('foo').then(win => {
|
||||
// Schedule a timer within the new window. Our intent is
|
||||
// to navigate the window before the timer fires.
|
||||
let delayFired = false;
|
||||
let innerDelay = delay(win, DELAY);
|
||||
innerDelay.then(_ => {
|
||||
delayFired = true;
|
||||
});
|
||||
|
||||
return navigate_by_name(win, 'bar').then(_ => {
|
||||
// Since the window has navigated the timer should not
|
||||
// fire. We set a timer on our current test window
|
||||
// to verify the other timer is not received.
|
||||
assert_false(delayFired);
|
||||
return delay(window, DELAY * 2);
|
||||
}).then(_ => {
|
||||
// The navigated window's timer should not have fired.
|
||||
assert_false(delayFired);
|
||||
// Now go back to the document that set the timer.
|
||||
return go_back(win);
|
||||
}).then(_ => {
|
||||
// We wait for one of two conditions here. For browsers
|
||||
// with a bfcache the original suspended timer will fire.
|
||||
// Alternatively, if the browser reloads the page the original
|
||||
// message will be sent again. Wait for either of these
|
||||
// two events.
|
||||
return Promise.race([wait_for_message('foo'), innerDelay]);
|
||||
}).then(_ => {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
}, 'history.back() handles top level page timer correctly');
|
||||
|
||||
promise_test(t => {
|
||||
let win;
|
||||
// Create a new window so we can navigate it later.
|
||||
return with_window_by_name('foo').then(w => {
|
||||
win = w;
|
||||
|
||||
// Create a nested frame so we check if navigation and history.back()
|
||||
// properly handle child window state.
|
||||
return with_nested_frame(win, 'about:blank');
|
||||
|
||||
}).then(frame => {
|
||||
// Schedule a timer within the nested frame contained by the new window.
|
||||
// Our intent is to navigate the window before the timer fires.
|
||||
let delayFired = false;
|
||||
let innerDelay = delay(frame.contentWindow, DELAY);
|
||||
innerDelay.then(_ => {
|
||||
delayFired = true;
|
||||
});
|
||||
|
||||
return navigate_by_name(win, 'bar').then(_ => {
|
||||
// Since the window has navigated the timer should not
|
||||
// fire. We set a timer on our current test window
|
||||
// to verify the other timer is not received.
|
||||
assert_false(delayFired);
|
||||
return delay(window, DELAY * 2);
|
||||
}).then(_ => {
|
||||
// The navigated window's timer should not have fired.
|
||||
assert_false(delayFired);
|
||||
// Now go back to the document containing the frame that set the timer.
|
||||
return go_back(win);
|
||||
}).then(_ => {
|
||||
// We wait for one of two conditions here. For browsers
|
||||
// with a bfcache the original suspended timer will fire.
|
||||
// Alternatively, if the browser reloads the page the original
|
||||
// message will be sent again. Wait for either of these
|
||||
// two events.
|
||||
return Promise.race([wait_for_message('foo'), innerDelay]);
|
||||
}).then(_ => {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
}, 'history.back() handles nested iframe timer correctly');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue