Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 function test() | |
| 7 { | |
| 8 var mainFrameId = ""; | |
| 9 InspectorTest.eventHandler["Runtime.executionContextCreated"] = | |
| 10 function(message) { | |
| 11 if (message.params.context.auxData.frameId !== mainFrameId) | |
| 12 return; | |
| 13 if (message.params.context.auxData.isDefault === false) { | |
| 14 InspectorTest.log("PASS - isolated world created."); | |
| 15 } else { | |
| 16 InspectorTest.log("fail - main world created."); | |
| 17 } | |
| 18 InspectorTest.completeTest(); | |
| 19 }; | |
| 20 | |
| 21 InspectorTest.sendCommandOrDie("Runtime.enable", {}, runtimeAgentEnabled); | |
| 22 | |
| 23 function runtimeAgentEnabled() { | |
| 24 InspectorTest.log("Runtime enabled"); | |
| 25 | |
| 26 InspectorTest.sendCommandOrDie("Page.enable", {}, pageAgentEnabled); | |
| 27 } | |
| 28 | |
| 29 function pageAgentEnabled() { | |
| 30 InspectorTest.log("Page enabled"); | |
| 31 InspectorTest.sendCommandOrDie( | |
| 32 "Page.getResourceTree", {}, resourceTreeLoaded); | |
| 33 } | |
| 34 | |
| 35 function resourceTreeLoaded(payload) { | |
| 36 mainFrameId = payload.frameTree.frame.id; | |
| 37 onMainFrameId(mainFrameId); | |
| 38 } | |
| 39 | |
| 40 function onMainFrameId(mainFrameId) | |
| 41 { | |
| 
 
Sami
2017/04/28 10:12:57
nit: move brace to previous line
 
 | |
| 42 InspectorTest.log("Main Frame obtained"); | |
| 43 InspectorTest.sendCommandOrDie("Page.ensureIsolatedWorld", { | |
| 44 frameId: mainFrameId, worldId:1}); | |
| 45 } | |
| 46 } | |
| 47 | |
| 48 </script> | |
| 49 </head> | |
| 50 <body onload="runTest()"> | |
| 51 </body> | |
| 52 </html> | |
| OLD | NEW |