| OLD | NEW |
| 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 return new Promise((resolve) => frame.onload = resolve); |
| 12 } | 13 } |
| 13 | 14 |
| 14 function createCraftedFrame() | 15 function createCraftedFrame() |
| 15 { | 16 { |
| 16 var frame = document.createElement("iframe"); | 17 var frame = document.createElement("iframe"); |
| 17 frame.src = "../resources/blank.html"; | 18 frame.src = "../resources/blank.html"; |
| 18 frame.id = "crafted-iframe"; | 19 frame.id = "crafted-iframe"; |
| 19 document.body.appendChild(frame); | 20 document.body.appendChild(frame); |
| 20 frame.contentDocument.write("<div>crafted</div>"); | 21 frame.contentDocument.write("<div>crafted</div>"); |
| 21 } | 22 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 InspectorTest.log(message); | 33 InspectorTest.log(message); |
| 33 InspectorTest.completeTest(); | 34 InspectorTest.completeTest(); |
| 34 } | 35 } |
| 35 | 36 |
| 36 InspectorTest.sendCommand("Runtime.enable", {}); | 37 InspectorTest.sendCommand("Runtime.enable", {}); |
| 37 | 38 |
| 38 function pageContextCreated() | 39 function pageContextCreated() |
| 39 { | 40 { |
| 40 InspectorTest.log("Page context was created"); | 41 InspectorTest.log("Page context was created"); |
| 41 InspectorTest.log("Create new frame"); | 42 InspectorTest.log("Create new frame"); |
| 42 InspectorTest.evaluate("createFrame()"); | 43 InspectorTest.sendCommandPromise("Runtime.evaluate", {expression: "creat
eFrame()", awaitPromise: true}) |
| 44 .then(() => navigateFrame()); |
| 43 } | 45 } |
| 44 | 46 |
| 45 var frameExecutionContextId = 0; | 47 var frameExecutionContextId = 0; |
| 46 | 48 |
| 47 function frameContextCreated(executionContextId) | 49 function frameContextCreated(executionContextId) |
| 48 { | 50 { |
| 49 InspectorTest.log("Frame context was created"); | 51 InspectorTest.log("Frame context was created"); |
| 50 frameExecutionContextId = executionContextId; | 52 frameExecutionContextId = executionContextId; |
| 53 } |
| 54 |
| 55 function navigateFrame() |
| 56 { |
| 51 InspectorTest.log("Navigate frame"); | 57 InspectorTest.log("Navigate frame"); |
| 52 InspectorTest.evaluate("window.frames[0].location = \"resources/runtime-
events-iframe.html\""); | 58 InspectorTest.evaluate("window.frames[0].location = \"resources/runtime-
events-iframe.html\""); |
| 53 } | 59 } |
| 54 | 60 |
| 55 function frameContextDestroyedBeforeNavigation(executionContextId) | 61 function frameContextDestroyedBeforeNavigation(executionContextId) |
| 56 { | 62 { |
| 57 if (frameExecutionContextId !== executionContextId) { | 63 if (frameExecutionContextId !== executionContextId) { |
| 58 InspectorTest.fail("Execution context with id = " + executionContext
Id + " was destroyed, but iframe's executionContext had id = " + frameExecutionC
ontextId + " before navigation"); | 64 InspectorTest.fail("Execution context with id = " + executionContext
Id + " was destroyed, but iframe's executionContext had id = " + frameExecutionC
ontextId + " before navigation"); |
| 59 return; | 65 return; |
| 60 } | 66 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 break; | 144 break; |
| 139 } | 145 } |
| 140 } | 146 } |
| 141 | 147 |
| 142 } | 148 } |
| 143 </script> | 149 </script> |
| 144 </head> | 150 </head> |
| 145 <body onload="runTest()"> | 151 <body onload="runTest()"> |
| 146 </body> | 152 </body> |
| 147 </html> | 153 </html> |
| OLD | NEW |