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