OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 const expression = ` | 5 const expression = ` |
6 Object.defineProperty(Object.prototype, 'RemoteObject', { | 6 Object.defineProperty(Object.prototype, 'RemoteObject', { |
7 configurable: true, | 7 configurable: true, |
8 set(v) { | 8 set(v) { |
9 console.log("Should never be called"); | 9 console.log("Should never be called"); |
10 delete Object.prototype.RemoteObject; | 10 delete Object.prototype.RemoteObject; |
11 this.RemoteObject = v; | 11 this.RemoteObject = v; |
12 | 12 |
13 detachInspector(); | 13 inspector.detachInspector(); |
14 setTimeout(function() { | 14 setTimeout(function() { |
15 // Attach the inspector again for the sake of establishing a | 15 // Attach the inspector again for the sake of establishing a |
16 // communication channel with the frontend test runner. | 16 // communication channel with the frontend test runner. |
17 attachInspector(); | 17 inspector.attachInspector(); |
18 console.log("End of test"); | 18 console.log("End of test"); |
19 }, 0); | 19 }, 0); |
20 }, | 20 }, |
21 }); | 21 }); |
22 | 22 |
23 // Before the whole script runs, the inspector is already attached. | 23 // Before the whole script runs, the inspector is already attached. |
24 // Re-attach the inspector and trigger the console API to make sure that the | 24 // Re-attach the inspector and trigger the console API to make sure that the |
25 // injected inspector script runs again (and triggers the above setter). | 25 // injected inspector script runs again (and triggers the above setter). |
26 detachInspector(); | 26 inspector.detachInspector(); |
27 attachInspector(); | 27 inspector.attachInspector(); |
28 console.log("First inspector activity after attaching inspector"); | 28 console.log("First inspector activity after attaching inspector"); |
29 console.log("End of test"); | 29 console.log("End of test"); |
30 `; | 30 `; |
31 | 31 |
32 Protocol.Runtime.enable(); | 32 Protocol.Runtime.enable(); |
33 Protocol.Runtime.evaluate({ expression: expression }); | 33 Protocol.Runtime.evaluate({ expression: expression }); |
34 | 34 |
35 Protocol.Runtime.onConsoleAPICalled(function(result) { | 35 Protocol.Runtime.onConsoleAPICalled(function(result) { |
36 InspectorTest.logObject(result.params.args[0]); | 36 InspectorTest.logObject(result.params.args[0]); |
37 if (result.params.args[0].value == "End of test") { | 37 if (result.params.args[0].value == "End of test") { |
38 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
39 } | 39 } |
40 }); | 40 }); |
OLD | NEW |