diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/embedded-content/the-object-element')
18 files changed, 615 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/block-object-with-ruby-crash.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/block-object-with-ruby-crash.html new file mode 100644 index 0000000000..481a7408e4 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/block-object-with-ruby-crash.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=966363"> +<object style="display:block;"> + <ruby></ruby> +</object> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + test(()=> {}, "no crash"); +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html new file mode 100644 index 0000000000..3d1077538e --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/document-getters-return-null-for-cross-origin.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Test that contentDocument/getSVGDocument() return null for a cross-origin document.</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<object data='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="100" width="100"/></svg>'></object> +<script> +const object = document.querySelector('object'); +var t1 = async_test('HTMLObjectElement.contentDocument for cross-origin document'); +window.addEventListener( + 'load', t1.step_func_done(() => { assert_equals(object.contentDocument, null); })); +var t2 = async_test('HTMLObjectElement.getSVGDocument() for cross-origin document'); +window.addEventListener( + 'load', t2.step_func_done(() => { assert_equals(object.getSVGDocument(), null); })); +</script> +</body> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html new file mode 100644 index 0000000000..c7a577a9d4 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/historical.html @@ -0,0 +1,33 @@ +<!doctype html> +<title>Historical object element features should not be supported</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<object id=object></object> +<script> +test(function() { + var elm = document.getElementById('object'); + assert_equals(typeof elm, 'object', 'typeof'); + assert_throws_js(TypeError, function() { + elm(); + }); +}, 'object legacycaller should not be supported'); + +test(() => { + const obj = document.createElement("object"); + assert_false("typeMustMatch" in obj); +}, "object's typeMustMatch IDL attribute should not be supported"); + +async_test(t => { + const obj = document.createElement("object"); + t.add_cleanup(() => obj.remove()); + obj.setAttribute("data", "/common/blank.html"); + obj.setAttribute("type", "text/plain"); + obj.setAttribute("typemustmatch", ""); + obj.onload = t.step_func_done(() => { + assert_not_equals(obj.contentDocument, null, "/common/blank.html should be loaded"); + }); + obj.onerror = t.unreached_func(); + document.body.appendChild(obj); +}, "object's typemustmatch content attribute should not be supported"); +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-attributes.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-attributes.html new file mode 100644 index 0000000000..c630d8055c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-attributes.html @@ -0,0 +1,60 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: object - attributes</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body onload="on_load()"> +<div id="log"></div> +<form> + <object id="obj1" data="/common/blank.html" name="o" height="50" width="100"></object> + <object id="obj2" name="p" type="image/png"></object> + <object id="obj3" data="missing.html" name="o3" height="50" width="100"></object> +</form> +<script> + var obj1; + var obj2; + var obj3; + var t1 = async_test("object.contentWindow"); + var t2 = async_test("object.contentWindow.name"); + var t3 = async_test("object.width"); + var t4 = async_test("object.height"); + + setup(function() { + obj1 = document.getElementById("obj1"); + obj2 = document.getElementById("obj2"); + obj3 = document.getElementById("obj3"); + }); + + function on_load () { + t1.step(function() { + assert_not_equals(obj1.contentWindow, null, "The contentWindow of the object element should not be null."); + assert_equals(obj2.contentWindow, null, "The contentWindow of the object element should be null when it type attribute starts with 'image/'."); + assert_equals(obj3.contentWindow, null, "The contentWindow of the object element should be null as it is showing fallback content."); + }); + t1.done() + + t2.step(function() { + assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should be 'o'."); + obj1.setAttribute("name", "o1"); + assert_equals(obj1.name, "o1", "The name of the object element should be 'o1'."); + assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should still be 'o'."); + obj1.removeAttribute("name"); + assert_equals(obj1.name, "", "The name of the object element should be empty string."); + assert_equals(obj1.contentWindow.name, "o", "The contentWindow's name of the object element should still be 'o'."); + }); + t2.done() + + t3.step(function() { + assert_equals(getComputedStyle(obj1, null)["width"], "100px", "The width should be 100px."); + }); + t3.done(); + + t4.step(function() { + assert_equals(getComputedStyle(obj1, null)["height"], "50px", "The height should be 50px."); + }); + t4.done(); + } +</script> + +</body> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-construct-in-document-with-null-browsing-context-crash.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-construct-in-document-with-null-browsing-context-crash.html new file mode 100644 index 0000000000..7248368656 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-construct-in-document-with-null-browsing-context-crash.html @@ -0,0 +1,11 @@ +<title>HTMLObjectElement: construct in a document with a null browsing context</title> +<link rel="author" title="Nate Chapin" href="mailto:japhet@chromium.org"> +<link rel="help" href="https://html.spec.whatwg.org/C/#the-object-element"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1083437"> +<meta name="assert" content="Constructing an HTMLObjectElement in a document with a null browsing context should not crash"/> +<iframe id="i"></iframe> +<script> +var doc = i.contentDocument; +i.remove(); +doc.createElement('object'); +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-events.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-events.html new file mode 100644 index 0000000000..38f92c3d35 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-events.html @@ -0,0 +1,81 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: object-events</title> +<meta name="timeout" content="long"> +<link rel="author" title="Intel" href="http://www.intel.com"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> + +async_test(function(t) { + var obj = document.createElement("object"); + obj.onerror = t.step_func_done(function(e){ + assert_equals(Object.getPrototypeOf(e).constructor, Event, "The error event should use the Event interface."); + assert_true(e.isTrusted, "The error event should be a trusted event."); + assert_false(e.cancelable, "The error event should not be a cancelable event."); + assert_false(e.bubbles, "The error event should not be a bubble event."); + assert_equals(e.target, obj, "The error event target should be the corresponding object element."); + }); + + obj.onload = t.step_func_done(function(e){ + assert_unreached("The load event should not be fired."); + }); + + obj.data = "file:\\http://nonexistent.html"; + document.body.appendChild(obj); +}, "error event (using 'file:' protocol)"); + +async_test(function(t) { + var obj = document.createElement("object"); + obj.onerror = t.step_func_done(function(e){ + assert_equals(e.target, obj, + "The error event should be fired on our element"); + }); + obj.onload = t.step_func_done(function(e){ + assert_unreached("The load event should not be fired."); + }); + + obj.data = "http://test:test"; + document.body.appendChild(obj); +}, "error event (using 'http:' protocol)"); + + +async_test(function(t) { + var obj = document.createElement("object"); + obj.onload = t.step_func_done(function(e){ + assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface."); + assert_true(e.isTrusted, "The load event should be a trusted event."); + assert_false(e.cancelable, "The load event should not be a cancelable event."); + assert_false(e.bubbles, "The load event should not be a bubble event."); + assert_equals(e.target, obj, "The load event target should be the corresponding object element."); + }); + + obj.onerror = t.step_func_done(function(e){ + assert_unreached("The error event should not be fired."); + }); + + obj.data = "/images/blue.png"; + document.body.appendChild(obj); +}, "load event"); + +async_test(function(t) { + var obj = document.createElement("object"); + obj.onload = t.step_func_done(function(e){ + assert_true(obj.contentWindow instanceof obj.contentWindow.Window, "The object element should represent a nested browsing context.") + assert_equals(Object.getPrototypeOf(e).constructor, Event, "The load event should use the Event interface."); + assert_true(e.isTrusted, "The load event should be a trusted event."); + assert_false(e.cancelable, "The load event should not be a cancelable event."); + assert_false(e.bubbles, "The load event should not be a bubble event."); + assert_equals(e.target, obj, "The load event target should be the corresponding object element."); + }); + + obj.onerror = t.step_func_done(function(e){ + assert_unreached("The error event should not be fired."); + }); + + obj.data = "about:blank"; + document.body.appendChild(obj); +}, "load event of about:blank"); + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-fallback-failed-cross-origin-navigation.sub.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-fallback-failed-cross-origin-navigation.sub.html new file mode 100644 index 0000000000..09061e0349 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-fallback-failed-cross-origin-navigation.sub.html @@ -0,0 +1,68 @@ +<!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> + 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, 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); + t.add_cleanup(() => object.remove()); + return promise; + } + + function area(el) { + let bounds = el.getBoundingClientRect(); + return bounds.width * bounds.height; + } + + 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> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-handler.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-handler.html new file mode 100644 index 0000000000..a24554e0cc --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-handler.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: object - handler</title> +<link rel="author" title="Intel" href="http://www.intel.com" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<object id="test" name="obj" data="test0.html" type="text/html"></object> +<script> + +var t1 = async_test("The nested browsing context must be navigated to the resource specified by the data attribute."); +var t2 = async_test("The object.data must not be updated if the browsing context gets further navigated."); + +function callback(data) { + if (data == "test0") { + t1.step(function() { + var testEle = document.getElementById("test"); + assert_true(testEle.contentDocument.location.href.indexOf("test0.html") != -1, "The nested browsing context should be navigated to test0.html."); + window["obj"].history.replaceState({state:"ok"}, "mytitle ", "object-fallback.html"); + assert_not_equals(testEle.contentDocument.location.href.indexOf("object-fallback.html"), -1, "The nested browsing context should be replacement enabled."); + }); + t1.done(); + } else if (data == "test1") { + t2.step(function() { + var testEle = document.getElementById("test"); + assert_true(testEle.contentDocument.location.href.indexOf("test1.html") != -1, "The browsing context should be navigated to test1.html."); + assert_true(testEle.data.indexOf("test0.html") != -1, "The value of attribute data should not be updated."); + }); + t2.done(); + } +} + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-ignored-in-media-element.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-ignored-in-media-element.html new file mode 100644 index 0000000000..2bf84c2946 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-ignored-in-media-element.html @@ -0,0 +1,22 @@ +<!doctype html> +<meta charset="utf-8"> +<title>HTML Test: The embed element represents a document</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<meta name="assert" content="Check if the object element is ignored when used inside a media element"> +<script type="application/javascript"> + var nestingTest = async_test("Test <object> being ignored inside media element"); + onload = nestingTest.step_func_done(function() { + assert_true(true, "We got to a load event without loading things we should not load"); + }); +</script> +<body> + <video> + <object type="text/html" data="../resources/should-not-load.html" + test-description="<object> in <video>"></object> + </video> + <audio> + <object type="text/html" data="../resources/should-not-load.html" + test-description="<object> in <audio>"></object> + </audio> +</body> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-display-none-load-event.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-display-none-load-event.html new file mode 100644 index 0000000000..c8369365af --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-display-none-load-event.html @@ -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> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-object-fallback-2.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-object-fallback-2.html new file mode 100644 index 0000000000..47cf801693 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-in-object-fallback-2.html @@ -0,0 +1,56 @@ +<!doctype html> +<html> + <head> + <meta charset=utf-8> + <title></title> + <script src=/resources/testharness.js></script> + <script src=/resources/testharnessreport.js></script> + <script> + var loadedCount = 0; + var nestingTest = async_test("Test <object> nesting inside <object>"); + onload = nestingTest.step_func_done(function() { + assert_equals(loadedCount, 12, "Should have loaded all should-load elements"); + }); + </script> + <style> + object { display: none } + </style> + </head> + <body> + <object data="../resources/should-load.html" style="width: 100px; height: 100px"> + <object type="text/html" data="../resources/should-not-load.html" + test-description="<object> inside <object>"></object> + </object> + <object style="width: 100px; height: 100px" data="data:application/x-does-not-exist,test"> + <object type="text/html" data="../resources/should-load.html"></object> + </object> + <object style="width: 100px; height: 100px" data="data:application/x-does-not-exist,test"> + <div></div> + <object type="text/html" data="../resources/should-load.html"></object> + </object> + <object style="width: 100px; height: 100px" data="data:application/x-does-not-exist,test"> + <div> + <object type="text/html" data="../resources/should-load.html"></object> + </div> + </object> + <object style="width: 100px; height: 100px" data="data:application/x-does-not-exist,test"> + <object type="text/html" data="../resources/should-load.html"></object> + <object type="text/html" data="../resources/should-load.html"></object> + <object data="../resources/should-load.html"> + <object type="text/html" data="../resources/should-not-load.html" + test-description="<object> inside loaded <object> inside non-loaded <object>"></object> + </object> + <object data="data:application/x-does-not-exist,test"> + <object type="text/html" data="../resources/should-load.html"></object> + </object> + </object> + <div> + <object data="../resources/should-load.html" style="width: 100px; height: 100px"></object> + <object type="text/html" data="../resources/should-load.html"></object> + </div> + <div> + <object type="text/html" data="../resources/should-load.html"></object> + <object data="../resources/should-load.html" style="width: 100px; height: 100px"></object> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url-ref.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url-ref.html new file mode 100644 index 0000000000..7eb9256b0f --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url-ref.html @@ -0,0 +1,39 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<meta charset="utf-8"> +<title>object element containing param element specifying a URL</title> +<link rel="author" href="mailto:masonf@chromium.org"> + +<style> + div { + width:300px; + height:80px; + border:1px solid black; + margin: 5px; + overflow: hidden; + } +</style> +<body> +<script> +const smallPdf = 'JVBERi0xLjIgCjkgMCBvYmoKPDwKPj4Kc3RyZWFtCkJULyA5IFRmKFRlc3QpJyBFVAplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCA1IDAgUgovQ29udGVudHMgOSAwIFIKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL0tpZHMgWzQgMCBSIF0KL0NvdW50IDEKL1R5cGUgL1BhZ2VzCi9NZWRpYUJveCBbIDAgMCA5OSA5IF0KPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1BhZ2VzIDUgMCBSCi9UeXBlIC9DYXRhbG9nCj4+CmVuZG9iagp0cmFpbGVyCjw8Ci9Sb290IDMgMCBSCj4+CiUlRU9G'; +const dataUrl = `data:application/pdf;base64,${smallPdf}`; + +function addOne(html) { + const wrapper = document.createElement('div'); + wrapper.innerHTML = html; + const objectElement = wrapper.querySelector('object'); + document.body.appendChild(wrapper); +} + +// This should be one <object> that loads a PDF, and the rest that don't. +addOne(`<object data=${dataUrl}></object>`); +addOne(`<object></object>`); +addOne(`<object></object>`); +addOne(`<object></object>`); +addOne(`<object></object>`); +addOne(`<object></object>`); + +// Not a great way to tell when any <object> that might load has loaded. +setTimeout(() => document.documentElement.classList.remove("reftest-wait"),2000); + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url.html new file mode 100644 index 0000000000..5f1e54c4d9 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-param-url.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html class="reftest-wait"> +<meta charset="utf-8"> +<title>object element containing param element specifying a URL</title> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel="help" href="https://github.com/whatwg/html/pull/7816"> +<link rel=match href="object-param-url-ref.html"> + +<style> + div { + width:300px; + height:80px; + border:1px solid black; + margin: 5px; + overflow: hidden; + } +</style> +<body> +<script> +const smallPdf = 'JVBERi0xLjIgCjkgMCBvYmoKPDwKPj4Kc3RyZWFtCkJULyA5IFRmKFRlc3QpJyBFVAplbmRzdHJlYW0KZW5kb2JqCjQgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCA1IDAgUgovQ29udGVudHMgOSAwIFIKPj4KZW5kb2JqCjUgMCBvYmoKPDwKL0tpZHMgWzQgMCBSIF0KL0NvdW50IDEKL1R5cGUgL1BhZ2VzCi9NZWRpYUJveCBbIDAgMCA5OSA5IF0KPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1BhZ2VzIDUgMCBSCi9UeXBlIC9DYXRhbG9nCj4+CmVuZG9iagp0cmFpbGVyCjw8Ci9Sb290IDMgMCBSCj4+CiUlRU9G'; +const dataUrl = `data:application/pdf;base64,${smallPdf}`; + +function addOne(html) { + const wrapper = document.createElement('div'); + wrapper.innerHTML = html; + const objectElement = wrapper.querySelector('object'); + document.body.appendChild(wrapper); +} + +// This should be one <object> that loads a PDF, and the rest that don't. +addOne(`<object data=${dataUrl}></object>`); +addOne(`<object><param name=src value=${dataUrl}></object>`); +addOne(`<object><param name=data value=${dataUrl}></object>`); +addOne(`<object><param name=code value=${dataUrl}></object>`); +addOne(`<object><param name=movie value=${dataUrl}></object>`); +addOne(`<object><param name=url value=${dataUrl}></object>`); + +// Not a great way to tell when any <object> that might load has loaded. +setTimeout(() => document.documentElement.classList.remove("reftest-wait"),2000); + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-remove-param-crash.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-remove-param-crash.html new file mode 100644 index 0000000000..e1e2ebb4e6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-remove-param-crash.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> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html new file mode 100644 index 0000000000..44574ffd11 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/object-setcustomvalidity.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<title>object setCustomValidity</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<object id='object_test'></object> + +<script> + +test(() => { + let elem = document.getElementById("object_test"); + assert_false(elem.validity.customError); + elem.setCustomValidity("custom error"); + assert_true(elem.validity.customError); +}, "object setCustomValidity is correct") + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test0.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test0.html new file mode 100644 index 0000000000..17df71daa2 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test0.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<script> + +parent.callback("test0"); +document.location.href = "test1.html"; + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test1.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test1.html new file mode 100644 index 0000000000..cf2423275e --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/test1.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<script> + +parent.callback("test1"); + +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html new file mode 100644 index 0000000000..114a472fb6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html @@ -0,0 +1,82 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>object usemap case-sensitive</title> +<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference"> +<!-- See also: https://github.com/whatwg/html/issues/1666 --> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id="log"></div> + +<object data="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300"></object> +<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#sImPlE" width="300" height="300"></object> +<map name="simple"><area shape="rect" coords="0,0,300,300"></map> +<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300"></object> +<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map> +<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="passfield-Killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map> +<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map> +<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#глупый" width="300" height="300"></object> +<map name="глупый"><area shape="rect" coords="0,0,300,300"></map> +<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map> +<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#åωk" width="300" height="300"></object> +<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map> +<map name="Åωk"><area shape="rect" coords="0,0,300,300"></map> +<map name="åΩk"><area shape="rect" coords="0,0,300,300"></map> +<map name="åωK"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#blah1" width="300" height="300"></object> +<map name="blah①"><area shape="rect" coords="0,0,300,300"></map> +<map name="blⒶh1"><area shape="rect" coords="0,0,300,300"></map> +<map name="blⓐh1"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#tÉdz5アパートFi" width="300" height="300"></object> +<map name="TÉDZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map> +<map name="TéDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map> +<map name="tÉdz5㌀Fi"><area shape="rect" coords="0,0,300,300"></map> +<map name="tÉdz5アパートFi"><area shape="rect" coords="0,0,300,300"></map> +<map name="TÉDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map> +<map name="TÉDZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map> + +<object data="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300"></object> +<map name="σς"><area shape="rect" coords="0,0,300,300"></map> + +<script> +"use strict"; +setup({ explicit_done: true }); + +onload = () => { + const objects = Array.from(document.querySelectorAll(`object`)); + + for (let object of objects) { + test(() => { + const objectRect = object.getBoundingClientRect(); + const x = objectRect.left + objectRect.width / 2; + const y = objectRect.top + objectRect.height / 2; + const element = document.elementFromPoint(x, y); + + const name = element.parentElement.getAttribute("name"); + const messageSuffix = name ? `; used <map> with name "${name}"` : ""; + + assert_equals(element, object, "The element retrieved must be the object, not an area" + messageSuffix); + }, `Object with usemap of ${object.useMap} should not match any of the areas (it does not support usemap)`); + } + + done(); +}; +</script> |