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

Side by Side Diff: LayoutTests/inspector-protocol/runtime/runtime-execution-contexts-events.html

Issue 711853002: Revert of Fix Runtime.executionContextCreated for crafted iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 | LayoutTests/inspector-protocol/runtime/runtime-execution-contexts-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
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script> 4 <script>
5 5
6 function createFrame() 6 function createFrame()
7 { 7 {
8 var frame = document.createElement("iframe"); 8 var frame = document.createElement("iframe");
9 frame.src = "../resources/blank.html"; 9 frame.src = "../resources/blank.html";
10 frame.id = "iframe"; 10 frame.id = "iframe";
11 document.body.appendChild(frame); 11 document.body.appendChild(frame);
12 } 12 }
13 13
14 function createCraftedFrame()
15 {
16 var frame = document.createElement("iframe");
17 frame.src = "../resources/blank.html";
18 frame.id = "crafted-iframe";
19 document.body.appendChild(frame);
20 frame.contentDocument.write("<div>crafted</div>");
21 }
22
23 function test() 14 function test()
24 { 15 {
25 InspectorTest.evaluate = function(expression) 16 InspectorTest.evaluate = function(expression)
26 { 17 {
27 InspectorTest.sendCommandOrDie("Runtime.evaluate", {expression: expressi on}); 18 InspectorTest.sendCommandOrDie("Runtime.evaluate", {expression: expressi on});
28 } 19 }
29 20
30 InspectorTest.fail = function(message) 21 InspectorTest.fail = function(message)
31 { 22 {
32 InspectorTest.log(message); 23 InspectorTest.log(message);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 InspectorTest.evaluate("document.querySelector(\"#iframe\").remove()"); 61 InspectorTest.evaluate("document.querySelector(\"#iframe\").remove()");
71 } 62 }
72 63
73 function frameContextDestroyedAfterFrameRemoved(executionContextId) 64 function frameContextDestroyedAfterFrameRemoved(executionContextId)
74 { 65 {
75 if (frameExecutionContextId !== executionContextId) { 66 if (frameExecutionContextId !== executionContextId) {
76 InspectorTest.fail("Deleted frame had execution context with id = " + frameExecutionContextId + " , but executionContext with id = " + executionCont extId + " was removed"); 67 InspectorTest.fail("Deleted frame had execution context with id = " + frameExecutionContextId + " , but executionContext with id = " + executionCont extId + " was removed");
77 return; 68 return;
78 } 69 }
79 InspectorTest.log("Frame's context was destroyed"); 70 InspectorTest.log("Frame's context was destroyed");
80 InspectorTest.log("Create new crafted frame");
81 InspectorTest.evaluate("createCraftedFrame()");
82 }
83
84 function craftedFrameContextCreated(executionContextId)
85 {
86 InspectorTest.log("Crafted frame context was created");
87 frameExecutionContextId = executionContextId;
88 InspectorTest.log("Remove crafted frame");
89 InspectorTest.evaluate("document.querySelector(\"#crafted-iframe\").remo ve()");
90 }
91
92 function craftedFrameContextDestroyedAfterFrameRemoved(executionContextId)
93 {
94 if (frameExecutionContextId !== executionContextId) {
95 InspectorTest.fail("Deleted frame had execution context with id = " + frameExecutionContextId + " , but executionContext with id = " + executionCont extId + " was removed");
96 return;
97 }
98 InspectorTest.log("Crafted frame's context was destroyed");
99 InspectorTest.completeTest(); 71 InspectorTest.completeTest();
100 } 72 }
101 73
102 var contextCreationCounter = 0; 74 var contextCreationCounter = 0;
103 75
104 InspectorTest.eventHandler["Runtime.executionContextCreated"] = function(mes sageObject) 76 InspectorTest.eventHandler["Runtime.executionContextCreated"] = function(mes sageObject)
105 { 77 {
106 contextCreationCounter++; 78 contextCreationCounter++;
107 var executionContextId = messageObject.params.context.id; 79 var executionContextId = messageObject.params.context.id;
108 switch (contextCreationCounter) { 80 switch (contextCreationCounter) {
109 case 1: 81 case 1:
110 pageContextCreated(); 82 pageContextCreated();
111 break; 83 break;
112 case 2: 84 case 2:
113 frameContextCreated(executionContextId); 85 frameContextCreated(executionContextId);
114 break; 86 break;
115 case 3: 87 case 3:
116 frameContextCreatedAfterNavigation(executionContextId); 88 frameContextCreatedAfterNavigation(executionContextId);
117 break; 89 break;
118 case 4:
119 craftedFrameContextCreated(executionContextId);
120 break;
121 } 90 }
122 } 91 }
123 92
124 var contextDestructionCounter = 0; 93 var contextDestructionCounter = 0;
125 InspectorTest.eventHandler["Runtime.executionContextDestroyed"] = function(m essageObject) 94 InspectorTest.eventHandler["Runtime.executionContextDestroyed"] = function(m essageObject)
126 { 95 {
127 contextDestructionCounter++; 96 contextDestructionCounter++;
128 var executionContextId = messageObject.params.executionContextId; 97 var executionContextId = messageObject.params.executionContextId;
129 switch (contextDestructionCounter) { 98 switch (contextDestructionCounter) {
130 case 1: 99 case 1:
131 frameContextDestroyedBeforeNavigation(executionContextId); 100 frameContextDestroyedBeforeNavigation(executionContextId);
132 break; 101 break;
133 case 2: 102 case 2:
134 frameContextDestroyedAfterFrameRemoved(executionContextId); 103 frameContextDestroyedAfterFrameRemoved(executionContextId);
135 break; 104 break;
136 case 3:
137 craftedFrameContextDestroyedAfterFrameRemoved(executionContextId);
138 break;
139 } 105 }
140 } 106 }
141 107
142 } 108 }
143 </script> 109 </script>
144 </head> 110 </head>
145 <body onload="runTest()"> 111 <body onload="runTest()">
146 </body> 112 </body>
147 </html> 113 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector-protocol/runtime/runtime-execution-contexts-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698