| Index: third_party/WebKit/LayoutTests/fast/events/image-adoption-events.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/events/image-adoption-events.html b/third_party/WebKit/LayoutTests/fast/events/image-adoption-events.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..682cc5777d8330377df15623c605aa8094e6cccf
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/fast/events/image-adoption-events.html
|
| @@ -0,0 +1,46 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<script src="../../resources/js-test.js"></script>
|
| +<script>
|
| +// Ensure that events are handled correctly when an image element is adopted.
|
| +
|
| +jsTestIsAsync = true;
|
| +
|
| +var doc = document.documentElement.appendChild(document.createElement("iframe")).contentDocument;
|
| +var adopting = false;
|
| +var readyStateChangeEventHandlerTriggeredWhenComplete = false;
|
| +
|
| +doc.open();
|
| +doc.onreadystatechange = function() {
|
| + if (doc.readyState == "complete") {
|
| + readyStateChangeEventHandlerTriggeredWhenComplete = true;
|
| + testPassed("readystatechange event handler was executed when complete");
|
| + if (adopting)
|
| + testFailed("script triggered during adoption");
|
| + finishJSTest();
|
| + }
|
| +}
|
| +
|
| +var img = doc.appendChild(doc.createElement("img"));
|
| +var blobUrl = URL.createObjectURL(new Blob);
|
| +
|
| +var x = new XMLHttpRequest;
|
| +x.onload = function() {
|
| + img.src = blobUrl;
|
| +}
|
| +x.onloadend = function() {
|
| + doc.close();
|
| + URL.revokeObjectURL(blobUrl);
|
| + adopting = true;
|
| + document.adoptNode(img);
|
| + adopting = false;
|
| + if (doc.readyState == "complete" && !readyStateChangeEventHandlerTriggeredWhenComplete) {
|
| + // TODO: This can be replaced with testFailed once https://crbug.com/606651 is fixed.
|
| + debug("FAIL readystatechange event was dispatched but the handler was suppressed");
|
| + finishJSTest();
|
| + }
|
| +}
|
| +x.open("get", "data:text/html,");
|
| +x.send();
|
| +</script>
|
| +</html>
|
|
|