Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..39fe07a51d68b232d2991523fa96f6c1ffd5971f |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html |
| @@ -0,0 +1,24 @@ |
| +<!DOCTYPE html> |
|
dominicc (has gone to gerrit)
2016/12/05 03:30:55
Let's use testharness.js for new layout tests!
engedy
2016/12/06 15:27:57
Done.
|
| +<iframe src="about:blank" id="nested"></iframe> |
| +<script type="text/javascript"> |
| +if (window.testRunner) |
| + testRunner.waitUntilDone(); |
| + |
| +// Fallback content is implemented by means of shadow DOM, with a dumbed-down |
|
dominicc (has gone to gerrit)
2016/12/05 03:30:55
Nice comment explaining the intent of the test and
engedy
2016/12/06 15:27:57
Thanks!
By the way, are tests in these folder Bli
|
| +// HTMLImageElement instance used to render the broken image icon inside. |
| +// |
| +// When such an <img> element is moved to a new document after the shadow tree |
| +// is created, care must be taken that there is no attempt to reload the broken |
| +// image icon inside, fail, and end up with infinitely nested fallback content. |
|
dominicc (has gone to gerrit)
2016/12/05 03:30:55
I'm curious--how would loading the broken image ic
engedy
2016/12/06 15:27:57
Done, I have extended the explanation.
|
| +let nestedDocument = document.getElementById("nested").contentDocument; |
| +let i = nestedDocument.createElement("img"); |
| +i.onerror = function() { |
| + i.onerror = function() { |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + }; |
| + document.body.appendChild(nestedDocument.body.removeChild(i)); |
|
dominicc (has gone to gerrit)
2016/12/05 03:30:55
Removes happen implicitly as part of apppend, appe
engedy
2016/12/06 15:27:57
Done.
|
| +}; |
| +i.src = "non-existent.png"; |
| +nestedDocument.body.appendChild(i); |
| +</script> |