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

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: 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
OLDNEW
(Empty)
1 <html>
esprehn 2016/04/26 20:17:18 Add doctype, you can also remove the head, title a
2 <head>
3 <title>Ensure that events are handled correctly when an image element is adopted .</title>
4 </head>
5 <body>
6 <pre id="console"></pre>
7 <script>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
11 }
12
13 function log(msg) {
14 document.getElementById("console").appendChild(document.createTextNode(msg + "\n"));
esprehn 2016/04/26 20:17:18 can you use js-test instead?
15 }
16
17 var doc = document.body.appendChild(document.createElement("iframe")).contentDoc ument;
18 var adopting = false;
19 var readyStateChangeEventHandlerTriggeredWhenComplete = false;
20
21 doc.open();
22 doc.onreadystatechange = function() {
23 if (doc.readyState == "complete") {
24 readyStateChangeEventHandlerTriggeredWhenComplete = true;
25 log("PASS: readystatechange event handler was executed when complete");
26 if (adopting)
27 log("FAIL: script triggered during adoption");
28 if (window.testRunner)
29 testRunner.notifyDone();
30 }
31 }
32
33 var img = doc.appendChild(doc.createElement("img"));
34 var blobUrl = URL.createObjectURL(new Blob);
35
36 var x = new XMLHttpRequest;
37 x.onload = function() {
38 img.src = blobUrl;
39 }
40 x.onloadend = function() {
41 doc.close();
42 URL.revokeObjectURL(blobUrl);
43 adopting = true;
44 document.adoptNode(img);
45 adopting = false;
46 if (doc.readyState == "complete" && !readyStateChangeEventHandlerTriggeredWh enComplete) {
47 log("FAIL: readystatechange event was dispatched but the handler was sup pressed");
48 if (window.testRunner)
49 testRunner.notifyDone();
50 }
51 }
52 x.open("get", "data:text/html,");
53 x.send();
54 </script>
55 </body>
56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698