| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/workspace-test.js"></script> |
| 5 <script> |
| 6 |
| 7 function test() |
| 8 { |
| 9 InspectorTest.createWorkspace(true); |
| 10 var context = new WebInspector.Context(); |
| 11 context.addFlavorChangeListener(WebInspector.ExecutionContext, executionCont
extChanged, this); |
| 12 context.addFlavorChangeListener(WebInspector.Target, targetChanged, this); |
| 13 new WebInspector.ExecutionContextSelector(InspectorTest.testTargetManager, c
ontext); |
| 14 |
| 15 function executionContextChanged(event) |
| 16 { |
| 17 var executionContext = event.data; |
| 18 InspectorTest.addResult("Execution context selected: " + (executionConte
xt.isMainWorldContext ? executionContext.target().name() + ":" + executionContex
t.frameId : "")); |
| 19 } |
| 20 |
| 21 function targetChanged(event) |
| 22 { |
| 23 InspectorTest.addResult("Target selected: " + event.data.name()); |
| 24 } |
| 25 |
| 26 |
| 27 InspectorTest.addResult("Adding page target:"); |
| 28 var pageTarget = InspectorTest.createMockTarget("page-target"); |
| 29 pageTarget.runtimeModel._executionContextCreated({id: "p1", name: "pageConte
xt1", isPageContext: true, origin: "origin", name: "pageContext1Name", frameId:
"pageFrame1"}); |
| 30 InspectorTest.addResult(""); |
| 31 |
| 32 InspectorTest.addResult("Adding sw target:"); |
| 33 var swTarget = InspectorTest.createMockTarget("sw-target"); |
| 34 swTarget.runtimeModel._executionContextCreated({id: "sw1", name: "swContext1
", isPageContext: true, origin: "origin", name: "swContext1Name", frameId: ""}); |
| 35 |
| 36 InspectorTest.addResult(""); |
| 37 InspectorTest.addResult("Removing page target:"); |
| 38 pageTarget.runtimeModel._executionContextDestroyed("p1"); |
| 39 |
| 40 InspectorTest.addResult(""); |
| 41 InspectorTest.addResult("Readding page target:"); |
| 42 pageTarget.runtimeModel._executionContextCreated({id: "p2", name: "", isPage
Context: true, origin: "", name: "", frameId: "pageFrame1"}); |
| 43 |
| 44 InspectorTest.completeTest(); |
| 45 } |
| 46 |
| 47 </script> |
| 48 </head> |
| 49 |
| 50 <body onload="runTest()"> |
| 51 <p> |
| 52 Tests that re-adding a removed target restores the last selected execution conte
xt. |
| 53 </p> |
| 54 |
| 55 </body> |
| 56 </html> |
| OLD | NEW |