Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLImageElement/fallback-image-moved-across-documents.html

Issue 2535383003: Collapse images disallowed by the Safe Browsing Subresource Filter. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <body>
5 <iframe src="about:blank" id="nested"></iframe>
6 <script type="text/javascript">
7 // Fallback content is implemented by means of shadow DOM, using a dumbed-down
8 // HTMLImageElement instance inside to render the broken image icon. This inner
9 // image element displays a hard-coded ImageResource, and has no 'src' attribute
10 // so normally the `update image data` [1] algorithm is never invoked.
11 //
12 // However the `update image data` algorithm will be unconditionally invoked in
13 // response to an image element (inner or not) being adopted [2], e.g. when a
14 // subtree containing an image element (potentially in a shadow tree) is moved
15 // across documents.
16 //
17 // In Blink, when 'src' is empty, as is the case for the inner fallback image,
18 // the `update image data` algorithm will synchronously fail and create the
19 // shadow tree to render fallback content.
20 //
21 // Therefore special care must be taken to prevent creating the shadow tree
22 // for the inner fallback image itself, otherwise the recursive adoption
23 // algorithm would reach those nodes in the newly created shadow tree next, and
24 // the same thing would happen again and we end up with infinite nesting.
25 //
26 // [1]: https://html.spec.whatwg.org/multipage/embedded-content.html#update-the- image-data
27 // [2]: https://html.spec.whatwg.org/multipage/embedded-content.html#reacting-to -dom-mutations
28
29 var nestedDocument = document.getElementById("nested").contentDocument;
30
31 promise_test(t => {
32 let i = nestedDocument.createElement("img");
33 i.src = "non-existent/gives-404.png";
34 window.setTimeout(_ => nestedDocument.body.append(i));
35
36 let eventWatcher = new EventWatcher(t, i, [ "load", "error" ]);
37 return eventWatcher.wait_for("error").then(_ => {
38 window.setTimeout(_ => document.body.append(i));
39 return eventWatcher.wait_for("error").then(_ => {
40 assert_equals(i.clientWidth, 20, "Fallback content should be displayed.");
41 });
42 });
43 }, "Infinitely nested fallback content shadow trees should not be created, or th is test will never terminate.");
44
45 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/subresource_filter/image-allow-disallow-transitions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698