Created
September 20, 2020 16:24
-
-
Save jasonLaster/f7f8238330ae8237708caf9d44b98480 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/.prettierrc b/.prettierrc | |
| index 5a49d93..e3d36e1 100644 | |
| --- a/.prettierrc | |
| +++ b/.prettierrc | |
| @@ -5,5 +5,5 @@ | |
| "tabWidth": 2, | |
| "trailingComma": "es5", | |
| "arrowParens": "avoid", | |
| - "printWidth": 80 | |
| + "printWidth": 90 | |
| } | |
| diff --git a/src/build/package.js b/src/build/package.js | |
| index 367f000..49e9e91 100644 | |
| --- a/src/build/package.js | |
| +++ b/src/build/package.js | |
| @@ -58,17 +58,12 @@ const generatedFiles = []; | |
| const sharedFlags = ["-O0", "-g", "-I", "cpp", "-D", "OS_LINUX=1"]; | |
| for (const file of linkerFiles) { | |
| - const generated = | |
| - file.substring(0, file.length - 4).replace(/\//g, "_") + ".o"; | |
| + const generated = file.substring(0, file.length - 4).replace(/\//g, "_") + ".o"; | |
| generatedFiles.push(generated); | |
| - spawnSync( | |
| - "g++", | |
| - [...sharedFlags, "-c", "-o", `/out/${generated}`, `cpp/${file}`], | |
| - { | |
| - stdio: "inherit", | |
| - } | |
| - ); | |
| + spawnSync("g++", [...sharedFlags, "-c", "-o", `/out/${generated}`, `cpp/${file}`], { | |
| + stdio: "inherit", | |
| + }); | |
| } | |
| spawnSync( | |
| diff --git a/src/control/analysis.js b/src/control/analysis.js | |
| index d4d13cb..8ad4398 100644 | |
| --- a/src/control/analysis.js | |
| +++ b/src/control/analysis.js | |
| @@ -57,9 +57,7 @@ async function getPointsForPosition(position, onStackFrame) { | |
| const steps = await findFrameSteps(onStackFrame); | |
| const firstStep = steps[0], | |
| lastStep = steps[steps.length - 1]; | |
| - return points.filter( | |
| - p => pointPrecedes(firstStep, p) && pointPrecedes(p, lastStep) | |
| - ); | |
| + return points.filter(p => pointPrecedes(firstStep, p) && pointPrecedes(p, lastStep)); | |
| } | |
| return points; | |
| @@ -303,12 +301,9 @@ async function applyMapper(pool, mapper, input) { | |
| try { | |
| // Babel doesn't seem to support parsing function bodies with "return" | |
| // statements, so use a wrapper function. | |
| - const transformed = babel.transform( | |
| - `async function __wrapper() { ${mapper} }`, | |
| - { | |
| - plugins: [MapperPlugin], | |
| - } | |
| - ).code; | |
| + const transformed = babel.transform(`async function __wrapper() { ${mapper} }`, { | |
| + plugins: [MapperPlugin], | |
| + }).code; | |
| // This is insecure. See https://github.com/RecordReplay/backend/issues/77 | |
| const mapperFunction = new AsyncFunction( | |
| diff --git a/src/control/child.js b/src/control/child.js | |
| index 7912b56..757dc0b 100644 | |
| --- a/src/control/child.js | |
| +++ b/src/control/child.js | |
| @@ -30,14 +30,7 @@ let gNextForkId = 1; | |
| // Interface which the control logic uses to interact with child processes. | |
| // A Child is abstract in that it is associated with a set of child processes | |
| // which can change over time. | |
| -function Child({ | |
| - startPoint, | |
| - onFinished, | |
| - rootId, | |
| - forkId, | |
| - parent, | |
| - parentManifestIndex, | |
| -}) { | |
| +function Child({ startPoint, onFinished, rootId, forkId, parent, parentManifestIndex }) { | |
| // Set if this child is no longer in use. | |
| this.dead = false; | |
| @@ -136,13 +129,9 @@ Child.prototype = { | |
| }, | |
| _nextManifestFinished(result) { | |
| - const { manifest, onFinished } = this.manifests[ | |
| - this.numFinishedManifests++ | |
| - ]; | |
| + const { manifest, onFinished } = this.manifests[this.numFinishedManifests++]; | |
| if (result.endpoint) { | |
| - assert( | |
| - !manifest.endpoint || pointEquals(result.endpoint, manifest.endpoint) | |
| - ); | |
| + assert(!manifest.endpoint || pointEquals(result.endpoint, manifest.endpoint)); | |
| } | |
| onFinished(result); | |
| @@ -238,11 +227,7 @@ Process.prototype = { | |
| this.pending.push({ manifest, index, time: Date.now() }); | |
| - log( | |
| - `SendManifest ${this.id} Index ${index} Manifest ${formatManifest( | |
| - manifest | |
| - )}` | |
| - ); | |
| + log(`SendManifest ${this.id} Index ${index} Manifest ${formatManifest(manifest)}`); | |
| ReplayProcess.sendManifest(this.rootId, this.forkId, manifest); | |
| }, | |
| @@ -269,9 +254,7 @@ Process.prototype = { | |
| const { manifest } = this.child.manifests[skipIndex]; | |
| if (!skipManifestAfterCrash(manifest, this.forkId)) { | |
| log( | |
| - `Error: Skipping unexpected manifest ${formatManifest( | |
| - manifest | |
| - )} ${skipIndex}` | |
| + `Error: Skipping unexpected manifest ${formatManifest(manifest)} ${skipIndex}` | |
| ); | |
| } | |
| this.child.numFinishedManifests++; | |
| @@ -539,9 +522,7 @@ function RecoverFromCrash(rootId, forkId) { | |
| log(`RecoverFromCrash ${process.id}`); | |
| if (!process.pending.length) { | |
| - Channel.fatalError( | |
| - "Can't recover from crash: child isn't processing a manifest" | |
| - ); | |
| + Channel.fatalError("Can't recover from crash: child isn't processing a manifest"); | |
| return; | |
| } | |
| @@ -563,10 +544,7 @@ function RecoverFromCrash(rootId, forkId) { | |
| // If the root child crashed, then all transitive forks also crashed. | |
| if (!forkId) { | |
| for (const process of gProcesses.values()) { | |
| - if ( | |
| - process.rootId == rootId && | |
| - !crashedForkIds.includes(process.forkId) | |
| - ) { | |
| + if (process.rootId == rootId && !crashedForkIds.includes(process.forkId)) { | |
| log(`AlsoCrashed ${process.forkId}`); | |
| crashedForkIds.push(process.forkId); | |
| } | |
| diff --git a/src/control/debugger.js b/src/control/debugger.js | |
| index b30d2b9..258bb21 100644 | |
| --- a/src/control/debugger.js | |
| +++ b/src/control/debugger.js | |
| @@ -119,9 +119,7 @@ ReplayScript.prototype = { | |
| if (this._offsetMetadata[offset]) { | |
| return this._offsetMetadata[offset]; | |
| } | |
| - const { lineNumber, columnNumber, isStepStart } = this._getBreakpoint( | |
| - offset | |
| - ); | |
| + const { lineNumber, columnNumber, isStepStart } = this._getBreakpoint(offset); | |
| return { lineNumber, columnNumber, isBreakpoint: true, isStepStart }; | |
| }, | |
| @@ -176,28 +174,18 @@ ReplayScript.prototype = { | |
| if (!query) { | |
| return this._data.breakpoints; | |
| } | |
| - const { | |
| - minOffset, | |
| - maxOffset, | |
| - line, | |
| - minLine, | |
| - minColumn, | |
| - maxLine, | |
| - maxColumn, | |
| - } = query; | |
| - return this._data.breakpoints.filter( | |
| - ({ offset, lineNumber, columnNumber }) => { | |
| - return !( | |
| - (minOffset != undefined && offset < minOffset) || | |
| - (maxOffset != undefined && offset >= maxOffset) || | |
| - (line != undefined && lineNumber != line) || | |
| - (minLine != undefined && lineNumber < minLine) || | |
| - (minColumn != undefined && columnNumber < minColumn) || | |
| - (maxLine != undefined && lineNumber >= maxLine) || | |
| - (maxColumn != undefined && columnNumber >= maxColumn) | |
| - ); | |
| - } | |
| - ); | |
| + const { minOffset, maxOffset, line, minLine, minColumn, maxLine, maxColumn } = query; | |
| + return this._data.breakpoints.filter(({ offset, lineNumber, columnNumber }) => { | |
| + return !( | |
| + (minOffset != undefined && offset < minOffset) || | |
| + (maxOffset != undefined && offset >= maxOffset) || | |
| + (line != undefined && lineNumber != line) || | |
| + (minLine != undefined && lineNumber < minLine) || | |
| + (minColumn != undefined && columnNumber < minColumn) || | |
| + (maxLine != undefined && lineNumber >= maxLine) || | |
| + (maxColumn != undefined && columnNumber >= maxColumn) | |
| + ); | |
| + }); | |
| }, | |
| async getPossibleBreakpointsAsync() { | |
| @@ -262,9 +250,7 @@ async function positionProtocolLocation(position) { | |
| return { scriptId, line: script.startLine, column: script.startColumn }; | |
| } | |
| - const { lineNumber, columnNumber } = script.getOffsetMetadata( | |
| - position.offset | |
| - ); | |
| + const { lineNumber, columnNumber } = script.getOffsetMetadata(position.offset); | |
| return { scriptId, line: lineNumber, column: columnNumber }; | |
| } | |
| @@ -291,9 +277,7 @@ const gProtocolScripts = []; | |
| // Sessions listening for protocol scripts. | |
| const gScriptListenerSessions = new Set(); | |
| -Channel.addSessionCleanup(sessionId => | |
| - gScriptListenerSessions.delete(sessionId) | |
| -); | |
| +Channel.addSessionCleanup(sessionId => gScriptListenerSessions.delete(sessionId)); | |
| // Information about all scripts, indexed by ID. | |
| const gProtocolScriptsById = new Map(); | |
| @@ -382,16 +366,12 @@ Channel.addMessageHandler("Debugger.findScripts", async function () { | |
| return {}; | |
| }); | |
| -Channel.addMessageHandler("Debugger.getScriptSource", async function ({ | |
| - scriptId, | |
| -}) { | |
| +Channel.addMessageHandler("Debugger.getScriptSource", async function ({ scriptId }) { | |
| const { contents, contentType } = getProtocolScriptInfo(scriptId); | |
| return { scriptSource: contents, contentType }; | |
| }); | |
| -Channel.addMessageHandler("Debugger.getPossibleBreakpoints", async function ( | |
| - range | |
| -) { | |
| +Channel.addMessageHandler("Debugger.getPossibleBreakpoints", async function (range) { | |
| const generatedRanges = getGeneratedScriptRanges(range); | |
| const locations = []; | |
| for (const { scriptId, begin, end } of generatedRanges) { | |
| diff --git a/src/control/pause.js b/src/control/pause.js | |
| index 87bf7da..561ac62 100644 | |
| --- a/src/control/pause.js | |
| +++ b/src/control/pause.js | |
| @@ -25,10 +25,7 @@ const { | |
| previousSavedCheckpoint, | |
| sendManifestTrunkChild, | |
| } = require("./tree"); | |
| -const { | |
| - getGeneratedScriptLocation, | |
| - getGeneratedScriptRanges, | |
| -} = require("./sourcemaps"); | |
| +const { getGeneratedScriptLocation, getGeneratedScriptRanges } = require("./sourcemaps"); | |
| const Channel = require("./channel"); | |
| const Errors = require("../protocol/errors"); | |
| const { inLegacyMode } = require("./replayProcess"); | |
| @@ -62,9 +59,7 @@ async function findStepTarget(sessionId, point, forward, resumeLimit) { | |
| } | |
| const { blackboxedScripts } = getSessionState(sessionId); | |
| - const script = inLegacyMode() | |
| - ? await ensureScriptAsync(point.position.script) | |
| - : null; | |
| + const script = inLegacyMode() ? await ensureScriptAsync(point.position.script) : null; | |
| let currentEntryPoint; | |
| for ( | |
| @@ -205,9 +200,7 @@ async function findResumeTarget(sessionId, point, forward, resumeLimit) { | |
| for (const { position } of breakpoints.values()) { | |
| const breakpointHits = await findHits(checkpoint, position); | |
| - hits.push( | |
| - ...breakpointHits.map(point => ({ point, reason: "breakpoint" })) | |
| - ); | |
| + hits.push(...breakpointHits.map(point => ({ point, reason: "breakpoint" }))); | |
| } | |
| const { debuggerStatements } = savedCheckpointInfo(checkpoint); | |
| @@ -275,9 +268,7 @@ Channel.addMessageHandler("Debugger.setBreakpoint", async function ({ | |
| return { breakpointId }; | |
| }); | |
| -Channel.addMessageHandler("Debugger.removeBreakpoint", function ({ | |
| - breakpointId, | |
| -}) { | |
| +Channel.addMessageHandler("Debugger.removeBreakpoint", function ({ breakpointId }) { | |
| const { breakpoints } = getSessionState(this.sessionId); | |
| breakpoints.delete(breakpointId); | |
| return {}; | |
| diff --git a/src/control/pool.js b/src/control/pool.js | |
| index bdfc3ac..a7d04b8 100644 | |
| --- a/src/control/pool.js | |
| +++ b/src/control/pool.js | |
| @@ -206,9 +206,7 @@ Pool.prototype = { | |
| return i; | |
| } | |
| } | |
| - ThrowError( | |
| - `Could not find frame ${frameId} on stack ${JSON.stringify(this.stack)}` | |
| - ); | |
| + ThrowError(`Could not find frame ${frameId} on stack ${JSON.stringify(this.stack)}`); | |
| }, | |
| }; | |
| @@ -269,9 +267,7 @@ Channel.addMessageHandler("Pause.evaluateInFrame", async function (params) { | |
| return { result }; | |
| }); | |
| -Channel.addMessageHandler("Pause.evaluateInGlobal", async function ({ | |
| - expression, | |
| -}) { | |
| +Channel.addMessageHandler("Pause.evaluateInGlobal", async function ({ expression }) { | |
| const pool = Pool.lookup(this.pauseId); | |
| const { result } = await pool.sendAsyncDebuggerRequest( | |
| { type: "globalEvaluate", expression }, | |
| @@ -281,9 +277,7 @@ Channel.addMessageHandler("Pause.evaluateInGlobal", async function ({ | |
| return { result }; | |
| }); | |
| -Channel.addMessageHandler("Pause.getObjectPreview", async function ({ | |
| - object, | |
| -}) { | |
| +Channel.addMessageHandler("Pause.getObjectPreview", async function ({ object }) { | |
| const pool = Pool.lookup(this.pauseId); | |
| const { data } = await pool.sendAsyncDebuggerRequest({ | |
| type: "getObjectPreview", | |
| @@ -330,10 +324,7 @@ Channel.addMessageHandler("DOM.getParentNodes", async function ({ node }) { | |
| return { data }; | |
| }); | |
| -Channel.addMessageHandler("DOM.querySelector", async function ({ | |
| - node, | |
| - selector, | |
| -}) { | |
| +Channel.addMessageHandler("DOM.querySelector", async function ({ node, selector }) { | |
| const pool = Pool.lookup(this.pauseId); | |
| const { result, data } = await pool.sendAsyncDebuggerRequest({ | |
| type: "querySelector", | |
| @@ -359,9 +350,7 @@ Channel.addMessageHandler("DOM.getBoxModel", async function ({ node }) { | |
| return pool.sendAsyncDebuggerRequest({ type: "getBoxModel", node }); | |
| }); | |
| -Channel.addMessageHandler("DOM.getBoundingClientRect", async function ({ | |
| - node, | |
| -}) { | |
| +Channel.addMessageHandler("DOM.getBoundingClientRect", async function ({ node }) { | |
| const pool = Pool.lookup(this.pauseId); | |
| return pool.sendAsyncDebuggerRequest({ type: "getBoundingClientRect", node }); | |
| }); | |
| diff --git a/src/control/replayProcess.js b/src/control/replayProcess.js | |
| index 63f8b28..4e76211 100644 | |
| --- a/src/control/replayProcess.js | |
| +++ b/src/control/replayProcess.js | |
| @@ -167,9 +167,7 @@ ProcessOwner.prototype = { | |
| // In non-legacy mode we create a server that listens to connections from | |
| // the replaying process and all of its forks. | |
| assert(!gLegacyMode); | |
| - this.server = net.createServer(socket => | |
| - this.serverSocketConnected(socket) | |
| - ); | |
| + this.server = net.createServer(socket => this.serverSocketConnected(socket)); | |
| this.server.on("error", e => { | |
| log(`ReplayProcessServer Error ${e}`); | |
| }); | |
| @@ -383,11 +381,7 @@ ProcessOwner.prototype = { | |
| await gBuildWaiter.promise; | |
| assert(gLegacyMode !== undefined); | |
| if (!gLegacyMode) { | |
| - const msg = makeMessage( | |
| - MessageKind.RecordingLength, | |
| - BinaryMessageStart, | |
| - forkId | |
| - ); | |
| + const msg = makeMessage(MessageKind.RecordingLength, BinaryMessageStart, forkId); | |
| msg.writeUIntLE(length, BinaryMessageTag, 6); | |
| this.sendMessageToProcess(msg); | |
| } | |
| @@ -606,10 +600,7 @@ function getProcessSpec(buildId, buildDir, legacyMode) { | |
| return { | |
| buildDir, | |
| - libraryPaths: [ | |
| - ...systemLibraries, | |
| - ...libraryPaths.map(lib => `${buildDir}/${lib}`), | |
| - ], | |
| + libraryPaths: [...systemLibraries, ...libraryPaths.map(lib => `${buildDir}/${lib}`)], | |
| binaryArgs, | |
| replayJS, | |
| legacyMode, | |
| @@ -618,24 +609,22 @@ function getProcessSpec(buildId, buildDir, legacyMode) { | |
| } | |
| function isLegacyBuildId(buildId) { | |
| - return ( | |
| - !buildId.startsWith("macOS-node") && !buildId.startsWith("macOS-gecko") | |
| - ); | |
| + return !buildId.startsWith("macOS-node") && !buildId.startsWith("macOS-gecko"); | |
| } | |
| function processCallStackMismatch(line) { | |
| - const match = /RecordedCallStackMismatch (.*?) Recorded (.*?) Replayed (.*)/.exec( | |
| - line | |
| - ); | |
| + const match = /RecordedCallStackMismatch (.*?) Recorded (.*?) Replayed (.*)/.exec(line); | |
| const name = match[1]; | |
| const recordFrames = match[2].split(" ").filter(f => f.length); | |
| const replayFrames = match[3].split(" ").filter(f => f.length); | |
| let mismatch = false; | |
| for (let i = 0; i < Math.max(recordFrames.length, replayFrames.length); i++) { | |
| - if (recordFrames[i] != replayFrames[i] && | |
| - !whitelist(recordFrames[i]) && | |
| - !whitelist(replayFrames[i])) { | |
| + if ( | |
| + recordFrames[i] != replayFrames[i] && | |
| + !whitelist(recordFrames[i]) && | |
| + !whitelist(replayFrames[i]) | |
| + ) { | |
| mismatch = true; | |
| } | |
| } | |
| diff --git a/src/control/scan.js b/src/control/scan.js | |
| index 11e2b50..62e73e5 100644 | |
| --- a/src/control/scan.js | |
| +++ b/src/control/scan.js | |
| @@ -243,13 +243,7 @@ function addScanData({ breakpoints, enters, resumes, exits, calls }) { | |
| )} Checkpoint ${checkpoint} Progress ${progress} Script ${script} Offset ${offset} FrameIndex ${frameIndex}` | |
| ); | |
| } | |
| - getCheckpointData(checkpoint).addHit( | |
| - which, | |
| - progress, | |
| - script, | |
| - offset, | |
| - frameIndex | |
| - ); | |
| + getCheckpointData(checkpoint).addHit(which, progress, script, offset, frameIndex); | |
| } | |
| } | |
| } | |
| @@ -282,9 +276,7 @@ function findFrameSteps(targetPoint) { | |
| minProgress: entryPoint.progress, | |
| maxProgress: exitPoint.progress, | |
| }; | |
| - breakpointHits.push( | |
| - ...checkpointData.getBreakpointHits(script, offset, filter) | |
| - ); | |
| + breakpointHits.push(...checkpointData.getBreakpointHits(script, offset, filter)); | |
| } | |
| const entryFilter = { | |
| @@ -296,9 +288,7 @@ function findFrameSteps(targetPoint) { | |
| return [...breakpointHits, ...entryHits, entryPoint, exitPoint] | |
| .filter(point => { | |
| - return ( | |
| - !pointPrecedes(point, entryPoint) && !pointPrecedes(exitPoint, point) | |
| - ); | |
| + return !pointPrecedes(point, entryPoint) && !pointPrecedes(exitPoint, point); | |
| }) | |
| .sort((a, b) => (pointPrecedes(a, b) ? -1 : 1)); | |
| @@ -307,32 +297,28 @@ function findFrameSteps(targetPoint) { | |
| return targetPoint; | |
| } | |
| - return scanProgressDecrease( | |
| - targetPoint.progress, | |
| - (minProgress, maxProgress) => { | |
| - const entryPoints = changesWithinFrame( | |
| - ScriptHitKinds.Enter, | |
| - minProgress, | |
| - maxProgress | |
| - ); | |
| - const resumePoints = changesWithinFrame( | |
| - ScriptHitKinds.Resume, | |
| - minProgress, | |
| - maxProgress | |
| - ); | |
| - const enterFrameHits = [...entryPoints, ...resumePoints]; | |
| - const point = findClosestPoint(enterFrameHits, targetPoint, true, true); | |
| - if (point) { | |
| - return point; | |
| - } | |
| + return scanProgressDecrease(targetPoint.progress, (minProgress, maxProgress) => { | |
| + const entryPoints = changesWithinFrame( | |
| + ScriptHitKinds.Enter, | |
| + minProgress, | |
| + maxProgress | |
| + ); | |
| + const resumePoints = changesWithinFrame( | |
| + ScriptHitKinds.Resume, | |
| + minProgress, | |
| + maxProgress | |
| + ); | |
| + const enterFrameHits = [...entryPoints, ...resumePoints]; | |
| + const point = findClosestPoint(enterFrameHits, targetPoint, true, true); | |
| + if (point) { | |
| + return point; | |
| } | |
| - ); | |
| + }); | |
| } | |
| function findExitPoint() { | |
| const { checkpointExecutionPoint } = require("./tree"); | |
| - const limitProgress = checkpointExecutionPoint(targetPoint.checkpoint + 1) | |
| - .progress; | |
| + const limitProgress = checkpointExecutionPoint(targetPoint.checkpoint + 1).progress; | |
| return scanProgressIncrease( | |
| targetPoint.progress, | |
| (minProgress, maxProgress) => { | |
| diff --git a/src/control/scopes.js b/src/control/scopes.js | |
| index 1788ce2..20df40e 100644 | |
| --- a/src/control/scopes.js | |
| +++ b/src/control/scopes.js | |
| @@ -11,11 +11,7 @@ const { | |
| binarySearch, | |
| babelIdentifierIsVariable, | |
| } = require("../shared/utils"); | |
| -const { | |
| - spawnAsync, | |
| - readFileAsync, | |
| - writeFileAsync, | |
| -} = require("../shared/instanceUtils"); | |
| +const { spawnAsync, readFileAsync, writeFileAsync } = require("../shared/instanceUtils"); | |
| const babel = require("@babel/core"); | |
| // Map ScriptId => ScriptScopes | |
| @@ -152,9 +148,7 @@ function buildScopes(scriptId, contents) { | |
| if (binding) { | |
| binding.uses.push(path.node.loc.start); | |
| } else { | |
| - log( | |
| - `Error: Could not find scope binding for ${path.node.name}` | |
| - ); | |
| + log(`Error: Could not find scope binding for ${path.node.name}`); | |
| } | |
| break; | |
| } | |
| diff --git a/src/control/search.js b/src/control/search.js | |
| index 0f8e9e3..43d7a11 100644 | |
| --- a/src/control/search.js | |
| +++ b/src/control/search.js | |
| @@ -141,13 +141,10 @@ function initSearch() { | |
| for (const { id, point } of rv.generators) { | |
| gGeneratorScripts.add(point.position.script); | |
| gGeneratorEntryPoints.add(id, point); | |
| - gCheckpointGenerators.add( | |
| - `${point.checkpoint}:${point.position.frameIndex}`, | |
| - { | |
| - generatorId: id, | |
| - point, | |
| - } | |
| - ); | |
| + gCheckpointGenerators.add(`${point.checkpoint}:${point.position.frameIndex}`, { | |
| + generatorId: id, | |
| + point, | |
| + }); | |
| } | |
| if (!inLegacyMode()) { | |
| @@ -185,9 +182,7 @@ function unscannedRegions() { | |
| if ((!scanned || !traversed) && checkpoint != lastSavedCheckpoint()) { | |
| const endCheckpoint = nextSavedCheckpoint(checkpoint); | |
| - log( | |
| - `UnscannedRegion ${checkpoint} Traversed ${traversed} Scanned ${scanned}` | |
| - ); | |
| + log(`UnscannedRegion ${checkpoint} Traversed ${traversed} Scanned ${scanned}`); | |
| const begin = checkpointTime(checkpoint); | |
| const end = checkpointTime(endCheckpoint); | |
| @@ -261,16 +256,13 @@ const gFrameSteps = new PromiseMap({ | |
| if (inLegacyMode()) { | |
| const script = await ensureScriptAsync(point.position.script); | |
| const breakpoints = await script.getPossibleBreakpointsAsync(); | |
| - log( | |
| - `FindFrameSteps ${JSON.stringify(point)} ${Error().stack.substring(5)}` | |
| - ); | |
| + log(`FindFrameSteps ${JSON.stringify(point)} ${Error().stack.substring(5)}`); | |
| steps = await rootChild().sendManifest({ | |
| kind: "findFrameSteps", | |
| targetPoint: point, | |
| breakpointOffsets: breakpoints.map(bp => bp.offset), | |
| progressLimitMin: checkpointExecutionPoint(point.checkpoint).progress, | |
| - progressLimitMax: checkpointExecutionPoint(point.checkpoint + 1) | |
| - .progress, | |
| + progressLimitMax: checkpointExecutionPoint(point.checkpoint + 1).progress, | |
| }); | |
| } else { | |
| steps = ScanData.findFrameSteps(point); | |
| @@ -327,9 +319,7 @@ async function stringToPoint(str) { | |
| targetPoint: point, | |
| }); | |
| } else { | |
| - if ( | |
| - !(await gScanResults.waitForResult(getSavedCheckpoint(point.checkpoint))) | |
| - ) { | |
| + if (!(await gScanResults.waitForResult(getSavedCheckpoint(point.checkpoint)))) { | |
| ThrowError(`stringToPoint scan failed`); | |
| } | |
| @@ -371,9 +361,7 @@ async function findMostRecentStepForMessage(msg) { | |
| }, | |
| }; | |
| - if ( | |
| - !(await gScanResults.waitForResult(getSavedCheckpoint(msg.checkpoint))) | |
| - ) { | |
| + if (!(await gScanResults.waitForResult(getSavedCheckpoint(msg.checkpoint)))) { | |
| ThrowError(`findMostRecentStepForMessage scan failed`); | |
| } | |
| @@ -434,11 +422,7 @@ async function findAllStepsForGeneratorFrame(point) { | |
| `${point.checkpoint}:${point.position.frameIndex}` | |
| ); | |
| if (!frameEntries) { | |
| - log( | |
| - `Error: findAllStepsForGeneratorFrame NoFrameEntries ${JSON.stringify( | |
| - point | |
| - )}` | |
| - ); | |
| + log(`Error: findAllStepsForGeneratorFrame NoFrameEntries ${JSON.stringify(point)}`); | |
| return findFrameSteps(point); | |
| } | |
| const index = binarySearch(0, frameEntries.length, i => { | |
| @@ -607,9 +591,7 @@ const gValidPaintPoints = new Set(); | |
| // Sessions listening for paint points. | |
| const gPaintPointListenerSessions = new Set(); | |
| -Channel.addSessionCleanup(sessionId => | |
| - gPaintPointListenerSessions.delete(sessionId) | |
| -); | |
| +Channel.addSessionCleanup(sessionId => gPaintPointListenerSessions.delete(sessionId)); | |
| function onPaintPoints(paints) { | |
| gPaints.push(...paints); | |
| @@ -647,10 +629,7 @@ Channel.addMessageHandler("Graphics.getPaintContents", async function ({ | |
| } | |
| const { checkpoint } = await stringToPoint(point); | |
| - const info = await getPaintDataAtCheckpoint( | |
| - checkpoint, | |
| - mimeType == "image/png" | |
| - ); | |
| + const info = await getPaintDataAtCheckpoint(checkpoint, mimeType == "image/png"); | |
| assert(info.mimeType == mimeType); | |
| @@ -659,9 +638,7 @@ Channel.addMessageHandler("Graphics.getPaintContents", async function ({ | |
| if (resizeHeight) { | |
| const buf = Buffer.from(data, "base64"); | |
| - const resized = await Sharp(buf) | |
| - .resize({ height: resizeHeight }) | |
| - .toBuffer(); | |
| + const resized = await Sharp(buf).resize({ height: resizeHeight }).toBuffer(); | |
| data = resized.toString("base64"); | |
| hash = String(hashString(data)); | |
| mimeType = "image/jpeg"; | |
| @@ -674,9 +651,7 @@ Channel.addMessageHandler("Graphics.getPaintContents", async function ({ | |
| // Sessions listening for unprocessed regions. | |
| const gUnprocessedListenerSessions = new Set(); | |
| -Channel.addSessionCleanup(sessionId => | |
| - gUnprocessedListenerSessions.delete(sessionId) | |
| -); | |
| +Channel.addSessionCleanup(sessionId => gUnprocessedListenerSessions.delete(sessionId)); | |
| function unscannedRegionsChanged() { | |
| const regions = unscannedRegions(); | |
| diff --git a/src/control/sourcemaps.js b/src/control/sourcemaps.js | |
| index 6468340..5f4a622 100644 | |
| --- a/src/control/sourcemaps.js | |
| +++ b/src/control/sourcemaps.js | |
| @@ -52,9 +52,7 @@ SourceMap.prototype = { | |
| if (existing) { | |
| existing.push({ column, targetScriptId, targetLine, targetColumn }); | |
| } else { | |
| - this.mappings[line] = [ | |
| - { column, targetScriptId, targetLine, targetColumn }, | |
| - ]; | |
| + this.mappings[line] = [{ column, targetScriptId, targetLine, targetColumn }]; | |
| } | |
| }, | |
| @@ -274,12 +272,7 @@ async function ensureCSSSourceMap(sheetURL, sourceMapURL) { | |
| return sourceMap; | |
| } | |
| -async function mapCSSRuleLocation( | |
| - sheetURL, | |
| - sourceMapURL, | |
| - startLine, | |
| - startColumn | |
| -) { | |
| +async function mapCSSRuleLocation(sheetURL, sourceMapURL, startLine, startColumn) { | |
| const sourceMap = await ensureCSSSourceMap(sheetURL, sourceMapURL); | |
| if (!sourceMap) { | |
| return undefined; | |
| @@ -357,17 +350,13 @@ async function mapPauseData(pool, data) { | |
| for (const frame of data.frames || []) { | |
| frame.location = await getMappedLocations(frame.location[0]); | |
| if (frame.functionLocation) { | |
| - frame.functionLocation = await getMappedLocations( | |
| - frame.functionLocation[0] | |
| - ); | |
| + frame.functionLocation = await getMappedLocations(frame.functionLocation[0]); | |
| } | |
| frame.originalScopeChain = await buildOriginalScopeChain(pool, frame); | |
| } | |
| for (const { preview } of data.objects || []) { | |
| if (preview && preview.functionLocation) { | |
| - preview.functionLocation = await getMappedLocations( | |
| - preview.functionLocation[0] | |
| - ); | |
| + preview.functionLocation = await getMappedLocations(preview.functionLocation[0]); | |
| } | |
| if (preview && preview.rule && preview.rule.sourceMapURL) { | |
| const { sheetURL, sourceMapURL, startLine, startColumn } = preview.rule; | |
| @@ -466,11 +455,7 @@ async function getScopeRenames(pool, frameId) { | |
| let numSkip = generatedNameCount.get(name) || 0; | |
| generatedNameCount.set(name, numSkip + 1); | |
| - const generatedBinding = findBindingInScopes( | |
| - generatedScopes, | |
| - name, | |
| - numSkip | |
| - ); | |
| + const generatedBinding = findBindingInScopes(generatedScopes, name, numSkip); | |
| if (!generatedBinding) { | |
| if (name != "arguments") { | |
| log(`Error: Could not find variable ${name} in generated scope`); | |
| @@ -492,11 +477,7 @@ async function getScopeRenames(pool, frameId) { | |
| numSkip = originalNameCount.get(originalName) || 0; | |
| originalNameCount.set(originalName, numSkip + 1); | |
| - const originalBinding = findBindingInScopes( | |
| - originalScopes, | |
| - originalName, | |
| - numSkip | |
| - ); | |
| + const originalBinding = findBindingInScopes(originalScopes, originalName, numSkip); | |
| if (originalBinding) { | |
| renames.push({ name, value, originalBinding }); | |
| } | |
| @@ -1035,9 +1016,7 @@ function generatePrettyPrintedSourceMaps( | |
| continue; | |
| } | |
| - ThrowError( | |
| - `Non-whitespace mismatch in pretty printed source: ${code} ${prettyCode}` | |
| - ); | |
| + ThrowError(`Non-whitespace mismatch in pretty printed source: ${code} ${prettyCode}`); | |
| } | |
| map.finish(); | |
| @@ -1055,12 +1034,7 @@ function maybePrettyPrint(scriptId) { | |
| indent_size: 2, | |
| }); | |
| - generatePrettyPrintedSourceMaps( | |
| - scriptId, | |
| - contents, | |
| - prettyScriptId, | |
| - prettyContents | |
| - ); | |
| + generatePrettyPrintedSourceMaps(scriptId, contents, prettyScriptId, prettyContents); | |
| addProtocolScript( | |
| prettyScriptId, | |
| "prettyPrinted", | |
| @@ -1089,9 +1063,7 @@ module.exports = { | |
| // Message Handlers | |
| /////////////////////////////////// | |
| -Channel.addMessageHandler("Debugger.getMappedLocation", async function ({ | |
| - location, | |
| -}) { | |
| +Channel.addMessageHandler("Debugger.getMappedLocation", async function ({ location }) { | |
| const generated = await getGeneratedScriptLocation(location); | |
| if (!generated) { | |
| this.reportError(Errors.InvalidLocation); | |
| diff --git a/src/control/tree.js b/src/control/tree.js | |
| index 67f17c6..5e4a114 100644 | |
| --- a/src/control/tree.js | |
| +++ b/src/control/tree.js | |
| @@ -127,14 +127,10 @@ function addBranchChild(branch) { | |
| const checkpoint = branch.startPoint.checkpoint; | |
| const existing = gBranchChildren.get(checkpoint); | |
| if (existing) { | |
| - assert( | |
| - pointPrecedes(existing[existing.length - 1].startPoint, branch.startPoint) | |
| - ); | |
| + assert(pointPrecedes(existing[existing.length - 1].startPoint, branch.startPoint)); | |
| existing.push({ branch, startPoint: branch.startPoint }); | |
| } else { | |
| - gBranchChildren.set(checkpoint, [ | |
| - { branch, startPoint: branch.startPoint }, | |
| - ]); | |
| + gBranchChildren.set(checkpoint, [{ branch, startPoint: branch.startPoint }]); | |
| } | |
| } | |
| @@ -346,11 +342,7 @@ forAllCheckpointRegions(async (point, endpoint, info) => { | |
| // Maximum amount of time that should pass between branch children. | |
| const BranchChildFrequencyMs = 1000; | |
| -async function maybeAddSupplementalBranches( | |
| - checkpoint, | |
| - endCheckpoint, | |
| - elapsed | |
| -) { | |
| +async function maybeAddSupplementalBranches(checkpoint, endCheckpoint, elapsed) { | |
| // While we try to space saved checkpoints such that creating branch | |
| // children at each of them will allow forked leaves to quickly visit any | |
| // point in the recording, this doesn't always work. There could be a very | |
| @@ -368,8 +360,7 @@ async function maybeAddSupplementalBranches( | |
| const startProgress = checkpointExecutionPoint(checkpoint).progress; | |
| const endProgress = checkpointExecutionPoint(endCheckpoint).progress; | |
| - const spacing = | |
| - ((endProgress - startProgress) / (numSupplementalBranches + 1)) | 0; | |
| + const spacing = ((endProgress - startProgress) / (numSupplementalBranches + 1)) | 0; | |
| if (spacing < 100) { | |
| // Not much JS is running, it doesn't seem like supplemental branches will help. | |
| return; | |
| @@ -407,11 +398,7 @@ async function maybeAddSupplementalBranches( | |
| const branch = child.fork(); | |
| addBranchChild(branch); | |
| - log( | |
| - `AddSupplementalBranchChild ${JSON.stringify( | |
| - point | |
| - )} ${branch.currentId()}` | |
| - ); | |
| + log(`AddSupplementalBranchChild ${JSON.stringify(point)} ${branch.currentId()}`); | |
| } | |
| // Make sure the child finishes all manifests before killing it. | |
| @@ -585,10 +572,7 @@ let gRecordingLastCheckpoint; | |
| function sendDebuggerRequestMainChild(request) { | |
| let data; | |
| - gTrunkChild.sendManifestRaw( | |
| - { kind: "debuggerRequest", request }, | |
| - d => (data = d) | |
| - ); | |
| + gTrunkChild.sendManifestRaw({ kind: "debuggerRequest", request }, d => (data = d)); | |
| gTrunkChild.waitUntilPaused(); | |
| return data.result; | |
| } | |
| @@ -615,9 +599,7 @@ function pointTime(point) { | |
| } | |
| let next = gCheckpoints[point.checkpoint + 1]; | |
| - const { widgetEvents } = savedCheckpointInfo( | |
| - getSavedCheckpoint(point.checkpoint) | |
| - ); | |
| + const { widgetEvents } = savedCheckpointInfo(getSavedCheckpoint(point.checkpoint)); | |
| for (const event of widgetEvents) { | |
| if (pointPrecedes(event.point, point)) { | |
| if (pointPrecedes(previous.point, event.point)) { | |
| @@ -680,11 +662,9 @@ function OnRecordingData(offset, buf) { | |
| : entry.buf; | |
| gSummaryPromises.push( | |
| - child | |
| - .sendManifest({ kind: "getRecordingSummary" }) | |
| - .then(({ checkpoints }) => { | |
| - checkpoints.forEach(newRecordingSegment); | |
| - }) | |
| + child.sendManifest({ kind: "getRecordingSummary" }).then(({ checkpoints }) => { | |
| + checkpoints.forEach(newRecordingSegment); | |
| + }) | |
| ); | |
| if (gSentRecording.length == gFinalRecordingLength) { | |
| @@ -726,11 +706,7 @@ function KillForks(numForks) { | |
| // Get the pruned branches between a point and the previous intact branch. | |
| function prunedBranchesBefore(point) { | |
| const pruned = []; | |
| - for ( | |
| - let checkpoint = point.checkpoint; | |
| - checkpoint >= FirstCheckpointId; | |
| - checkpoint-- | |
| - ) { | |
| + for (let checkpoint = point.checkpoint; checkpoint >= FirstCheckpointId; checkpoint--) { | |
| const entries = gBranchChildren.get(checkpoint) || []; | |
| for (let i = entries.length - 1; i >= 0; i--) { | |
| const entry = entries[i]; | |
| @@ -764,11 +740,7 @@ function pruneBranch() { | |
| scoredEntries.sort((a, b) => a.score - b.score); | |
| if (scoredEntries.length) { | |
| const entry = scoredEntries[0].entry; | |
| - log( | |
| - `PruneBranch ${JSON.stringify( | |
| - entry.startPoint | |
| - )} ${entry.branch.currentId()}` | |
| - ); | |
| + log(`PruneBranch ${JSON.stringify(entry.startPoint)} ${entry.branch.currentId()}`); | |
| entry.branch.kill(); | |
| entry.branch = null; | |
| } | |
| @@ -785,11 +757,7 @@ function regrowBranch(targetEntry) { | |
| assert(pointPrecedes(child.manifestEndpoint, entry.startPoint)); | |
| child.sendManifest({ kind: "runToPoint", endpoint: entry.startPoint }); | |
| entry.branch = child.fork(); | |
| - log( | |
| - `RegrowBranch ${JSON.stringify( | |
| - entry.startPoint | |
| - )} ${entry.branch.currentId()}` | |
| - ); | |
| + log(`RegrowBranch ${JSON.stringify(entry.startPoint)} ${entry.branch.currentId()}`); | |
| } | |
| child.kill(); | |
| } | |
| @@ -802,9 +770,7 @@ const gMouseEvents = []; | |
| // Sessions listening for mouse events. | |
| const gMouseEventListenerSessions = new Set(); | |
| -Channel.addSessionCleanup(sessionId => | |
| - gMouseEventListenerSessions.delete(sessionId) | |
| -); | |
| +Channel.addSessionCleanup(sessionId => gMouseEventListenerSessions.delete(sessionId)); | |
| function onMouseEvents(events) { | |
| gMouseEvents.push(...events); | |
| @@ -845,9 +811,7 @@ const gConsoleMessages = []; | |
| // Map sessions listening for console messages to an array of promises that | |
| // resolve when the messages have been emitted. | |
| const gMessageListenerSessions = new Map(); | |
| -Channel.addSessionCleanup(sessionId => | |
| - gMessageListenerSessions.delete(sessionId) | |
| -); | |
| +Channel.addSessionCleanup(sessionId => gMessageListenerSessions.delete(sessionId)); | |
| // Split messages into batches for processing, as for analyses. | |
| const ConsoleMessageBatchSize = 30; | |
| @@ -867,14 +831,8 @@ function onConsoleMessages(messages) { | |
| a.messageIndex < b.messageIndex ? -1 : 1 | |
| ); | |
| } | |
| - for ( | |
| - let i = 0; | |
| - i < messagesWithContents.length; | |
| - i += ConsoleMessageBatchSize | |
| - ) { | |
| - loadMessageContents( | |
| - messagesWithContents.slice(i, i + ConsoleMessageBatchSize) | |
| - ); | |
| + for (let i = 0; i < messagesWithContents.length; i += ConsoleMessageBatchSize) { | |
| + loadMessageContents(messagesWithContents.slice(i, i + ConsoleMessageBatchSize)); | |
| } | |
| for (const [sessionId, waiters] of gMessageListenerSessions.entries()) { | |
| @@ -996,9 +954,7 @@ Channel.addMessageHandler("Console.findMessages", async function () { | |
| this.reportError(Errors.DuplicateCommand); | |
| return null; | |
| } | |
| - const waiters = gConsoleMessages.map(msg => | |
| - emitConsoleMessage(this.sessionId, msg) | |
| - ); | |
| + const waiters = gConsoleMessages.map(msg => emitConsoleMessage(this.sessionId, msg)); | |
| gMessageListenerSessions.set(this.sessionId, waiters); | |
| await waitForScanFinished(); | |
| await Promise.all(waiters); | |
| diff --git a/src/dispatch/analysis.js b/src/dispatch/analysis.js | |
| index 68e0244..237647e 100644 | |
| --- a/src/dispatch/analysis.js | |
| +++ b/src/dispatch/analysis.js | |
| @@ -177,12 +177,7 @@ const AnalysisMessageHandlers = { | |
| return {}; | |
| }, | |
| - "Analysis.addLocation": function ({ | |
| - analysisId, | |
| - sessionId, | |
| - location, | |
| - onStackFrame, | |
| - }) { | |
| + "Analysis.addLocation": function ({ analysisId, sessionId, location, onStackFrame }) { | |
| const analysis = checkAnalysis(this, analysisId, sessionId); | |
| if (!analysis) { | |
| return null; | |
| @@ -191,11 +186,7 @@ const AnalysisMessageHandlers = { | |
| return {}; | |
| }, | |
| - "Analysis.addEventHandlerEntryPoints": function ({ | |
| - analysisId, | |
| - sessionId, | |
| - eventType, | |
| - }) { | |
| + "Analysis.addEventHandlerEntryPoints": function ({ analysisId, sessionId, eventType }) { | |
| const analysis = checkAnalysis(this, analysisId, sessionId); | |
| if (!analysis) { | |
| return null; | |
| diff --git a/src/dispatch/control.js b/src/dispatch/control.js | |
| index 1274028..1402922 100644 | |
| --- a/src/dispatch/control.js | |
| +++ b/src/dispatch/control.js | |
| @@ -14,10 +14,7 @@ const { | |
| waitForFinishedRecording, | |
| isValidRecordingId, | |
| } = require("./recording"); | |
| -const { | |
| - initializeAnalysis, | |
| - handleControlAnalysisMessage, | |
| -} = require("./analysis"); | |
| +const { initializeAnalysis, handleControlAnalysisMessage } = require("./analysis"); | |
| const ControlSocket = require("../control/socket"); | |
| const Host = require("./host"); | |
| const Errors = require("../protocol/errors"); | |
| @@ -25,10 +22,7 @@ const Errors = require("../protocol/errors"); | |
| // Server for connections from controllers. | |
| const controlServer = http.createServer(); | |
| const controlWSS = new WebSocket.Server({ server: controlServer }); | |
| -controlWSS.on( | |
| - "connection", | |
| - socket => new ControlSocket(socket, ControlSocketHandler) | |
| -); | |
| +controlWSS.on("connection", socket => new ControlSocket(socket, ControlSocketHandler)); | |
| controlServer.listen(controlPort); | |
| // Map control ID to ControlInfo | |
| diff --git a/src/dispatch/host.js b/src/dispatch/host.js | |
| index 0c24671..15dfeaa 100644 | |
| --- a/src/dispatch/host.js | |
| +++ b/src/dispatch/host.js | |
| @@ -38,9 +38,7 @@ openHostSocket(); | |
| async function spawnController(controlId, recordingId) { | |
| await hostSocketWaiter.promise; | |
| - hostSocket.send( | |
| - JSON.stringify({ kind: "spawnController", controlId, recordingId }) | |
| - ); | |
| + hostSocket.send(JSON.stringify({ kind: "spawnController", controlId, recordingId })); | |
| } | |
| const gStorageWaiters = new Map(); | |
| diff --git a/src/dispatch/main.js b/src/dispatch/main.js | |
| index 1fc7bcf..2790734 100644 | |
| --- a/src/dispatch/main.js | |
| +++ b/src/dispatch/main.js | |
| @@ -20,10 +20,7 @@ const { | |
| const { ProtocolSocket } = require("../protocol/socket"); | |
| const { loadTypes } = require("../protocol/typeCheck"); | |
| const { log } = require("../shared/utils"); | |
| -const { | |
| - AnalysisMessageHandlers, | |
| - analysisOnProtocolSocketClose, | |
| -} = require("./analysis"); | |
| +const { AnalysisMessageHandlers, analysisOnProtocolSocketClose } = require("./analysis"); | |
| const { | |
| forwardSessionMessage, | |
| ControlMessageHandlers, | |
| @@ -33,10 +30,7 @@ const { | |
| RecordingMessageHandlers, | |
| recordingOnProtocolSocketClose, | |
| } = require("./recording"); | |
| -const { | |
| - MetadataMessageHandlers, | |
| - metadataOnProtocolSocketClose, | |
| -} = require("./metadata"); | |
| +const { MetadataMessageHandlers, metadataOnProtocolSocketClose } = require("./metadata"); | |
| const { InternalMessageHandlers } = require("./internal"); | |
| process.on("unhandledRejection", error => { | |
| diff --git a/src/dispatch/metadata.js b/src/dispatch/metadata.js | |
| index 5e29c6c..bc1827f 100644 | |
| --- a/src/dispatch/metadata.js | |
| +++ b/src/dispatch/metadata.js | |
| @@ -113,12 +113,7 @@ const MetadataMessageHandlers = { | |
| return {}; | |
| }, | |
| - "Recording.setMetadata": async function ({ | |
| - recordingId, | |
| - key, | |
| - newValue, | |
| - oldValue, | |
| - }) { | |
| + "Recording.setMetadata": async function ({ recordingId, key, newValue, oldValue }) { | |
| if (!(await isValidRecordingId(recordingId))) { | |
| this.reportError(Errors.BadRecordingId); | |
| return null; | |
| diff --git a/src/dispatch/recording.js b/src/dispatch/recording.js | |
| index ca381c1..a8c50b5 100644 | |
| --- a/src/dispatch/recording.js | |
| +++ b/src/dispatch/recording.js | |
| @@ -206,11 +206,7 @@ async function addRecordingListener(recordingId, listener) { | |
| for (let i = 0; ; i++) { | |
| const suffix = recordingPathSuffix(i); | |
| const path = `${recordingDirectory}/${recordingId}${suffix}`; | |
| - const sent = await downloadAndSendRecordingData( | |
| - path, | |
| - offset, | |
| - listener.onData | |
| - ); | |
| + const sent = await downloadAndSendRecordingData(path, offset, listener.onData); | |
| if (!sent) { | |
| // We should have already checked the recording exists. | |
| assert(i != 0); | |
| @@ -364,11 +360,7 @@ const RecordingMessageHandlers = { | |
| return { recordingId }; | |
| }, | |
| - "Internal.addRecordingData": async function ({ | |
| - recordingId, | |
| - offset, | |
| - length, | |
| - }) { | |
| + "Internal.addRecordingData": async function ({ recordingId, offset, length }) { | |
| const buf = await this.socket.waitForBinaryMessage(); | |
| if (!buf || buf.length != length) { | |
| this.reportError(Errors.BadDataBuffer); | |
| diff --git a/src/host/aws/dispatch.js b/src/host/aws/dispatch.js | |
| index 5a5580a..c822fa5 100644 | |
| --- a/src/host/aws/dispatch.js | |
| +++ b/src/host/aws/dispatch.js | |
| @@ -179,13 +179,9 @@ function dispatchConnected(socket) { | |
| assert(message.length == length); | |
| await writeFileAsync(path, message); | |
| try { | |
| - await spawnAsync( | |
| - "aws", | |
| - ["s3", "cp", path, `s3://${S3Bucket}/${path}`], | |
| - { | |
| - stdio: "inherit", | |
| - } | |
| - ); | |
| + await spawnAsync("aws", ["s3", "cp", path, `s3://${S3Bucket}/${path}`], { | |
| + stdio: "inherit", | |
| + }); | |
| } catch (e) { | |
| log(`Error uploading to S3 ${e}`); | |
| } | |
| @@ -213,12 +209,7 @@ function dispatchConnected(socket) { | |
| log(`DownloadStorage Start ${path} ${id}`); | |
| if (!(await existsAsync(path))) { | |
| try { | |
| - await spawnAsync("aws", [ | |
| - "s3", | |
| - "cp", | |
| - `s3://${S3Bucket}/${path}`, | |
| - path, | |
| - ]); | |
| + await spawnAsync("aws", ["s3", "cp", `s3://${S3Bucket}/${path}`, path]); | |
| } catch (e) {} | |
| log(`DownloadStorage AfterAWS ${id}`); | |
| } | |
| @@ -226,9 +217,7 @@ function dispatchConnected(socket) { | |
| const contents = await readFileAsync(path); | |
| log(`DownloadStorage AfterReadFile ${id}`); | |
| if (contents.length) { | |
| - socket.send( | |
| - JSON.stringify({ kind: "storage", id, length: contents.length }) | |
| - ); | |
| + socket.send(JSON.stringify({ kind: "storage", id, length: contents.length })); | |
| socket.send(contents); | |
| break; | |
| } | |
| @@ -311,9 +300,7 @@ Replayer.prototype = { | |
| logStatus() { | |
| const ratio = (this.memoryUsed / this.memoryTotal).toFixed(2); | |
| const controlJSON = JSON.stringify(this.control); | |
| - log( | |
| - `ReplayerStatus ${this.url}: Utilization ${ratio} Controllers ${controlJSON}` | |
| - ); | |
| + log(`ReplayerStatus ${this.url}: Utilization ${ratio} Controllers ${controlJSON}`); | |
| }, | |
| setStatus({ memoryTotal, memoryUsed, memoryAvailable, control }) { | |
| @@ -579,9 +566,7 @@ async function checkReplayers() { | |
| // Remove any entries from gReplayers which have shut down. | |
| for (const [url, replayer] of gReplayers) { | |
| if (!replayerInstances.some(i => i.InstanceId == replayer.instanceId)) { | |
| - log( | |
| - `CheckReplayers Deleting replayer ${replayer.instanceId} with url ${url}` | |
| - ); | |
| + log(`CheckReplayers Deleting replayer ${replayer.instanceId} with url ${url}`); | |
| if (replayer.socket) { | |
| replayer.socket.close(); | |
| replayer.socket = null; | |
| @@ -595,9 +580,7 @@ async function checkReplayers() { | |
| connectReplayerInstance(instance); | |
| } | |
| - log( | |
| - `CheckReplayers Active ${gReplayers.size} Pending ${gNumPendingReplayers}` | |
| - ); | |
| + log(`CheckReplayers Active ${gReplayers.size} Pending ${gNumPendingReplayers}`); | |
| maybeSpawnReplayers(); | |
| maybeTerminateReplayers(); | |
| @@ -859,9 +842,7 @@ async function spawnReplayerInstance() { | |
| return; | |
| } | |
| - log( | |
| - `Spot request ${requestId} ${failed ? "failed" : "timed out"}, canceling...` | |
| - ); | |
| + log(`Spot request ${requestId} ${failed ? "failed" : "timed out"}, canceling...`); | |
| // No instance ever appeared. Maybe the price was too low? Cancel the request | |
| // to prevent instances from appearing in the future. It's possible that an | |
| diff --git a/src/host/aws/replayer.js b/src/host/aws/replayer.js | |
| index 021b996..bce380f 100644 | |
| --- a/src/host/aws/replayer.js | |
| +++ b/src/host/aws/replayer.js | |
| @@ -125,12 +125,7 @@ async function uploadDumps() { | |
| await spawnAsync("tar", ["-czf", `${dump}.tgz`, dump], { | |
| cwd: dumpsDirectory, | |
| }); | |
| - await spawnAsync("aws", [ | |
| - "s3", | |
| - "cp", | |
| - archive, | |
| - `s3://${S3Bucket}/${archive}`, | |
| - ]); | |
| + await spawnAsync("aws", ["s3", "cp", archive, `s3://${S3Bucket}/${archive}`]); | |
| await unlinkAsync(path); | |
| await unlinkAsync(archive); | |
| } | |
| @@ -225,12 +220,7 @@ function createController(controlId, recordingId) { | |
| async function processAndUploadLog(logPath) { | |
| if (await existsAsync(logPath)) { | |
| - await spawnAsync("aws", [ | |
| - "s3", | |
| - "cp", | |
| - logPath, | |
| - `s3://${S3Bucket}/${logPath}`, | |
| - ]); | |
| + await spawnAsync("aws", ["s3", "cp", logPath, `s3://${S3Bucket}/${logPath}`]); | |
| await unlinkAsync(logPath); | |
| } | |
| } | |
| diff --git a/src/host/local/server.js b/src/host/local/server.js | |
| index a4721d0..04f78ba 100644 | |
| --- a/src/host/local/server.js | |
| +++ b/src/host/local/server.js | |
| @@ -25,11 +25,7 @@ let gStorageDirectory; | |
| // Whether to spawn controllers in containers, instead of directly. | |
| let gUseContainer; | |
| -function initLocalServer( | |
| - dispatchControllerAddress, | |
| - storageDirectory, | |
| - useContainer | |
| -) { | |
| +function initLocalServer(dispatchControllerAddress, storageDirectory, useContainer) { | |
| gDispatchControllerAddress = dispatchControllerAddress; | |
| gStorageDirectory = storageDirectory; | |
| gUseContainer = useContainer; | |
| @@ -85,9 +81,7 @@ function onMessage(socket, msg) { | |
| if (fs.existsSync(resolved)) { | |
| const contents = fs.readFileSync(resolved); | |
| if (contents.length) { | |
| - socket.send( | |
| - JSON.stringify({ kind: "storage", id, length: contents.length }) | |
| - ); | |
| + socket.send(JSON.stringify({ kind: "storage", id, length: contents.length })); | |
| socket.send(contents); | |
| break; | |
| } | |
| @@ -96,9 +90,7 @@ function onMessage(socket, msg) { | |
| break; | |
| } | |
| default: | |
| - console.log( | |
| - `Unknown host message from dispatcher ${JSON.stringify(msg)}` | |
| - ); | |
| + console.log(`Unknown host message from dispatcher ${JSON.stringify(msg)}`); | |
| break; | |
| } | |
| } | |
| diff --git a/src/processing/analyzeCrash.js b/src/processing/analyzeCrash.js | |
| index 776e5be..e85354b 100644 | |
| --- a/src/processing/analyzeCrash.js | |
| +++ b/src/processing/analyzeCrash.js | |
| @@ -47,9 +47,7 @@ async function analyzeCrash(settings, crashFile) { | |
| } | |
| } | |
| - const outputFile = `crash-${crashFile.substring( | |
| - crashFile.lastIndexOf("/") + 1 | |
| - )}.log`; | |
| + const outputFile = `crash-${crashFile.substring(crashFile.lastIndexOf("/") + 1)}.log`; | |
| fs.writeFileSync(`${triageDir}/${outputFile}`, output); | |
| return outputFile; | |
| } | |
| @@ -131,10 +129,7 @@ async function symbolify(settings, buildId, libraries, address, library) { | |
| closest = { library, base: 0 }; | |
| } else { | |
| for (const { library, base } of libraries) { | |
| - if ( | |
| - address >= base && | |
| - (!closest || address - base < address - closest.base) | |
| - ) { | |
| + if (address >= base && (!closest || address - base < address - closest.base)) { | |
| closest = { library, base }; | |
| } | |
| } | |
| diff --git a/src/processing/analyzeLatency.js b/src/processing/analyzeLatency.js | |
| index b3d6ce6..e66725b 100644 | |
| --- a/src/processing/analyzeLatency.js | |
| +++ b/src/processing/analyzeLatency.js | |
| @@ -40,10 +40,7 @@ ManifestInfo.prototype = { | |
| if (this.sendTime && this.receiveTime && this.startTime && this.endTime) { | |
| // The main thread processing delay is not considered part of the latency. | |
| const s = | |
| - this.receiveTime - | |
| - this.sendTime - | |
| - (this.endTime - this.startTime) - | |
| - this.delay; | |
| + this.receiveTime - this.sendTime - (this.endTime - this.startTime) - this.delay; | |
| return (s * 1000) | 0; | |
| } | |
| return undefined; | |
| diff --git a/src/processing/generateSymbols.js b/src/processing/generateSymbols.js | |
| index b101df4..09df7dc 100644 | |
| --- a/src/processing/generateSymbols.js | |
| +++ b/src/processing/generateSymbols.js | |
| @@ -11,11 +11,7 @@ const { checkForFile, readSymbols } = require("../shared/instanceUtils"); | |
| const legacy = process.argv[2] == "--legacy"; | |
| -const libraries = [ | |
| - "dist/bin/XUL", | |
| - "dist/bin/libmozglue.dylib", | |
| - "dist/bin/libnss3.dylib", | |
| -]; | |
| +const libraries = ["dist/bin/XUL", "dist/bin/libmozglue.dylib", "dist/bin/libnss3.dylib"]; | |
| const json = {}; | |
| const buildIdFile = `${objectDirectory}/toolkit/library/buildid.cpp`; | |
| diff --git a/src/processing/getMetrics.js b/src/processing/getMetrics.js | |
| index 4f6ddd0..0b7f102 100644 | |
| --- a/src/processing/getMetrics.js | |
| +++ b/src/processing/getMetrics.js | |
| @@ -15,9 +15,7 @@ function calculateAvgs() { | |
| const avgResults = []; | |
| for (const type in avgs) { | |
| avgResults.push( | |
| - `${type} ${Math.round( | |
| - avgs[type].reduce((s, c) => s + c, 0) / avgs[type].length | |
| - )}` | |
| + `${type} ${Math.round(avgs[type].reduce((s, c) => s + c, 0) / avgs[type].length)}` | |
| ); | |
| } | |
| console.log(avgResults.sort().join("\n")); | |
| @@ -96,9 +94,7 @@ function processLog(log) { | |
| } | |
| results.push([time.start.type, duration]); | |
| - table.push( | |
| - [id++, time.start.type, duration, date, recordingId, log].join("\t") | |
| - ); | |
| + table.push([id++, time.start.type, duration, date, recordingId, log].join("\t")); | |
| if (!avgs[time.start.type]) { | |
| avgs[time.start.type] = []; | |
| } | |
| diff --git a/src/processing/logs/dispatch.js b/src/processing/logs/dispatch.js | |
| index 53b3747..4c0eba8 100644 | |
| --- a/src/processing/logs/dispatch.js | |
| +++ b/src/processing/logs/dispatch.js | |
| @@ -61,9 +61,7 @@ function summarizeCrashes() { | |
| .map(data => { | |
| // const data = summaryData.find((log) => log.log === `replay-${crash}.log`); | |
| const mismatch = | |
| - data.mismatch.length > 0 || data.mismatchInput.length > 0 | |
| - ? "mismatch" | |
| - : ""; | |
| + data.mismatch.length > 0 || data.mismatchInput.length > 0 ? "mismatch" : ""; | |
| const errors = data.errors.length > 0 ? "fatal" : ""; | |
| const buildError = data.buildError > 0 ? "build error" : ""; | |
| return `${data.log} ${data.date} ${mismatch} ${errors} ${buildError}`; | |
| @@ -78,8 +76,7 @@ function findNotMatched() { | |
| .filter(log => log && !log.test && log.date == "9/17") | |
| .length.filter(crash => { | |
| const data = summaryData.find(log => log.log === `replay-${crash}.log`); | |
| - const mismatch = | |
| - data.mismatch.length > 0 || data.mismatchInput.length > 0; | |
| + const mismatch = data.mismatch.length > 0 || data.mismatchInput.length > 0; | |
| const errors = data.errors.length > 0; | |
| const buildError = data.buildError > 0; | |
| return !mismatch && !errors && !buildError; | |
| diff --git a/src/processing/logs/process.js b/src/processing/logs/process.js | |
| index 6f81b0d..458d5e2 100644 | |
| --- a/src/processing/logs/process.js | |
| +++ b/src/processing/logs/process.js | |
| @@ -17,9 +17,7 @@ function fatalError(data, chunk, lines) { | |
| if (chunk.includes("FatalError!")) { | |
| const fatalErrors = lines | |
| .filter(line => line.match(/FatalError! \[.*\] \[.*\] \[.*\] \[(.*)\]/)) | |
| - .map(line => | |
| - line.match(/FatalError! \[.*\] \[.*\] \[.*\] \[(.*)\]/)[1].trim() | |
| - ); | |
| + .map(line => line.match(/FatalError! \[.*\] \[.*\] \[.*\] \[(.*)\]/)[1].trim()); | |
| data.errors = [...(data.errors || []), ...fatalErrors]; | |
| } | |
| @@ -98,16 +96,11 @@ async function processLog(log, logData, skipSeenLogs) { | |
| } | |
| async function processLogs(skipSeenLogs = true) { | |
| - const logs = fs | |
| - .readdirSync("../../../logs") | |
| - .filter(log => log.match(/replay-/)); | |
| + const logs = fs.readdirSync("../../../logs").filter(log => log.match(/replay-/)); | |
| let logData = skipSeenLogs ? summaryData : []; | |
| await Promise.all(logs.map(log => processLog(log, logData, skipSeenLogs))); | |
| logData = _.sortBy(logData, l => l.dateStr); | |
| - fs.writeFileSync( | |
| - "../../../triage/logs-summary.json", | |
| - JSON.stringify(logData, null, 2) | |
| - ); | |
| + fs.writeFileSync("../../../triage/logs-summary.json", JSON.stringify(logData, null, 2)); | |
| } | |
| function updateLogs() { | |
| diff --git a/src/processing/logs/query.js b/src/processing/logs/query.js | |
| index f7d6049..c8d8f20 100644 | |
| --- a/src/processing/logs/query.js | |
| +++ b/src/processing/logs/query.js | |
| @@ -62,9 +62,7 @@ function summarizeMismatchInput() { | |
| const logsByMismatch = mismatchErrors | |
| .map(error => { | |
| const failedLogs = data | |
| - .filter( | |
| - log => log.mismatchInput.filter(m => m.includes(error)).length > 0 | |
| - ) | |
| + .filter(log => log.mismatchInput.filter(m => m.includes(error)).length > 0) | |
| .flat(); | |
| const logs = failedLogs.map(l => `${l.log} (${l.date})`).join("\n"); | |
| diff --git a/src/processing/replayNodeTests.js b/src/processing/replayNodeTests.js | |
| index 4c984ae..b2bc654 100644 | |
| --- a/src/processing/replayNodeTests.js | |
| +++ b/src/processing/replayNodeTests.js | |
| @@ -11,10 +11,7 @@ | |
| const fs = require("fs"); | |
| const { defer, waitForTime } = require("../shared/utils"); | |
| -const { | |
| - killContainers, | |
| - killMatchingProcesses, | |
| -} = require("../shared/instanceUtils"); | |
| +const { killContainers, killMatchingProcesses } = require("../shared/instanceUtils"); | |
| const { spawn } = require("child_process"); | |
| const { replayRecording } = require("./replayRecording"); | |
| @@ -29,9 +26,7 @@ process.on("unhandledRejection", error => { | |
| killContainers(); | |
| -const { todoFile, doneFile, failedFile } = JSON.parse( | |
| - fs.readFileSync(process.argv[2]) | |
| -); | |
| +const { todoFile, doneFile, failedFile } = JSON.parse(fs.readFileSync(process.argv[2])); | |
| const filter = process.argv[3]; | |
| const noTimeout = process.env.RECORD_REPLAY_NO_TIMEOUT; | |
| diff --git a/src/processing/triageLogs.js b/src/processing/triageLogs.js | |
| index 3fbfe47..079cd0e 100644 | |
| --- a/src/processing/triageLogs.js | |
| +++ b/src/processing/triageLogs.js | |
| @@ -121,10 +121,7 @@ function processLog(settings, log, includeAllLogs) { | |
| // If the log ends while the control process has been blocked for over a | |
| // second while waiting for a child process, treat it as an error. | |
| - if ( | |
| - waitingUntilPausedStart && | |
| - lastControlMessage - waitingUntilPausedStart >= 1 | |
| - ) { | |
| + if (waitingUntilPausedStart && lastControlMessage - waitingUntilPausedStart >= 1) { | |
| contents.push("Error: WaitUntilPaused at end of log"); | |
| hasError = true; | |
| } | |
| @@ -148,10 +145,7 @@ function errorWhitelisted(line) { | |
| ["browsing-context.js", "parentDocShell is null"], | |
| ["PictureInPictureChild.jsm", "this.contentWindow.windowRoot is null"], | |
| ["SessionStore.jsm", "subject.QueryInterface is not a function"], | |
| - [ | |
| - "parser-worker.js", | |
| - "This experimental syntax requires enabling the parser plugin", | |
| - ], | |
| + ["parser-worker.js", "This experimental syntax requires enabling the parser plugin"], | |
| ["network-response-listener.js", "NS_ERROR_FAILURE"], | |
| ["resource/core.js", "already exists, cannot insert"], | |
| ["ContentDOMReference.jsm", "nsIFinalizationWitnessService.make"], | |
| @@ -274,9 +268,7 @@ ManifestCounter.prototype = { | |
| }, | |
| matchesManifest(kind, formatted) { | |
| - return ( | |
| - formatted.startsWith(kind) || formatted.startsWith(`{"kind":"${kind}"`) | |
| - ); | |
| + return formatted.startsWith(kind) || formatted.startsWith(`{"kind":"${kind}"`); | |
| }, | |
| newLine(log, line) { | |
| @@ -317,25 +309,13 @@ const gStatCounters = [ | |
| // UI process counters. | |
| // Time taken by the debugger to pause after issuing a command. | |
| - new StatCounter( | |
| - "PauseAfterCommand", | |
| - "Debugger CommandStart", | |
| - "Debugger PAUSED" | |
| - ), | |
| + new StatCounter("PauseAfterCommand", "Debugger CommandStart", "Debugger PAUSED"), | |
| // Time taken by the debugger to show a selected location after pausing. | |
| - new StatCounter( | |
| - "SelectLocation", | |
| - "Debugger PAUSED", | |
| - "Debugger SET_SELECTED_LOCATION" | |
| - ), | |
| + new StatCounter("SelectLocation", "Debugger PAUSED", "Debugger SET_SELECTED_LOCATION"), | |
| // Time taken by the debugger to load frames after pausing. | |
| new StatCounter("LoadFrames", "Debugger PAUSED", "Debugger FETCHED_FRAMES"), | |
| // Time taken by the debugger to generate inline previews after pausing. | |
| - new StatCounter( | |
| - "InlinePreviews", | |
| - "Debugger PAUSED", | |
| - "Debugger ADD_INLINE_PREVIEW" | |
| - ), | |
| + new StatCounter("InlinePreviews", "Debugger PAUSED", "Debugger ADD_INLINE_PREVIEW"), | |
| // Time taken by the debugger to expand scope nodes. | |
| new StatCounter( | |
| "DebuggerExpandNode", | |
| @@ -421,11 +401,7 @@ const gStatCounters = [ | |
| "WebConsole.evaluateJSAsync End" | |
| ), | |
| // Time taken to load mouse targets for the inspector highlighter. | |
| - new StatCounter( | |
| - "LoadMouseTargets", | |
| - "LoadMouseTargets Start", | |
| - "LoadMouseTargets End" | |
| - ), | |
| + new StatCounter("LoadMouseTargets", "LoadMouseTargets Start", "LoadMouseTargets End"), | |
| // Long running tasks in the middleman process. | |
| new OneLineStatCounter("LongControlTask", /Control.*?LongTask (.*)/), | |
| @@ -435,18 +411,11 @@ const gStatCounters = [ | |
| new ManifestCounter("PauseData", "getPauseData"), | |
| // Time spent by replaying processes to run to their target point before | |
| // generating pause data. | |
| - new ManifestCounter( | |
| - "RunToPointBeforePauseData", | |
| - "runToPoint", | |
| - "getPauseData" | |
| - ), | |
| + new ManifestCounter("RunToPointBeforePauseData", "runToPoint", "getPauseData"), | |
| // Time spent by replaying processes to evaluate logpoints. | |
| new ManifestCounter("EvaluateLogpoint", "HitLogpoint"), | |
| // Time spent by replaying processes getting mouse targets. | |
| - new ManifestCounter( | |
| - "LoadMouseTargetsReplay", | |
| - "DebuggerRequest:getMouseTargets" | |
| - ), | |
| + new ManifestCounter("LoadMouseTargetsReplay", "DebuggerRequest:getMouseTargets"), | |
| // Time spent by the root replaying process to query scan data. | |
| new ManifestCounter("FindFrameSteps", "findFrameSteps"), | |
| new ManifestCounter("PickExecutionPoint", "pickExecutionPoint"), | |
| diff --git a/src/protocol/errors.js b/src/protocol/errors.js | |
| index e590755..9cb1532 100644 | |
| --- a/src/protocol/errors.js | |
| +++ b/src/protocol/errors.js | |
| @@ -26,8 +26,7 @@ const Errors = { | |
| UnexpectedPauseId: "Message should not have a pauseId", | |
| UnknownAnalysis: "Unknown analysis ID", | |
| AnalysisRunning: "Analysis has started running", | |
| - MultipleAnalysisSessions: | |
| - "Running analysis in multiple sessions is not supported yet", | |
| + MultipleAnalysisSessions: "Running analysis in multiple sessions is not supported yet", | |
| EmptyAnalysisDomain: "No execution points specified for analysis", | |
| AnalysisNotRunning: "Analysis has not started running", | |
| NotRecordingResource: "Resource not available to recording", | |
| diff --git a/src/protocol/socket.js b/src/protocol/socket.js | |
| index 43cb291..e834a52 100644 | |
| --- a/src/protocol/socket.js | |
| +++ b/src/protocol/socket.js | |
| @@ -81,9 +81,7 @@ ProtocolSocket.prototype = { | |
| try { | |
| data = JSON.parse(msg.toString()); | |
| } catch (e) { | |
| - console.error( | |
| - `Error: Could not parse message: ${JSON.stringify(msg)} ${e}` | |
| - ); | |
| + console.error(`Error: Could not parse message: ${JSON.stringify(msg)} ${e}`); | |
| this.reportError(null, null, Errors.ParseError); | |
| return; | |
| } | |
| @@ -133,9 +131,7 @@ ProtocolSocket.prototype = { | |
| const idkey = `${msg.sessionId}:${msg.id}`; | |
| - log( | |
| - `HandleMessage Start ${msg.id} ${msg.sessionId} ${msg.pauseId} ${msg.method}` | |
| - ); | |
| + log(`HandleMessage Start ${msg.id} ${msg.sessionId} ${msg.pauseId} ${msg.method}`); | |
| // Make sure that messages with a pause ID are processed in FIFO order. | |
| // These are sent to the replaying process synchronously, and the replaying | |
| @@ -165,14 +161,8 @@ ProtocolSocket.prototype = { | |
| } catch (e) { | |
| // Errors when handling messages are OK if the session was destroyed while | |
| // handling the message. | |
| - if ( | |
| - !msg.sessionId || | |
| - !this.isValidSession || | |
| - this.isValidSession(msg.sessionId) | |
| - ) { | |
| - log( | |
| - `Error: Message handler ${msg.method} threw an exception: ${e} ${e.stack}` | |
| - ); | |
| + if (!msg.sessionId || !this.isValidSession || this.isValidSession(msg.sessionId)) { | |
| + log(`Error: Message handler ${msg.method} threw an exception: ${e} ${e.stack}`); | |
| } | |
| } | |
| @@ -244,13 +234,7 @@ ProtocolSocket.prototype = { | |
| return null; | |
| } | |
| - const handler = new MessageHandler( | |
| - this, | |
| - id, | |
| - sessionId, | |
| - pauseId, | |
| - params || {} | |
| - ); | |
| + const handler = new MessageHandler(this, id, sessionId, pauseId, params || {}); | |
| if (!typeCheckMessage(handler, method, sessionId, pauseId, params || {})) { | |
| return null; | |
| } | |
| diff --git a/src/protocol/typeCheck.js b/src/protocol/typeCheck.js | |
| index 765367e..4b657f7 100644 | |
| --- a/src/protocol/typeCheck.js | |
| +++ b/src/protocol/typeCheck.js | |
| @@ -198,14 +198,7 @@ exports.typeCheckMessage = (handler, method, sessionId, pauseId, params) => { | |
| return false; | |
| } | |
| - if ( | |
| - !typeCheckValueList( | |
| - reportError, | |
| - info.domain, | |
| - info.command.parameters, | |
| - params | |
| - ) | |
| - ) { | |
| + if (!typeCheckValueList(reportError, info.domain, info.command.parameters, params)) { | |
| return false; | |
| } | |
| @@ -232,12 +225,7 @@ exports.typeCheckMessageResult = (handler, method, result) => { | |
| return false; | |
| } | |
| - return typeCheckValueList( | |
| - reportError, | |
| - info.domain, | |
| - info.command.returns, | |
| - result | |
| - ); | |
| + return typeCheckValueList(reportError, info.domain, info.command.returns, result); | |
| }; | |
| exports.typeCheckEvent = (method, sessionId, params) => { | |
| @@ -256,14 +244,7 @@ exports.typeCheckEvent = (method, sessionId, params) => { | |
| return false; | |
| } | |
| - if ( | |
| - !typeCheckValueList( | |
| - reportError, | |
| - info.domain, | |
| - info.command.parameters, | |
| - params | |
| - ) | |
| - ) { | |
| + if (!typeCheckValueList(reportError, info.domain, info.command.parameters, params)) { | |
| return false; | |
| } | |
| diff --git a/src/shared/config.js b/src/shared/config.js | |
| index 85e6e32..29a6582 100644 | |
| --- a/src/shared/config.js | |
| +++ b/src/shared/config.js | |
| @@ -61,10 +61,7 @@ exports.systemLibraries = ["libc++.dylib", "libsystem_c.dylib"]; | |
| // When unpacking a gecko DMG, possible subdirectories where the installation | |
| // can be found. | |
| -exports.installDirectoryPaths = [ | |
| - "Replay/Replay.app", | |
| - "Web Replay/Web Replay.app", | |
| -]; | |
| +exports.installDirectoryPaths = ["Replay/Replay.app", "Web Replay/Web Replay.app"]; | |
| // Local file where the dispatcher keeps its current status. See also crashServer.js | |
| // and updateServer.js | |
| @@ -81,8 +78,7 @@ exports.awsPrivateKey = "dispatch"; | |
| // IAM profile and ARN to use for replayer instances. | |
| exports.awsIamProfile = "full_s3_access"; | |
| -exports.awsIamProfileArn = | |
| - "arn:aws:iam::165324622525:instance-profile/full_s3_access"; | |
| +exports.awsIamProfileArn = "arn:aws:iam::165324622525:instance-profile/full_s3_access"; | |
| // Object file directory when building gecko-dev | |
| exports.objectDirectory = "rr-opt"; | |
| diff --git a/src/shared/instanceUtils.js b/src/shared/instanceUtils.js | |
| index 2a5c285..013a006 100644 | |
| --- a/src/shared/instanceUtils.js | |
| +++ b/src/shared/instanceUtils.js | |
| @@ -154,9 +154,7 @@ function extractBuildId(buf) { | |
| function readContainers() { | |
| const containers = []; | |
| try { | |
| - const lines = spawnSync("docker", ["ps", "-a"]) | |
| - .stdout.toString() | |
| - .split("\n"); | |
| + const lines = spawnSync("docker", ["ps", "-a"]).stdout.toString().split("\n"); | |
| for (const line of lines) { | |
| if (line.includes("CONTAINER ID")) { | |
| continue; | |
| diff --git a/src/shared/logger.js b/src/shared/logger.js | |
| index b5532c7..42bd3eb 100644 | |
| --- a/src/shared/logger.js | |
| +++ b/src/shared/logger.js | |
| @@ -26,9 +26,7 @@ if (process.env.ENV !== "production") { | |
| const formatMeta = meta => { | |
| const splat = meta[Symbol.for("splat")]; | |
| if (splat && splat.length) { | |
| - return splat.length === 1 | |
| - ? JSON.stringify(splat[0]) | |
| - : JSON.stringify(splat); | |
| + return splat.length === 1 ? JSON.stringify(splat[0]) : JSON.stringify(splat); | |
| } | |
| return ""; | |
| }; | |
| diff --git a/src/shared/restart.js b/src/shared/restart.js | |
| index 5a9c283..a8c4473 100644 | |
| --- a/src/shared/restart.js | |
| +++ b/src/shared/restart.js | |
| @@ -14,13 +14,9 @@ const { spawn } = require("child_process"); | |
| if (process.argv[2] != "@NOHUP@") { | |
| // Respawn the process in the background. | |
| - spawn( | |
| - process.argv[0], | |
| - [process.argv[1], "@NOHUP@", ...process.argv.slice(2)], | |
| - { | |
| - stdio: "inherit", | |
| - } | |
| - ).unref(); | |
| + spawn(process.argv[0], [process.argv[1], "@NOHUP@", ...process.argv.slice(2)], { | |
| + stdio: "inherit", | |
| + }).unref(); | |
| console.log("Restart process spawned, exiting..."); | |
| process.exit(0); | |
| } | |
| diff --git a/src/shared/utils.js b/src/shared/utils.js | |
| index a6246ee..8f3e3de 100644 | |
| --- a/src/shared/utils.js | |
| +++ b/src/shared/utils.js | |
| @@ -342,14 +342,7 @@ const gDOMProperties = { | |
| ], | |
| HTMLStyleElement: ["textContent"], | |
| HTMLIFrameElement: ["contentWindow"], | |
| - Window: [ | |
| - "location", | |
| - "frameElement", | |
| - "windowUtils", | |
| - "scrollX", | |
| - "scrollY", | |
| - "document", | |
| - ], | |
| + Window: ["location", "frameElement", "windowUtils", "scrollX", "scrollY", "document"], | |
| XPCWrappedNative_NoHelper: [ | |
| // WindowUtils | |
| "fullZoom", | |
| @@ -712,10 +705,7 @@ function babelIdentifierIsVariable(path) { | |
| // There doesn't seem to be a way to distinguish the two cases other than | |
| // looking at the context in which they are used. | |
| - if ( | |
| - path.parent.type == "MemberExpression" && | |
| - path.parent.property == path.node | |
| - ) { | |
| + if (path.parent.type == "MemberExpression" && path.parent.property == path.node) { | |
| return false; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment