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 delete Object.prototype.RemoteObject; | 10 delete Object.prototype.RemoteObject; |
10 this.RemoteObject = v; | 11 this.RemoteObject = v; |
11 | 12 |
12 detachInspector(); | 13 detachInspector(); |
13 setTimeout(function() { | 14 setTimeout(function() { |
14 // Attach the inspector again for the sake of establishing a | 15 // Attach the inspector again for the sake of establishing a |
15 // communication channel with the frontend test runner. | 16 // communication channel with the frontend test runner. |
16 attachInspector(); | 17 attachInspector(); |
17 console.log("End of test"); | 18 console.log("End of test"); |
18 }, 0); | 19 }, 0); |
19 }, | 20 }, |
20 }); | 21 }); |
21 | 22 |
22 // Before the whole script runs, the inspector is already attached. | 23 // Before the whole script runs, the inspector is already attached. |
23 // 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 |
24 // injected inspector script runs again (and triggers the above setter). | 25 // injected inspector script runs again (and triggers the above setter). |
25 detachInspector(); | 26 detachInspector(); |
26 attachInspector(); | 27 attachInspector(); |
27 console.log("First inspector activity after attaching inspector"); | 28 console.log("First inspector activity after attaching inspector"); |
| 29 console.log("End of test"); |
28 `; | 30 `; |
29 | 31 |
30 Protocol.Runtime.enable(); | 32 Protocol.Runtime.enable(); |
31 Protocol.Runtime.evaluate({ expression: expression }); | 33 Protocol.Runtime.evaluate({ expression: expression }); |
32 | 34 |
33 Protocol.Runtime.onConsoleAPICalled(function(result) { | 35 Protocol.Runtime.onConsoleAPICalled(function(result) { |
34 InspectorTest.logObject(result.params.args[0]); | 36 InspectorTest.logObject(result.params.args[0]); |
35 if (result.params.args[0].value == "End of test") { | 37 if (result.params.args[0].value == "End of test") { |
36 InspectorTest.completeTest(); | 38 InspectorTest.completeTest(); |
37 } | 39 } |
38 }); | 40 }); |
OLD | NEW |