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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/image-adoption-events.html

Issue 1921853004: Move the ScriptForbiddenScope in TreeScope::adoptIfNeeded to the top of the function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments + a whitespace fix Created 4 years, 7 months 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/fast/events/image-adoption-events-expected.txt » ('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 <html>
3 <script src="../../resources/js-test.js"></script>
4 <script>
5 // Ensure that events are handled correctly when an image element is adopted.
6
7 jsTestIsAsync = true;
8
9 var doc = document.documentElement.appendChild(document.createElement("iframe")) .contentDocument;
10 var adopting = false;
11 var readyStateChangeEventHandlerTriggeredWhenComplete = false;
12
13 doc.open();
14 doc.onreadystatechange = function() {
15 if (doc.readyState == "complete") {
16 readyStateChangeEventHandlerTriggeredWhenComplete = true;
17 testPassed("readystatechange event handler was executed when complete");
18 if (adopting)
19 testFailed("script triggered during adoption");
20 finishJSTest();
21 }
22 }
23
24 var img = doc.appendChild(doc.createElement("img"));
25 var blobUrl = URL.createObjectURL(new Blob);
26
27 var x = new XMLHttpRequest;
28 x.onload = function() {
29 img.src = blobUrl;
30 }
31 x.onloadend = function() {
32 doc.close();
33 URL.revokeObjectURL(blobUrl);
34 adopting = true;
35 document.adoptNode(img);
36 adopting = false;
37 if (doc.readyState == "complete" && !readyStateChangeEventHandlerTriggeredWh enComplete) {
38 // TODO: This can be replaced with testFailed once https://crbug.com/606 651 is fixed.
39 debug("FAIL readystatechange event was dispatched but the handler was su ppressed");
40 finishJSTest();
41 }
42 }
43 x.open("get", "data:text/html,");
44 x.send();
45 </script>
46 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/image-adoption-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698