MCPcopy Index your code
hub / github.com/nodejs/node / setupInjectedScriptEnvironment

Method setupInjectedScriptEnvironment

deps/v8/test/inspector/protocol-test.js:190–233  ·  view source on GitHub ↗
(session)

Source from the content-addressed store, hash-verified

188 }
189
190 setupInjectedScriptEnvironment(session) {
191 let scriptSource = '';
192 let getters = ["length","internalConstructorName","subtype","getProperty",
193 "objectHasOwnProperty","nullifyPrototype","primitiveTypes",
194 "closureTypes","prototype","all","RemoteObject","bind",
195 "PropertyDescriptor","object","get","set","value","configurable",
196 "enumerable","symbol","getPrototypeOf","nativeAccessorDescriptor",
197 "isBuiltin","hasGetter","hasSetter","getOwnPropertyDescriptor",
198 "description","isOwn","name",
199 "typedArrayProperties","keys","getOwnPropertyNames",
200 "getOwnPropertySymbols","isPrimitiveValue","com","toLowerCase",
201 "ELEMENT","trim","replace","DOCUMENT","size","byteLength","toString",
202 "stack","substr","message","indexOf","key","type","unserializableValue",
203 "objectId","className","preview","proxyTargetValue","customPreview",
204 "CustomPreview","resolve","then","console","error","header","hasBody",
205 "stringify","ObjectPreview","ObjectPreviewType","properties",
206 "ObjectPreviewSubtype","getInternalProperties","wasThrown","indexes",
207 "overflow","valuePreview","entries"];
208 scriptSource += `(function installSettersAndGetters() {
209 let defineProperty = Object.defineProperty;
210 let ObjectPrototype = Object.prototype;
211 let ArrayPrototype = Array.prototype;
212 defineProperty(ArrayPrototype, 0, {
213 set() { debugger; throw 42; }, get() { debugger; throw 42; },
214 __proto__: null
215 });`,
216 scriptSource += getters.map(getter => `
217 defineProperty(ObjectPrototype, '${getter}', {
218 set() { debugger; throw 42; }, get() { debugger; throw 42; },
219 __proto__: null
220 });
221 `).join('\n') + '})();';
222 this.addScript(scriptSource);
223
224 if (session) {
225 InspectorTest.log('WARNING: setupInjectedScriptEnvironment with debug flag for debugging only and should not be landed.');
226 session.setupScriptMap();
227 session.Protocol.Debugger.enable();
228 session.Protocol.Debugger.onPaused(message => {
229 let callFrames = message.params.callFrames;
230 session.logSourceLocations(callFrames.map(frame => frame.location));
231 })
232 }
233 }
234};
235
236InspectorTest.Session = class {

Calls 8

addScriptMethod · 0.80
setupScriptMapMethod · 0.80
onPausedMethod · 0.80
logSourceLocationsMethod · 0.80
mapMethod · 0.65
joinMethod · 0.45
logMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected