3 <script src=
"../inspector/inspector-test.js"></script>
4 <script src=
"../inspector/console-test.js"></script>
7 function openWebInspector()
9 if (window
.testRunner
) {
10 testRunner
.waitUntilDone();
11 testRunner
.showWebInspector();
16 function reopenWebInspector(objectId
)
18 window
.objectId
= unescape(objectId
);
19 testRunner
.closeWebInspector();
20 setTimeout(function() {
21 testRunner
.showWebInspector();
28 InspectorTest
.RuntimeAgent
.evaluate("window.objectId", dispatch
);
30 function dispatch(error
, result
, wasThrown
)
32 if (result
.type
!== "string") {
33 InspectorTest
.evaluateInPage("console.log('Opening front-end for the first time')");
34 installHandleInInjectedScript();
36 InspectorTest
.evaluateInPage("console.log('Opening front-end second time')");
37 checkHandleInInjectedScript(result
.value
, InspectorTest
.completeTest
);
41 function installHandleInInjectedScript()
43 InspectorTest
.RuntimeAgent
.evaluate("({ handle : \"handle\" })", storeIdInTargetWindow
);
45 function storeIdInTargetWindow(error
, result
, wasThrown
)
47 checkHandleInInjectedScript(result
.objectId
, reopenInspector
);
49 function reopenInspector()
51 InspectorTest
.evaluateInPage("reopenWebInspector('" + escape(result
.objectId
) + "')");
56 function checkHandleInInjectedScript(objectId
, callback
)
58 InspectorTest
.RuntimeAgent
.getProperties(objectId
, false, propertiesAvailable
);
60 function propertiesAvailable(error
, properties
)
62 InspectorTest
.evaluateInPage(error
? "console.log('Error resolving object')" : "console.log('Resolved object successfully')", callback
);
69 <body onload=
"openWebInspector()">
71 Tests that injected script is discarded upon front-end close.