| 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 InspectorTest = {}; | 5 InspectorTest = {}; |
| 6 InspectorTest._dispatchTable = new Map(); | 6 InspectorTest._dispatchTable = new Map(); |
| 7 InspectorTest._requestId = 0; | 7 InspectorTest._requestId = 0; |
| 8 InspectorTest._dumpInspectorProtocolMessages = false; | 8 InspectorTest._dumpInspectorProtocolMessages = false; |
| 9 InspectorTest._eventHandler = {}; | 9 InspectorTest._eventHandler = {}; |
| 10 InspectorTest._commandsForLogging = new Set(); | 10 InspectorTest._commandsForLogging = new Set(); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 InspectorTest.setupInjectedScriptEnvironment = function(debug) { | 322 InspectorTest.setupInjectedScriptEnvironment = function(debug) { |
| 323 let scriptSource = ''; | 323 let scriptSource = ''; |
| 324 // First define all getters on Object.prototype. | 324 // First define all getters on Object.prototype. |
| 325 let injectedScriptSource = utils.read('src/inspector/injected-script-source.js
'); | 325 let injectedScriptSource = utils.read('src/inspector/injected-script-source.js
'); |
| 326 let getterRegex = /\.[a-zA-Z0-9]+/g; | 326 let getterRegex = /\.[a-zA-Z0-9]+/g; |
| 327 let match; | 327 let match; |
| 328 let getters = new Set(); | 328 let getters = new Set(); |
| 329 while (match = getterRegex.exec(injectedScriptSource)) { | 329 while (match = getterRegex.exec(injectedScriptSource)) { |
| 330 getters.add(match[0].substr(1)); | 330 getters.add(match[0].substr(1)); |
| 331 } | 331 } |
| 332 // TODO(kozyatinskiy): pass builtins to injected script source. | |
| 333 getters.delete('constructor'); | |
| 334 scriptSource += `(function installSettersAndGetters() { | 332 scriptSource += `(function installSettersAndGetters() { |
| 335 let defineProperty = Object.defineProperty; | 333 let defineProperty = Object.defineProperty; |
| 336 let ObjectPrototype = Object.prototype;\n`; | 334 let ObjectPrototype = Object.prototype;\n`; |
| 337 scriptSource += Array.from(getters).map(getter => ` | 335 scriptSource += Array.from(getters).map(getter => ` |
| 338 defineProperty(ObjectPrototype, '${getter}', { | 336 defineProperty(ObjectPrototype, '${getter}', { |
| 339 set() { debugger; throw 42; }, get() { debugger; throw 42; }, | 337 set() { debugger; throw 42; }, get() { debugger; throw 42; }, |
| 340 __proto__: null | 338 __proto__: null |
| 341 }); | 339 }); |
| 342 `).join('\n') + '})();'; | 340 `).join('\n') + '})();'; |
| 343 InspectorTest.addScript(scriptSource); | 341 InspectorTest.addScript(scriptSource); |
| 344 | 342 |
| 345 if (debug) { | 343 if (debug) { |
| 346 InspectorTest.log('WARNING: InspectorTest.setupInjectedScriptEnvironment wit
h debug flag for debugging only and should not be landed.'); | 344 InspectorTest.log('WARNING: InspectorTest.setupInjectedScriptEnvironment wit
h debug flag for debugging only and should not be landed.'); |
| 347 InspectorTest.log('WARNING: run test with --expose-inspector-scripts flag to
get more details.'); | 345 InspectorTest.log('WARNING: run test with --expose-inspector-scripts flag to
get more details.'); |
| 348 InspectorTest.log('WARNING: you can additionally comment rjsmin in xxd.py to
get unminified injected-script-source.js.'); | 346 InspectorTest.log('WARNING: you can additionally comment rjsmin in xxd.py to
get unminified injected-script-source.js.'); |
| 349 InspectorTest.setupScriptMap(); | 347 InspectorTest.setupScriptMap(); |
| 350 Protocol.Debugger.enable(); | 348 Protocol.Debugger.enable(); |
| 351 Protocol.Debugger.onPaused(message => { | 349 Protocol.Debugger.onPaused(message => { |
| 352 let callFrames = message.params.callFrames; | 350 let callFrames = message.params.callFrames; |
| 353 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location)); | 351 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location)); |
| 354 }) | 352 }) |
| 355 } | 353 } |
| 356 } | 354 } |
| OLD | NEW |