mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
This commit is contained in:
parent
35e95f55a1
commit
58e8ee674b
9438 changed files with 266112 additions and 106976 deletions
|
@ -1,52 +1,68 @@
|
|||
n<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test that <object> renders its own fallback.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
// The host exists but the resource is unavailable.
|
||||
const cross_origin_url_a = "http://{{hosts[alt][www]}}:{{ports[http][0]}}/foo.html";
|
||||
// The destination does not even exist and the navigation fails.
|
||||
const cross_origin_url_b = "http://{{hosts[alt][nonexistent]}}:{{ports[http][0]}}/foo.html";
|
||||
|
||||
// Returns a promise which is resolved when |callback| returns true. The |callback| is invoked at
|
||||
// every animation frame.
|
||||
function for_each_animation_frame(callback) {
|
||||
return new Promise((resolve) => {
|
||||
function on_raf() {
|
||||
if (!callback())
|
||||
resolve();
|
||||
window.requestAnimationFrame(on_raf);
|
||||
}
|
||||
window.requestAnimationFrame(on_raf);
|
||||
});
|
||||
}
|
||||
const URIS = [
|
||||
// The host exists but the resource is unavailable.
|
||||
"http://{{hosts[alt][www]}}:{{ports[http][0]}}/foo.html",
|
||||
// The destination does not even exist and the navigation fails.
|
||||
"http://{{hosts[alt][nonexistent]}}:{{ports[http][0]}}/foo.html",
|
||||
];
|
||||
|
||||
// Create an <object> with some fallback content.
|
||||
function create_object_with_fallback(url) {
|
||||
function create_object_with_fallback(url, t) {
|
||||
var object = document.createElement("object");
|
||||
var fallback = document.createElement("button");
|
||||
fallback.textContent = "FALLBACK CONTENT";
|
||||
object.appendChild(fallback);
|
||||
object.data = url;
|
||||
object.type = "text/html";
|
||||
let promise = new Promise(resolve => {
|
||||
object.addEventListener("load", t.unreached_func("Should never reach the load event"), {once: true});
|
||||
object.addEventListener("error", () => resolve(object), {once: true});
|
||||
});
|
||||
document.body.appendChild(object);
|
||||
return object;
|
||||
t.add_cleanup(() => object.remove());
|
||||
return promise;
|
||||
}
|
||||
|
||||
function area(el) {
|
||||
let bounds = el.getBoundingClientRect();
|
||||
return el.width * el.height;
|
||||
return bounds.width * bounds.height;
|
||||
}
|
||||
|
||||
promise_test(async() => {
|
||||
var object = create_object_with_fallback(cross_origin_url_a);
|
||||
await for_each_animation_frame(() => area(object.firstChild) > 0);
|
||||
object.parentElement.removeChild(object);
|
||||
object = create_object_with_fallback(cross_origin_url_b);
|
||||
await for_each_animation_frame(() => area(object.firstChild) > 0);
|
||||
object.parentElement.removeChild(object);
|
||||
}, "Verify fallback content for failed cross-origin navigations is shown correctly.");
|
||||
for (let uri of URIS) {
|
||||
promise_test(async(t) => {
|
||||
let object = await create_object_with_fallback(uri, t);
|
||||
|
||||
// XXX In Chrome this is needed, fallback doesn't seem to be ready after
|
||||
// the error event, which seems weird/odd.
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
|
||||
assert_true(area(object.firstChild) > 0, "Should be showing fallback");
|
||||
|
||||
// Per https://html.spec.whatwg.org/#the-object-element:
|
||||
//
|
||||
// The object element can represent an external resource, which,
|
||||
// depending on the type of the resource, will either be treated as
|
||||
// image, as a child browsing context, or as an external resource to
|
||||
// be processed by a plugin.
|
||||
//
|
||||
// [...]
|
||||
//
|
||||
// If the load failed (e.g. there was an HTTP 404 error, there was a
|
||||
// DNS error), fire an event named error at the element, then jump to
|
||||
// the step below labeled fallback.
|
||||
//
|
||||
// (And that happens before "Determine the resource type" which is what
|
||||
// sets the nested browsing context).
|
||||
//
|
||||
// So the expected window.length is 0.
|
||||
assert_equals(window.length, 0);
|
||||
}, `Verify fallback content for failed cross-origin navigations is shown correctly: ${uri}`);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html style="display:none">
|
||||
<meta charset=utf-8>
|
||||
<title>Test that an object in a display:none subtree does not block the load event</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
async_test(t => {
|
||||
window.onload = t.step_func_done();
|
||||
document.documentElement.offsetTop;
|
||||
}, "Load event triggered on window");
|
||||
</script>
|
||||
<object data="data:text/html,"></object>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<title>HTML Test: object - crash removing a param after changing its style</title>
|
||||
<link rel="help" href="https://crbug.com/1195633">
|
||||
<object type="text/html">
|
||||
<param id="param"></param>
|
||||
</object>
|
||||
<script>
|
||||
getComputedStyle(param).color;
|
||||
param.style.color = "red";
|
||||
param.remove();
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue