Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / inspector-enabled / injected-script-discard.html
blob8fe5ce8e72571ec6f53b7cef7061c2daa8940b9c
1 <html>
2 <head>
3 <script src="../inspector/inspector-test.js"></script>
4 <script src="../inspector/console-test.js"></script>
5 <script>
7 function openWebInspector()
9 if (window.testRunner) {
10 testRunner.waitUntilDone();
11 testRunner.showWebInspector();
12 runTest();
16 function reopenWebInspector(objectId)
18 window.objectId = unescape(objectId);
19 testRunner.closeWebInspector();
20 setTimeout(function() {
21 testRunner.showWebInspector();
22 runTest();
23 }, 0);
26 function test()
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();
35 } else {
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);
67 </script>
68 </head>
69 <body onload="openWebInspector()">
70 <p>
71 Tests that injected script is discarded upon front-end close.
72 </p>
73 <div id="container"/>
74 </body>
75 </html>