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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 utils.compileAndRunWithOrigin = compileAndRunWithOrigin; | 42 utils.compileAndRunWithOrigin = compileAndRunWithOrigin; |
43 this.compileAndRunWithOrigin = null; | 43 this.compileAndRunWithOrigin = null; |
44 utils.quit = quit; | 44 utils.quit = quit; |
45 this.quit = null; | 45 this.quit = null; |
46 utils.print = print; | 46 utils.print = print; |
47 this.print = null; | 47 this.print = null; |
48 utils.setlocale = setlocale; | 48 utils.setlocale = setlocale; |
49 this.setlocale = null; | 49 this.setlocale = null; |
50 utils.setCurrentTimeMSForTest = setCurrentTimeMSForTest; | 50 utils.setCurrentTimeMSForTest = setCurrentTimeMSForTest; |
51 this.setCurrentTimeMSForTest = null; | 51 this.setCurrentTimeMSForTest = null; |
52 utils.setMemoryInfoForTest = setMemoryInfoForTest; | |
53 this.setMemoryInfoForTest = null; | |
54 utils.schedulePauseOnNextStatement = schedulePauseOnNextStatement; | 52 utils.schedulePauseOnNextStatement = schedulePauseOnNextStatement; |
55 this.schedulePauseOnNextStatement = null; | 53 this.schedulePauseOnNextStatement = null; |
56 utils.cancelPauseOnNextStatement = cancelPauseOnNextStatement; | 54 utils.cancelPauseOnNextStatement = cancelPauseOnNextStatement; |
57 this.cancelPauseOnNextStatement = null; | 55 this.cancelPauseOnNextStatement = null; |
58 utils.reconnect = reconnect; | 56 utils.reconnect = reconnect; |
59 this.reconnect = null; | 57 this.reconnect = null; |
60 utils.createContextGroup = createContextGroup; | 58 utils.createContextGroup = createContextGroup; |
61 this.createContextGroup = null; | 59 this.createContextGroup = null; |
62 })(); | 60 })(); |
63 | 61 |
64 InspectorTest.log = utils.print.bind(null); | 62 InspectorTest.log = utils.print.bind(null); |
65 | 63 |
66 InspectorTest.logMessage = function(originalMessage) | 64 InspectorTest.logMessage = function(originalMessage) |
67 { | 65 { |
68 var message = JSON.parse(JSON.stringify(originalMessage)); | 66 var message = JSON.parse(JSON.stringify(originalMessage)); |
69 if (message.id) | 67 if (message.id) |
70 message.id = "<messageId>"; | 68 message.id = "<messageId>"; |
71 | 69 |
72 const nonStableFields = new Set(["objectId", "scriptId", "exceptionId", "times
tamp", | 70 const nonStableFields = new Set(["objectId", "scriptId", "exceptionId", "times
tamp", |
73 "executionContextId", "callFrameId", "breakpointId", "bindRemoteObjectFuncti
onId", "formatterObjectId" ]); | 71 "executionContextId", "callFrameId", "breakpointId", "bindRemoteObjectFuncti
onId", "formatterObjectId" ]); |
74 var objects = [ message ]; | 72 var objects = [ message ]; |
75 while (objects.length) { | 73 while (objects.length) { |
76 var object = objects.shift(); | 74 var object = objects.shift(); |
77 for (var key in object) { | 75 for (var key in object) { |
78 if (nonStableFields.has(key)) | 76 if (nonStableFields.has(key)) |
79 object[key] = `<${key}>`; | 77 object[key] = `<${key}>`; |
80 else if (typeof object[key] === "string" && object[key].match(/\d+:\d+:\d+
:debug/)) | |
81 object[key] = object[key].replace(/\d+/, '<scriptId>'); | |
82 else if (typeof object[key] === "object") | 78 else if (typeof object[key] === "object") |
83 objects.push(object[key]); | 79 objects.push(object[key]); |
84 } | 80 } |
85 } | 81 } |
86 | 82 |
87 InspectorTest.logObject(message); | 83 InspectorTest.logObject(message); |
88 return originalMessage; | 84 return originalMessage; |
89 } | 85 } |
90 | 86 |
91 InspectorTest.logObject = function(object, title) | 87 InspectorTest.logObject = function(object, title) |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 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.'); |
350 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.'); |
351 InspectorTest.setupScriptMap(); | 347 InspectorTest.setupScriptMap(); |
352 Protocol.Debugger.enable(); | 348 Protocol.Debugger.enable(); |
353 Protocol.Debugger.onPaused(message => { | 349 Protocol.Debugger.onPaused(message => { |
354 let callFrames = message.params.callFrames; | 350 let callFrames = message.params.callFrames; |
355 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location)); | 351 InspectorTest.logSourceLocations(callFrames.map(frame => frame.location)); |
356 }) | 352 }) |
357 } | 353 } |
358 } | 354 } |
OLD | NEW |