Chromium Code Reviews| 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({ | |
| 32 expression, | |
|
kozy
2016/10/21 15:06:53
Looks suspicious, expression: expression?
robwu
2016/10/21 20:32:45
Nope, this is ES6 syntax. It is a shorthand for ex
kozy
2016/10/21 20:41:26
Thanks,
For object literals we prefer ES5 syntax w
robwu
2016/10/21 20:47:36
Is this tribal knowledge, or is there a public cod
| |
| 33 silent: true, | |
|
kozy
2016/10/21 15:06:53
You don't really need it and it'll hide exception
robwu
2016/10/21 20:32:45
Done.
| |
| 34 returnByValue: false, | |
|
kozy
2016/10/21 15:06:53
it's false by default, you can just pass { express
robwu
2016/10/21 20:32:45
Done.
| |
| 35 }); | |
| 36 | |
| 37 Protocol.Runtime.onConsoleAPICalled(function(result) { | |
| 38 InspectorTest.logObject(result.params.args[0]); | |
| 39 if (result.params.args[0].value == "End of test") { | |
| 40 InspectorTest.completeTest(); | |
| 41 } | |
| 42 }); | |
| OLD | NEW |