From d52357f283ae8ceacbdc9a93ba9f2355d64b7773 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Fri, 22 Dec 2017 18:33:29 +0100 Subject: [PATCH] Bug 1426462 - Update Debugger Frontend (12-20). r=jdescottes MozReview-Commit-ID: LU8UG988kll --- devtools/client/debugger/new/README.mozilla | 2 +- devtools/client/debugger/new/debugger.css | 41 +- devtools/client/debugger/new/debugger.js | 4999 +++++++++-------- devtools/client/debugger/new/parser-worker.js | 579 +- .../debugger/new/pretty-print-worker.js | 4 +- devtools/client/debugger/new/search-worker.js | 2662 +-------- .../mochitest/browser_dbg-editor-highlight.js | 20 +- .../test/mochitest/browser_dbg-minified.js | 14 +- .../new/test/mochitest/browser_dbg-outline.js | 2 +- .../new/test/mochitest/browser_dbg-reload.js | 21 +- .../new/test/mochitest/examples/doc-asm.html | 5 +- .../test/mochitest/examples/doc-async.html | 5 +- .../examples/doc-content-script-sources.html | 5 +- .../examples/doc-debugger-statements.html | 3 + .../mochitest/examples/doc-exceptions.html | 3 + .../test/mochitest/examples/doc-frames.html | 3 + .../test/mochitest/examples/doc-iframes.html | 3 + .../test/mochitest/examples/doc-minified.html | 5 +- .../mochitest/examples/doc-minified2.html | 5 +- .../mochitest/examples/doc-return-values.html | 3 + .../mochitest/examples/doc-script-mutate.html | 5 +- .../examples/doc-script-switching.html | 5 +- .../test/mochitest/examples/doc-scripts.html | 5 +- .../examples/doc-sourcemap-bogus.html | 5 +- .../mochitest/examples/doc-sourcemaps.html | 5 +- .../mochitest/examples/doc-sourcemaps2.html | 3 + .../mochitest/examples/doc-sourcemaps3.html | 3 + .../test/mochitest/examples/doc-sources.html | 5 +- .../examples/doc-wasm-sourcemaps.html | 5 +- .../debugger/new/test/mochitest/head.js | 6 + .../client/themes/images/debugger/react.svg | 5 +- 31 files changed, 2897 insertions(+), 5539 deletions(-) diff --git a/devtools/client/debugger/new/README.mozilla b/devtools/client/debugger/new/README.mozilla index 81fa5d6116bb..faa8e9fd1060 100644 --- a/devtools/client/debugger/new/README.mozilla +++ b/devtools/client/debugger/new/README.mozilla @@ -1,7 +1,7 @@ This is the debugger.html project output. See https://github.com/devtools-html/debugger.html -Taken from upstream commit: 53faca589b021f01c7af5980c8c0e98b58c02e4c +Taken from upstream commit: f98e56ff661460044382df55bd33cea601e093f0 Packages: - babel-plugin-transform-es2015-modules-commonjs @6.26.0 diff --git a/devtools/client/debugger/new/debugger.css b/devtools/client/debugger/new/debugger.css index d23c286570f7..273e9f1b2e63 100644 --- a/devtools/client/debugger/new/debugger.css +++ b/devtools/client/debugger/new/debugger.css @@ -428,24 +428,15 @@ body { } .modal { + display: flex; width: 80%; - height: auto; + max-height: 80vh; overflow-y: auto; background-color: var(--theme-toolbar-background); transition: transform 150ms cubic-bezier(0.07, 0.95, 0, 1); box-shadow: 1px 1px 3px 1px var(--popup-shadow-color); } -.modal .input-wrapper { - display: flex; - justify-content: center; -} - -.modal .result-list { - height: calc(100% - 28px); - overflow-y: auto; -} - .modal.entering, .modal.exited { transform: translateY(-101%); @@ -454,20 +445,17 @@ body { .modal.entered, .modal.exiting { transform: translateY(5px); + flex-direction: column; } -/* This rule is active when the screen is not short and narrow */ -@media (min-width: 580px) and (min-height: 340px) { +/* This rule is active when the screen is not narrow */ +@media (min-width: 580px) { .modal { width: 50%; } } @media (min-height: 340px) { - .modal { - height: auto; - max-height: 80vh; - } .modal.entered, .modal.exiting { transform: translateY(30px); @@ -1757,6 +1745,10 @@ html .toggle-button.end.vertical svg { justify-content: center; } +.source-footer > button.action:hover { + background: var(--theme-toolbar-background-hover); +} + .source-footer > .commands > button.action:focus { outline: none; } @@ -2279,12 +2271,17 @@ html[dir="rtl"] .arrow svg, .popover .preview-popup .header-container { width: 100%; - line-height: 20px; + line-height: 15px; display: flex; - flex-direction: column; + flex-direction: row; margin-bottom: 5px; } +.popover .preview-popup .immutable-logo { + width: 20px; + margin-right: 5px; +} + .popover .preview-popup .header-container h3 { margin: 0; margin-bottom: 5px; @@ -3325,7 +3322,7 @@ img.resume { border-bottom: none; background-color: var(--theme-body-background); border-top: 1px solid var(--theme-splitter-color); - flex: 0 0 27px; + flex: 0 0 26px; } .command-bar.bottom { @@ -3810,6 +3807,7 @@ html .welcomebox .toggle-button-end.collapsed { padding: 0px; overflow: auto; width: calc(100% - 1px); /* 1px fixes the hidden right border */ + background: var(--theme-body-background); } .result-list * { @@ -3822,7 +3820,6 @@ html .welcomebox .toggle-button-end.collapsed { padding: 4px 13px; display: flex; justify-content: space-between; - border: 1px solid transparent; } .result-list.big li { @@ -3836,7 +3833,7 @@ html .welcomebox .toggle-button-end.collapsed { } .result-list li.selected { - border-color: var(--theme-selection-background); + background: var(--accordion-header-background); } .result-list.small li.selected { diff --git a/devtools/client/debugger/new/debugger.js b/devtools/client/debugger/new/debugger.js index d2d14cb119a3..497c1230a0b2 100644 --- a/devtools/client/debugger/new/debugger.js +++ b/devtools/client/debugger/new/debugger.js @@ -10309,7 +10309,7 @@ if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) { /* 247 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 248 */ @@ -10653,14 +10653,14 @@ function isSlowBuffer (obj) { /* 256 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 257 */, /* 258 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 259 */ @@ -12298,7 +12298,7 @@ module.exports = "" /***/ }), /* 352 */ @@ -12334,7 +12334,7 @@ module.exports = "" /***/ }), /* 358 */ @@ -12364,7 +12364,7 @@ module.exports = "" /***/ }), /* 363 */ @@ -12418,7 +12418,7 @@ module.exports = "" /***/ }), /* 372 */ @@ -12926,7 +12926,7 @@ module.exports = function(module) { /* 806 */ /***/ (function(module, exports) { -module.exports = "dojo_square" +module.exports = "dojo_square" /***/ }), /* 807 */, @@ -14067,13 +14067,13 @@ if (!String.prototype.codePointAt) { /* 919 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 920 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 921 */, @@ -14532,7 +14532,7 @@ function createStructuredSelector(selectors) { /* 997 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 998 */ @@ -14544,37 +14544,37 @@ module.exports = "" /***/ }), /* 1000 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1001 */ /***/ (function(module, exports) { -module.exports = "icon" +module.exports = "icon" /***/ }), /* 1002 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1003 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1004 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1005 */, @@ -14618,19 +14618,19 @@ module.exports = "" +module.exports = "" /***/ }), /* 1044 */ /***/ (function(module, exports) { -module.exports = "Created with Sketch." +module.exports = "Created with Sketch." /***/ }), /* 1045 */ /***/ (function(module, exports) { -module.exports = "Created with Sketch." +module.exports = "Created with Sketch." /***/ }), /* 1046 */, @@ -14707,19 +14707,19 @@ module.exports = "" +module.exports = "" /***/ }), /* 1118 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1119 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1120 */, @@ -14794,7 +14794,7 @@ module.exports = "image/svg+xml" /***/ }), /* 1175 */, @@ -15966,7 +15966,7 @@ function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, dis /* 1233 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1234 */, @@ -16028,7 +16028,7 @@ module.exports = "" +module.exports = "" /***/ }), /* 1291 */, @@ -16425,11 +16425,11 @@ var _isSelectedFrameVisible = __webpack_require__(1505); var _isSelectedFrameVisible2 = _interopRequireDefault(_isSelectedFrameVisible); -var _getCallStackFrames = __webpack_require__(1771); +var _getCallStackFrames = __webpack_require__(1780); var _getCallStackFrames2 = _interopRequireDefault(_getCallStackFrames); -var _visibleSelectedFrame = __webpack_require__(1772); +var _visibleSelectedFrame = __webpack_require__(1781); var _visibleSelectedFrame2 = _interopRequireDefault(_visibleSelectedFrame); @@ -16941,9 +16941,13 @@ var _toolbox = __webpack_require__(1534); var toolbox = _interopRequireWildcard(_toolbox); +var _preview = __webpack_require__(1787); + +var preview = _interopRequireWildcard(_preview); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } -exports.default = _extends({}, navigation, breakpoints, expressions, eventListeners, sources, pause, ui, fileSearch, ast, coverage, projectTextSearch, quickOpen, sourceTree, loadSourceText, debuggee, toolbox); +exports.default = _extends({}, navigation, breakpoints, expressions, eventListeners, sources, pause, ui, fileSearch, ast, coverage, projectTextSearch, quickOpen, sourceTree, loadSourceText, debuggee, toolbox, preview); /***/ }), /* 1355 */ @@ -16968,6 +16972,15 @@ Object.defineProperty(exports, "__esModule", { }); exports.isLoading = exports.isLoaded = exports.getMode = exports.getSourceLineCount = exports.getSourcePath = exports.getFileURL = exports.getFilenameFromURL = exports.getFilename = exports.getRawSourceURL = exports.getPrettySourceURL = exports.shouldPrettyPrint = exports.isThirdParty = exports.isPretty = exports.isJavaScript = exports.isMinified = undefined; +var _isMinified = __webpack_require__(1779); + +Object.defineProperty(exports, "isMinified", { + enumerable: true, + get: function () { + return _isMinified.isMinified; + } +}); + var _devtoolsSourceMap = __webpack_require__(1360); var _utils = __webpack_require__(1366); @@ -16982,15 +16995,6 @@ var _url = __webpack_require__(334); * @memberof utils/source * @static */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -/** - * Utils for working with Source URLs - * @module utils/source - */ - function trimUrlQuery(url) { const length = url.length; const q1 = url.indexOf("?"); @@ -17008,8 +17012,8 @@ function shouldPrettyPrint(source) { const _isPretty = isPretty(source); const _isJavaScript = isJavaScript(source); - const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.id); - const hasSourceMap = source.sourceMapURL; + const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.get("id")); + const hasSourceMap = source.get("sourceMapURL"); if (_isPretty || isOriginal || hasSourceMap || !_isJavaScript) { return false; @@ -17029,7 +17033,9 @@ function shouldPrettyPrint(source) { * @static */ function isJavaScript(source) { - return source.url && /\.(jsm|js)?$/.test(trimUrlQuery(source.url)) || !!(source.contentType && source.contentType.includes("javascript")); + const url = source.get("url"); + const contentType = source.get("contentType"); + return url && /\.(jsm|js)?$/.test(trimUrlQuery(url)) || !!(contentType && contentType.includes("javascript")); } /** @@ -17037,15 +17043,17 @@ function isJavaScript(source) { * @static */ function isPretty(source) { - return source.url ? /formatted$/.test(source.url) : false; + const url = source.get("url"); + return url ? /formatted$/.test(url) : false; } function isThirdParty(source) { - if (!source || !source.url) { + const url = source.get("url"); + if (!source || !url) { return false; } - return !!source.url.match(/(node_modules|bower_components)/); + return !!url.match(/(node_modules|bower_components)/); } /** @@ -17134,12 +17142,12 @@ const contentTypeModeMap = { "text/html": { name: "htmlmixed" } }; -function getSourcePath(source) { - if (!source.url) { +function getSourcePath(url) { + if (!url) { return ""; } - const { path, href } = (0, _url.parse)(source.url); + const { path, href } = (0, _url.parse)(url); // for URLs like "about:home" the path is null so we pass the full href return path || href; } @@ -17156,12 +17164,6 @@ function getSourceLineCount(source) { return source.text != undefined ? source.text.split("\n").length : 0; } -// Used to detect minification for automatic pretty printing -const SAMPLE_SIZE = 50; -const INDENT_COUNT_THRESHOLD = 5; -const CHARACTER_LIMIT = 250; -const _minifiedCache = new Map(); - /** * * Checks if a source is minified based on some heuristics @@ -17172,46 +17174,6 @@ const _minifiedCache = new Map(); * @static */ -function isMinified(key, text) { - if (!key || !text) { - return false; - } - - if (_minifiedCache.has(key)) { - return _minifiedCache.get(key); - } - - let lineEndIndex = 0; - let lineStartIndex = 0; - let lines = 0; - let indentCount = 0; - let overCharLimit = false; - - // Strip comments. - text = text.replace(/\/\*[\S\s]*?\*\/|\/\/(.+|\n)/g, ""); - - while (lines++ < SAMPLE_SIZE) { - lineEndIndex = text.indexOf("\n", lineStartIndex); - if (lineEndIndex == -1) { - break; - } - if (/^\s+/.test(text.slice(lineStartIndex, lineEndIndex))) { - indentCount++; - } - // For files with no indents but are not minified. - if (lineEndIndex - lineStartIndex > CHARACTER_LIMIT) { - overCharLimit = true; - break; - } - lineStartIndex = lineEndIndex + 1; - } - - const minified = indentCount / lines * 100 < INDENT_COUNT_THRESHOLD || overCharLimit; - - _minifiedCache.set(key, minified); - return minified; -} - /** * * Returns Code Mirror mode for source content type @@ -17280,13 +17242,12 @@ function getMode(source, sourceMetaData) { } function isLoaded(source) { - return source.loadedState === "loaded"; + return source.get("loadedState") === "loaded"; } function isLoading(source) { - return source.loadedState === "loading"; + return source.get("loadedState") === "loading"; } -exports.isMinified = isMinified; exports.isJavaScript = isJavaScript; exports.isPretty = isPretty; exports.isThirdParty = isThirdParty; @@ -17340,9 +17301,7 @@ var sourceDocumentUtils = _interopRequireWildcard(_sourceDocuments); var _source = __webpack_require__(1356); -var _expression = __webpack_require__(1525); - -var expressionUtils = _interopRequireWildcard(_expression); +var _getTokenLocation = __webpack_require__(1784); var _sourceSearch = __webpack_require__(1526); @@ -17365,7 +17324,6 @@ function shouldShowPrettyPrint(selectedSource) { return false; } - selectedSource = selectedSource.toJS(); return (0, _source.shouldPrettyPrint)(selectedSource); } @@ -17483,7 +17441,7 @@ function getSourceLocationFromMouseEvent(editor, selectedLocation, e) { }; } -module.exports = _extends({}, expressionUtils, sourceDocumentUtils, sourceSearchUtils, _devtoolsSourceEditor.SourceEditorUtils, { +module.exports = _extends({}, sourceDocumentUtils, sourceSearchUtils, _devtoolsSourceEditor.SourceEditorUtils, { createEditor, isWasm: _wasm.isWasm, toEditorLine, @@ -17498,7 +17456,8 @@ module.exports = _extends({}, expressionUtils, sourceDocumentUtils, sourceSearch markText, lineAtHeight, getSourceLocationFromMouseEvent, - resizeBreakpointGutter: _ui.resizeBreakpointGutter + resizeBreakpointGutter: _ui.resizeBreakpointGutter, + getTokenLocation: _getTokenLocation.getTokenLocation }); /***/ }), @@ -18032,7 +17991,7 @@ function createPendingBreakpoint(bp) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.replaceOriginalVariableName = exports.isReactComponent = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.getEmptyLines = exports.getNextStep = exports.clearASTs = exports.clearScopes = exports.clearSymbols = exports.getOutOfScopeLocations = exports.getVariablesInScope = exports.getScopes = exports.getSymbols = exports.getClosestExpression = exports.stopParserWorker = exports.startParserWorker = undefined; +exports.replaceOriginalVariableName = exports.isReactComponent = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.getEmptyLines = exports.getNextStep = exports.clearASTs = exports.clearScopes = exports.clearSymbols = exports.findOutOfScopeLocations = exports.getVariablesInScope = exports.getScopes = exports.getSymbols = exports.getClosestExpression = exports.stopParserWorker = exports.startParserWorker = undefined; var _devtoolsUtils = __webpack_require__(1363); @@ -18048,7 +18007,7 @@ const getClosestExpression = exports.getClosestExpression = dispatcher.task("get const getSymbols = exports.getSymbols = dispatcher.task("getSymbols"); const getScopes = exports.getScopes = dispatcher.task("getScopes"); const getVariablesInScope = exports.getVariablesInScope = dispatcher.task("getVariablesInScope"); -const getOutOfScopeLocations = exports.getOutOfScopeLocations = dispatcher.task("getOutOfScopeLocations"); +const findOutOfScopeLocations = exports.findOutOfScopeLocations = dispatcher.task("findOutOfScopeLocations"); const clearSymbols = exports.clearSymbols = dispatcher.task("clearSymbols"); const clearScopes = exports.clearScopes = dispatcher.task("clearScopes"); const clearASTs = exports.clearASTs = dispatcher.task("clearASTs"); @@ -18374,17 +18333,12 @@ function update(state = initialState(), action) { switch (action.type) { case "ADD_SOURCE": { - const source = action.source; - return updateSource(state, source); + return updateSource(state, action.source); } case "ADD_SOURCES": { - action.sources.forEach(source => { - state = state.mergeIn(["sources", source.id], source); - }); - - return state; + return action.sources.reduce((newState, source) => updateSource(newState, source), state); } case "SELECT_SOURCE": @@ -18443,9 +18397,6 @@ function update(state = initialState(), action) { } break; - case "TOGGLE_PRETTY_PRINT": - return setSourceTextProps(state, action); - case "NAVIGATE": const source = getSelectedSource({ sources: state }); const url = source && source.get("url"); @@ -18461,17 +18412,16 @@ function update(state = initialState(), action) { } function getTextPropsFromAction(action) { - const source = action.source; - const { value } = action; + const { value, sourceId } = action; if (action.status === "start") { - return { id: source.id, loadedState: "loading" }; + return { id: sourceId, loadedState: "loading" }; } else if (action.status === "error") { - return { id: source.id, error: action.error, loadedState: "loaded" }; + return { id: sourceId, error: action.error, loadedState: "loaded" }; } return { text: value.text, - id: source.id, + id: sourceId, contentType: value.contentType, loadedState: "loaded" }; @@ -18717,7 +18667,7 @@ function isDirectory(url) { } function isNotJavaScript(source) { - const parsedUrl = (0, _url.parse)(source.url).pathname; + const parsedUrl = (0, _url.parse)(source.get("url")).pathname; if (!parsedUrl) { return false; } @@ -18727,7 +18677,7 @@ function isNotJavaScript(source) { } function isInvalidUrl(url, source) { - return IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || source.get("loadedState") === "loading" || !url.group || (0, _source.isPretty)(source.toJS()) || isNotJavaScript(source.toJS()); + return IGNORED_URLS.indexOf(url) != -1 || !source.get("url") || source.get("loadedState") === "loading" || !url.group || (0, _source.isPretty)(source) || isNotJavaScript(source); } function partIsFile(index, parts, url) { @@ -18960,7 +18910,7 @@ var _ui = __webpack_require__(1385); var _source2 = __webpack_require__(1356); -var _location = __webpack_require__(1774); +var _location = __webpack_require__(1783); var _createPrettySource = __webpack_require__(1523); @@ -18972,34 +18922,43 @@ var _editor = __webpack_require__(1358); var _sourceMaps = __webpack_require__(1397); +var _devtoolsSourceMap = __webpack_require__(1360); + var _selectors = __webpack_require__(1352); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // If a request has been made to show this source, go ahead and // select it. -async function checkSelectedSource(state, dispatch, source) { - const pendingLocation = (0, _selectors.getPendingSelectedLocation)(state); +function checkSelectedSource(source) { + return async ({ dispatch, getState }) => { + const pendingLocation = (0, _selectors.getPendingSelectedLocation)(getState()); - if (pendingLocation && !!source.url && pendingLocation.url === source.url) { - await dispatch(selectLocation(_extends({}, pendingLocation, { sourceId: source.id }))); - } + if (pendingLocation && !!source.url && pendingLocation.url === source.url) { + await dispatch(selectLocation(_extends({}, pendingLocation, { sourceId: source.id }))); + } + }; } -async function checkPendingBreakpoints(state, dispatch, sourceId) { - // source may have been modified by selectLocation - const source = (0, _selectors.getSource)(state, sourceId).toJS(); - const pendingBreakpoints = (0, _selectors.getPendingBreakpointsForSource)(state, source.url); - if (!pendingBreakpoints.size) { - return; - } +function checkPendingBreakpoints(sourceId) { + return async ({ dispatch, getState }) => { + // source may have been modified by selectLocation + const source = (0, _selectors.getSource)(getState(), sourceId); - // load the source text if there is a pending breakpoint for it - await dispatch((0, _loadSourceText.loadSourceText)(source)); - const pendingBreakpointsArray = pendingBreakpoints.valueSeq().toJS(); - for (const pendingBreakpoint of pendingBreakpointsArray) { - await dispatch((0, _breakpoints.syncBreakpoint)(sourceId, pendingBreakpoint)); - } + const pendingBreakpoints = (0, _selectors.getPendingBreakpointsForSource)(getState(), source.get("url")); + + if (!pendingBreakpoints.size) { + return; + } + + // load the source text if there is a pending breakpoint for it + await dispatch((0, _loadSourceText.loadSourceText)(source)); + + const pendingBreakpointsArray = pendingBreakpoints.valueSeq().toJS(); + for (const pendingBreakpoint of pendingBreakpointsArray) { + await dispatch((0, _breakpoints.syncBreakpoint)(sourceId, pendingBreakpoint)); + } + }; } /** @@ -19017,11 +18976,11 @@ function newSource(source) { dispatch({ type: "ADD_SOURCE", source }); if (_prefs.prefs.clientSourceMapsEnabled) { - await dispatch(loadSourceMap(source)); + dispatch(loadSourceMap(source)); } - await checkSelectedSource(getState(), dispatch, source); - await checkPendingBreakpoints(getState(), dispatch, source.id); + dispatch(checkSelectedSource(source)); + dispatch(checkPendingBreakpoints(source.id)); }; } @@ -19029,9 +18988,32 @@ function newSources(sources) { return async ({ dispatch, getState }) => { const filteredSources = sources.filter(source => !(0, _selectors.getSource)(getState(), source.id)); - for (const source of filteredSources) { - await dispatch(newSource(source)); + if (filteredSources.length == 0) { + return; } + + dispatch({ + type: "ADD_SOURCES", + sources: filteredSources + }); + + for (const source of filteredSources) { + dispatch(checkSelectedSource(source)); + dispatch(checkPendingBreakpoints(source.id)); + } + + return Promise.all(filteredSources.map(source => dispatch(loadSourceMap(source)))); + }; +} + +function createOriginalSource(originalUrl, generatedSource, sourceMaps) { + return { + url: originalUrl, + id: sourceMaps.generatedToOriginalId(generatedSource.id, originalUrl), + isPrettyPrinted: false, + isWasm: false, + isBlackBoxed: false, + loadedState: "unloaded" }; } @@ -19042,27 +19024,19 @@ function newSources(sources) { function loadSourceMap(generatedSource) { return async function ({ dispatch, getState, sourceMaps }) { const urls = await sourceMaps.getOriginalURLs(generatedSource); + if (!urls) { // If this source doesn't have a sourcemap, do nothing. return; } - const originalSources = urls.map(originalUrl => ({ - url: originalUrl, - id: sourceMaps.generatedToOriginalId(generatedSource.id, originalUrl), - isPrettyPrinted: false, - isWasm: false, - isBlackBoxed: false, - loadedState: "unloaded" - })); + const originalSources = urls.map(url => createOriginalSource(url, generatedSource, sourceMaps)); - dispatch({ type: "ADD_SOURCES", sources: originalSources }); - - await dispatch((0, _loadSourceText.loadSourceText)(generatedSource)); - originalSources.forEach(async source => { - await checkSelectedSource(getState(), dispatch, source); - checkPendingBreakpoints(getState(), dispatch, source.id); - }); + // TODO: check if this line is really needed, it introduces + // a lot of lag to the application. + const generatedSourceRecord = (0, _selectors.getSource)(getState(), generatedSource.id); + await dispatch((0, _loadSourceText.loadSourceText)(generatedSourceRecord)); + dispatch(newSources(originalSources)); }; } @@ -19103,9 +19077,9 @@ function selectSourceURL(url, options = {}) { * @static */ function selectSource(sourceId, tabIndex = "") { - return ({ dispatch }) => { + return async ({ dispatch }) => { const location = (0, _location.createLocation)({ sourceId }); - return dispatch(selectLocation(location, tabIndex)); + return await dispatch(selectLocation(location, tabIndex)); }; } @@ -19140,12 +19114,12 @@ function selectLocation(location, tabIndex = "") { tabIndex, location, [_promise.PROMISE]: (async () => { - await dispatch((0, _loadSourceText.loadSourceText)(source.toJS())); - await dispatch((0, _ast.setOutOfScopeLocations)()); - const src = (0, _selectors.getSource)(getState(), location.sourceId).toJS(); + await dispatch((0, _loadSourceText.loadSourceText)(source)); + dispatch((0, _ast.setOutOfScopeLocations)()); + const src = (0, _selectors.getSource)(getState(), location.sourceId); const { autoPrettyPrint } = _prefs.prefs; - if (autoPrettyPrint && (0, _source2.shouldPrettyPrint)(src) && (0, _source2.isMinified)(src.id, src.text)) { - await dispatch(togglePrettyPrint(src.id)); + if (autoPrettyPrint && (0, _source2.shouldPrettyPrint)(src) && (0, _source2.isMinified)(src)) { + await dispatch(togglePrettyPrint(src.get("id"))); } })() }); @@ -19164,7 +19138,7 @@ function jumpToMappedLocation(sourceLocation) { const source = (0, _selectors.getSource)(getState(), sourceLocation.sourceId); let pairedLocation; - if (sourceMaps.isOriginalId(sourceLocation.sourceId)) { + if ((0, _devtoolsSourceMap.isOriginalId)(sourceLocation.sourceId)) { pairedLocation = await (0, _sourceMaps.getGeneratedLocation)(getState(), source.toJS(), sourceLocation, sourceMaps); } else { pairedLocation = await sourceMaps.getOriginalLocation(sourceLocation, source.toJS()); @@ -19240,16 +19214,20 @@ function closeTabs(urls) { */ function togglePrettyPrint(sourceId) { return async ({ dispatch, getState, client, sourceMaps }) => { - const source = (0, _selectors.getSource)(getState(), sourceId).toJS(); + const source = (0, _selectors.getSource)(getState(), sourceId); - if (!source || !(0, _source2.isLoaded)(source)) { + if (!source) { return {}; } + if (!(0, _source2.isLoaded)(source)) { + await dispatch((0, _loadSourceText.loadSourceText)(source)); + } + (0, _assert2.default)(sourceMaps.isGeneratedId(sourceId), "Pretty-printing only allowed on generated sources"); const selectedLocation = (0, _selectors.getSelectedLocation)(getState()); - const url = (0, _source2.getPrettySourceURL)(source.url); + const url = (0, _source2.getPrettySourceURL)(source.get("url")); const prettySource = (0, _selectors.getSourceByURL)(getState(), url); const options = {}; @@ -19292,8 +19270,7 @@ function loadAllSources() { return async ({ dispatch, getState }) => { const sources = (0, _selectors.getSources)(getState()); const query = (0, _selectors.getTextSearchQuery)(getState()); - for (const [, src] of sources) { - const source = src.toJS(); + for (const [, source] of sources) { if ((0, _source2.isThirdParty)(source)) { continue; } @@ -19302,7 +19279,7 @@ function loadAllSources() { // If there is a current search query we search // each of the source texts as they get loaded if (query) { - await dispatch((0, _projectTextSearch.searchSource)(source.id, query)); + await dispatch((0, _projectTextSearch.searchSource)(source.get("id"), query)); } } }; @@ -20357,6 +20334,7 @@ function update(state = initialState(), action) { cursorPos, extra } = action.value; + return state.set("preview", { updating: false, expression, @@ -20392,14 +20370,16 @@ function update(state = initialState(), action) { // NOTE: we'd like to have the app state fully typed // https://github.com/devtools-html/debugger.html/blob/master/src/reducers/sources.js#L179-L185 + + +const emptySymbols = { variables: [], functions: [] }; function getSymbols(state, source) { - const emptySet = { variables: [], functions: [] }; if (!source) { - return emptySet; + return emptySymbols; } const symbols = state.ast.getIn(["symbols", source.id]); - return symbols || emptySet; + return symbols || emptySymbols; } function hasSymbols(state, source) { @@ -21115,19 +21095,6 @@ function update(state = State(), action) { const frameScopes = _extends({}, state.frameScopes, { [selectedFrameId]: scopes }); return _extends({}, state, { frameScopes }); - case "TOGGLE_PRETTY_PRINT": - if (action.status == "done") { - const frames = action.value.frames; - const pause = state.pause; - if (pause) { - pause.frame = frames[0]; - } - - return _extends({}, state, { pause, frames }); - } - - break; - case "BREAK_ON_NEXT": return _extends({}, state, { isWaitingOnBreak: true }); @@ -21909,36 +21876,17 @@ async function getMappedExpression({ sourceMaps }, generatedLocation, expression Object.defineProperty(exports, "__esModule", { value: true }); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - exports.setSourceMetaData = setSourceMetaData; exports.setSymbols = setSymbols; exports.setEmptyLines = setEmptyLines; exports.setOutOfScopeLocations = setOutOfScopeLocations; -exports.clearPreview = clearPreview; -exports.setPreview = setPreview; var _selectors = __webpack_require__(1352); -var _expressions = __webpack_require__(1398); - -var _setInScopeLines = __webpack_require__(1773); - -var _promise = __webpack_require__(1653); +var _setInScopeLines = __webpack_require__(1782); var _parser = __webpack_require__(1365); -var _ast = __webpack_require__(1638); - -var _devtoolsSourceMap = __webpack_require__(1360); - -const extraProps = { - react: { displayName: "this._reactInternalInstance.getName()" } -}; - function setSourceMetaData(sourceId) { return async ({ dispatch, getState }) => { const sourceRecord = (0, _selectors.getSource)(getState(), sourceId); @@ -21960,7 +21908,9 @@ function setSourceMetaData(sourceId) { } }); }; -} +} /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ function setSymbols(sourceId) { return async ({ dispatch, getState }) => { @@ -21970,18 +21920,13 @@ function setSymbols(sourceId) { } const source = sourceRecord.toJS(); + if (!source.text || source.isWasm || (0, _selectors.hasSymbols)(getState(), source)) { return; } const symbols = await (0, _parser.getSymbols)(source); - - dispatch({ - type: "SET_SYMBOLS", - source, - symbols - }); - + dispatch({ type: "SET_SYMBOLS", source, symbols }); dispatch(setEmptyLines(source.id)); dispatch(setSourceMetaData(source.id)); }; @@ -22019,7 +21964,7 @@ function setOutOfScopeLocations() { const source = (0, _selectors.getSource)(getState(), location.sourceId); - const locations = !location.line || !source ? null : await (0, _parser.getOutOfScopeLocations)(source.toJS(), location); + const locations = !location.line || !source ? null : await (0, _parser.findOutOfScopeLocations)(source.toJS(), location); dispatch({ type: "OUT_OF_SCOPE_LOCATIONS", @@ -22030,76 +21975,6 @@ function setOutOfScopeLocations() { }; } -function clearPreview() { - return ({ dispatch, getState, client }) => { - const currentSelection = (0, _selectors.getPreview)(getState()); - if (!currentSelection) { - return; - } - - return dispatch({ - type: "CLEAR_SELECTION" - }); - }; -} - -function setPreview(token, tokenPos, cursorPos) { - return async ({ dispatch, getState, client, sourceMaps }) => { - const currentSelection = (0, _selectors.getPreview)(getState()); - if (currentSelection && currentSelection.updating) { - return; - } - - await dispatch({ - type: "SET_PREVIEW", - [_promise.PROMISE]: async function () { - const source = (0, _selectors.getSelectedSource)(getState()); - const _symbols = await (0, _parser.getSymbols)(source.toJS()); - - const found = (0, _ast.findBestMatchExpression)(_symbols, tokenPos, token); - if (!found) { - return; - } - - let { expression, location } = found; - - if (!expression) { - return; - } - - const sourceId = source.get("id"); - if (location && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId)) { - const generatedLocation = await sourceMaps.getGeneratedLocation(_extends({}, location.start, { sourceId }), source.toJS()); - - expression = await (0, _expressions.getMappedExpression)({ sourceMaps }, generatedLocation, expression); - } - - const selectedFrame = (0, _selectors.getSelectedFrame)(getState()); - const { result } = await client.evaluate(expression, { - frameId: selectedFrame.id - }); - - const data = await client.evaluate(extraProps.react.displayName, { - frameId: selectedFrame.id - }); - - if (result === undefined) { - return; - } - - return { - expression, - result, - location, - tokenPos, - cursorPos, - extra: data && data.result - }; - }() - }); - }; -} - /***/ }), /* 1400 */ /***/ (function(module, exports, __webpack_require__) { @@ -22111,24 +21986,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -// eslint-disable-next-line max-len - +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; exports.updateFrameLocations = updateFrameLocations; -exports.updateScopeBindings = updateScopeBindings; exports.getPauseReason = getPauseReason; exports.getPausedPosition = getPausedPosition; exports.inDebuggerEval = inDebuggerEval; var _lodash = __webpack_require__(2); -var _parser = __webpack_require__(1365); - -var _updateScopeBindings = __webpack_require__(1775); +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ function updateFrameLocations(frames, sourceMaps) { if (!frames || frames.length == 0) { @@ -22141,19 +22010,6 @@ function updateFrameLocations(frames, sourceMaps) { })))); } -async function updateScopeBindings(scope, generatedLocation, originalLocation, { getLocationScopes, loadSourceText }) { - return (0, _updateScopeBindings.updateScopeBindings)(scope, generatedLocation, originalLocation, { - async getSourceMapsScopes(location) { - const astScopes = await (0, _parser.getScopes)(location); - return getLocationScopes(location, astScopes); - }, - async getOriginalSourceScopes(location) { - await loadSourceText(location.sourceId); - return (0, _parser.getScopes)(location); - } - }); -} - // Map protocol pause "why" reason to a valid L10N key // These are the known unhandled reasons: // "breakpointConditionThrown", "clientEvaluated" @@ -22848,7 +22704,7 @@ var _Svg = __webpack_require__(1359); var _Svg2 = _interopRequireDefault(_Svg); -var _CommandBarButton = __webpack_require__(1787); +var _CommandBarButton = __webpack_require__(1765); var _CommandBarButton2 = _interopRequireDefault(_CommandBarButton); @@ -23249,7 +23105,7 @@ module.exports = Grip; * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = __webpack_require__(0); -const InlineSVG = __webpack_require__(1793); +const InlineSVG = __webpack_require__(1790); const svg = { "arrow": __webpack_require__(1152), @@ -23317,7 +23173,7 @@ module.exports = function defer() { * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const { Menu, MenuItem } = __webpack_require__(1762); +const { Menu, MenuItem } = __webpack_require__(1768); function inToolbox() { return window.parent.document.documentURI == "about:devtools-toolbox"; @@ -24813,7 +24669,7 @@ async function prettyPrint({ source, url }) { return await _prettyPrint({ url, indent, - source: source.text + sourceText: source.get("text") }); } @@ -24917,9 +24773,9 @@ function searchSources(query) { dispatch(updateSearchStatus(_projectTextSearch.statusType.fetching)); await dispatch((0, _sources.loadAllSources)()); const sources = (0, _selectors.getSources)(getState()); - const validSources = sources.valueSeq().filter(source => (0, _source.isLoaded)(source.toJS()) && !(0, _source.isThirdParty)(source.toJS())).toJS(); + const validSources = sources.valueSeq().filter(source => (0, _source.isLoaded)(source) && !(0, _source.isThirdParty)(source)); for (const source of validSources) { - await dispatch(searchSource(source.id, query)); + await dispatch(searchSource(source.get("id"), query)); } }; } @@ -24931,13 +24787,12 @@ function searchSource(sourceId, query) { return; } - const source = sourceRecord.toJS(); - const matches = await (0, _search.findSourceMatches)(source, query); + const matches = await (0, _search.findSourceMatches)(sourceRecord.toJS(), query); dispatch({ type: "ADD_SEARCH_RESULT", result: { - sourceId: source.id, - filepath: source.url, + sourceId: sourceRecord.get("id"), + filepath: sourceRecord.get("url"), matches } }); @@ -24960,6 +24815,8 @@ Object.defineProperty(exports, "__esModule", { }); exports.loadSourceText = loadSourceText; +var _devtoolsSourceMap = __webpack_require__(1360); + var _promise = __webpack_require__(1653); var _ast = __webpack_require__(1399); @@ -24970,19 +24827,22 @@ var _parser = __webpack_require__(1365); var _source = __webpack_require__(1356); -const requests = new Map(); /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +const requests = new Map(); async function loadSource(source, { sourceMaps, client }) { - if (sourceMaps.isOriginalId(source.id)) { - return await sourceMaps.getOriginalSourceText(source); + const id = source.get("id"); + if ((0, _devtoolsSourceMap.isOriginalId)(id)) { + return await sourceMaps.getOriginalSourceText(source.toJS()); } - const response = await client.sourceContents(source.id); + const response = await client.sourceContents(id); return { - id: source.id, + id, text: response.source, contentType: response.contentType || "text/javascript" }; @@ -25012,28 +24872,35 @@ function loadSourceText(source) { return Promise.resolve(source); } - if ((0, _source.isLoading)(source) || requests.has(source.id)) { - return requests.get(source.id); + const id = source.get("id"); + + if ((0, _source.isLoading)(source) || requests.has(id)) { + return requests.get(id); } - requests.set(source.id, deferred.promise); + requests.set(id, deferred.promise); await dispatch({ type: "LOAD_SOURCE_TEXT", - source: source, + sourceId: id, [_promise.PROMISE]: loadSource(source, { sourceMaps, client }) }); - const newSource = (0, _selectors.getSource)(getState(), source.id).toJS(); + const newSource = (0, _selectors.getSource)(getState(), source.get("id")).toJS(); if (newSource.isWasm) { return; } + if ((0, _devtoolsSourceMap.isOriginalId)(newSource.id)) { + const generatedSource = (0, _selectors.getGeneratedSource)(getState(), source.toJS()); + await dispatch(loadSourceText(generatedSource)); + } + await (0, _parser.setSource)(newSource); - dispatch((0, _ast.setSymbols)(source.id)); + dispatch((0, _ast.setSymbols)(id)); // signal that the action is finished deferred.resolve(); - requests.delete(source.id); + requests.delete(id); }; } @@ -27003,7 +26870,7 @@ class FrameComponent extends _react.Component { } onMouseDown(e, frame, selectedFrame) { - if (e.nativeEvent.which == 3 && selectedFrame.id != frame.id) { + if (e.nativeEvent.which == 3 || selectedFrame.id === frame.id) { return; } this.props.selectFrame(frame); @@ -27158,15 +27025,17 @@ var _client = __webpack_require__(1499); var _bootstrap = __webpack_require__(1430); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _sourceQueue = __webpack_require__(1762); -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ +var _sourceQueue2 = _interopRequireDefault(_sourceQueue); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } if (false) { window.Perf = require("react-addons-perf"); -} +} /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ if ((0, _devtoolsConfig.isFirefoxPanel)()) { module.exports = { @@ -27191,6 +27060,7 @@ if ((0, _devtoolsConfig.isFirefoxPanel)()) { }, destroy: () => { (0, _devtoolsLaunchpad.unmountRoot)(_reactDom2.default); + _sourceQueue2.default.clear(); (0, _bootstrap.teardownWorkers)(); } }; @@ -29431,7 +29301,7 @@ module.exports = connect(mapStateToProps, mapDispatchToProps)(LaunchpadApp); * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const { score } = __webpack_require__(1788); +const { score } = __webpack_require__(1775); function getTabs(state) { let tabs = state.tabs.get("tabs"); @@ -29482,7 +29352,7 @@ const React = __webpack_require__(0); __webpack_require__(1298); const { Component } = React; const PropTypes = __webpack_require__(20); -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); const ImPropTypes = __webpack_require__(150); const configMap = __webpack_require__(1377).sidePanelItems; const Tabs = React.createFactory(__webpack_require__(1492)); @@ -29694,7 +29564,7 @@ const React = __webpack_require__(0); __webpack_require__(1299); const { Component } = React; -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); const PropTypes = __webpack_require__(20); const classnames = __webpack_require__(175); @@ -29766,7 +29636,7 @@ module.exports = Tabs; const React = __webpack_require__(0); __webpack_require__(1300); const { Component } = React; -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); const PropTypes = __webpack_require__(20); const classnames = __webpack_require__(175); const Svg = __webpack_require__(1494); @@ -29836,7 +29706,7 @@ module.exports = Sidebar; const React = __webpack_require__(0); -const { default: InlineSVG } = __webpack_require__(1786); +const { default: InlineSVG } = __webpack_require__(1764); const { isDevelopment } = __webpack_require__(1355); const svg = { @@ -29874,7 +29744,7 @@ module.exports = Svg; const React = __webpack_require__(0); const { Component } = React; -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); const PropTypes = __webpack_require__(20); const { showMenu, buildMenu } = __webpack_require__(1413); @@ -30822,11 +30692,19 @@ exports.clientEvents = exports.setupEvents = undefined; var _create = __webpack_require__(1428); +var _sourceQueue = __webpack_require__(1762); + +var _sourceQueue2 = _interopRequireDefault(_sourceQueue); + var _devtoolsConfig = __webpack_require__(1355); -const CALL_STACK_PAGE_SIZE = 1000; /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +const CALL_STACK_PAGE_SIZE = 1000; let threadClient; let actions; @@ -30836,6 +30714,7 @@ function setupEvents(dependencies) { threadClient = dependencies.threadClient; actions = dependencies.actions; supportsWasm = dependencies.supportsWasm; + _sourceQueue2.default.initialize({ actions, supportsWasm, createSource: _create.createSource }); if (threadClient) { Object.keys(clientEvents).forEach(eventName => { @@ -30858,6 +30737,7 @@ async function paused(_, packet) { if (why.type != "alreadyPaused") { const pause = (0, _create.createPause)(packet, response); + _sourceQueue2.default.flush(); actions.paused(pause); } } @@ -30867,7 +30747,7 @@ function resumed(_, packet) { } function newSource(_, { source }) { - actions.newSource((0, _create.createSource)(source, { supportsWasm })); + _sourceQueue2.default.queue(source); if ((0, _devtoolsConfig.isEnabled)("eventListeners")) { actions.fetchEventListeners(); @@ -31890,8 +31770,8 @@ var _source = __webpack_require__(1356); function createPrettySource(sourceId) { return async ({ dispatch, getState, sourceMaps }) => { - const source = (0, _selectors.getSource)(getState(), sourceId).toJS(); - const url = (0, _source.getPrettySourceURL)(source.url); + const source = (0, _selectors.getSource)(getState(), sourceId); + const url = (0, _source.getPrettySourceURL)(source.get("url")); const id = await sourceMaps.generatedToOriginalId(sourceId, url); const { code, mappings } = await (0, _prettyPrint.prettyPrint)({ @@ -31899,7 +31779,7 @@ function createPrettySource(sourceId) { url }); - await sourceMaps.applySourceMap(source.id, url, code, mappings); + await sourceMaps.applySourceMap(source.get("id"), url, code, mappings); let frames = (0, _selectors.getFrames)(getState()); if (frames) { @@ -31980,70 +31860,7 @@ module.exports = { }; /***/ }), -/* 1525 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getTokenLocation = getTokenLocation; -exports.updatePreview = updatePreview; - -var _lodash = __webpack_require__(2); - -function getTokenLocation(codeMirror, tokenEl) { - const { left, top, width, height } = tokenEl.getBoundingClientRect(); - const { line, ch } = codeMirror.coordsChar({ - left: left + width / 2, - top: top + height / 2 - }); - - return { - line: line + 1, - column: ch - }; -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function updatePreview(target, editor, { linesInScope, preview, setPreview, clearPreview }) { - const location = getTokenLocation(editor.codeMirror, target); - const tokenText = target.innerText ? target.innerText.trim() : ""; - const cursorPos = target.getBoundingClientRect(); - - if (preview) { - // We are mousing over the same token as before - if ((0, _lodash.isEqual)(preview.tokenPos, location)) { - return; - } - - // We are mousing over a new token that is not in the preview - if (!target.classList.contains("debug-expression")) { - clearPreview(); - } - } - - const invalidToken = tokenText === "" || tokenText.match(/[(){}\|&%,.;=<>\+-/\*\s]/); - - const invalidTarget = target.parentElement && !target.parentElement.closest(".CodeMirror-line") || cursorPos.top == 0; - - const isUpdating = preview && preview.updating; - - const inScope = linesInScope && linesInScope.includes(location.line); - - const invaildType = target.className === "cm-string" || target.className === "cm-number" || target.className === "cm-atom"; - - if (invalidTarget || !inScope || isUpdating || invalidToken || invaildType) { - return; - } - - setPreview(tokenText, location, cursorPos); -} - -/***/ }), +/* 1525 */, /* 1526 */ /***/ (function(module, exports, __webpack_require__) { @@ -32524,6 +32341,10 @@ exports.navigated = navigated; var _editor = __webpack_require__(1358); +var _sourceQueue = __webpack_require__(1762); + +var _sourceQueue2 = _interopRequireDefault(_sourceQueue); + var _sources = __webpack_require__(1369); var _utils = __webpack_require__(1366); @@ -32534,6 +32355,8 @@ var _parser = __webpack_require__(1365); var _wasm = __webpack_require__(1401); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** * Redux actions for the navigation state * @module actions/navigation @@ -32543,10 +32366,6 @@ var _wasm = __webpack_require__(1401); * @memberof actions/navigation * @static */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - function willNavigate(_, event) { return async function ({ dispatch, getState, client, sourceMaps }) { await sourceMaps.clearSourceMaps(); @@ -32556,10 +32375,13 @@ function willNavigate(_, event) { (0, _parser.clearASTs)(); (0, _parser.clearScopes)(); (0, _parser.clearSources)(); + _sourceQueue2.default.clear(); dispatch(navigate(event.url)); }; -} +} /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ function navigate(url) { return { @@ -32977,7 +32799,7 @@ const ReactDOM = __webpack_require__(4); const Draggable = React.createFactory(__webpack_require__(1537)); const { Component } = React; const PropTypes = __webpack_require__(20); -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); __webpack_require__(1309); @@ -33225,7 +33047,7 @@ const React = __webpack_require__(0); const ReactDOM = __webpack_require__(4); const { Component } = React; const PropTypes = __webpack_require__(20); -const dom = __webpack_require__(1759); +const dom = __webpack_require__(1758); class Draggable extends Component { static get propTypes() { @@ -33388,19 +33210,6 @@ class ProjectSearch extends _react.Component { ); } } - -ProjectSearch.propTypes = { - sources: _propTypes2.default.object.isRequired, - results: _propTypes2.default.object, - textSearchQuery: _propTypes2.default.string, - setActiveSearch: _propTypes2.default.func.isRequired, - closeActiveSearch: _propTypes2.default.func.isRequired, - closeProjectSearch: _propTypes2.default.func.isRequired, - searchSources: _propTypes2.default.func, - activeSearch: _propTypes2.default.string, - selectLocation: _propTypes2.default.func.isRequired -}; - ProjectSearch.contextTypes = { shortcuts: _propTypes2.default.object }; @@ -33669,7 +33478,7 @@ TextSearch.contextTypes = { "use strict"; -var _svgInlineReact = __webpack_require__(1786); +var _svgInlineReact = __webpack_require__(1764); var _svgInlineReact2 = _interopRequireDefault(_svgInlineReact); @@ -33694,7 +33503,7 @@ const svg = { domain: __webpack_require__(353), file: __webpack_require__(354), folder: __webpack_require__(355), - function: __webpack_require__(1777), + function: __webpack_require__(1788), globe: __webpack_require__(356), jquery: __webpack_require__(999), underscore: __webpack_require__(1117), @@ -35693,7 +35502,7 @@ class Editor extends _react.PureComponent { // Only update and jump around in real source texts. This will // keep the jump state around until the real source text is // loaded. - if (selectedSource && (0, _source.isLoaded)(selectedSource.toJS())) { + if (selectedSource && (0, _source.isLoaded)(selectedSource)) { this.highlightLine(); } @@ -35820,7 +35629,7 @@ class Editor extends _react.PureComponent { return this.showMessage(""); } - if (!(0, _source.isLoaded)(selectedSource.toJS())) { + if (!(0, _source.isLoaded)(selectedSource)) { return (0, _editor.showLoading)(this.state.editor); } @@ -35864,7 +35673,7 @@ class Editor extends _react.PureComponent { renderHitCounts() { const { hitCount, selectedSource } = this.props; - if (!selectedSource || !(0, _source.isLoaded)(selectedSource.toJS()) || !hitCount || !this.state.editor) { + if (!selectedSource || !(0, _source.isLoaded)(selectedSource) || !hitCount || !this.state.editor) { return; } @@ -35879,7 +35688,7 @@ class Editor extends _react.PureComponent { const { selectedSource, horizontal } = this.props; const { editor } = this.state; - if (!editor || !selectedSource || !(0, _source.isLoaded)(selectedSource.toJS())) { + if (!editor || !selectedSource || !(0, _source.isLoaded)(selectedSource)) { return null; } @@ -36004,7 +35813,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de class SourceFooter extends _react.PureComponent { prettyPrintButton() { const { selectedSource, togglePrettyPrint } = this.props; - const sourceLoaded = selectedSource && (0, _source.isLoaded)(selectedSource.toJS()); + const sourceLoaded = selectedSource && (0, _source.isLoaded)(selectedSource); if (!(0, _editor.shouldShowPrettyPrint)(selectedSource)) { return; @@ -36019,7 +35828,7 @@ class SourceFooter extends _react.PureComponent { onClick: () => togglePrettyPrint(selectedSource.get("id")), className: (0, _classnames2.default)("action", type, { active: sourceLoaded, - pretty: (0, _source.isPretty)(selectedSource.toJS()) + pretty: (0, _source.isPretty)(selectedSource) }), key: type, title: tooltip, @@ -36031,7 +35840,7 @@ class SourceFooter extends _react.PureComponent { blackBoxButton() { const { selectedSource, toggleBlackBox } = this.props; - const sourceLoaded = selectedSource && (0, _source.isLoaded)(selectedSource.toJS()); + const sourceLoaded = selectedSource && (0, _source.isLoaded)(selectedSource); if (!(0, _devtoolsConfig.isEnabled)("blackbox") || !sourceLoaded) { return; @@ -36652,7 +36461,7 @@ class Preview extends _react.PureComponent { onMouseOver(e) { const { target } = e; if (this.props.selectedFrameVisible) { - (0, _editor.updatePreview)(target, this.props.editor, this.props); + this.props.updatePreview(target, this.props.editor); } } @@ -36708,19 +36517,18 @@ class Preview extends _react.PureComponent { const { addExpression, loadObjectProperties, - setPreview, + updatePreview, clearPreview } = _actions2.default; exports.default = (0, _reactRedux.connect)(state => ({ preview: (0, _selectors.getPreview)(state), selectedSource: (0, _selectors.getSelectedSource)(state), - linesInScope: (0, _selectors.getInScopeLines)(state), selectedFrameVisible: (0, _selectors.isSelectedFrameVisible)(state) }), { addExpression, loadObjectProperties, - setPreview, + updatePreview, clearPreview })(Preview); @@ -36764,6 +36572,10 @@ var _PreviewFunction2 = _interopRequireDefault(_PreviewFunction); var _editor = __webpack_require__(1358); +var _Svg = __webpack_require__(1359); + +var _Svg2 = _interopRequireDefault(_Svg); + __webpack_require__(1328); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -36839,8 +36651,9 @@ class Popup extends _react.Component { } renderObjectPreview(expression, root, extra) { - let reactHeader = null; + let header = null; const { loadedObjects } = this.props; + const { extra: { react, immutable } } = this.props; const getObjectProperties = id => loadedObjects[id]; let roots = this.getChildren(root, getObjectProperties); @@ -36849,25 +36662,48 @@ class Popup extends _react.Component { } if (isReactComponent(roots)) { - if (typeof extra !== "undefined") { - reactHeader = _react2.default.createElement( - "div", - { className: "header-container" }, - _react2.default.createElement( - "h3", - null, - extra - ) - ); - } + const reactHeader = react.displayName || "React Component"; + + header = _react2.default.createElement( + "div", + { className: "header-container" }, + _react2.default.createElement( + "h3", + null, + reactHeader + ) + ); roots = roots.filter(r => ["state", "props"].includes(r.name)); } + if (immutable.isImmutable) { + const immutableHeader = immutable.type || "Immutable"; + + header = _react2.default.createElement( + "div", + { className: "header-container" }, + _react2.default.createElement(_Svg2.default, { name: "immutable", className: "immutable-logo" }), + _react2.default.createElement( + "h3", + null, + immutableHeader + ) + ); + + roots = roots.filter(r => ["size"].includes(r.name)); + + roots.push({ + name: "entries", + contents: { value: immutable.entries }, + path: "entries" + }); + } + return _react2.default.createElement( "div", { className: "preview-popup" }, - reactHeader, + header, this.renderObjectInspector(roots) ); } @@ -39626,7 +39462,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de class Breakpoints extends _react.Component { shouldComponentUpdate(nextProps) { - if (nextProps.selectedSource && !(0, _source.isLoaded)(nextProps.selectedSource.toJS())) { + if (nextProps.selectedSource && !(0, _source.isLoaded)(nextProps.selectedSource)) { return false; } @@ -40545,22 +40381,22 @@ Object.defineProperty(exports, "__esModule", { var _react = __webpack_require__(0); +var _reactRedux = __webpack_require__(1189); + var _devtoolsLaunchpad = __webpack_require__(1362); var _devtoolsSourceMap = __webpack_require__(1360); var _clipboard = __webpack_require__(1388); -var _source = __webpack_require__(1356); - -var _editor = __webpack_require__(1358); - -var _reactRedux = __webpack_require__(1189); - var _function = __webpack_require__(1597); var _astBreakpointLocation = __webpack_require__(1416); +var _editor = __webpack_require__(1358); + +var _source = __webpack_require__(1356); + var _selectors = __webpack_require__(1352); var _actions = __webpack_require__(1354); @@ -40574,42 +40410,53 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob * file, You can obtain one at . */ function getMenuItems(event, { + addExpression, editor, + flashLineRange, + getFunctionLocation, + getFunctionText, + hasPrettyPrint, + jumpToMappedLocation, + onGutterContextMenu, selectedLocation, selectedSource, showSource, - onGutterContextMenu, - jumpToMappedLocation, - toggleBlackBox, - addExpression, - getFunctionText, - getFunctionLocation, - flashLineRange, - hasPrettyPrint + toggleBlackBox }) { - const copySourceLabel = L10N.getStr("copySource"); - const copySourceKey = L10N.getStr("copySource.accesskey"); - const copyFunctionLabel = L10N.getStr("copyFunction.label"); - const copyFunctionKey = L10N.getStr("copyFunction.accesskey"); - const copySourceUri2Label = L10N.getStr("copySourceUri2"); - const copySourceUri2Key = L10N.getStr("copySourceUri2.accesskey"); - const revealInTreeLabel = L10N.getStr("sourceTabs.revealInTree"); - const revealInTreeKey = L10N.getStr("sourceTabs.revealInTree.accesskey"); + // variables + const hasSourceMap = !!selectedSource.get("sourceMapURL"); + const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId); + const isPrettyPrinted = (0, _source.isPretty)(selectedSource); + const isPrettified = isPrettyPrinted || hasPrettyPrint; + const isMapped = isOriginal || hasSourceMap; + const { line } = editor.codeMirror.coordsChar({ + left: event.clientX, + top: event.clientY + }); + const selectionText = editor.codeMirror.getSelection().trim(); + const sourceLocation = (0, _editor.getSourceLocationFromMouseEvent)(editor, selectedLocation, event); + const textSelected = editor.codeMirror.somethingSelected(); + + // localizations + const blackboxKey = L10N.getStr("sourceFooter.blackbox.accesskey"); const blackboxLabel = L10N.getStr("sourceFooter.blackbox"); const unblackboxLabel = L10N.getStr("sourceFooter.unblackbox"); - const blackboxKey = L10N.getStr("sourceFooter.blackbox.accesskey"); const toggleBlackBoxLabel = selectedSource.get("isBlackBoxed") ? unblackboxLabel : blackboxLabel; + const copyFunctionKey = L10N.getStr("copyFunction.accesskey"); + const copyFunctionLabel = L10N.getStr("copyFunction.label"); + const copySourceKey = L10N.getStr("copySource.accesskey"); + const copySourceLabel = L10N.getStr("copySource"); + const copySourceUri2Key = L10N.getStr("copySourceUri2.accesskey"); + const copySourceUri2Label = L10N.getStr("copySourceUri2"); + const jumpToMappedLocKey = L10N.getStr("editor.jumpToMappedLocation1.accesskey"); + const jumpToMappedLocLabel = L10N.getFormatStr("editor.jumpToMappedLocation1", isOriginal ? L10N.getStr("generated") : L10N.getStr("original")); + const revealInTreeKey = L10N.getStr("sourceTabs.revealInTree.accesskey"); + const revealInTreeLabel = L10N.getStr("sourceTabs.revealInTree"); + const watchExpressionKey = L10N.getStr("expressions.accesskey"); + const watchExpressionLabel = L10N.getStr("expressions.label"); - const copySourceUri2 = { - id: "node-menu-copy-source-url", - label: copySourceUri2Label, - accesskey: copySourceUri2Key, - disabled: false, - click: () => (0, _clipboard.copyToTheClipboard)(selectedSource.get("url")) - }; - - const selectionText = editor.codeMirror.getSelection().trim(); - const copySource = { + // menu items + const copySourceItem = { id: "node-menu-copy-source", label: copySourceLabel, accesskey: copySourceKey, @@ -40617,56 +40464,16 @@ function getMenuItems(event, { click: () => (0, _clipboard.copyToTheClipboard)(selectionText) }; - const { line } = editor.codeMirror.coordsChar({ - left: event.clientX, - top: event.clientY - }); - - const sourceLocation = (0, _editor.getSourceLocationFromMouseEvent)(editor, selectedLocation, event); - - const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId); - const hasSourceMap = !!selectedSource.get("sourceMapURL"); - const isPrettyPrinted = (0, _source.isPretty)(selectedSource.toJS()); - - const isPrettified = isPrettyPrinted || hasPrettyPrint; - const isMapped = isOriginal || hasSourceMap; - - const jumpLabel = { - id: "node-menu-jump", - accesskey: L10N.getStr("editor.jumpToMappedLocation1.accesskey"), - disabled: !isMapped && !isPrettified, - label: L10N.getFormatStr("editor.jumpToMappedLocation1", isOriginal ? L10N.getStr("generated") : L10N.getStr("original")), - click: () => jumpToMappedLocation(sourceLocation) - }; - - const watchExpressionLabel = { - id: "node-menu-add-watch-expression", - accesskey: L10N.getStr("expressions.accesskey"), - label: L10N.getStr("expressions.label"), - click: () => addExpression(editor.codeMirror.getSelection()) - }; - - const blackBoxMenuItem = { - id: "node-menu-blackbox", - label: toggleBlackBoxLabel, - accesskey: blackboxKey, - disabled: isOriginal || isPrettyPrinted || hasSourceMap, - click: () => toggleBlackBox(selectedSource.toJS()) - }; - - // TODO: Find a new way to only add this for mapped sources? - const textSelected = editor.codeMirror.somethingSelected(); - - const showSourceMenuItem = { - id: "node-menu-show-source", - label: revealInTreeLabel, - accesskey: revealInTreeKey, - disabled: isPrettyPrinted, - click: () => showSource(selectedSource.get("id")) + const copySourceUri2Item = { + id: "node-menu-copy-source-url", + label: copySourceUri2Label, + accesskey: copySourceUri2Key, + disabled: false, + click: () => (0, _clipboard.copyToTheClipboard)(selectedSource.get("url")) }; const functionText = getFunctionText(line + 1); - const copyFunction = { + const copyFunctionItem = { id: "node-menu-copy-function", label: copyFunctionLabel, accesskey: copyFunctionKey, @@ -40682,10 +40489,44 @@ function getMenuItems(event, { } }; - const menuItems = [copySource, copySourceUri2, copyFunction, { type: "separator" }, jumpLabel, showSourceMenuItem, blackBoxMenuItem]; + const jumpToMappedLocationItem = { + id: "node-menu-jump", + label: jumpToMappedLocLabel, + accesskey: jumpToMappedLocKey, + disabled: !isMapped && !isPrettified, + click: () => jumpToMappedLocation(sourceLocation) + }; + const showSourceMenuItem = { + id: "node-menu-show-source", + label: revealInTreeLabel, + accesskey: revealInTreeKey, + disabled: isPrettyPrinted, + click: () => showSource(selectedSource.get("id")) + }; + + const blackBoxMenuItem = { + id: "node-menu-blackbox", + label: toggleBlackBoxLabel, + accesskey: blackboxKey, + disabled: isOriginal || isPrettyPrinted || hasSourceMap, + click: () => toggleBlackBox(selectedSource.toJS()) + }; + + const watchExpressionItem = { + id: "node-menu-add-watch-expression", + label: watchExpressionLabel, + accesskey: watchExpressionKey, + click: () => addExpression(editor.codeMirror.getSelection()) + }; + + // construct menu + const menuItems = [copySourceItem, copySourceUri2Item, copyFunctionItem, { type: "separator" }, jumpToMappedLocationItem, showSourceMenuItem, blackBoxMenuItem]; + + // conditionally added items + // TODO: Find a new way to only add this for mapped sources? if (textSelected) { - menuItems.push(watchExpressionLabel); + menuItems.push(watchExpressionItem); } return menuItems; @@ -40721,11 +40562,11 @@ class EditorMenu extends _react.PureComponent { const { addExpression, + flashLineRange, jumpToMappedLocation, - toggleBlackBox, setContextMenu, showSource, - flashLineRange + toggleBlackBox } = _actions2.default; exports.default = (0, _reactRedux.connect)(state => { @@ -40743,11 +40584,11 @@ exports.default = (0, _reactRedux.connect)(state => { }; }, { addExpression, + flashLineRange, jumpToMappedLocation, - toggleBlackBox, setContextMenu, showSource, - flashLineRange + toggleBlackBox })(EditorMenu); /***/ }), @@ -41062,7 +40903,7 @@ var _UtilsBar = __webpack_require__(1609); var _UtilsBar2 = _interopRequireDefault(_UtilsBar); -var _BreakpointsDropdown = __webpack_require__(1778); +var _BreakpointsDropdown = __webpack_require__(1791); var _BreakpointsDropdown2 = _interopRequireDefault(_BreakpointsDropdown); @@ -42653,7 +42494,7 @@ var _actions = __webpack_require__(1354); var _actions2 = _interopRequireDefault(_actions); -var _CommandBarButton = __webpack_require__(1787); +var _CommandBarButton = __webpack_require__(1765); var _CommandBarButton2 = _interopRequireDefault(_CommandBarButton); @@ -43172,7 +43013,7 @@ var _actions2 = _interopRequireDefault(_actions); var _selectors = __webpack_require__(1352); -var _scopes = __webpack_require__(1780); +var _scopes = __webpack_require__(1793); var _devtoolsReps = __webpack_require__(1408); @@ -43578,7 +43419,7 @@ class SourceTabs extends _react.PureComponent { return; } - const isPrettySource = (0, _source.isPretty)(sourceTab.toJS()); + const isPrettySource = (0, _source.isPretty)(sourceTab); const closeTabMenuItem = { id: "node-menu-close-tab", @@ -43678,20 +43519,24 @@ class SourceTabs extends _react.PureComponent { } getIconClass(source) { - if ((0, _source.isPretty)(source.toJS())) return "prettyPrint"; - if (source.get("isBlackBoxed")) return "blackBox"; + if ((0, _source.isPretty)(source)) { + return "prettyPrint"; + } + if (source.get("isBlackBoxed")) { + return "blackBox"; + } return "file"; } renderDropdownSource(source) { - const { selectLocation } = this.props; + const { selectSource } = this.props; const filename = (0, _source.getFilename)(source.toJS()); - const onClick = () => selectLocation({ sourceId: source.get("id"), line: 0 }); + const onClick = () => selectSource(source.get("id")); return _react2.default.createElement( "li", { key: source.get("id"), onClick: onClick }, - _react2.default.createElement("img", { className: "dropdown-icon " + this.getIconClass(source) }), + _react2.default.createElement("img", { className: `dropdown-icon ${this.getIconClass(source)}` }), filename ); } @@ -43756,10 +43601,10 @@ class SourceTabs extends _react.PureComponent { } renderSourceTab(source) { - const { selectedSource, selectLocation, closeTab } = this.props; + const { selectedSource, selectSource, closeTab } = this.props; const filename = (0, _source.getFilename)(source.toJS()); const active = selectedSource && source.get("id") == selectedSource.get("id") && !this.isProjectSearchEnabled() && !this.isSourceSearchEnabled(); - const isPrettyCode = (0, _source.isPretty)(source.toJS()); + const isPrettyCode = (0, _source.isPretty)(source); const sourceAnnotation = this.getSourceAnnotation(source); function onClickClose(ev) { @@ -43777,7 +43622,7 @@ class SourceTabs extends _react.PureComponent { { className: className, key: source.get("id"), - onClick: () => selectLocation({ sourceId: source.get("id") }), + onClick: () => selectSource(source.get("id")), onContextMenu: e => this.onTabContextMenu(e, source.get("id")), title: (0, _source.getFileURL)(source.toJS()) }, @@ -43831,17 +43676,16 @@ class SourceTabs extends _react.PureComponent { } getSourceAnnotation(source) { - const sourceObj = source.toJS(); const sourceId = source.get("id"); const sourceMetaData = this.props.sourceTabsMetaData[sourceId]; if (sourceMetaData && sourceMetaData.isReactComponent) { return _react2.default.createElement("img", { className: "react" }); } - if ((0, _source.isPretty)(sourceObj)) { + if ((0, _source.isPretty)(source)) { return _react2.default.createElement("img", { className: "prettyPrint" }); } - if (sourceObj.isBlackBoxed) { + if (source.get("isBlackBoxed")) { return _react2.default.createElement("img", { className: "blackBox" }); } } @@ -44136,12 +43980,15 @@ function formatSymbols(symbols) { } function formatSources(sources) { - return sources.valueSeq().toJS().filter(source => !(0, _source.isPretty)(source) && !(0, _source.isThirdParty)(source)).map(source => ({ - value: (0, _source.getSourcePath)(source), - title: (0, _source.getSourcePath)(source).split("/").pop(), - subtitle: (0, _utils.endTruncateStr)((0, _source.getSourcePath)(source), 100), - id: source.id - })).filter(formattedSource => formattedSource.value != ""); + return sources.valueSeq().filter(source => !(0, _source.isPretty)(source) && !(0, _source.isThirdParty)(source)).map(source => { + const sourcePath = (0, _source.getSourcePath)(source.get("url")); + return { + value: sourcePath, + title: sourcePath.split("/").pop(), + subtitle: (0, _utils.endTruncateStr)(sourcePath, 100), + id: source.get("id") + }; + }).filter(({ value }) => value != "").toJS(); } /***/ }), @@ -44740,25 +44587,25 @@ function closeQuickOpen() { /* 1648 */ /***/ (function(module, exports) { -module.exports = "image/svg+xml" +module.exports = "image/svg+xml" /***/ }), /* 1649 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1650 */ /***/ (function(module, exports) { -module.exports = "Zeit - Black on white logo" +module.exports = "Zeit - Black on white logo" /***/ }), /* 1651 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1652 */ @@ -45161,23 +45008,31 @@ exports.fetchScopes = fetchScopes; var _selectors = __webpack_require__(1352); -var _pause = __webpack_require__(1400); - var _prefs = __webpack_require__(226); var _devtoolsSourceMap = __webpack_require__(1360); var _loadSourceText = __webpack_require__(1435); +var _parser = __webpack_require__(1365); + +var _updateScopeBindings = __webpack_require__(1785); + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + function mapScopes(scopes, frame) { return async function ({ dispatch, getState, client, sourceMaps }) { - const mappedScopes = await (0, _pause.updateScopeBindings)(scopes, frame.generatedLocation, frame.location, { - async getLocationScopes(location, astScopes) { + const mappedScopes = await (0, _updateScopeBindings.updateScopeBindings)(scopes, frame.generatedLocation, frame.location, { + async getSourceMapsScopes(location) { + const astScopes = await (0, _parser.getScopes)(location); return sourceMaps.getLocationScopes(location, astScopes); }, - async loadSourceText(sourceId) { - const source = (0, _selectors.getSource)(getState(), sourceId).toJS(); + async getOriginalSourceScopes(location) { + const source = (0, _selectors.getSource)(getState(), location.sourceId); await dispatch((0, _loadSourceText.loadSourceText)(source)); + return (0, _parser.getScopes)(location); } }); @@ -45187,10 +45042,9 @@ function mapScopes(scopes, frame) { scopes: mappedScopes }); }; -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ +} +// eslint-disable-next-line max-len function fetchScopes() { return async function ({ dispatch, getState, client, sourceMaps }) { const frame = (0, _selectors.getSelectedFrame)(getState()); @@ -45747,7 +45601,7 @@ exports.default = Badge; /* 1733 */ /***/ (function(module, exports) { -module.exports = "" +module.exports = "" /***/ }), /* 1734 */, @@ -45780,137 +45634,6 @@ module.exports = " { - this.off(aEvent, handler); - if (aListener) { - aListener.apply(null, [aEvent, aFirstArg, ...aRest]); - } - deferred.resolve(aFirstArg); - }; - - handler._originalListener = aListener; - this.on(aEvent, handler); - - return deferred.promise; - }, - - /** - * Remove a previously-registered event listener. Works for events - * registered with either on or once. - * - * @param string aEvent - * The event name whose listener we're disconnecting. - * @param function aListener - * The listener to remove. - */ - off: function EventEmitter_off(aEvent, aListener) { - if (!this._eventEmitterListeners) return; - let listeners = this._eventEmitterListeners.get(aEvent); - if (listeners) { - this._eventEmitterListeners.set(aEvent, listeners.filter(l => { - return l !== aListener && l._originalListener !== aListener; - })); - } - }, - - /** - * Emit an event. All arguments to this method will - * be sent to listener functions. - */ - emit: function EventEmitter_emit(aEvent) { - if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) { - return; - } - - let originalListeners = this._eventEmitterListeners.get(aEvent); - for (let listener of this._eventEmitterListeners.get(aEvent)) { - // If the object was destroyed during event emission, stop - // emitting. - if (!this._eventEmitterListeners) { - break; - } - - // If listeners were removed during emission, make sure the - // event handler we're going to fire wasn't removed. - if (originalListeners === this._eventEmitterListeners.get(aEvent) || this._eventEmitterListeners.get(aEvent).some(l => l === listener)) { - try { - listener.apply(null, arguments); - } catch (ex) { - // Prevent a bad listener from interfering with the others. - let msg = ex + ": " + ex.stack; - //console.error(msg); - console.log(msg); - } - } - } - } -}; - -/***/ }), -/* 1759 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - /** * Copyright (c) 2015-present, Facebook, Inc. * @@ -46107,1711 +45830,138 @@ EventEmitter.prototype = { /***/ }), -/* 1760 */ +/* 1759 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getSourceBindingVariables = getSourceBindingVariables; -exports.getBindingVariables = getBindingVariables; - -var _lodash = __webpack_require__(2); - -// VarAndBindingsPair actually is [name: string, contents: BindingContents] - - -// Scope's bindings field which holds variables and arguments -function getSourceBindingVariables(bindings, sourceBindings, parentName) { - const result = getBindingVariables(bindings, parentName); - const index = Object.create(null); - result.forEach(entry => { - index[entry.name] = { used: false, entry }; - }); - // Find and replace variables that is present in sourceBindings. - const bound = Object.keys(sourceBindings).map(name => { - const generatedName = sourceBindings[name]; - const foundMap = index[generatedName]; - let contents; - if (foundMap) { - foundMap.used = true; - contents = foundMap.entry.contents; - } else { - contents = { value: { type: "undefined" } }; - } - return { - name, - generatedName, - path: `${parentName}/${generatedName}`, - contents - }; - }); - // Use rest of them (not found in the sourceBindings) as is. - const unused = result.filter(entry => !index[entry.name].used); - return bound.concat(unused); -} - -// Create the tree nodes representing all the variables and arguments -// for the bindings from a scope. -/* eslint max-nested-callbacks: ["error", 4] */ - /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -function getBindingVariables(bindings, parentName) { - const args = bindings.arguments.map(arg => (0, _lodash.toPairs)(arg)[0]); - const variables = (0, _lodash.toPairs)(bindings.variables); +var EventEmitter = function EventEmitter() {}; +module.exports = EventEmitter; - return args.concat(variables).map(binding => { - const name = binding[0]; - const contents = binding[1]; - return { - name, - path: `${parentName}/${name}`, - contents - }; - }); -} +const promise = __webpack_require__(1770); -/***/ }), -/* 1761 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Decorate an object with event emitter functionality. + * + * @param Object aObjectToDecorate + * Bind all public methods of EventEmitter to + * the aObjectToDecorate object. + */ +EventEmitter.decorate = function EventEmitter_decorate(aObjectToDecorate) { + let emitter = new EventEmitter(); + aObjectToDecorate.on = emitter.on.bind(emitter); + aObjectToDecorate.off = emitter.off.bind(emitter); + aObjectToDecorate.once = emitter.once.bind(emitter); + aObjectToDecorate.emit = emitter.emit.bind(emitter); +}; -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getFramePopVariables = getFramePopVariables; -exports.getThisVariable = getThisVariable; -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function getFramePopVariables(pauseInfo, path) { - const vars = []; - - if (pauseInfo.why && pauseInfo.why.frameFinished) { - const frameFinished = pauseInfo.why.frameFinished; - - // Always display a `throw` property if present, even if it is falsy. - if (Object.prototype.hasOwnProperty.call(frameFinished, "throw")) { - vars.push({ - name: "", - path: `${path}/`, - contents: { value: frameFinished.throw } - }); +EventEmitter.prototype = { + /** + * Connect a listener. + * + * @param string aEvent + * The event name to which we're connecting. + * @param function aListener + * Called when the event is fired. + */ + on: function EventEmitter_on(aEvent, aListener) { + if (!this._eventEmitterListeners) this._eventEmitterListeners = new Map(); + if (!this._eventEmitterListeners.has(aEvent)) { + this._eventEmitterListeners.set(aEvent, []); } + this._eventEmitterListeners.get(aEvent).push(aListener); + }, - if (Object.prototype.hasOwnProperty.call(frameFinished, "return")) { - const returned = frameFinished.return; + /** + * Listen for the next time an event is fired. + * + * @param string aEvent + * The event name to which we're connecting. + * @param function aListener + * (Optional) Called when the event is fired. Will be called at most + * one time. + * @return promise + * A promise which is resolved when the event next happens. The + * resolution value of the promise is the first event argument. If + * you need access to second or subsequent event arguments (it's rare + * that this is needed) then use aListener + */ + once: function EventEmitter_once(aEvent, aListener) { + let deferred = promise.defer(); - // Do not display undefined. Do display falsy values like 0 and false. The - // protocol grip for undefined is a JSON object: { type: "undefined" }. - if (typeof returned !== "object" || returned.type !== "undefined") { - vars.push({ - name: "", - path: `${path}/`, - contents: { value: returned } - }); + let handler = (aEvent, aFirstArg, ...aRest) => { + this.off(aEvent, handler); + if (aListener) { + aListener.apply(null, [aEvent, aFirstArg, ...aRest]); } + deferred.resolve(aFirstArg); + }; + + handler._originalListener = aListener; + this.on(aEvent, handler); + + return deferred.promise; + }, + + /** + * Remove a previously-registered event listener. Works for events + * registered with either on or once. + * + * @param string aEvent + * The event name whose listener we're disconnecting. + * @param function aListener + * The listener to remove. + */ + off: function EventEmitter_off(aEvent, aListener) { + if (!this._eventEmitterListeners) return; + let listeners = this._eventEmitterListeners.get(aEvent); + if (listeners) { + this._eventEmitterListeners.set(aEvent, listeners.filter(l => { + return l !== aListener && l._originalListener !== aListener; + })); } - } + }, - return vars; -} - -function getThisVariable(frame, path) { - const this_ = frame.this; - - if (!this_) { - return null; - } - - return { - name: "", - path: `${path}/`, - contents: { value: this_ } - }; -} - -/***/ }), -/* 1762 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const Menu = __webpack_require__(1763); -const MenuItem = __webpack_require__(1765); -const { PrefsHelper } = __webpack_require__(1766); -const Services = __webpack_require__(22); -const KeyShortcuts = __webpack_require__(1767); -const { ZoomKeys } = __webpack_require__(1768); -const EventEmitter = __webpack_require__(1758); - -module.exports = { - KeyShortcuts, - Menu, - MenuItem, - PrefsHelper, - Services, - ZoomKeys, - EventEmitter -}; - -/***/ }), -/* 1763 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const EventEmitter = __webpack_require__(1758); - -function inToolbox() { - return window.parent.document.documentURI == "about:devtools-toolbox"; -} - -/** - * A partial implementation of the Menu API provided by electron: - * https://github.com/electron/electron/blob/master/docs/api/menu.md. - * - * Extra features: - * - Emits an 'open' and 'close' event when the menu is opened/closed - - * @param String id (non standard) - * Needed so tests can confirm the XUL implementation is working - */ -function Menu({ id = null } = {}) { - this.menuitems = []; - this.id = id; - - Object.defineProperty(this, "items", { - get() { - return this.menuitems; - } - }); - - EventEmitter.decorate(this); -} - -/** - * Add an item to the end of the Menu - * - * @param {MenuItem} menuItem - */ -Menu.prototype.append = function (menuItem) { - this.menuitems.push(menuItem); -}; - -/** - * Add an item to a specified position in the menu - * - * @param {int} pos - * @param {MenuItem} menuItem - */ -Menu.prototype.insert = function (pos, menuItem) { - throw Error("Not implemented"); -}; - -/** - * Show the Menu at a specified location on the screen - * - * Missing features: - * - browserWindow - BrowserWindow (optional) - Default is null. - * - positioningItem Number - (optional) OS X - * - * @param {int} screenX - * @param {int} screenY - * @param Toolbox toolbox (non standard) - * Needed so we in which window to inject XUL - */ -Menu.prototype.popup = function (screenX, screenY, toolbox) { - let doc = toolbox.doc; - let popupset = doc.querySelector("popupset"); - // See bug 1285229, on Windows, opening the same popup multiple times in a - // row ends up duplicating the popup. The newly inserted popup doesn't - // dismiss the old one. So remove any previously displayed popup before - // opening a new one. - let popup = popupset.querySelector("menupopup[menu-api=\"true\"]"); - if (popup) { - popup.hidePopup(); - } - - popup = this.createPopup(doc); - popup.setAttribute("menu-api", "true"); - - if (this.id) { - popup.id = this.id; - } - this._createMenuItems(popup); - - // Remove the menu from the DOM once it's hidden. - popup.addEventListener("popuphidden", e => { - if (e.target === popup) { - popup.remove(); - this.emit("close", popup); - } - }); - - popup.addEventListener("popupshown", e => { - if (e.target === popup) { - this.emit("open", popup); - } - }); - - popupset.appendChild(popup); - popup.openPopupAtScreen(screenX, screenY, true); -}; - -Menu.prototype.createPopup = function (doc) { - return doc.createElement("menupopup"); -}; - -Menu.prototype._createMenuItems = function (parent) { - let doc = parent.ownerDocument; - this.menuitems.forEach(item => { - if (!item.visible) { + /** + * Emit an event. All arguments to this method will + * be sent to listener functions. + */ + emit: function EventEmitter_emit(aEvent) { + if (!this._eventEmitterListeners || !this._eventEmitterListeners.has(aEvent)) { return; } - if (item.submenu) { - let menupopup = doc.createElement("menupopup"); - item.submenu._createMenuItems(menupopup); - - let menuitem = doc.createElement("menuitem"); - menuitem.setAttribute("label", item.label); - if (!inToolbox()) { - menuitem.textContent = item.label; + let originalListeners = this._eventEmitterListeners.get(aEvent); + for (let listener of this._eventEmitterListeners.get(aEvent)) { + // If the object was destroyed during event emission, stop + // emitting. + if (!this._eventEmitterListeners) { + break; } - let menu = doc.createElement("menu"); - menu.appendChild(menuitem); - menu.appendChild(menupopup); - if (item.disabled) { - menu.setAttribute("disabled", "true"); - } - if (item.accesskey) { - menu.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menu.id = item.id; - } - parent.appendChild(menu); - } else if (item.type === "separator") { - let menusep = doc.createElement("menuseparator"); - parent.appendChild(menusep); - } else { - let menuitem = doc.createElement("menuitem"); - menuitem.setAttribute("label", item.label); - - if (!inToolbox()) { - menuitem.textContent = item.label; - } - - menuitem.addEventListener("command", () => item.click()); - - if (item.type === "checkbox") { - menuitem.setAttribute("type", "checkbox"); - } - if (item.type === "radio") { - menuitem.setAttribute("type", "radio"); - } - if (item.disabled) { - menuitem.setAttribute("disabled", "true"); - } - if (item.checked) { - menuitem.setAttribute("checked", "true"); - } - if (item.accesskey) { - menuitem.setAttribute("accesskey", item.accesskey); - } - if (item.id) { - menuitem.id = item.id; - } - - parent.appendChild(menuitem); - } - }); -}; - -Menu.setApplicationMenu = () => { - throw Error("Not implemented"); -}; - -Menu.sendActionToFirstResponder = () => { - throw Error("Not implemented"); -}; - -Menu.buildFromTemplate = () => { - throw Error("Not implemented"); -}; - -module.exports = Menu; - -/***/ }), -/* 1764 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* - * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm - */ - -/** - * Promise.jsm is mostly the Promise web API with a `defer` method. Just drop this in here, - * and use the native web API (although building with webpack/babel, it may replace this - * with it's own version if we want to target environments that do not have `Promise`. - */ - -let p = typeof window != "undefined" ? window.Promise : Promise; -p.defer = function defer() { - var resolve, reject; - var promise = new Promise(function () { - resolve = arguments[0]; - reject = arguments[1]; - }); - return { - resolve: resolve, - reject: reject, - promise: promise - }; -}; - -module.exports = p; - -/***/ }), -/* 1765 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * A partial implementation of the MenuItem API provided by electron: - * https://github.com/electron/electron/blob/master/docs/api/menu-item.md. - * - * Missing features: - * - id String - Unique within a single menu. If defined then it can be used - * as a reference to this item by the position attribute. - * - role String - Define the action of the menu item; when specified the - * click property will be ignored - * - sublabel String - * - accelerator Accelerator - * - icon NativeImage - * - position String - This field allows fine-grained definition of the - * specific location within a given menu. - * - * Implemented features: - * @param Object options - * Function click - * Will be called with click(menuItem, browserWindow) when the menu item - * is clicked - * String type - * Can be normal, separator, submenu, checkbox or radio - * String label - * Boolean enabled - * If false, the menu item will be greyed out and unclickable. - * Boolean checked - * Should only be specified for checkbox or radio type menu items. - * Menu submenu - * Should be specified for submenu type menu items. If submenu is specified, - * the type: 'submenu' can be omitted. If the value is not a Menu then it - * will be automatically converted to one using Menu.buildFromTemplate. - * Boolean visible - * If false, the menu item will be entirely hidden. - */ -function MenuItem({ - accesskey = null, - checked = false, - click = () => {}, - disabled = false, - label = "", - id = null, - submenu = null, - type = "normal", - visible = true -} = {}) { - this.accesskey = accesskey; - this.checked = checked; - this.click = click; - this.disabled = disabled; - this.id = id; - this.label = label; - this.submenu = submenu; - this.type = type; - this.visible = visible; -} - -module.exports = MenuItem; - -/***/ }), -/* 1766 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const Services = __webpack_require__(22); -const EventEmitter = __webpack_require__(1758); - -/** - * Shortcuts for lazily accessing and setting various preferences. - * Usage: - * let prefs = new Prefs("root.path.to.branch", { - * myIntPref: ["Int", "leaf.path.to.my-int-pref"], - * myCharPref: ["Char", "leaf.path.to.my-char-pref"], - * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], - * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] - * ... - * }); - * - * Get/set: - * prefs.myCharPref = "foo"; - * let aux = prefs.myCharPref; - * - * Observe: - * prefs.registerObserver(); - * prefs.on("pref-changed", (prefName, prefValue) => { - * ... - * }); - * - * @param string prefsRoot - * The root path to the required preferences branch. - * @param object prefsBlueprint - * An object containing { accessorName: [prefType, prefName, prefDefault] } keys. - */ -function PrefsHelper(prefsRoot = "", prefsBlueprint = {}) { - EventEmitter.decorate(this); - - let cache = new Map(); - - for (let accessorName in prefsBlueprint) { - let [prefType, prefName, prefDefault] = prefsBlueprint[accessorName]; - map(this, cache, accessorName, prefType, prefsRoot, prefName, prefDefault); - } - - let observer = makeObserver(this, cache, prefsRoot, prefsBlueprint); - this.registerObserver = () => observer.register(); - this.unregisterObserver = () => observer.unregister(); -} - -/** - * Helper method for getting a pref value. - * - * @param Map cache - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @return any - */ -function get(cache, prefType, prefsRoot, prefName) { - let cachedPref = cache.get(prefName); - if (cachedPref !== undefined) { - return cachedPref; - } - let value = Services.prefs["get" + prefType + "Pref"]([prefsRoot, prefName].join(".")); - cache.set(prefName, value); - return value; -} - -/** - * Helper method for setting a pref value. - * - * @param Map cache - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @param any value - */ -function set(cache, prefType, prefsRoot, prefName, value) { - Services.prefs["set" + prefType + "Pref"]([prefsRoot, prefName].join("."), value); - cache.set(prefName, value); -} - -/** - * Maps a property name to a pref, defining lazy getters and setters. - * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" - * type and casting), and "Json" (which is basically just sugar for "Char" - * using the standard JSON serializer). - * - * @param PrefsHelper self - * @param Map cache - * @param string accessorName - * @param string prefType - * @param string prefsRoot - * @param string prefName - * @param string prefDefault - * @param array serializer [optional] - */ -function map(self, cache, accessorName, prefType, prefsRoot, prefName, prefDefault, serializer = { in: e => e, out: e => e }) { - if (prefName in self) { - throw new Error(`Can't use ${prefName} because it overrides a property` + "on the instance."); - } - if (prefType == "Json") { - map(self, cache, accessorName, "String", prefsRoot, prefName, prefDefault, { - in: JSON.parse, - out: JSON.stringify - }); - return; - } - if (prefType == "Float") { - map(self, cache, accessorName, "Char", prefsRoot, prefName, prefDefault, { - in: Number.parseFloat, - out: n => n + "" - }); - return; - } - - Object.defineProperty(self, accessorName, { - get: () => { - try { - return serializer.in(get(cache, prefType, prefsRoot, prefName)); - } catch (e) { - if (typeof prefDefault !== 'undefined') { - return prefDefault; + // If listeners were removed during emission, make sure the + // event handler we're going to fire wasn't removed. + if (originalListeners === this._eventEmitterListeners.get(aEvent) || this._eventEmitterListeners.get(aEvent).some(l => l === listener)) { + try { + listener.apply(null, arguments); + } catch (ex) { + // Prevent a bad listener from interfering with the others. + let msg = ex + ": " + ex.stack; + //console.error(msg); + console.log(msg); } - throw e; - } - }, - set: e => set(cache, prefType, prefsRoot, prefName, serializer.out(e)) - }); -} - -/** - * Finds the accessor for the provided pref, based on the blueprint object - * used in the constructor. - * - * @param PrefsHelper self - * @param object prefsBlueprint - * @return string - */ -function accessorNameForPref(somePrefName, prefsBlueprint) { - for (let accessorName in prefsBlueprint) { - let [, prefName] = prefsBlueprint[accessorName]; - if (somePrefName == prefName) { - return accessorName; - } - } - return ""; -} - -/** - * Creates a pref observer for `self`. - * - * @param PrefsHelper self - * @param Map cache - * @param string prefsRoot - * @param object prefsBlueprint - * @return object - */ -function makeObserver(self, cache, prefsRoot, prefsBlueprint) { - return { - register: function () { - this._branch = Services.prefs.getBranch(prefsRoot + "."); - this._branch.addObserver("", this); - }, - unregister: function () { - this._branch.removeObserver("", this); - }, - observe: function (subject, topic, prefName) { - // If this particular pref isn't handled by the blueprint object, - // even though it's in the specified branch, ignore it. - let accessorName = accessorNameForPref(prefName, prefsBlueprint); - if (!(accessorName in self)) { - return; - } - cache.delete(prefName); - self.emit("pref-changed", accessorName, self[accessorName]); - } - }; -} - -exports.PrefsHelper = PrefsHelper; - -/***/ }), -/* 1767 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const { appinfo } = __webpack_require__(22); -const EventEmitter = __webpack_require__(1758); -const isOSX = appinfo.OS === "Darwin"; - -// List of electron keys mapped to DOM API (DOM_VK_*) key code -const ElectronKeysMapping = { - "F1": "DOM_VK_F1", - "F2": "DOM_VK_F2", - "F3": "DOM_VK_F3", - "F4": "DOM_VK_F4", - "F5": "DOM_VK_F5", - "F6": "DOM_VK_F6", - "F7": "DOM_VK_F7", - "F8": "DOM_VK_F8", - "F9": "DOM_VK_F9", - "F10": "DOM_VK_F10", - "F11": "DOM_VK_F11", - "F12": "DOM_VK_F12", - "F13": "DOM_VK_F13", - "F14": "DOM_VK_F14", - "F15": "DOM_VK_F15", - "F16": "DOM_VK_F16", - "F17": "DOM_VK_F17", - "F18": "DOM_VK_F18", - "F19": "DOM_VK_F19", - "F20": "DOM_VK_F20", - "F21": "DOM_VK_F21", - "F22": "DOM_VK_F22", - "F23": "DOM_VK_F23", - "F24": "DOM_VK_F24", - "Space": "DOM_VK_SPACE", - "Backspace": "DOM_VK_BACK_SPACE", - "Delete": "DOM_VK_DELETE", - "Insert": "DOM_VK_INSERT", - "Return": "DOM_VK_RETURN", - "Enter": "DOM_VK_RETURN", - "Up": "DOM_VK_UP", - "Down": "DOM_VK_DOWN", - "Left": "DOM_VK_LEFT", - "Right": "DOM_VK_RIGHT", - "Home": "DOM_VK_HOME", - "End": "DOM_VK_END", - "PageUp": "DOM_VK_PAGE_UP", - "PageDown": "DOM_VK_PAGE_DOWN", - "Escape": "DOM_VK_ESCAPE", - "Esc": "DOM_VK_ESCAPE", - "Tab": "DOM_VK_TAB", - "VolumeUp": "DOM_VK_VOLUME_UP", - "VolumeDown": "DOM_VK_VOLUME_DOWN", - "VolumeMute": "DOM_VK_VOLUME_MUTE", - "PrintScreen": "DOM_VK_PRINTSCREEN" -}; - -/** - * Helper to listen for keyboard events decribed in .properties file. - * - * let shortcuts = new KeyShortcuts({ - * window - * }); - * shortcuts.on("Ctrl+F", event => { - * // `event` is the KeyboardEvent which relates to the key shortcuts - * }); - * - * @param DOMWindow window - * The window object of the document to listen events from. - * @param DOMElement target - * Optional DOM Element on which we should listen events from. - * If omitted, we listen for all events fired on `window`. - */ -function KeyShortcuts({ window, target }) { - this.window = window; - this.target = target || window; - this.keys = new Map(); - this.eventEmitter = new EventEmitter(); - this.target.addEventListener("keydown", this); -} - -/* - * Parse an electron-like key string and return a normalized object which - * allow efficient match on DOM key event. The normalized object matches DOM - * API. - * - * @param DOMWindow window - * Any DOM Window object, just to fetch its `KeyboardEvent` object - * @param String str - * The shortcut string to parse, following this document: - * https://github.com/electron/electron/blob/master/docs/api/accelerator.md - */ -KeyShortcuts.parseElectronKey = function (window, str) { - let modifiers = str.split("+"); - let key = modifiers.pop(); - - let shortcut = { - ctrl: false, - meta: false, - alt: false, - shift: false, - // Set for character keys - key: undefined, - // Set for non-character keys - keyCode: undefined - }; - for (let mod of modifiers) { - if (mod === "Alt") { - shortcut.alt = true; - } else if (["Command", "Cmd"].includes(mod)) { - shortcut.meta = true; - } else if (["CommandOrControl", "CmdOrCtrl"].includes(mod)) { - if (isOSX) { - shortcut.meta = true; - } else { - shortcut.ctrl = true; - } - } else if (["Control", "Ctrl"].includes(mod)) { - shortcut.ctrl = true; - } else if (mod === "Shift") { - shortcut.shift = true; - } else { - console.error("Unsupported modifier:", mod, "from key:", str); - return null; - } - } - - // Plus is a special case. It's a character key and shouldn't be matched - // against a keycode as it is only accessible via Shift/Capslock - if (key === "Plus") { - key = "+"; - } - - if (typeof key === "string" && key.length === 1) { - // Match any single character - shortcut.key = key.toLowerCase(); - } else if (key in ElectronKeysMapping) { - // Maps the others manually to DOM API DOM_VK_* - key = ElectronKeysMapping[key]; - shortcut.keyCode = window.KeyboardEvent[key]; - // Used only to stringify the shortcut - shortcut.keyCodeString = key; - shortcut.key = key; - } else { - console.error("Unsupported key:", key); - return null; - } - - return shortcut; -}; - -KeyShortcuts.stringify = function (shortcut) { - let list = []; - if (shortcut.alt) { - list.push("Alt"); - } - if (shortcut.ctrl) { - list.push("Ctrl"); - } - if (shortcut.meta) { - list.push("Cmd"); - } - if (shortcut.shift) { - list.push("Shift"); - } - let key; - if (shortcut.key) { - key = shortcut.key.toUpperCase(); - } else { - key = shortcut.keyCodeString; - } - list.push(key); - return list.join("+"); -}; - -KeyShortcuts.prototype = { - destroy() { - this.target.removeEventListener("keydown", this); - this.keys.clear(); - }, - - doesEventMatchShortcut(event, shortcut) { - if (shortcut.meta != event.metaKey) { - return false; - } - if (shortcut.ctrl != event.ctrlKey) { - return false; - } - if (shortcut.alt != event.altKey) { - return false; - } - // Shift is a special modifier, it may implicitely be required if the - // expected key is a special character accessible via shift. - if (shortcut.shift != event.shiftKey && event.key && event.key.match(/[a-zA-Z]/)) { - return false; - } - if (shortcut.keyCode) { - return event.keyCode == shortcut.keyCode; - } else if (event.key in ElectronKeysMapping) { - return ElectronKeysMapping[event.key] === shortcut.key; - } - - // get the key from the keyCode if key is not provided. - let key = event.key || String.fromCharCode(event.keyCode); - - // For character keys, we match if the final character is the expected one. - // But for digits we also accept indirect match to please azerty keyboard, - // which requires Shift to be pressed to get digits. - return key.toLowerCase() == shortcut.key || shortcut.key.match(/^[0-9]$/) && event.keyCode == shortcut.key.charCodeAt(0); - }, - - handleEvent(event) { - for (let [key, shortcut] of this.keys) { - if (this.doesEventMatchShortcut(event, shortcut)) { - this.eventEmitter.emit(key, event); } } - }, - - on(key, listener) { - if (typeof listener !== "function") { - throw new Error("KeyShortcuts.on() expects a function as " + "second argument"); - } - if (!this.keys.has(key)) { - let shortcut = KeyShortcuts.parseElectronKey(this.window, key); - // The key string is wrong and we were unable to compute the key shortcut - if (!shortcut) { - return; - } - this.keys.set(key, shortcut); - } - this.eventEmitter.on(key, listener); - }, - - off(key, listener) { - this.eventEmitter.off(key, listener); } }; -module.exports = KeyShortcuts; - -/***/ }), -/* 1768 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - - -/** - * Empty shim for "devtools/client/shared/zoom-keys" module - * - * Based on nsIMarkupDocumentViewer.fullZoom API - * https://developer.mozilla.org/en-US/Firefox/Releases/3/Full_page_zoom - */ - -exports.register = function (window) {}; - -/***/ }), -/* 1769 */, -/* 1770 */, -/* 1771 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -exports.formatCallStackFrames = formatCallStackFrames; -exports.default = getCallStackFrames; - -var _sources = __webpack_require__(1369); - -var _pause = __webpack_require__(1394); - -var _frame = __webpack_require__(1380); - -var _devtoolsSourceMap = __webpack_require__(1360); - -var _lodash = __webpack_require__(2); - -function getLocation(frame, isGeneratedSource) { - return isGeneratedSource ? frame.generatedLocation || frame.location : frame.location; -} - -function getSourceForFrame(sources, frame, isGeneratedSource) { - const sourceId = getLocation(frame, isGeneratedSource).sourceId; - return (0, _sources.getSourceInSources)(sources, sourceId); -} - -function appendSource(sources, frame, selectedSource) { - const isGeneratedSource = selectedSource && !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.get("id")); - return _extends({}, frame, { - location: getLocation(frame, isGeneratedSource), - source: getSourceForFrame(sources, frame, isGeneratedSource).toJS() - }); -} - -function formatCallStackFrames(frames, sources, selectedSource) { - if (!frames) { - return null; - } - - return frames.filter(frame => getSourceForFrame(sources, frame)).map(frame => appendSource(sources, frame, selectedSource)).filter(frame => !(0, _lodash.get)(frame, "source.isBlackBoxed")).map(_frame.annotateFrame); -} - -function getCallStackFrames(state) { - const selectedSource = (0, _sources.getSelectedSource)(state); - const sources = (0, _sources.getSources)(state); - const frames = (0, _pause.getFrames)(state); - - return formatCallStackFrames(frames, sources, selectedSource); -} - -/***/ }), -/* 1772 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = getVisibleSelectedFrame; - -var _sources = __webpack_require__(1369); - -var _pause = __webpack_require__(1394); - -var _devtoolsSourceMap = __webpack_require__(1360); - -function getLocation(frame, isGeneratedSource) { - return isGeneratedSource ? frame.generatedLocation || frame.location : frame.location; -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function getVisibleSelectedFrame(state) { - const selectedLocation = (0, _sources.getSelectedLocation)(state); - const isGeneratedSource = !(0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId); - const selectedFrame = (0, _pause.getSelectedFrame)(state); - - if (!selectedFrame) { - return; - } - - return { - location: getLocation(selectedFrame, isGeneratedSource) - }; -} - -/***/ }), -/* 1773 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.setInScopeLines = setInScopeLines; - -var _selectors = __webpack_require__(1352); - -var _source = __webpack_require__(1356); - -var _lodash = __webpack_require__(2); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function getOutOfScopeLines(outOfScopeLocations) { - if (!outOfScopeLocations) { - return null; - } - - return (0, _lodash.uniq)((0, _lodash.flatMap)(outOfScopeLocations, location => (0, _lodash.range)(location.start.line, location.end.line))); -} - -function setInScopeLines() { - return ({ dispatch, getState }) => { - const source = (0, _selectors.getSelectedSource)(getState()); - const outOfScopeLocations = (0, _selectors.getOutOfScopeLocations)(getState()); - - if (!source || !source.get("text")) { - return; - } - - const linesOutOfScope = getOutOfScopeLines(outOfScopeLocations, source.toJS()); - - const sourceNumLines = (0, _source.getSourceLineCount)(source.toJS()); - const sourceLines = (0, _lodash.range)(1, sourceNumLines + 1); - - const inScopeLines = !linesOutOfScope ? sourceLines : (0, _lodash.without)(sourceLines, ...linesOutOfScope); - - dispatch({ - type: "IN_SCOPE_LINES", - lines: inScopeLines - }); - }; -} - -/***/ }), -/* 1774 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.createLocation = createLocation; -function createLocation({ - sourceId, - line, - column, - sourceUrl -}) { - return { - sourceId, - line: line || 0, - column: column || 0, - sourceUrl: sourceUrl || null - }; -} - -/***/ }), -/* 1775 */ -/***/ (function(module, exports, __webpack_require__) { - -let updateScopeBindings = (() => { - var _ref = _asyncToGenerator(function* (scope, location, originalLocation, scopesDataSource) { - const generatedScopes = yield scopesDataSource.getSourceMapsScopes(location); - if (!generatedScopes) { - return scope; - } - const originalScopes = yield scopesDataSource.getOriginalSourceScopes(originalLocation); - const remapedScopes = remapScopes(originalScopes, generatedScopes); - return extendScope(scope, generatedScopes, 0, remapedScopes, 0); - }); - - return function updateScopeBindings(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - }; -})(); - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const { remapScopes } = __webpack_require__(1776); - -function extendScope(scope, generatedScopes, index, remapedScopes, remapedScopesIndex) { - if (!scope) { - return undefined; - } - if (index >= generatedScopes.length) { - return scope; - } - - let syntheticScopes; - if (remapedScopes && remapedScopesIndex < remapedScopes.length) { - if (index >= remapedScopes[remapedScopesIndex].end) { - remapedScopesIndex++; - } - if (remapedScopesIndex < remapedScopes.length) { - const remapedScope = remapedScopes[remapedScopesIndex]; - syntheticScopes = { - scopes: remapedScope.scopes, - groupIndex: index - remapedScope.start, - groupLength: remapedScope.end - remapedScope.start - }; - } - } - - const parent = extendScope(scope.parent, generatedScopes, index + 1, remapedScopes, remapedScopesIndex); - return Object.assign({}, scope, { - parent, - sourceBindings: generatedScopes[index].bindings, - syntheticScopes - }); -} - -module.exports = { - updateScopeBindings -}; /***/ }), -/* 1776 */ -/***/ (function(module, exports) { - - - -// Chunk split source scopes on function/closure boundary -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -function rollupFunctionScopes(scopes) { - const { result } = scopes.reduce(({ isLast, result }, scope) => { - if (isLast) { - result.push([]); - } - result[result.length - 1].push(scope); - return { - isLast: scope.type === "function", - result - }; - }, { isLast: true, result: [] }); - return result; -} - -function getBindingNames(summarizedScopes) { - return summarizedScopes.reduce((acc, { bindingsNames }) => acc.concat(bindingsNames), []); -} - -// Performs mapping of the original parsed scopes to the locals mappings -// based on the generated source parse and source map data. -function remapScopes(scopes, generatedScopes) { - if (!scopes || scopes.length === 0) { - return null; - } - const scopeChunks = rollupFunctionScopes(scopes); - const { result: assigned } = scopeChunks.reduce(({ result, searchIn, searchOffset }, scopeChunk) => { - if (searchIn.length === 0) { - return { result, searchIn, searchOffset }; - } - // Process chunk of original parsed scopes: create used original names - // binding summary per scope and entire chunk. - const summarizedScopes = scopeChunk.map(({ type, bindings }) => ({ - type, - bindingsNames: Object.keys(bindings) - })); - const names = getBindingNames(summarizedScopes); - // ... and find these names in the generated scopes (with mapped - // original names) -- we need index of the last scope in the searchIn. - let foundInMax = names.reduce((max, name) => { - const index = searchIn.findIndex(s => name in s.bindings); - return index < 0 ? Math.max(index, max) : max; - }, 0); - - // TODO double check if names were not matched/found -- the source maps - // and scope parsing can be broken. - // Moving to the function bounary (in generated scopes). - while (foundInMax + 1 < searchIn.length && searchIn[foundInMax].type !== "function") { - foundInMax++; - } - - // We found chunk of the function(s) that contains all/most of - // the scopeChunk names -- adding finding to the result. - result.push({ - scopes: summarizedScopes, - start: searchOffset, - end: searchOffset + foundInMax + 1 - }); - - // Consuming generated scopes mappings (searchIn). - return { - result, - searchIn: searchIn.slice(foundInMax + 1), - searchOffset: searchOffset + foundInMax + 1 - }; - }, { result: [], searchIn: generatedScopes, searchOffset: 0 }); - return assigned; -} - -module.exports = { - remapScopes -}; - -/***/ }), -/* 1777 */ -/***/ (function(module, exports) { - -module.exports = "Group 2Created with Sketch." - -/***/ }), -/* 1778 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = renderBreakpointsDropdown; - -var _react = __webpack_require__(0); - -var _react2 = _interopRequireDefault(_react); - -var _Svg = __webpack_require__(1359); - -var _Svg2 = _interopRequireDefault(_Svg); - -var _Dropdown = __webpack_require__(1615); - -var _Dropdown2 = _interopRequireDefault(_Dropdown); - -var _classnames = __webpack_require__(175); - -var _classnames2 = _interopRequireDefault(_classnames); - -__webpack_require__(1779); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function renderPause(isWaitingOnBreak) { - const active = isWaitingOnBreak; - return _react2.default.createElement( - "div", - { - className: (0, _classnames2.default)("pause-next", { - active: active, - inactive: !active - }) - }, - _react2.default.createElement("img", { className: "pause-next" }), - _react2.default.createElement( - "span", - { className: "icon-spacer" }, - L10N.getStr("pauseButtonItem") - ) - ); -} - -function renderPauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { - const active = (shouldPauseOnExceptions || shouldIgnoreCaughtExceptions) && (!shouldPauseOnExceptions || !shouldIgnoreCaughtExceptions); - return _react2.default.createElement( - "div", - { - className: (0, _classnames2.default)("pause-on-exceptions", { - active: active, - inactive: !active - }) - }, - _react2.default.createElement("img", { className: "pause-on-exceptions" }), - _react2.default.createElement( - "span", - { className: "icon-spacer" }, - L10N.getStr("pauseOnExceptionsItem") - ) - ); -} - -function renderPauseOnUncaughtExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { - const active = shouldPauseOnExceptions && shouldIgnoreCaughtExceptions; - return _react2.default.createElement( - "div", - { - className: (0, _classnames2.default)("pause-uncaught-exceptions", { - active: active, - inactive: !active - }) - }, - _react2.default.createElement("img", { className: "pause-uncaught-exceptions" }), - _react2.default.createElement( - "span", - { className: "icon-spacer" }, - L10N.getStr("pauseOnUncaughtExceptionsItem") - ) - ); -} - -function renderIgnoreExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { - const active = !shouldPauseOnExceptions && !shouldIgnoreCaughtExceptions; - return _react2.default.createElement( - "div", - { - className: (0, _classnames2.default)("ignore-exceptions", { - active: active, - inactive: !active - }) - }, - _react2.default.createElement("img", { className: "ignore-exceptions" }), - _react2.default.createElement( - "span", - { className: "icon-spacer" }, - L10N.getStr("ignoreExceptionsItem") - ) - ); -} - -function handleClick(e) { - e.stopPropagation(); -} - -function renderBreakpointsDropdown(breakOnNext, pauseOnExceptions, shouldPauseOnExceptions, shouldIgnoreCaughtExceptions, isWaitingOnBreak) { - const Panel = _react2.default.createElement( - "ul", - null, - _react2.default.createElement( - "li", - { onClick: () => breakOnNext(), className: "first" }, - renderPause(isWaitingOnBreak) - ), - _react2.default.createElement( - "li", - { onClick: () => pauseOnExceptions(false, false) }, - renderIgnoreExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) - ), - _react2.default.createElement( - "li", - { onClick: () => pauseOnExceptions(true, true) }, - renderPauseOnUncaughtExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) - ), - _react2.default.createElement( - "li", - { onClick: () => pauseOnExceptions(true, false) }, - renderPauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) - ) - ); - - const active = shouldPauseOnExceptions || shouldIgnoreCaughtExceptions || isWaitingOnBreak; - - return _react2.default.createElement( - "div", - { - className: "breakpoints-dropdown", - onClick: e => handleClick(e), - key: "breakpoints-dropdown" - }, - _react2.default.createElement(_Dropdown2.default, { - className: "dropdown", - panel: Panel, - icon: _react2.default.createElement(_Svg2.default, { - name: "plus", - className: (0, _classnames2.default)("plus", { - active: active, - inactive: !active - }) - }) - }) - ); -} - -/***/ }), -/* 1779 */ -/***/ (function(module, exports) { - -// removed by extract-text-webpack-plugin - -/***/ }), -/* 1780 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getScopes = getScopes; - -var _synthesizeScopes = __webpack_require__(1781); - -var _getScope = __webpack_require__(1782); - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function getScopes(pauseInfo, selectedFrame, frameScopes) { - if (!pauseInfo || !selectedFrame) { - return null; - } - - if (!frameScopes) { - return null; - } - - const scopes = []; - - let scope = frameScopes; - let scopeIndex = 1; - - while (scope) { - const { syntheticScopes } = scope; - let lastScope = scope; - - if (!syntheticScopes) { - const scopeItem = (0, _getScope.getScope)(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex); - - if (scopeItem) { - scopes.push(scopeItem); - } - scopeIndex++; - } else { - scopes.push(...(0, _synthesizeScopes.synthesizeScopes)(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex)); - - // skip to the next generated scope - const scopeDepth = syntheticScopes.groupLength; - for (let i = 1; lastScope.parent && i < scopeDepth; i++) { - const nextScope = lastScope.parent; - lastScope = nextScope; - } - - scope = lastScope; - scopeIndex += syntheticScopes.scopes.length; - } - scope = scope.parent; - } - - return scopes; -} - -/***/ }), -/* 1781 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.synthesizeScopes = synthesizeScopes; - -var _getVariables = __webpack_require__(1760); - -var _frame = __webpack_require__(1380); - -var _utils = __webpack_require__(1761); - -function getSynteticScopeTitle(type, generatedScopes) { - if (type === "function") { - // FIXME Use original function name here - const lastGeneratedScope = generatedScopes[generatedScopes.length - 1]; - const isLastGeneratedScopeFn = lastGeneratedScope && lastGeneratedScope.type === "function"; - return isLastGeneratedScopeFn && lastGeneratedScope.function.displayName ? (0, _frame.simplifyDisplayName)(lastGeneratedScope.function.displayName) : L10N.getStr("anonymous"); - } - return L10N.getStr("scopes.block"); -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function findOriginalBindings(bindingsNames, generatedScopes, key, foundGeneratedNames) { - return bindingsNames.reduce((vars, name) => { - // Find binding name in the original source bindings - const generatedScope = generatedScopes.find(gs => gs.sourceBindings && name in gs.sourceBindings); - if (!generatedScope || !generatedScope.sourceBindings) { - return vars; - } - // .. and map it to the generated name - const generatedName = generatedScope.sourceBindings[name]; - // Skip if we already use the generated name - if (generatedName && !foundGeneratedNames[generatedName]) { - if (generatedScope.bindings.variables[generatedName]) { - vars.push({ - name, - generatedName, - path: `${key}/${generatedName}`, - contents: generatedScope.bindings.variables[generatedName] - }); - foundGeneratedNames[generatedName] = true; - return vars; - } - - const arg = generatedScope.bindings.arguments.find(arg_ => arg_[generatedName]); - if (arg) { - vars.push({ - name, - generatedName, - path: `${key}/${generatedName}`, - contents: arg[generatedName] - }); - foundGeneratedNames[generatedName] = true; - return vars; - } - } - - vars.push({ - name, - generatedName, - path: `${key}/${generatedName}`, - contents: { value: { type: "undefined" } } - }); - return vars; - }, []); -} - -function findUnusedBindings(generatedScopes, foundGeneratedNames, key) { - const allGeneratedVars = generatedScopes.reduce((acc, { bindings }) => { - return acc.concat((0, _getVariables.getBindingVariables)(bindings, key)); - }, []); - return allGeneratedVars.filter(v => !foundGeneratedNames[v.name]); -} - -// Create a synthesized scope based on its binding names and -// generated/original scopes information. -function synthesizeScope(syntheticScope, index, actor, key, scopeIndex, lastScopeIndex, generatedScopes, foundGeneratedNames, scope, frameScopes, selectedFrame, pauseInfo) { - const { bindingsNames } = syntheticScope; - const isLast = index === lastScopeIndex; - - let vars = findOriginalBindings(bindingsNames, generatedScopes, key, foundGeneratedNames); - - if (isLast) { - // For the last synthesized scope, apply all generated names we did not use - vars = [...vars, ...findUnusedBindings(generatedScopes, foundGeneratedNames, key)]; - } - - if (index === 0) { - const isLocalScope = scope.actor === frameScopes.actor; - - // For the first synthesized scope, add this and other vars. - if (isLocalScope) { - vars = [...vars, ...(0, _utils.getFramePopVariables)(pauseInfo, key)]; - - const this_ = (0, _utils.getThisVariable)(selectedFrame, key); - - if (this_) { - vars.push(this_); - } - } - } - - return vars; -} - -function synthesizeScopes(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { - const { actor, syntheticScopes } = scope; - if (!syntheticScopes) { - return []; - } - - // Collect all connected generated scopes. - const generatedScopes = []; - for (let count = syntheticScopes.groupLength, s = scope; count > 0 && s; count--) { - generatedScopes.push(s); - s = s.parent; - } - - const foundGeneratedNames = Object.create(null); - const lastScopeIndex = syntheticScopes.scopes.length - 1; - return syntheticScopes.scopes.reduce((result, syntheticScope, index) => { - const key = `${actor}-${scopeIndex + index}`; - const bindings = synthesizeScope(syntheticScope, index, actor, key, scopeIndex, lastScopeIndex, generatedScopes, foundGeneratedNames, scope, frameScopes, selectedFrame, pauseInfo); - - if (bindings && bindings.length) { - const title = getSynteticScopeTitle(syntheticScope.type, generatedScopes); - bindings.sort((a, b) => a.name.localeCompare(b.name)); - result.push({ - name: title, - path: key, - contents: bindings - }); - } - return result; - }, []); -} - -/***/ }), -/* 1782 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -exports.getScope = getScope; - -var _getVariables = __webpack_require__(1760); - -var _utils = __webpack_require__(1761); - -var _frame = __webpack_require__(1380); - -function getScopeTitle(type, scope) { - if (type === "function") { - return scope.function.displayName ? (0, _frame.simplifyDisplayName)(scope.function.displayName) : L10N.getStr("anonymous"); - } - return L10N.getStr("scopes.block"); -} - -function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { - const { type, actor } = scope; - - const isLocalScope = scope.actor === frameScopes.actor; - - const key = `${actor}-${scopeIndex}`; - if (type === "function" || type === "block") { - const bindings = scope.bindings; - const sourceBindings = scope.sourceBindings; - - let vars = sourceBindings ? (0, _getVariables.getSourceBindingVariables)(bindings, sourceBindings, key) : (0, _getVariables.getBindingVariables)(bindings, key); - - // show exception, return, and this variables in innermost scope - if (isLocalScope) { - vars = vars.concat((0, _utils.getFramePopVariables)(pauseInfo, key)); - - const this_ = (0, _utils.getThisVariable)(selectedFrame, key); - - if (this_) { - vars.push(this_); - } - } - - if (vars && vars.length) { - const title = getScopeTitle(type, scope); - vars.sort((a, b) => a.name.localeCompare(b.name)); - return { - name: title, - path: key, - contents: vars - }; - } - } else if (type === "object") { - let value = scope.object; - // If this is the global window scope, mark it as such so that it will - // preview Window: Global instead of Window: Window - if (value.class === "Window") { - value = _extends({}, scope.object, { displayClass: "Global" }); - } - return { - name: scope.object.class, - path: key, - contents: { value } - }; - } - - return null; -} - -/***/ }), -/* 1783 */ +/* 1760 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48148,7 +46298,7 @@ function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { }).call(undefined); /***/ }), -/* 1784 */ +/* 1761 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48157,7 +46307,7 @@ function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { (function () { var computeScore, countDir, file_coeff, getExtension, getExtensionScore, isMatch, scorePath, scoreSize, tau_depth, _ref; - _ref = __webpack_require__(1783), isMatch = _ref.isMatch, computeScore = _ref.computeScore, scoreSize = _ref.scoreSize; + _ref = __webpack_require__(1760), isMatch = _ref.isMatch, computeScore = _ref.computeScore, scoreSize = _ref.scoreSize; tau_depth = 13; @@ -48265,7 +46415,50 @@ function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { }).call(undefined); /***/ }), -/* 1785 */ +/* 1762 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _lodash = __webpack_require__(2); + +let newSources; +let createSource; +let queuedSources; +let supportsWasm = false; + +const queue = (0, _lodash.throttle)(() => { + if (!newSources || !createSource) { + return; + } + newSources(queuedSources.map(source => { + return createSource(source, { supportsWasm }); + })); + queuedSources = []; +}, 100); + +exports.default = { + initialize: options => { + newSources = options.actions.newSources; + createSource = options.createSource; + supportsWasm = options.supportsWasm; + queuedSources = []; + }, + queue: source => { + queuedSources.push(source); + queue(); + }, + flush: () => queue.flush(), + clear: () => queue.cancel() +}; + +/***/ }), +/* 1763 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48274,7 +46467,7 @@ function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { (function () { var Query, coreChars, countDir, getCharCodes, getExtension, opt_char_re, truncatedUpperCase, _ref; - _ref = __webpack_require__(1784), countDir = _ref.countDir, getExtension = _ref.getExtension; + _ref = __webpack_require__(1761), countDir = _ref.countDir, getExtension = _ref.getExtension; module.exports = Query = function () { function Query(query, _arg) { @@ -48328,7 +46521,7 @@ function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { }).call(undefined); /***/ }), -/* 1786 */ +/* 1764 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48348,7 +46541,7 @@ var _react2 = _interopRequireDefault(_react); var _propTypes = __webpack_require__(20); -var _util = __webpack_require__(1791); +var _util = __webpack_require__(1778); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -48426,7 +46619,7 @@ InlineSVG.propTypes = { }; /***/ }), -/* 1787 */ +/* 1765 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48446,7 +46639,7 @@ var _react = __webpack_require__(0); var _react2 = _interopRequireDefault(_react); -__webpack_require__(1792); +__webpack_require__(1789); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -48469,7 +46662,925 @@ const CommandBarButton = props => { exports.default = CommandBarButton; /***/ }), -/* 1788 */ +/* 1766 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getSourceBindingVariables = getSourceBindingVariables; +exports.getBindingVariables = getBindingVariables; + +var _lodash = __webpack_require__(2); + +// VarAndBindingsPair actually is [name: string, contents: BindingContents] + + +// Scope's bindings field which holds variables and arguments +function getSourceBindingVariables(bindings, sourceBindings, parentName) { + const result = getBindingVariables(bindings, parentName); + const index = Object.create(null); + result.forEach(entry => { + index[entry.name] = { used: false, entry }; + }); + // Find and replace variables that is present in sourceBindings. + const bound = Object.keys(sourceBindings).map(name => { + const generatedName = sourceBindings[name]; + const foundMap = index[generatedName]; + let contents; + if (foundMap) { + foundMap.used = true; + contents = foundMap.entry.contents; + } else { + contents = { value: { type: "undefined" } }; + } + return { + name, + generatedName, + path: `${parentName}/${generatedName}`, + contents + }; + }); + // Use rest of them (not found in the sourceBindings) as is. + const unused = result.filter(entry => !index[entry.name].used); + return bound.concat(unused); +} + +// Create the tree nodes representing all the variables and arguments +// for the bindings from a scope. +/* eslint max-nested-callbacks: ["error", 4] */ + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getBindingVariables(bindings, parentName) { + const args = bindings.arguments.map(arg => (0, _lodash.toPairs)(arg)[0]); + const variables = (0, _lodash.toPairs)(bindings.variables); + + return args.concat(variables).map(binding => { + const name = binding[0]; + const contents = binding[1]; + return { + name, + path: `${parentName}/${name}`, + contents + }; + }); +} + +/***/ }), +/* 1767 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getFramePopVariables = getFramePopVariables; +exports.getThisVariable = getThisVariable; +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getFramePopVariables(pauseInfo, path) { + const vars = []; + + if (pauseInfo.why && pauseInfo.why.frameFinished) { + const frameFinished = pauseInfo.why.frameFinished; + + // Always display a `throw` property if present, even if it is falsy. + if (Object.prototype.hasOwnProperty.call(frameFinished, "throw")) { + vars.push({ + name: "", + path: `${path}/`, + contents: { value: frameFinished.throw } + }); + } + + if (Object.prototype.hasOwnProperty.call(frameFinished, "return")) { + const returned = frameFinished.return; + + // Do not display undefined. Do display falsy values like 0 and false. The + // protocol grip for undefined is a JSON object: { type: "undefined" }. + if (typeof returned !== "object" || returned.type !== "undefined") { + vars.push({ + name: "", + path: `${path}/`, + contents: { value: returned } + }); + } + } + } + + return vars; +} + +function getThisVariable(frame, path) { + const this_ = frame.this; + + if (!this_) { + return null; + } + + return { + name: "", + path: `${path}/`, + contents: { value: this_ } + }; +} + +/***/ }), +/* 1768 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const Menu = __webpack_require__(1769); +const MenuItem = __webpack_require__(1771); +const { PrefsHelper } = __webpack_require__(1772); +const Services = __webpack_require__(22); +const KeyShortcuts = __webpack_require__(1773); +const { ZoomKeys } = __webpack_require__(1774); +const EventEmitter = __webpack_require__(1759); + +module.exports = { + KeyShortcuts, + Menu, + MenuItem, + PrefsHelper, + Services, + ZoomKeys, + EventEmitter +}; + +/***/ }), +/* 1769 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const EventEmitter = __webpack_require__(1759); + +function inToolbox() { + return window.parent.document.documentURI == "about:devtools-toolbox"; +} + +/** + * A partial implementation of the Menu API provided by electron: + * https://github.com/electron/electron/blob/master/docs/api/menu.md. + * + * Extra features: + * - Emits an 'open' and 'close' event when the menu is opened/closed + + * @param String id (non standard) + * Needed so tests can confirm the XUL implementation is working + */ +function Menu({ id = null } = {}) { + this.menuitems = []; + this.id = id; + + Object.defineProperty(this, "items", { + get() { + return this.menuitems; + } + }); + + EventEmitter.decorate(this); +} + +/** + * Add an item to the end of the Menu + * + * @param {MenuItem} menuItem + */ +Menu.prototype.append = function (menuItem) { + this.menuitems.push(menuItem); +}; + +/** + * Add an item to a specified position in the menu + * + * @param {int} pos + * @param {MenuItem} menuItem + */ +Menu.prototype.insert = function (pos, menuItem) { + throw Error("Not implemented"); +}; + +/** + * Show the Menu at a specified location on the screen + * + * Missing features: + * - browserWindow - BrowserWindow (optional) - Default is null. + * - positioningItem Number - (optional) OS X + * + * @param {int} screenX + * @param {int} screenY + * @param Toolbox toolbox (non standard) + * Needed so we in which window to inject XUL + */ +Menu.prototype.popup = function (screenX, screenY, toolbox) { + let doc = toolbox.doc; + let popupset = doc.querySelector("popupset"); + // See bug 1285229, on Windows, opening the same popup multiple times in a + // row ends up duplicating the popup. The newly inserted popup doesn't + // dismiss the old one. So remove any previously displayed popup before + // opening a new one. + let popup = popupset.querySelector("menupopup[menu-api=\"true\"]"); + if (popup) { + popup.hidePopup(); + } + + popup = this.createPopup(doc); + popup.setAttribute("menu-api", "true"); + + if (this.id) { + popup.id = this.id; + } + this._createMenuItems(popup); + + // Remove the menu from the DOM once it's hidden. + popup.addEventListener("popuphidden", e => { + if (e.target === popup) { + popup.remove(); + this.emit("close", popup); + } + }); + + popup.addEventListener("popupshown", e => { + if (e.target === popup) { + this.emit("open", popup); + } + }); + + popupset.appendChild(popup); + popup.openPopupAtScreen(screenX, screenY, true); +}; + +Menu.prototype.createPopup = function (doc) { + return doc.createElement("menupopup"); +}; + +Menu.prototype._createMenuItems = function (parent) { + let doc = parent.ownerDocument; + this.menuitems.forEach(item => { + if (!item.visible) { + return; + } + + if (item.submenu) { + let menupopup = doc.createElement("menupopup"); + item.submenu._createMenuItems(menupopup); + + let menuitem = doc.createElement("menuitem"); + menuitem.setAttribute("label", item.label); + if (!inToolbox()) { + menuitem.textContent = item.label; + } + + let menu = doc.createElement("menu"); + menu.appendChild(menuitem); + menu.appendChild(menupopup); + if (item.disabled) { + menu.setAttribute("disabled", "true"); + } + if (item.accesskey) { + menu.setAttribute("accesskey", item.accesskey); + } + if (item.id) { + menu.id = item.id; + } + parent.appendChild(menu); + } else if (item.type === "separator") { + let menusep = doc.createElement("menuseparator"); + parent.appendChild(menusep); + } else { + let menuitem = doc.createElement("menuitem"); + menuitem.setAttribute("label", item.label); + + if (!inToolbox()) { + menuitem.textContent = item.label; + } + + menuitem.addEventListener("command", () => item.click()); + + if (item.type === "checkbox") { + menuitem.setAttribute("type", "checkbox"); + } + if (item.type === "radio") { + menuitem.setAttribute("type", "radio"); + } + if (item.disabled) { + menuitem.setAttribute("disabled", "true"); + } + if (item.checked) { + menuitem.setAttribute("checked", "true"); + } + if (item.accesskey) { + menuitem.setAttribute("accesskey", item.accesskey); + } + if (item.id) { + menuitem.id = item.id; + } + + parent.appendChild(menuitem); + } + }); +}; + +Menu.setApplicationMenu = () => { + throw Error("Not implemented"); +}; + +Menu.sendActionToFirstResponder = () => { + throw Error("Not implemented"); +}; + +Menu.buildFromTemplate = () => { + throw Error("Not implemented"); +}; + +module.exports = Menu; + +/***/ }), +/* 1770 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * A sham for https://dxr.mozilla.org/mozilla-central/source/toolkit/modules/Promise.jsm + */ + +/** + * Promise.jsm is mostly the Promise web API with a `defer` method. Just drop this in here, + * and use the native web API (although building with webpack/babel, it may replace this + * with it's own version if we want to target environments that do not have `Promise`. + */ + +let p = typeof window != "undefined" ? window.Promise : Promise; +p.defer = function defer() { + var resolve, reject; + var promise = new Promise(function () { + resolve = arguments[0]; + reject = arguments[1]; + }); + return { + resolve: resolve, + reject: reject, + promise: promise + }; +}; + +module.exports = p; + +/***/ }), +/* 1771 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * A partial implementation of the MenuItem API provided by electron: + * https://github.com/electron/electron/blob/master/docs/api/menu-item.md. + * + * Missing features: + * - id String - Unique within a single menu. If defined then it can be used + * as a reference to this item by the position attribute. + * - role String - Define the action of the menu item; when specified the + * click property will be ignored + * - sublabel String + * - accelerator Accelerator + * - icon NativeImage + * - position String - This field allows fine-grained definition of the + * specific location within a given menu. + * + * Implemented features: + * @param Object options + * Function click + * Will be called with click(menuItem, browserWindow) when the menu item + * is clicked + * String type + * Can be normal, separator, submenu, checkbox or radio + * String label + * Boolean enabled + * If false, the menu item will be greyed out and unclickable. + * Boolean checked + * Should only be specified for checkbox or radio type menu items. + * Menu submenu + * Should be specified for submenu type menu items. If submenu is specified, + * the type: 'submenu' can be omitted. If the value is not a Menu then it + * will be automatically converted to one using Menu.buildFromTemplate. + * Boolean visible + * If false, the menu item will be entirely hidden. + */ +function MenuItem({ + accesskey = null, + checked = false, + click = () => {}, + disabled = false, + label = "", + id = null, + submenu = null, + type = "normal", + visible = true +} = {}) { + this.accesskey = accesskey; + this.checked = checked; + this.click = click; + this.disabled = disabled; + this.id = id; + this.label = label; + this.submenu = submenu; + this.type = type; + this.visible = visible; +} + +module.exports = MenuItem; + +/***/ }), +/* 1772 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const Services = __webpack_require__(22); +const EventEmitter = __webpack_require__(1759); + +/** + * Shortcuts for lazily accessing and setting various preferences. + * Usage: + * let prefs = new Prefs("root.path.to.branch", { + * myIntPref: ["Int", "leaf.path.to.my-int-pref"], + * myCharPref: ["Char", "leaf.path.to.my-char-pref"], + * myJsonPref: ["Json", "leaf.path.to.my-json-pref"], + * myFloatPref: ["Float", "leaf.path.to.my-float-pref"] + * ... + * }); + * + * Get/set: + * prefs.myCharPref = "foo"; + * let aux = prefs.myCharPref; + * + * Observe: + * prefs.registerObserver(); + * prefs.on("pref-changed", (prefName, prefValue) => { + * ... + * }); + * + * @param string prefsRoot + * The root path to the required preferences branch. + * @param object prefsBlueprint + * An object containing { accessorName: [prefType, prefName, prefDefault] } keys. + */ +function PrefsHelper(prefsRoot = "", prefsBlueprint = {}) { + EventEmitter.decorate(this); + + let cache = new Map(); + + for (let accessorName in prefsBlueprint) { + let [prefType, prefName, prefDefault] = prefsBlueprint[accessorName]; + map(this, cache, accessorName, prefType, prefsRoot, prefName, prefDefault); + } + + let observer = makeObserver(this, cache, prefsRoot, prefsBlueprint); + this.registerObserver = () => observer.register(); + this.unregisterObserver = () => observer.unregister(); +} + +/** + * Helper method for getting a pref value. + * + * @param Map cache + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @return any + */ +function get(cache, prefType, prefsRoot, prefName) { + let cachedPref = cache.get(prefName); + if (cachedPref !== undefined) { + return cachedPref; + } + let value = Services.prefs["get" + prefType + "Pref"]([prefsRoot, prefName].join(".")); + cache.set(prefName, value); + return value; +} + +/** + * Helper method for setting a pref value. + * + * @param Map cache + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @param any value + */ +function set(cache, prefType, prefsRoot, prefName, value) { + Services.prefs["set" + prefType + "Pref"]([prefsRoot, prefName].join("."), value); + cache.set(prefName, value); +} + +/** + * Maps a property name to a pref, defining lazy getters and setters. + * Supported types are "Bool", "Char", "Int", "Float" (sugar around "Char" + * type and casting), and "Json" (which is basically just sugar for "Char" + * using the standard JSON serializer). + * + * @param PrefsHelper self + * @param Map cache + * @param string accessorName + * @param string prefType + * @param string prefsRoot + * @param string prefName + * @param string prefDefault + * @param array serializer [optional] + */ +function map(self, cache, accessorName, prefType, prefsRoot, prefName, prefDefault, serializer = { in: e => e, out: e => e }) { + if (prefName in self) { + throw new Error(`Can't use ${prefName} because it overrides a property` + "on the instance."); + } + if (prefType == "Json") { + map(self, cache, accessorName, "String", prefsRoot, prefName, prefDefault, { + in: JSON.parse, + out: JSON.stringify + }); + return; + } + if (prefType == "Float") { + map(self, cache, accessorName, "Char", prefsRoot, prefName, prefDefault, { + in: Number.parseFloat, + out: n => n + "" + }); + return; + } + + Object.defineProperty(self, accessorName, { + get: () => { + try { + return serializer.in(get(cache, prefType, prefsRoot, prefName)); + } catch (e) { + if (typeof prefDefault !== 'undefined') { + return prefDefault; + } + throw e; + } + }, + set: e => set(cache, prefType, prefsRoot, prefName, serializer.out(e)) + }); +} + +/** + * Finds the accessor for the provided pref, based on the blueprint object + * used in the constructor. + * + * @param PrefsHelper self + * @param object prefsBlueprint + * @return string + */ +function accessorNameForPref(somePrefName, prefsBlueprint) { + for (let accessorName in prefsBlueprint) { + let [, prefName] = prefsBlueprint[accessorName]; + if (somePrefName == prefName) { + return accessorName; + } + } + return ""; +} + +/** + * Creates a pref observer for `self`. + * + * @param PrefsHelper self + * @param Map cache + * @param string prefsRoot + * @param object prefsBlueprint + * @return object + */ +function makeObserver(self, cache, prefsRoot, prefsBlueprint) { + return { + register: function () { + this._branch = Services.prefs.getBranch(prefsRoot + "."); + this._branch.addObserver("", this); + }, + unregister: function () { + this._branch.removeObserver("", this); + }, + observe: function (subject, topic, prefName) { + // If this particular pref isn't handled by the blueprint object, + // even though it's in the specified branch, ignore it. + let accessorName = accessorNameForPref(prefName, prefsBlueprint); + if (!(accessorName in self)) { + return; + } + cache.delete(prefName); + self.emit("pref-changed", accessorName, self[accessorName]); + } + }; +} + +exports.PrefsHelper = PrefsHelper; + +/***/ }), +/* 1773 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { appinfo } = __webpack_require__(22); +const EventEmitter = __webpack_require__(1759); +const isOSX = appinfo.OS === "Darwin"; + +// List of electron keys mapped to DOM API (DOM_VK_*) key code +const ElectronKeysMapping = { + "F1": "DOM_VK_F1", + "F2": "DOM_VK_F2", + "F3": "DOM_VK_F3", + "F4": "DOM_VK_F4", + "F5": "DOM_VK_F5", + "F6": "DOM_VK_F6", + "F7": "DOM_VK_F7", + "F8": "DOM_VK_F8", + "F9": "DOM_VK_F9", + "F10": "DOM_VK_F10", + "F11": "DOM_VK_F11", + "F12": "DOM_VK_F12", + "F13": "DOM_VK_F13", + "F14": "DOM_VK_F14", + "F15": "DOM_VK_F15", + "F16": "DOM_VK_F16", + "F17": "DOM_VK_F17", + "F18": "DOM_VK_F18", + "F19": "DOM_VK_F19", + "F20": "DOM_VK_F20", + "F21": "DOM_VK_F21", + "F22": "DOM_VK_F22", + "F23": "DOM_VK_F23", + "F24": "DOM_VK_F24", + "Space": "DOM_VK_SPACE", + "Backspace": "DOM_VK_BACK_SPACE", + "Delete": "DOM_VK_DELETE", + "Insert": "DOM_VK_INSERT", + "Return": "DOM_VK_RETURN", + "Enter": "DOM_VK_RETURN", + "Up": "DOM_VK_UP", + "Down": "DOM_VK_DOWN", + "Left": "DOM_VK_LEFT", + "Right": "DOM_VK_RIGHT", + "Home": "DOM_VK_HOME", + "End": "DOM_VK_END", + "PageUp": "DOM_VK_PAGE_UP", + "PageDown": "DOM_VK_PAGE_DOWN", + "Escape": "DOM_VK_ESCAPE", + "Esc": "DOM_VK_ESCAPE", + "Tab": "DOM_VK_TAB", + "VolumeUp": "DOM_VK_VOLUME_UP", + "VolumeDown": "DOM_VK_VOLUME_DOWN", + "VolumeMute": "DOM_VK_VOLUME_MUTE", + "PrintScreen": "DOM_VK_PRINTSCREEN" +}; + +/** + * Helper to listen for keyboard events decribed in .properties file. + * + * let shortcuts = new KeyShortcuts({ + * window + * }); + * shortcuts.on("Ctrl+F", event => { + * // `event` is the KeyboardEvent which relates to the key shortcuts + * }); + * + * @param DOMWindow window + * The window object of the document to listen events from. + * @param DOMElement target + * Optional DOM Element on which we should listen events from. + * If omitted, we listen for all events fired on `window`. + */ +function KeyShortcuts({ window, target }) { + this.window = window; + this.target = target || window; + this.keys = new Map(); + this.eventEmitter = new EventEmitter(); + this.target.addEventListener("keydown", this); +} + +/* + * Parse an electron-like key string and return a normalized object which + * allow efficient match on DOM key event. The normalized object matches DOM + * API. + * + * @param DOMWindow window + * Any DOM Window object, just to fetch its `KeyboardEvent` object + * @param String str + * The shortcut string to parse, following this document: + * https://github.com/electron/electron/blob/master/docs/api/accelerator.md + */ +KeyShortcuts.parseElectronKey = function (window, str) { + let modifiers = str.split("+"); + let key = modifiers.pop(); + + let shortcut = { + ctrl: false, + meta: false, + alt: false, + shift: false, + // Set for character keys + key: undefined, + // Set for non-character keys + keyCode: undefined + }; + for (let mod of modifiers) { + if (mod === "Alt") { + shortcut.alt = true; + } else if (["Command", "Cmd"].includes(mod)) { + shortcut.meta = true; + } else if (["CommandOrControl", "CmdOrCtrl"].includes(mod)) { + if (isOSX) { + shortcut.meta = true; + } else { + shortcut.ctrl = true; + } + } else if (["Control", "Ctrl"].includes(mod)) { + shortcut.ctrl = true; + } else if (mod === "Shift") { + shortcut.shift = true; + } else { + console.error("Unsupported modifier:", mod, "from key:", str); + return null; + } + } + + // Plus is a special case. It's a character key and shouldn't be matched + // against a keycode as it is only accessible via Shift/Capslock + if (key === "Plus") { + key = "+"; + } + + if (typeof key === "string" && key.length === 1) { + // Match any single character + shortcut.key = key.toLowerCase(); + } else if (key in ElectronKeysMapping) { + // Maps the others manually to DOM API DOM_VK_* + key = ElectronKeysMapping[key]; + shortcut.keyCode = window.KeyboardEvent[key]; + // Used only to stringify the shortcut + shortcut.keyCodeString = key; + shortcut.key = key; + } else { + console.error("Unsupported key:", key); + return null; + } + + return shortcut; +}; + +KeyShortcuts.stringify = function (shortcut) { + let list = []; + if (shortcut.alt) { + list.push("Alt"); + } + if (shortcut.ctrl) { + list.push("Ctrl"); + } + if (shortcut.meta) { + list.push("Cmd"); + } + if (shortcut.shift) { + list.push("Shift"); + } + let key; + if (shortcut.key) { + key = shortcut.key.toUpperCase(); + } else { + key = shortcut.keyCodeString; + } + list.push(key); + return list.join("+"); +}; + +KeyShortcuts.prototype = { + destroy() { + this.target.removeEventListener("keydown", this); + this.keys.clear(); + }, + + doesEventMatchShortcut(event, shortcut) { + if (shortcut.meta != event.metaKey) { + return false; + } + if (shortcut.ctrl != event.ctrlKey) { + return false; + } + if (shortcut.alt != event.altKey) { + return false; + } + // Shift is a special modifier, it may implicitely be required if the + // expected key is a special character accessible via shift. + if (shortcut.shift != event.shiftKey && event.key && event.key.match(/[a-zA-Z]/)) { + return false; + } + if (shortcut.keyCode) { + return event.keyCode == shortcut.keyCode; + } else if (event.key in ElectronKeysMapping) { + return ElectronKeysMapping[event.key] === shortcut.key; + } + + // get the key from the keyCode if key is not provided. + let key = event.key || String.fromCharCode(event.keyCode); + + // For character keys, we match if the final character is the expected one. + // But for digits we also accept indirect match to please azerty keyboard, + // which requires Shift to be pressed to get digits. + return key.toLowerCase() == shortcut.key || shortcut.key.match(/^[0-9]$/) && event.keyCode == shortcut.key.charCodeAt(0); + }, + + handleEvent(event) { + for (let [key, shortcut] of this.keys) { + if (this.doesEventMatchShortcut(event, shortcut)) { + this.eventEmitter.emit(key, event); + } + } + }, + + on(key, listener) { + if (typeof listener !== "function") { + throw new Error("KeyShortcuts.on() expects a function as " + "second argument"); + } + if (!this.keys.has(key)) { + let shortcut = KeyShortcuts.parseElectronKey(this.window, key); + // The key string is wrong and we were unable to compute the key shortcut + if (!shortcut) { + return; + } + this.keys.set(key, shortcut); + } + this.eventEmitter.on(key, listener); + }, + + off(key, listener) { + this.eventEmitter.off(key, listener); + } +}; +module.exports = KeyShortcuts; + +/***/ }), +/* 1774 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + + +/** + * Empty shim for "devtools/client/shared/zoom-keys" module + * + * Based on nsIMarkupDocumentViewer.fullZoom API + * https://developer.mozilla.org/en-US/Firefox/Releases/3/Full_page_zoom + */ + +exports.register = function (window) {}; + +/***/ }), +/* 1775 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48478,15 +47589,15 @@ exports.default = CommandBarButton; (function () { var Query, defaultPathSeparator, filter, matcher, parseOptions, pathScorer, preparedQueryCache, scorer; - filter = __webpack_require__(1789); + filter = __webpack_require__(1776); - matcher = __webpack_require__(1790); + matcher = __webpack_require__(1777); - scorer = __webpack_require__(1783); + scorer = __webpack_require__(1760); - pathScorer = __webpack_require__(1784); + pathScorer = __webpack_require__(1761); - Query = __webpack_require__(1785); + Query = __webpack_require__(1763); preparedQueryCache = null; @@ -48590,7 +47701,7 @@ exports.default = CommandBarButton; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(120))) /***/ }), -/* 1789 */ +/* 1776 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48599,11 +47710,11 @@ exports.default = CommandBarButton; (function () { var Query, pathScorer, pluckCandidates, scorer, sortCandidates; - scorer = __webpack_require__(1783); + scorer = __webpack_require__(1760); - pathScorer = __webpack_require__(1784); + pathScorer = __webpack_require__(1761); - Query = __webpack_require__(1785); + Query = __webpack_require__(1763); pluckCandidates = function (a) { return a.candidate; @@ -48647,7 +47758,7 @@ exports.default = CommandBarButton; }).call(undefined); /***/ }), -/* 1790 */ +/* 1777 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48656,7 +47767,7 @@ exports.default = CommandBarButton; (function () { var basenameMatch, computeMatch, isMatch, isWordStart, match, mergeMatches, scoreAcronyms, scoreCharacter, scoreConsecutives, _ref; - _ref = __webpack_require__(1783), isMatch = _ref.isMatch, isWordStart = _ref.isWordStart, scoreConsecutives = _ref.scoreConsecutives, scoreCharacter = _ref.scoreCharacter, scoreAcronyms = _ref.scoreAcronyms; + _ref = __webpack_require__(1760), isMatch = _ref.isMatch, isWordStart = _ref.isWordStart, scoreConsecutives = _ref.scoreConsecutives, scoreCharacter = _ref.scoreCharacter, scoreAcronyms = _ref.scoreAcronyms; exports.match = match = function (string, query, options) { var allowErrors, baseMatches, matches, pathSeparator, preparedQuery, string_lw; @@ -48869,7 +47980,7 @@ exports.default = CommandBarButton; }).call(undefined); /***/ }), -/* 1791 */ +/* 1778 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48924,13 +48035,612 @@ function extractSVGProps(src) { } /***/ }), -/* 1792 */ +/* 1779 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isMinified = isMinified; + + +// Used to detect minification for automatic pretty printing +const SAMPLE_SIZE = 50; /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +const INDENT_COUNT_THRESHOLD = 5; +const CHARACTER_LIMIT = 250; +const _minifiedCache = new Map(); + +function isMinified(source) { + if (_minifiedCache.has(source.get("id"))) { + return _minifiedCache.get(source.get("id")); + } + + let text = source.get("text"); + if (!text) { + return false; + } + + let lineEndIndex = 0; + let lineStartIndex = 0; + let lines = 0; + let indentCount = 0; + let overCharLimit = false; + + // Strip comments. + text = text.replace(/\/\*[\S\s]*?\*\/|\/\/(.+|\n)/g, ""); + + while (lines++ < SAMPLE_SIZE) { + lineEndIndex = text.indexOf("\n", lineStartIndex); + if (lineEndIndex == -1) { + break; + } + if (/^\s+/.test(text.slice(lineStartIndex, lineEndIndex))) { + indentCount++; + } + // For files with no indents but are not minified. + if (lineEndIndex - lineStartIndex > CHARACTER_LIMIT) { + overCharLimit = true; + break; + } + lineStartIndex = lineEndIndex + 1; + } + + const minified = indentCount / lines * 100 < INDENT_COUNT_THRESHOLD || overCharLimit; + + _minifiedCache.set(source.id, minified); + return minified; +} + +/***/ }), +/* 1780 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +exports.formatCallStackFrames = formatCallStackFrames; +exports.default = getCallStackFrames; + +var _sources = __webpack_require__(1369); + +var _pause = __webpack_require__(1394); + +var _frame = __webpack_require__(1380); + +var _devtoolsSourceMap = __webpack_require__(1360); + +var _lodash = __webpack_require__(2); + +function getLocation(frame, isGeneratedSource) { + return isGeneratedSource ? frame.generatedLocation || frame.location : frame.location; +} + +function getSourceForFrame(sources, frame, isGeneratedSource) { + const sourceId = getLocation(frame, isGeneratedSource).sourceId; + return (0, _sources.getSourceInSources)(sources, sourceId); +} + +function appendSource(sources, frame, selectedSource) { + const isGeneratedSource = selectedSource && !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.get("id")); + return _extends({}, frame, { + location: getLocation(frame, isGeneratedSource), + source: getSourceForFrame(sources, frame, isGeneratedSource).toJS() + }); +} + +function formatCallStackFrames(frames, sources, selectedSource) { + if (!frames) { + return null; + } + + return frames.filter(frame => getSourceForFrame(sources, frame)).map(frame => appendSource(sources, frame, selectedSource)).filter(frame => !(0, _lodash.get)(frame, "source.isBlackBoxed")).map(_frame.annotateFrame); +} + +function getCallStackFrames(state) { + const selectedSource = (0, _sources.getSelectedSource)(state); + const sources = (0, _sources.getSources)(state); + const frames = (0, _pause.getFrames)(state); + + return formatCallStackFrames(frames, sources, selectedSource); +} + +/***/ }), +/* 1781 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = getVisibleSelectedFrame; + +var _sources = __webpack_require__(1369); + +var _pause = __webpack_require__(1394); + +var _devtoolsSourceMap = __webpack_require__(1360); + +function getLocation(frame, isGeneratedSource) { + return isGeneratedSource ? frame.generatedLocation || frame.location : frame.location; +} /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getVisibleSelectedFrame(state) { + const selectedLocation = (0, _sources.getSelectedLocation)(state); + const isGeneratedSource = !(0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId); + const selectedFrame = (0, _pause.getSelectedFrame)(state); + + if (!selectedFrame) { + return; + } + + return { + location: getLocation(selectedFrame, isGeneratedSource) + }; +} + +/***/ }), +/* 1782 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.setInScopeLines = setInScopeLines; + +var _selectors = __webpack_require__(1352); + +var _source = __webpack_require__(1356); + +var _lodash = __webpack_require__(2); + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getOutOfScopeLines(outOfScopeLocations) { + if (!outOfScopeLocations) { + return null; + } + + return (0, _lodash.uniq)((0, _lodash.flatMap)(outOfScopeLocations, location => (0, _lodash.range)(location.start.line, location.end.line))); +} + +function setInScopeLines() { + return ({ dispatch, getState }) => { + const source = (0, _selectors.getSelectedSource)(getState()); + const outOfScopeLocations = (0, _selectors.getOutOfScopeLocations)(getState()); + + if (!source || !source.get("text")) { + return; + } + + const linesOutOfScope = getOutOfScopeLines(outOfScopeLocations, source.toJS()); + + const sourceNumLines = (0, _source.getSourceLineCount)(source.toJS()); + const sourceLines = (0, _lodash.range)(1, sourceNumLines + 1); + + const inScopeLines = !linesOutOfScope ? sourceLines : (0, _lodash.without)(sourceLines, ...linesOutOfScope); + + dispatch({ + type: "IN_SCOPE_LINES", + lines: inScopeLines + }); + }; +} + +/***/ }), +/* 1783 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createLocation = createLocation; +function createLocation({ + sourceId, + line, + column, + sourceUrl +}) { + return { + sourceId, + line, + column, + sourceUrl: sourceUrl || null + }; +} + +/***/ }), +/* 1784 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getTokenLocation = getTokenLocation; +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getTokenLocation(codeMirror, tokenEl) { + const { left, top, width, height } = tokenEl.getBoundingClientRect(); + const { line, ch } = codeMirror.coordsChar({ + left: left + width / 2, + top: top + height / 2 + }); + + return { + line: line + 1, + column: ch + }; +} + +/***/ }), +/* 1785 */ +/***/ (function(module, exports, __webpack_require__) { + +let updateScopeBindings = (() => { + var _ref = _asyncToGenerator(function* (scope, location, originalLocation, scopesDataSource) { + const generatedScopes = yield scopesDataSource.getSourceMapsScopes(location); + if (!generatedScopes) { + return scope; + } + const originalScopes = yield scopesDataSource.getOriginalSourceScopes(originalLocation); + const remapedScopes = remapScopes(originalScopes, generatedScopes); + return extendScope(scope, generatedScopes, 0, remapedScopes, 0); + }); + + return function updateScopeBindings(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { remapScopes } = __webpack_require__(1786); + +function extendScope(scope, generatedScopes, index, remapedScopes, remapedScopesIndex) { + if (!scope) { + return undefined; + } + if (index >= generatedScopes.length) { + return scope; + } + + let syntheticScopes; + if (remapedScopes && remapedScopesIndex < remapedScopes.length) { + if (index >= remapedScopes[remapedScopesIndex].end) { + remapedScopesIndex++; + } + if (remapedScopesIndex < remapedScopes.length) { + const remapedScope = remapedScopes[remapedScopesIndex]; + syntheticScopes = { + scopes: remapedScope.scopes, + groupIndex: index - remapedScope.start, + groupLength: remapedScope.end - remapedScope.start + }; + } + } + + const parent = extendScope(scope.parent, generatedScopes, index + 1, remapedScopes, remapedScopesIndex); + return Object.assign({}, scope, { + parent, + sourceBindings: generatedScopes[index].bindings, + syntheticScopes + }); +} + +module.exports = { + updateScopeBindings +}; + +/***/ }), +/* 1786 */ +/***/ (function(module, exports) { + + + +// Chunk split source scopes on function/closure boundary +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +function rollupFunctionScopes(scopes) { + const { result } = scopes.reduce(({ isLast, result }, scope) => { + if (isLast) { + result.push([]); + } + result[result.length - 1].push(scope); + return { + isLast: scope.type === "function", + result + }; + }, { isLast: true, result: [] }); + return result; +} + +function getBindingNames(summarizedScopes) { + return summarizedScopes.reduce((acc, { bindingsNames }) => acc.concat(bindingsNames), []); +} + +// Performs mapping of the original parsed scopes to the locals mappings +// based on the generated source parse and source map data. +function remapScopes(scopes, generatedScopes) { + if (!scopes || scopes.length === 0) { + return null; + } + const scopeChunks = rollupFunctionScopes(scopes); + const { result: assigned } = scopeChunks.reduce(({ result, searchIn, searchOffset }, scopeChunk) => { + if (searchIn.length === 0) { + return { result, searchIn, searchOffset }; + } + // Process chunk of original parsed scopes: create used original names + // binding summary per scope and entire chunk. + const summarizedScopes = scopeChunk.map(({ type, bindings }) => ({ + type, + bindingsNames: Object.keys(bindings) + })); + const names = getBindingNames(summarizedScopes); + // ... and find these names in the generated scopes (with mapped + // original names) -- we need index of the last scope in the searchIn. + let foundInMax = names.reduce((max, name) => { + const index = searchIn.findIndex(s => name in s.bindings); + return index < 0 ? Math.max(index, max) : max; + }, 0); + + // TODO double check if names were not matched/found -- the source maps + // and scope parsing can be broken. + // Moving to the function bounary (in generated scopes). + while (foundInMax + 1 < searchIn.length && searchIn[foundInMax].type !== "function") { + foundInMax++; + } + + // We found chunk of the function(s) that contains all/most of + // the scopeChunk names -- adding finding to the result. + result.push({ + scopes: summarizedScopes, + start: searchOffset, + end: searchOffset + foundInMax + 1 + }); + + // Consuming generated scopes mappings (searchIn). + return { + result, + searchIn: searchIn.slice(foundInMax + 1), + searchOffset: searchOffset + foundInMax + 1 + }; + }, { result: [], searchIn: generatedScopes, searchOffset: 0 }); + return assigned; +} + +module.exports = { + remapScopes +}; + +/***/ }), +/* 1787 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.updatePreview = updatePreview; +exports.setPreview = setPreview; +exports.clearPreview = clearPreview; + +var _ast = __webpack_require__(1638); + +var _editor = __webpack_require__(1358); + +var _devtoolsSourceMap = __webpack_require__(1360); + +var _promise = __webpack_require__(1653); + +var _selectors = __webpack_require__(1352); + +var _lodash = __webpack_require__(2); + +const extraProps = { + react: { displayName: "this._reactInternalInstance.getName()" }, + immutable: { + isImmutable: exp => `Immutable.Iterable.isIterable(${exp})`, + entries: exp => `${exp}.toJS()`, + type: exp => `${exp}.constructor.name` + } +}; + +function updatePreview(target, editor) { + return ({ dispatch, getState, client, sourceMaps }) => { + const location = (0, _editor.getTokenLocation)(editor.codeMirror, target); + const tokenText = target.innerText ? target.innerText.trim() : ""; + const cursorPos = target.getBoundingClientRect(); + const preview = (0, _selectors.getPreview)(getState()); + + if (preview) { + // We are mousing over the same token as before + if ((0, _lodash.isEqual)(preview.tokenPos, location)) { + return; + } + + // We are mousing over a new token that is not in the preview + if (!target.classList.contains("debug-expression")) { + dispatch(clearPreview()); + } + } + + const source = (0, _selectors.getSelectedSource)(getState()); + if ((0, _selectors.getSymbols)(getState(), source.toJS()).functions.length == 0) { + return; + } + + const invalidToken = tokenText === "" || tokenText.match(/[(){}\|&%,.;=<>\+-/\*\s]/); + + const invalidTarget = target.parentElement && !target.parentElement.closest(".CodeMirror-line") || cursorPos.top == 0; + + const isUpdating = preview && preview.updating; + + const linesInScope = (0, _selectors.getInScopeLines)(getState()); + const inScope = linesInScope && linesInScope.includes(location.line); + + const invaildType = target.className === "cm-string" || target.className === "cm-number" || target.className === "cm-atom"; + + if (invalidTarget || !inScope || isUpdating || invalidToken || invaildType) { + return; + } + + dispatch(setPreview(tokenText, location, cursorPos)); + }; +} + +function setPreview(token, tokenPos, cursorPos) { + return async ({ dispatch, getState, client, sourceMaps }) => { + const currentSelection = (0, _selectors.getPreview)(getState()); + if (currentSelection && currentSelection.updating) { + return; + } + + await dispatch({ + type: "SET_PREVIEW", + [_promise.PROMISE]: async function () { + let immutableType = null; + let immutableEntries = null; + + const source = (0, _selectors.getSelectedSource)(getState()); + const symbols = (0, _selectors.getSymbols)(getState(), source.toJS()); + + const found = (0, _ast.findBestMatchExpression)(symbols, tokenPos, token); + if (!found) { + return; + } + + let { expression, location } = found; + + if (!expression) { + return; + } + + const sourceId = source.get("id"); + if (location && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId)) { + const generatedLocation = await sourceMaps.getGeneratedLocation(_extends({}, location.start, { sourceId }), source.toJS()); + + expression = await (0, _selectors.getMappedExpression)({ sourceMaps }, generatedLocation, expression); + } + + const selectedFrame = (0, _selectors.getSelectedFrame)(getState()); + const { result } = await client.evaluate(expression, { + frameId: selectedFrame.id + }); + + const reactDisplayName = await client.evaluate(extraProps.react.displayName, { + frameId: selectedFrame.id + }); + + const immutable = await client.evaluate(extraProps.immutable.isImmutable(expression), { + frameId: selectedFrame.id + }); + + if (immutable.result === true) { + immutableEntries = await client.evaluate(extraProps.immutable.entries(expression), { + frameId: selectedFrame.id + }); + + immutableType = await client.evaluate(extraProps.immutable.type(expression), { + frameId: selectedFrame.id + }); + } + + const extra = { + react: { + displayName: reactDisplayName.result + }, + immutable: { + isImmutable: immutable.result && immutable.result.type !== "undefined", + type: immutableType && immutableType.result, + entries: immutableEntries && immutableEntries.result + } + }; + + if (result === undefined) { + return; + } + + return { + expression, + result, + location, + tokenPos, + cursorPos, + extra + }; + }() + }); + }; +} + +function clearPreview() { + return ({ dispatch, getState, client }) => { + const currentSelection = (0, _selectors.getPreview)(getState()); + if (!currentSelection) { + return; + } + + return dispatch({ + type: "CLEAR_SELECTION" + }); + }; +} + +/***/ }), +/* 1788 */ +/***/ (function(module, exports) { + +module.exports = "Group 2Created with Sketch." + +/***/ }), +/* 1789 */ /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), -/* 1793 */ +/* 1790 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49130,6 +48840,461 @@ var InlineSVG = function (_React$Component) { exports['default'] = InlineSVG; module.exports = exports['default']; +/***/ }), +/* 1791 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = renderBreakpointsDropdown; + +var _react = __webpack_require__(0); + +var _react2 = _interopRequireDefault(_react); + +var _Svg = __webpack_require__(1359); + +var _Svg2 = _interopRequireDefault(_Svg); + +var _Dropdown = __webpack_require__(1615); + +var _Dropdown2 = _interopRequireDefault(_Dropdown); + +var _classnames = __webpack_require__(175); + +var _classnames2 = _interopRequireDefault(_classnames); + +__webpack_require__(1792); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function renderPause(isWaitingOnBreak) { + const active = isWaitingOnBreak; + return _react2.default.createElement( + "div", + { + className: (0, _classnames2.default)("pause-next", { + active: active, + inactive: !active + }) + }, + _react2.default.createElement("img", { className: "pause-next" }), + _react2.default.createElement( + "span", + { className: "icon-spacer" }, + L10N.getStr("pauseButtonItem") + ) + ); +} + +function renderPauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { + const active = (shouldPauseOnExceptions || shouldIgnoreCaughtExceptions) && (!shouldPauseOnExceptions || !shouldIgnoreCaughtExceptions); + return _react2.default.createElement( + "div", + { + className: (0, _classnames2.default)("pause-on-exceptions", { + active: active, + inactive: !active + }) + }, + _react2.default.createElement("img", { className: "pause-on-exceptions" }), + _react2.default.createElement( + "span", + { className: "icon-spacer" }, + L10N.getStr("pauseOnExceptionsItem") + ) + ); +} + +function renderPauseOnUncaughtExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { + const active = shouldPauseOnExceptions && shouldIgnoreCaughtExceptions; + return _react2.default.createElement( + "div", + { + className: (0, _classnames2.default)("pause-uncaught-exceptions", { + active: active, + inactive: !active + }) + }, + _react2.default.createElement("img", { className: "pause-uncaught-exceptions" }), + _react2.default.createElement( + "span", + { className: "icon-spacer" }, + L10N.getStr("pauseOnUncaughtExceptionsItem") + ) + ); +} + +function renderIgnoreExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) { + const active = !shouldPauseOnExceptions && !shouldIgnoreCaughtExceptions; + return _react2.default.createElement( + "div", + { + className: (0, _classnames2.default)("ignore-exceptions", { + active: active, + inactive: !active + }) + }, + _react2.default.createElement("img", { className: "ignore-exceptions" }), + _react2.default.createElement( + "span", + { className: "icon-spacer" }, + L10N.getStr("ignoreExceptionsItem") + ) + ); +} + +function handleClick(e) { + e.stopPropagation(); +} + +function renderBreakpointsDropdown(breakOnNext, pauseOnExceptions, shouldPauseOnExceptions, shouldIgnoreCaughtExceptions, isWaitingOnBreak) { + const Panel = _react2.default.createElement( + "ul", + null, + _react2.default.createElement( + "li", + { onClick: () => breakOnNext(), className: "first" }, + renderPause(isWaitingOnBreak) + ), + _react2.default.createElement( + "li", + { onClick: () => pauseOnExceptions(false, false) }, + renderIgnoreExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) + ), + _react2.default.createElement( + "li", + { onClick: () => pauseOnExceptions(true, true) }, + renderPauseOnUncaughtExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) + ), + _react2.default.createElement( + "li", + { onClick: () => pauseOnExceptions(true, false) }, + renderPauseOnExceptions(shouldPauseOnExceptions, shouldIgnoreCaughtExceptions) + ) + ); + + const active = shouldPauseOnExceptions || shouldIgnoreCaughtExceptions || isWaitingOnBreak; + + return _react2.default.createElement( + "div", + { + className: "breakpoints-dropdown", + onClick: e => handleClick(e), + key: "breakpoints-dropdown" + }, + _react2.default.createElement(_Dropdown2.default, { + className: "dropdown", + panel: Panel, + icon: _react2.default.createElement(_Svg2.default, { + name: "plus", + className: (0, _classnames2.default)("plus", { + active: active, + inactive: !active + }) + }) + }) + ); +} + +/***/ }), +/* 1792 */ +/***/ (function(module, exports) { + +// removed by extract-text-webpack-plugin + +/***/ }), +/* 1793 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getScopes = getScopes; + +var _synthesizeScopes = __webpack_require__(1794); + +var _getScope = __webpack_require__(1795); + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function getScopes(pauseInfo, selectedFrame, frameScopes) { + if (!pauseInfo || !selectedFrame) { + return null; + } + + if (!frameScopes) { + return null; + } + + const scopes = []; + + let scope = frameScopes; + let scopeIndex = 1; + + while (scope) { + const { syntheticScopes } = scope; + let lastScope = scope; + + if (!syntheticScopes) { + const scopeItem = (0, _getScope.getScope)(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex); + + if (scopeItem) { + scopes.push(scopeItem); + } + scopeIndex++; + } else { + scopes.push(...(0, _synthesizeScopes.synthesizeScopes)(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex)); + + // skip to the next generated scope + const scopeDepth = syntheticScopes.groupLength; + for (let i = 1; lastScope.parent && i < scopeDepth; i++) { + const nextScope = lastScope.parent; + lastScope = nextScope; + } + + scope = lastScope; + scopeIndex += syntheticScopes.scopes.length; + } + scope = scope.parent; + } + + return scopes; +} + +/***/ }), +/* 1794 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.synthesizeScopes = synthesizeScopes; + +var _getVariables = __webpack_require__(1766); + +var _frame = __webpack_require__(1380); + +var _utils = __webpack_require__(1767); + +function getSynteticScopeTitle(type, generatedScopes) { + if (type === "function") { + // FIXME Use original function name here + const lastGeneratedScope = generatedScopes[generatedScopes.length - 1]; + const isLastGeneratedScopeFn = lastGeneratedScope && lastGeneratedScope.type === "function"; + return isLastGeneratedScopeFn && lastGeneratedScope.function.displayName ? (0, _frame.simplifyDisplayName)(lastGeneratedScope.function.displayName) : L10N.getStr("anonymous"); + } + return L10N.getStr("scopes.block"); +} /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +function findOriginalBindings(bindingsNames, generatedScopes, key, foundGeneratedNames) { + return bindingsNames.reduce((vars, name) => { + // Find binding name in the original source bindings + const generatedScope = generatedScopes.find(gs => gs.sourceBindings && name in gs.sourceBindings); + if (!generatedScope || !generatedScope.sourceBindings) { + return vars; + } + // .. and map it to the generated name + const generatedName = generatedScope.sourceBindings[name]; + // Skip if we already use the generated name + if (generatedName && !foundGeneratedNames[generatedName]) { + if (generatedScope.bindings.variables[generatedName]) { + vars.push({ + name, + generatedName, + path: `${key}/${generatedName}`, + contents: generatedScope.bindings.variables[generatedName] + }); + foundGeneratedNames[generatedName] = true; + return vars; + } + + const arg = generatedScope.bindings.arguments.find(arg_ => arg_[generatedName]); + if (arg) { + vars.push({ + name, + generatedName, + path: `${key}/${generatedName}`, + contents: arg[generatedName] + }); + foundGeneratedNames[generatedName] = true; + return vars; + } + } + + vars.push({ + name, + generatedName, + path: `${key}/${generatedName}`, + contents: { value: { type: "undefined" } } + }); + return vars; + }, []); +} + +function findUnusedBindings(generatedScopes, foundGeneratedNames, key) { + const allGeneratedVars = generatedScopes.reduce((acc, { bindings }) => { + return acc.concat((0, _getVariables.getBindingVariables)(bindings, key)); + }, []); + return allGeneratedVars.filter(v => !foundGeneratedNames[v.name]); +} + +// Create a synthesized scope based on its binding names and +// generated/original scopes information. +function synthesizeScope(syntheticScope, index, actor, key, scopeIndex, lastScopeIndex, generatedScopes, foundGeneratedNames, scope, frameScopes, selectedFrame, pauseInfo) { + const { bindingsNames } = syntheticScope; + const isLast = index === lastScopeIndex; + + let vars = findOriginalBindings(bindingsNames, generatedScopes, key, foundGeneratedNames); + + if (isLast) { + // For the last synthesized scope, apply all generated names we did not use + vars = [...vars, ...findUnusedBindings(generatedScopes, foundGeneratedNames, key)]; + } + + if (index === 0) { + const isLocalScope = scope.actor === frameScopes.actor; + + // For the first synthesized scope, add this and other vars. + if (isLocalScope) { + vars = [...vars, ...(0, _utils.getFramePopVariables)(pauseInfo, key)]; + + const this_ = (0, _utils.getThisVariable)(selectedFrame, key); + + if (this_) { + vars.push(this_); + } + } + } + + return vars; +} + +function synthesizeScopes(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { + const { actor, syntheticScopes } = scope; + if (!syntheticScopes) { + return []; + } + + // Collect all connected generated scopes. + const generatedScopes = []; + for (let count = syntheticScopes.groupLength, s = scope; count > 0 && s; count--) { + generatedScopes.push(s); + s = s.parent; + } + + const foundGeneratedNames = Object.create(null); + const lastScopeIndex = syntheticScopes.scopes.length - 1; + return syntheticScopes.scopes.reduce((result, syntheticScope, index) => { + const key = `${actor}-${scopeIndex + index}`; + const bindings = synthesizeScope(syntheticScope, index, actor, key, scopeIndex, lastScopeIndex, generatedScopes, foundGeneratedNames, scope, frameScopes, selectedFrame, pauseInfo); + + if (bindings && bindings.length) { + const title = getSynteticScopeTitle(syntheticScope.type, generatedScopes); + bindings.sort((a, b) => a.name.localeCompare(b.name)); + result.push({ + name: title, + path: key, + contents: bindings + }); + } + return result; + }, []); +} + +/***/ }), +/* 1795 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ + +exports.getScope = getScope; + +var _getVariables = __webpack_require__(1766); + +var _utils = __webpack_require__(1767); + +var _frame = __webpack_require__(1380); + +function getScopeTitle(type, scope) { + if (type === "function") { + return scope.function.displayName ? (0, _frame.simplifyDisplayName)(scope.function.displayName) : L10N.getStr("anonymous"); + } + return L10N.getStr("scopes.block"); +} + +function getScope(scope, selectedFrame, frameScopes, pauseInfo, scopeIndex) { + const { type, actor } = scope; + + const isLocalScope = scope.actor === frameScopes.actor; + + const key = `${actor}-${scopeIndex}`; + if (type === "function" || type === "block") { + const bindings = scope.bindings; + const sourceBindings = scope.sourceBindings; + + let vars = sourceBindings ? (0, _getVariables.getSourceBindingVariables)(bindings, sourceBindings, key) : (0, _getVariables.getBindingVariables)(bindings, key); + + // show exception, return, and this variables in innermost scope + if (isLocalScope) { + vars = vars.concat((0, _utils.getFramePopVariables)(pauseInfo, key)); + + const this_ = (0, _utils.getThisVariable)(selectedFrame, key); + + if (this_) { + vars.push(this_); + } + } + + if (vars && vars.length) { + const title = getScopeTitle(type, scope); + vars.sort((a, b) => a.name.localeCompare(b.name)); + return { + name: title, + path: key, + contents: vars + }; + } + } else if (type === "object") { + let value = scope.object; + // If this is the global window scope, mark it as such so that it will + // preview Window: Global instead of Window: Window + if (value.class === "Window") { + value = _extends({}, scope.object, { displayClass: "Global" }); + } + return { + name: scope.object.class, + path: key, + contents: { value } + }; + } + + return null; +} + /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/devtools/client/debugger/new/parser-worker.js b/devtools/client/debugger/new/parser-worker.js index 8da7c0ebd09d..3337e7c11934 100644 --- a/devtools/client/debugger/new/parser-worker.js +++ b/devtools/client/debugger/new/parser-worker.js @@ -31653,19 +31653,40 @@ module.exports = isEmpty; Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseScriptTags = exports.parseScripts = exports.parseScript = exports.getCandidateScriptLocations = exports.generateWhitespace = exports.extractScriptTags = undefined; -var _babelTypes = __webpack_require__(493); +function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } -var types = _interopRequireWildcard(_babelTypes); +var babylon = __webpack_require__(435); +var types = __webpack_require__(493); -var _babylon = __webpack_require__(435); +var startScript = /]*>/im; +var endScript = /<\/script\s*>/im; +// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005 +var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/; -var babylon = _interopRequireWildcard(_babylon); +function getCandidateScriptLocations(source, index) { + var i = index || 0; + var str = source.substring(i); -var _customParse = __webpack_require__(1794); + var startMatch = startScript.exec(str); + if (startMatch) { + var startsAt = startMatch.index + startMatch[0].length; + var afterStart = str.substring(startsAt); + var endMatch = endScript.exec(afterStart); + if (endMatch) { + var locLength = endMatch.index; + var locIndex = i + startsAt; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + return [adjustForLineAndColumn(source, { + index: locIndex, + length: locLength, + source: source.substring(locIndex, locIndex + locLength) + })].concat(_toConsumableArray(getCandidateScriptLocations(source, locIndex + locLength + endMatch[0].length))); + } + } + + return []; +} function parseScript(_ref) { var source = _ref.source, @@ -31689,11 +31710,69 @@ function parseScript(_ref) { function parseScripts(locations) { var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript; - return (0, _customParse.parseScripts)(locations, parser); + return locations.map(parser); +} + +function generateWhitespace(length) { + return Array.from(new Array(length + 1)).join(" "); +} + +function calcLineAndColumn(source, index) { + var lines = source.substring(0, index).split(newLines); + var line = lines.length; + var column = lines.pop().length + 1; + + return { + column: column, + line: line + }; +} + +function adjustForLineAndColumn(fullSource, location) { + var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index), + column = _calcLineAndColumn.column, + line = _calcLineAndColumn.line; + + return Object.assign({}, location, { + line: line, + column: column, + // prepend whitespace for scripts that do not start on the first column + source: generateWhitespace(column) + location.source + }); +} + +function parseScriptTags(source, parser) { + var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) { + return { + statements: main.statements.concat(script.program.body), + comments: main.comments.concat(script.comments), + tokens: main.tokens.concat(script.tokens) + }; + }, { + statements: [], + comments: [], + tokens: [] + }); + + var program = types.program(scripts.statements); + var file = types.file(program, scripts.comments, scripts.tokens); + + var end = calcLineAndColumn(source, source.length); + file.start = program.start = 0; + file.end = program.end = source.length; + file.loc = program.loc = { + start: { + line: 1, + column: 0 + }, + end: end + }; + + return file; } function extractScriptTags(source) { - return parseScripts((0, _customParse.getCandidateScriptLocations)(source), function (loc) { + return parseScripts(getCandidateScriptLocations(source), function (loc) { var ast = parseScript(loc); if (ast) { @@ -31704,16 +31783,10 @@ function extractScriptTags(source) { }).filter(types.isFile); } -function parseScriptTags(source) { - var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript; - - return (0, _customParse.parseScriptTags)(source, parser); -} - exports.default = parseScriptTags; exports.extractScriptTags = extractScriptTags; -exports.generateWhitespace = _customParse.generateWhitespace; -exports.getCandidateScriptLocations = _customParse.getCandidateScriptLocations; +exports.generateWhitespace = generateWhitespace; +exports.getCandidateScriptLocations = getCandidateScriptLocations; exports.parseScript = parseScript; exports.parseScripts = parseScripts; exports.parseScriptTags = parseScriptTags; @@ -35492,7 +35565,7 @@ function getAst(source) { const { contentType } = source; if (contentType == "text/html") { ast = (0, _parseScriptTags2.default)(source.text, htmlParser) || {}; - } else if (contentType && contentType.includes("javascript")) { + } else if (contentType && contentType.match(/(javascript|jsx)/)) { ast = parse(source.text); } @@ -35565,6 +35638,7 @@ exports.isAwaitExpression = isAwaitExpression; exports.isYieldExpression = isYieldExpression; exports.isVariable = isVariable; exports.getMemberExpression = getMemberExpression; +exports.getVariables = getVariables; var _babelTypes = __webpack_require__(493); @@ -35616,6 +35690,22 @@ function getMemberExpression(root) { return expr.join("."); } +function getVariables(dec) { + if (dec.id.type === "ArrayPattern") { + return dec.id.elements.map(element => { + return { + name: element.name || element.argument.name, + location: element.loc + }; + }); + } + + return [{ + name: dec.id.name, + location: dec.loc + }]; +} + /***/ }), /* 1412 */, /* 1413 */, @@ -35834,6 +35924,10 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument exports.default = getSymbols; exports.clearSymbols = clearSymbols; +var _flatten = __webpack_require__(706); + +var _flatten2 = _interopRequireDefault(_flatten); + var _ast = __webpack_require__(1375); var _helpers = __webpack_require__(1411); @@ -35848,10 +35942,10 @@ var _getFunctionName = __webpack_require__(1621); var _getFunctionName2 = _interopRequireDefault(_getFunctionName); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + let symbolDeclarations = new Map(); function getFunctionParameterNames(path) { @@ -35868,7 +35962,12 @@ function getVariableNames(path) { name: path.node.key.value, location: path.node.loc }]; + } else if (path.node.value.type === "Identifier") { + return [{ name: path.node.value.name, location: path.node.loc }]; + } else if (path.node.value.type === "AssignmentPattern") { + return [{ name: path.node.value.left.name, location: path.node.loc }]; } + return [{ name: path.node.key.name, location: path.node.loc @@ -35882,10 +35981,9 @@ function getVariableNames(path) { })); } - return path.node.declarations.map(dec => ({ - name: dec.id.name, - location: dec.loc - })); + const declarations = path.node.declarations.filter(dec => dec.id.type !== "ObjectPattern").map(_helpers.getVariables); + + return (0, _flatten2.default)(declarations); } function getComments(ast) { @@ -35975,10 +36073,12 @@ function extractSymbols(source) { if (t.isCallExpression(path)) { const callee = path.node.callee; + const args = path.node.arguments; if (!t.isMemberExpression(callee)) { const { start, end, identifierName } = callee.loc; callExpressions.push({ name: identifierName, + values: args.filter(arg => arg.value).map(arg => arg.value), location: { start, end } }); } @@ -36436,9 +36536,9 @@ var _getScopes2 = _interopRequireDefault(_getScopes); var _sources = __webpack_require__(1458); -var _getOutOfScopeLocations = __webpack_require__(1624); +var _findOutOfScopeLocations = __webpack_require__(1624); -var _getOutOfScopeLocations2 = _interopRequireDefault(_getOutOfScopeLocations); +var _findOutOfScopeLocations2 = _interopRequireDefault(_findOutOfScopeLocations); var _steps = __webpack_require__(1625); @@ -36460,7 +36560,7 @@ const { workerHandler } = _devtoolsUtils.workerUtils; /* This Source Code Form i self.onmessage = workerHandler({ getClosestExpression: _closest.getClosestExpression, - getOutOfScopeLocations: _getOutOfScopeLocations2.default, + findOutOfScopeLocations: _findOutOfScopeLocations2.default, getSymbols: _getSymbols2.default, getScopes: _getScopes2.default, clearSymbols: _getSymbols.clearSymbols, @@ -37002,6 +37102,14 @@ var _get = __webpack_require__(1073); var _get2 = _interopRequireDefault(_get); +var _findIndex = __webpack_require__(262); + +var _findIndex2 = _interopRequireDefault(_findIndex); + +var _findLastIndex = __webpack_require__(1686); + +var _findLastIndex2 = _interopRequireDefault(_findLastIndex); + var _contains = __webpack_require__(1456); var _getSymbols = __webpack_require__(1457); @@ -37035,22 +37143,55 @@ function getLocation(func) { } /** - * Reduces an array of locations to remove items that are completely enclosed - * by another location in the array. + * Find the nearest location containing the input position and + * return new locations without inner locations under that nearest location + * + * @param locations Notice! The locations MUST be sorted by `sortByStart` + * so that we can do linear time complexity operation. */ -function removeOverlaps(locations, location) { - // support reducing without an initializing array - if (!Array.isArray(locations)) { - locations = [locations]; +function removeInnerLocations(locations, position) { + // First, let's find the nearest position-enclosing function location, + // which is to find the last location enclosing the position. + const newLocs = locations.slice(); + const parentIndex = (0, _findLastIndex2.default)(newLocs, loc => (0, _contains.containsPosition)(loc, position)); + if (parentIndex < 0) { + return newLocs; } - const contains = locations.filter(a => (0, _contains.containsLocation)(a, location)).length > 0; + // Second, from the nearest location, loop locations again, stop looping + // once seeing the 1st location not enclosed by the nearest location + // to find the last inner locations inside the nearest location. + const innerStartIndex = parentIndex + 1; + const parentLoc = newLocs[parentIndex]; + const outerBoundaryIndex = (0, _findIndex2.default)(newLocs, loc => !(0, _contains.containsLocation)(parentLoc, loc), innerStartIndex); + const innerBoundaryIndex = outerBoundaryIndex < 0 ? newLocs.length - 1 : outerBoundaryIndex - 1; - if (!contains) { - locations.push(location); + // Third, remove those inner functions + newLocs.splice(innerStartIndex, innerBoundaryIndex - parentIndex); + return newLocs; +} + +/** + * Return an new locations array which excludes + * items that are completely enclosed by another location in the input locations + * + * @param locations Notice! The locations MUST be sorted by `sortByStart` + * so that we can do linear time complexity operation. + */ +function removeOverlaps(locations) { + if (locations.length == 0) { + return []; } + const firstParent = locations[0]; + return locations.reduce(deduplicateNode, [firstParent]); +} - return locations; +function deduplicateNode(nodes, location) { + const parent = nodes[nodes.length - 1]; + if (!(0, _contains.containsLocation)(parent, location)) { + nodes.push(location); + } + return nodes; } /** @@ -37070,14 +37211,17 @@ function sortByStart(a, b) { * Returns an array of locations that are considered out of scope for the given * location. */ -function getOutOfScopeLocations(source, position) { +function findOutOfScopeLocations(source, position) { const { functions, comments } = findSymbols(source); const commentLocations = comments.map(c => c.location); - - return functions.map(getLocation).concat(commentLocations).filter(loc => !(0, _contains.containsPosition)(loc, position)).reduce(removeOverlaps, []).sort(sortByStart); + let locations = functions.map(getLocation).concat(commentLocations).sort(sortByStart); + // Must remove inner locations then filter, otherwise, + // we will mis-judge in-scope inner locations as out of scope. + locations = removeInnerLocations(locations, position).filter(loc => !(0, _contains.containsPosition)(loc, position)); + return removeOverlaps(locations); } -exports.default = getOutOfScopeLocations; +exports.default = findOutOfScopeLocations; /***/ }), /* 1625 */ @@ -41671,13 +41815,8 @@ var _getSymbols2 = _interopRequireDefault(_getSymbols); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function isReactComponent(source) { - const { imports, classes } = (0, _getSymbols2.default)(source); - - if (!imports || !classes) { - return false; - } - - return importsReact(imports) && extendsComponent(classes); + const { imports, classes, callExpressions } = (0, _getSymbols2.default)(source); + return (importsReact(imports) || requiresReact(callExpressions)) && extendsComponent(classes); } /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ @@ -41686,10 +41825,14 @@ function importsReact(imports) { return imports.some(importObj => importObj.source === "react" && importObj.specifiers.some(specifier => specifier === "React")); } +function requiresReact(callExpressions) { + return callExpressions.some(callExpression => callExpression.name === "require" && callExpression.values.some(value => value === "react")); +} + function extendsComponent(classes) { let result = false; classes.some(classObj => { - if (classObj.parent.name === "Component" || classObj.parent.name === "PureComponent") { + if (classObj.parent.name === "Component" || classObj.parent.name === "PureComponent" || classObj.parent.property.name === "Component") { result = true; } }); @@ -41809,344 +41952,6 @@ function baseToPairs(object, props) { module.exports = baseToPairs; -/***/ }), -/* 1758 */, -/* 1759 */, -/* 1760 */, -/* 1761 */, -/* 1762 */, -/* 1763 */, -/* 1764 */, -/* 1765 */, -/* 1766 */, -/* 1767 */, -/* 1768 */, -/* 1769 */, -/* 1770 */, -/* 1771 */, -/* 1772 */, -/* 1773 */, -/* 1774 */, -/* 1775 */, -/* 1776 */, -/* 1777 */, -/* 1778 */, -/* 1779 */, -/* 1780 */, -/* 1781 */, -/* 1782 */, -/* 1783 */, -/* 1784 */, -/* 1785 */, -/* 1786 */, -/* 1787 */, -/* 1788 */, -/* 1789 */, -/* 1790 */, -/* 1791 */, -/* 1792 */, -/* 1793 */, -/* 1794 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseScriptTags = exports.parseScripts = exports.getCandidateScriptLocations = exports.generateWhitespace = undefined; - -var _babelTypes = __webpack_require__(493); - -var types = _interopRequireWildcard(_babelTypes); - -var _parseScriptFragment = __webpack_require__(1795); - -var _parseScriptFragment2 = _interopRequireDefault(_parseScriptFragment); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } - -var startScript = /]*>/im; -var endScript = /<\/script\s*>/im; -// https://stackoverflow.com/questions/5034781/js-regex-to-split-by-line#comment5633979_5035005 -var newLines = /\r\n|[\n\v\f\r\x85\u2028\u2029]/; - -function getType(tag) { - var fragment = (0, _parseScriptFragment2.default)(tag); - - if (fragment) { - var type = fragment.attributes.type; - - return type ? type.toLowerCase() : null; - } - - return null; -} - -function getCandidateScriptLocations(source, index) { - var i = index || 0; - var str = source.substring(i); - - var startMatch = startScript.exec(str); - if (startMatch) { - var startsAt = startMatch.index + startMatch[0].length; - var afterStart = str.substring(startsAt); - var endMatch = endScript.exec(afterStart); - if (endMatch) { - var locLength = endMatch.index; - var locIndex = i + startsAt; - var endIndex = locIndex + locLength + endMatch[0].length; - - // extract the complete tag (incl start and end tags and content). if the - // type is invalid (= not JS), skip this tag and continue - var tag = source.substring(i + startMatch.index, endIndex); - var type = getType(tag); - if (type && type !== "javascript" && type !== "text/javascript") { - return getCandidateScriptLocations(source, endIndex); - } - - return [adjustForLineAndColumn(source, { - index: locIndex, - length: locLength, - source: source.substring(locIndex, locIndex + locLength) - })].concat(_toConsumableArray(getCandidateScriptLocations(source, endIndex))); - } - } - - return []; -} - -function parseScripts(locations, parser) { - return locations.map(parser); -} - -function generateWhitespace(length) { - return Array.from(new Array(length + 1)).join(" "); -} - -function calcLineAndColumn(source, index) { - var lines = source.substring(0, index).split(newLines); - var line = lines.length; - var column = lines.pop().length + 1; - - return { - column: column, - line: line - }; -} - -function adjustForLineAndColumn(fullSource, location) { - var _calcLineAndColumn = calcLineAndColumn(fullSource, location.index), - column = _calcLineAndColumn.column, - line = _calcLineAndColumn.line; - - return Object.assign({}, location, { - line: line, - column: column, - // prepend whitespace for scripts that do not start on the first column - source: generateWhitespace(column) + location.source - }); -} - -function parseScriptTags(source, parser) { - var scripts = parseScripts(getCandidateScriptLocations(source), parser).filter(types.isFile).reduce(function (main, script) { - return { - statements: main.statements.concat(script.program.body), - comments: main.comments.concat(script.comments), - tokens: main.tokens.concat(script.tokens) - }; - }, { - statements: [], - comments: [], - tokens: [] - }); - - var program = types.program(scripts.statements); - var file = types.file(program, scripts.comments, scripts.tokens); - - var end = calcLineAndColumn(source, source.length); - file.start = program.start = 0; - file.end = program.end = source.length; - file.loc = program.loc = { - start: { - line: 1, - column: 0 - }, - end: end - }; - - return file; -} - -exports.default = parseScriptTags; -exports.generateWhitespace = generateWhitespace; -exports.getCandidateScriptLocations = getCandidateScriptLocations; -exports.parseScripts = parseScripts; -exports.parseScriptTags = parseScriptTags; - -/***/ }), -/* 1795 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var alphanum = /[a-z0-9\-]/i; - -function parseToken(str, start) { - var i = start; - while (i < str.length && alphanum.test(str.charAt(i++))) { - continue; - } - - if (i !== start) { - return { - token: str.substring(start, i - 1), - index: i - }; - } - - return null; -} - -function parseAttributes(str, start) { - var i = start; - var attributes = {}; - var attribute = null; - - while (i < str.length) { - var c = str.charAt(i); - - if (attribute === null && c == ">") { - break; - } else if (attribute === null && alphanum.test(c)) { - attribute = { - name: null, - value: true, - bool: true, - terminator: null - }; - - var attributeNameNode = parseToken(str, i); - if (attributeNameNode) { - attribute.name = attributeNameNode.token; - i = attributeNameNode.index - 2; - } - } else if (attribute !== null) { - if (c === "=") { - // once we've started an attribute, look for = to indicate - // it's a non-boolean attribute - attribute.bool = false; - if (attribute.value === true) { - attribute.value = ""; - } - } else if (!attribute.bool && attribute.terminator === null && (c === '"' || c === "'")) { - // once we've determined it's non-boolean, look for a - // value terminator (", ') - attribute.terminator = c; - } else if (attribute.terminator) { - if (c === attribute.terminator) { - // if we had a terminator and found another, we've - // reach the end of the attribute - attributes[attribute.name] = attribute.value; - attribute = null; - } else { - // otherwise, append the character to the attribute value - attribute.value += c; - - // check for an escaped terminator and push it as well - // to avoid terminating prematurely - if (c === "\\") { - var next = str.charAt(i + 1); - if (next === attribute.terminator) { - attribute.value += next; - i += 1; - } - } - } - } else if (!/\s/.test(c)) { - // if we've hit a non-space character and aren't processing a value, - // we're starting a new attribute so push the attribute and clear the - // local variable - attributes[attribute.name] = attribute.value; - attribute = null; - - // move the cursor back to re-find the start of the attribute - i -= 1; - } - } - - i++; - } - - if (i !== start) { - return { - attributes: attributes, - index: i - }; - } - - return null; -} - -function parseFragment(str) { - var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - - var tag = null; - var open = false; - var attributes = {}; - - var i = start; - while (i < str.length) { - var c = str.charAt(i++); - - if (!open && !tag && c === "<") { - // Open Start Tag - open = true; - - var tagNode = parseToken(str, i); - if (!tagNode) { - return null; - } - - i = tagNode.index - 1; - tag = tagNode.token; - } else if (open && c === ">") { - // Close Start Tag - break; - } else if (open) { - // Attributes - var attributeNode = parseAttributes(str, i - 1); - - if (attributeNode) { - i = attributeNode.index; - attributes = attributeNode.attributes || attributes; - } - } - } - - if (tag) { - return { - tag: tag, - attributes: attributes - }; - } - - return null; -} - -exports.default = parseFragment; -exports.parseFragment = parseFragment; - /***/ }) /******/ ]); }); \ No newline at end of file diff --git a/devtools/client/debugger/new/pretty-print-worker.js b/devtools/client/debugger/new/pretty-print-worker.js index 5a5032ddaedc..3cdc414a5a16 100644 --- a/devtools/client/debugger/new/pretty-print-worker.js +++ b/devtools/client/debugger/new/pretty-print-worker.js @@ -281,8 +281,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const { workerHandler } = _devtoolsUtils.workerUtils; -function prettyPrint({ url, indent, source }) { - const prettified = (0, _prettyFast2.default)(source, { +function prettyPrint({ url, indent, sourceText }) { + const prettified = (0, _prettyFast2.default)(sourceText, { url: url, indent: " ".repeat(indent) }); diff --git a/devtools/client/debugger/new/search-worker.js b/devtools/client/debugger/new/search-worker.js index a31b0f21b98e..27f43016edf1 100644 --- a/devtools/client/debugger/new/search-worker.js +++ b/devtools/client/debugger/new/search-worker.js @@ -262,191 +262,6 @@ function arrayMap(array, iteratee) { module.exports = arrayMap; -/***/ }), - -/***/ 121: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - - -/***/ }), - -/***/ 122: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - - /***/ }), /***/ 1284: @@ -455,399 +270,6 @@ var objectKeys = Object.keys || function (obj) { module.exports = __webpack_require__(1631); -/***/ }), - -/***/ 1356: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isLoading = exports.isLoaded = exports.getMode = exports.getSourceLineCount = exports.getSourcePath = exports.getFileURL = exports.getFilenameFromURL = exports.getFilename = exports.getRawSourceURL = exports.getPrettySourceURL = exports.shouldPrettyPrint = exports.isThirdParty = exports.isPretty = exports.isJavaScript = exports.isMinified = undefined; - -var _devtoolsSourceMap = __webpack_require__(1360); - -var _utils = __webpack_require__(1366); - -var _path = __webpack_require__(1393); - -var _url = __webpack_require__(334); - -/** - * Trims the query part or reference identifier of a url string, if necessary. - * - * @memberof utils/source - * @static - */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -/** - * Utils for working with Source URLs - * @module utils/source - */ - -function trimUrlQuery(url) { - const length = url.length; - const q1 = url.indexOf("?"); - const q2 = url.indexOf("&"); - const q3 = url.indexOf("#"); - const q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); - - return url.slice(0, q); -} - -function shouldPrettyPrint(source) { - if (!source) { - return false; - } - - const _isPretty = isPretty(source); - const _isJavaScript = isJavaScript(source); - const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.id); - const hasSourceMap = source.sourceMapURL; - - if (_isPretty || isOriginal || hasSourceMap || !_isJavaScript) { - return false; - } - - return true; -} - -/** - * Returns true if the specified url and/or content type are specific to - * javascript files. - * - * @return boolean - * True if the source is likely javascript. - * - * @memberof utils/source - * @static - */ -function isJavaScript(source) { - return source.url && /\.(jsm|js)?$/.test(trimUrlQuery(source.url)) || !!(source.contentType && source.contentType.includes("javascript")); -} - -/** - * @memberof utils/source - * @static - */ -function isPretty(source) { - return source.url ? /formatted$/.test(source.url) : false; -} - -function isThirdParty(source) { - if (!source || !source.url) { - return false; - } - - return !!source.url.match(/(node_modules|bower_components)/); -} - -/** - * @memberof utils/source - * @static - */ -function getPrettySourceURL(url) { - if (!url) { - url = ""; - } - return `${url}:formatted`; -} - -/** - * @memberof utils/source - * @static - */ -function getRawSourceURL(url) { - return url.replace(/:formatted$/, ""); -} - -function resolveFileURL(url, transformUrl = initialUrl => initialUrl) { - url = getRawSourceURL(url || ""); - const name = transformUrl(url); - return (0, _utils.endTruncateStr)(name, 50); -} - -function getFilenameFromURL(url) { - return resolveFileURL(url, initialUrl => (0, _path.basename)(initialUrl) || "(index)"); -} - -function getFormattedSourceId(id) { - const sourceId = id.split("/")[1]; - return `SOURCE${sourceId}`; -} - -/** - * Show a source url's filename. - * If the source does not have a url, use the source id. - * - * @memberof utils/source - * @static - */ -function getFilename(source) { - const { url, id } = source; - if (!url) { - return getFormattedSourceId(id); - } - - let filename = getFilenameFromURL(url); - const qMarkIdx = filename.indexOf("?"); - if (qMarkIdx > 0) { - filename = filename.slice(0, qMarkIdx); - } - return filename; -} - -/** - * Show a source url. - * If the source does not have a url, use the source id. - * - * @memberof utils/source - * @static - */ -function getFileURL(source) { - const { url, id } = source; - if (!url) { - return getFormattedSourceId(id); - } - - return resolveFileURL(url); -} - -const contentTypeModeMap = { - "text/javascript": { name: "javascript" }, - "text/typescript": { name: "javascript", typescript: true }, - "text/coffeescript": "coffeescript", - "text/typescript-jsx": { - name: "jsx", - base: { name: "javascript", typescript: true } - }, - "text/jsx": "jsx", - "text/x-elm": "elm", - "text/x-clojure": "clojure", - "text/wasm": { name: "text" }, - "text/html": { name: "htmlmixed" } -}; - -function getSourcePath(source) { - if (!source.url) { - return ""; - } - - const { path, href } = (0, _url.parse)(source.url); - // for URLs like "about:home" the path is null so we pass the full href - return path || href; -} - -/** - * Returns amount of lines in the source. If source is a WebAssembly binary, - * the function returns amount of bytes. - */ -function getSourceLineCount(source) { - if (source.isWasm) { - const { binary } = source.text; - return binary.length; - } - return source.text != undefined ? source.text.split("\n").length : 0; -} - -// Used to detect minification for automatic pretty printing -const SAMPLE_SIZE = 50; -const INDENT_COUNT_THRESHOLD = 5; -const CHARACTER_LIMIT = 250; -const _minifiedCache = new Map(); - -/** - * - * Checks if a source is minified based on some heuristics - * @param key - * @param text - * @return boolean - * @memberof utils/source - * @static - */ - -function isMinified(key, text) { - if (!key || !text) { - return false; - } - - if (_minifiedCache.has(key)) { - return _minifiedCache.get(key); - } - - let lineEndIndex = 0; - let lineStartIndex = 0; - let lines = 0; - let indentCount = 0; - let overCharLimit = false; - - // Strip comments. - text = text.replace(/\/\*[\S\s]*?\*\/|\/\/(.+|\n)/g, ""); - - while (lines++ < SAMPLE_SIZE) { - lineEndIndex = text.indexOf("\n", lineStartIndex); - if (lineEndIndex == -1) { - break; - } - if (/^\s+/.test(text.slice(lineStartIndex, lineEndIndex))) { - indentCount++; - } - // For files with no indents but are not minified. - if (lineEndIndex - lineStartIndex > CHARACTER_LIMIT) { - overCharLimit = true; - break; - } - lineStartIndex = lineEndIndex + 1; - } - - const minified = indentCount / lines * 100 < INDENT_COUNT_THRESHOLD || overCharLimit; - - _minifiedCache.set(key, minified); - return minified; -} - -/** - * - * Returns Code Mirror mode for source content type - * @param contentType - * @return String - * @memberof utils/source - * @static - */ - -function getMode(source, sourceMetaData) { - const { contentType, text, isWasm, url } = source; - - if (!text || isWasm) { - return { name: "text" }; - } - - if (url && url.match(/\.jsx$/i) || sourceMetaData && sourceMetaData.isReactComponent) { - return "jsx"; - } - - const languageMimeMap = [{ ext: ".c", mode: "text/x-csrc" }, { ext: ".kt", mode: "text/x-kotlin" }, { ext: ".cpp", mode: "text/x-c++src" }, { ext: ".m", mode: "text/x-objectivec" }, { ext: ".rs", mode: "text/x-rustsrc" }]; - - // check for C and other non JS languages - if (url) { - const result = languageMimeMap.find(({ ext }) => url.endsWith(ext)); - - if (result !== undefined) { - return result.mode; - } - } - - // if the url ends with .marko we set the name to Javascript so - // syntax highlighting works for marko too - if (url && url.match(/\.marko$/i)) { - return { name: "javascript" }; - } - - // Use HTML mode for files in which the first non whitespace - // character is `<` regardless of extension. - const isHTMLLike = text.match(/^\s*. */ - -/** - * Utils for utils, by utils - * @module utils/utils - */ - -/** - * @memberof utils/utils - * @static - */ -function handleError(err) { - console.log("ERROR: ", err); -} - -/** - * @memberof utils/utils - * @static - */ -function promisify(context, method, ...args) { - return new Promise((resolve, reject) => { - args.push(response => { - if (response.error) { - reject(response); - } else { - resolve(response); - } - }); - method.apply(context, args); - }); -} - -/** - * @memberof utils/utils - * @static - */ -function endTruncateStr(str, size) { - if (str.length > size) { - return `...${str.slice(str.length - size)}`; - } - return str; -} - -/** - * @memberof utils/utils - * @static - */ -/** - * @memberof utils/utils - * @static - */ -function throttle(func, ms) { - let timeout, _this; - return function (...args) { - _this = this; - if (!timeout) { - timeout = setTimeout(() => { - func.apply(_this, ...args); - timeout = null; - }, ms); - } - }; -} - -function waitForMs(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -exports.handleError = handleError; -exports.promisify = promisify; -exports.endTruncateStr = endTruncateStr; -exports.throttle = throttle; -exports.waitForMs = waitForMs; - -/***/ }), - /***/ 1367: /***/ (function(module, exports) { @@ -1115,307 +450,6 @@ module.exports = { /***/ }), -/***/ 1389: -/***/ (function(module, exports, __webpack_require__) { - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const md5 = __webpack_require__(248); - -function originalToGeneratedId(originalId) { - const match = originalId.match(/(.*)\/originalSource/); - return match ? match[1] : ""; -} - -function generatedToOriginalId(generatedId, url) { - return `${generatedId}/originalSource-${md5(url)}`; -} - -function isOriginalId(id) { - return !!id.match(/\/originalSource/); -} - -function isGeneratedId(id) { - return !isOriginalId(id); -} - -/** - * Trims the query part or reference identifier of a URL string, if necessary. - */ -function trimUrlQuery(url) { - let length = url.length; - let q1 = url.indexOf("?"); - let q2 = url.indexOf("&"); - let q3 = url.indexOf("#"); - let q = Math.min(q1 != -1 ? q1 : length, q2 != -1 ? q2 : length, q3 != -1 ? q3 : length); - - return url.slice(0, q); -} - -// Map suffix to content type. -const contentMap = { - "js": "text/javascript", - "jsm": "text/javascript", - "ts": "text/typescript", - "tsx": "text/typescript-jsx", - "jsx": "text/jsx", - "coffee": "text/coffeescript", - "elm": "text/elm", - "cljs": "text/x-clojure" -}; - -/** - * Returns the content type for the specified URL. If no specific - * content type can be determined, "text/plain" is returned. - * - * @return String - * The content type. - */ -function getContentType(url) { - url = trimUrlQuery(url); - let dot = url.lastIndexOf("."); - if (dot >= 0) { - let name = url.substring(dot + 1); - if (name in contentMap) { - return contentMap[name]; - } - } - return "text/plain"; -} - -module.exports = { - originalToGeneratedId, - generatedToOriginalId, - isOriginalId, - isGeneratedId, - getContentType, - contentMapForTesting: contentMap -}; - -/***/ }), - -/***/ 1390: -/***/ (function(module, exports, __webpack_require__) { - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -const networkRequest = __webpack_require__(1391); -const workerUtils = __webpack_require__(1392); - -module.exports = { - networkRequest, - workerUtils -}; - -/***/ }), - -/***/ 1391: -/***/ (function(module, exports) { - -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -function networkRequest(url, opts) { - return fetch(url, { - cache: opts.loadFromCache ? "default" : "no-cache" - }).then(res => { - if (res.status >= 200 && res.status < 300) { - return res.text().then(text => ({ content: text })); - } - return Promise.reject(`request failed with status ${res.status}`); - }); -} - -module.exports = networkRequest; - -/***/ }), - -/***/ 1392: -/***/ (function(module, exports) { - -function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } - -function WorkerDispatcher() { - this.msgId = 1; - this.worker = null; -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -WorkerDispatcher.prototype = { - start(url) { - this.worker = new Worker(url); - this.worker.onerror = () => { - console.error(`Error in worker ${url}`); - }; - }, - - stop() { - if (!this.worker) { - return; - } - - this.worker.terminate(); - this.worker = null; - }, - - task(method) { - return (...args) => { - return new Promise((resolve, reject) => { - const id = this.msgId++; - this.worker.postMessage({ id, method, args }); - - const listener = ({ data: result }) => { - if (result.id !== id) { - return; - } - - if (!this.worker) { - reject("Oops, The worker has shutdown!"); - return; - } - this.worker.removeEventListener("message", listener); - if (result.error) { - reject(result.error); - } else { - resolve(result.response); - } - }; - - this.worker.addEventListener("message", listener); - }); - }; - } -}; - -function workerHandler(publicInterface) { - return function (msg) { - const { id, method, args } = msg.data; - try { - const response = publicInterface[method].apply(undefined, args); - if (response instanceof Promise) { - response.then(val => self.postMessage({ id, response: val }), - // Error can't be sent via postMessage, so be sure to - // convert to string. - err => self.postMessage({ id, error: err.toString() })); - } else { - self.postMessage({ id, response }); - } - } catch (error) { - // Error can't be sent via postMessage, so be sure to convert to - // string. - self.postMessage({ id, error: error.toString() }); - } - }; -} - -function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) { - let streamingWorker = (() => { - var _ref = _asyncToGenerator(function* (id, tasks) { - let isWorking = true; - - const intervalId = setTimeout(function () { - isWorking = false; - }, timeout); - - const results = []; - while (tasks.length !== 0 && isWorking) { - const { callback, context, args } = tasks.shift(); - const result = yield callback.call(context, args); - results.push(result); - } - worker.postMessage({ id, status: "pending", data: results }); - clearInterval(intervalId); - - if (tasks.length !== 0) { - yield streamingWorker(id, tasks); - } - }); - - return function streamingWorker(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); - - return (() => { - var _ref2 = _asyncToGenerator(function* (msg) { - const { id, method, args } = msg.data; - const workerMethod = publicInterface[method]; - if (!workerMethod) { - console.error(`Could not find ${method} defined in worker.`); - } - worker.postMessage({ id, status: "start" }); - - try { - const tasks = workerMethod(args); - yield streamingWorker(id, tasks); - worker.postMessage({ id, status: "done" }); - } catch (error) { - worker.postMessage({ id, status: "error", error }); - } - }); - - return function (_x3) { - return _ref2.apply(this, arguments); - }; - })(); -} - -module.exports = { - WorkerDispatcher, - workerHandler, - streamingWorkerHandler -}; - -/***/ }), - -/***/ 1393: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -function basename(path) { - return path.split("/").pop(); -} - -function dirname(path) { - const idx = path.lastIndexOf("/"); - return path.slice(0, idx); -} - -function isURL(str) { - return str.indexOf("://") !== -1; -} - -function isAbsolute(str) { - return str[0] === "/"; -} - -function join(base, dir) { - return `${base}/${dir}`; -} - -exports.basename = basename; -exports.dirname = dirname; -exports.isURL = isURL; -exports.isAbsolute = isAbsolute; -exports.join = join; - -/***/ }), - /***/ 14: /***/ (function(module, exports) { @@ -1608,12 +642,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.findSourceMatches = findSourceMatches; +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at . */ -var _source = __webpack_require__(1356); +// Maybe reuse file search's functions? function findSourceMatches(source, queryText) { - const { text } = source; - if (!(0, _source.isLoaded)(source) || !text || queryText == "") { + const text = source.text; + if (source.loadedState !== "loaded" || !text || queryText == "") { return []; } @@ -1639,350 +676,8 @@ function findSourceMatches(source, queryText) { matches = [].concat(...matches); return matches; -} /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at . */ - -// Maybe reuse file search's functions? - -/***/ }), - -/***/ 248: -/***/ (function(module, exports, __webpack_require__) { - -(function(){ - var crypt = __webpack_require__(249), - utf8 = __webpack_require__(250).utf8, - isBuffer = __webpack_require__(251), - bin = __webpack_require__(250).bin, - - // The core - md5 = function (message, options) { - // Convert to byte array - if (message.constructor == String) - if (options && options.encoding === 'binary') - message = bin.stringToBytes(message); - else - message = utf8.stringToBytes(message); - else if (isBuffer(message)) - message = Array.prototype.slice.call(message, 0); - else if (!Array.isArray(message)) - message = message.toString(); - // else, assume byte array already - - var m = crypt.bytesToWords(message), - l = message.length * 8, - a = 1732584193, - b = -271733879, - c = -1732584194, - d = 271733878; - - // Swap endian - for (var i = 0; i < m.length; i++) { - m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF | - ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00; - } - - // Padding - m[l >>> 5] |= 0x80 << (l % 32); - m[(((l + 64) >>> 9) << 4) + 14] = l; - - // Method shortcuts - var FF = md5._ff, - GG = md5._gg, - HH = md5._hh, - II = md5._ii; - - for (var i = 0; i < m.length; i += 16) { - - var aa = a, - bb = b, - cc = c, - dd = d; - - a = FF(a, b, c, d, m[i+ 0], 7, -680876936); - d = FF(d, a, b, c, m[i+ 1], 12, -389564586); - c = FF(c, d, a, b, m[i+ 2], 17, 606105819); - b = FF(b, c, d, a, m[i+ 3], 22, -1044525330); - a = FF(a, b, c, d, m[i+ 4], 7, -176418897); - d = FF(d, a, b, c, m[i+ 5], 12, 1200080426); - c = FF(c, d, a, b, m[i+ 6], 17, -1473231341); - b = FF(b, c, d, a, m[i+ 7], 22, -45705983); - a = FF(a, b, c, d, m[i+ 8], 7, 1770035416); - d = FF(d, a, b, c, m[i+ 9], 12, -1958414417); - c = FF(c, d, a, b, m[i+10], 17, -42063); - b = FF(b, c, d, a, m[i+11], 22, -1990404162); - a = FF(a, b, c, d, m[i+12], 7, 1804603682); - d = FF(d, a, b, c, m[i+13], 12, -40341101); - c = FF(c, d, a, b, m[i+14], 17, -1502002290); - b = FF(b, c, d, a, m[i+15], 22, 1236535329); - - a = GG(a, b, c, d, m[i+ 1], 5, -165796510); - d = GG(d, a, b, c, m[i+ 6], 9, -1069501632); - c = GG(c, d, a, b, m[i+11], 14, 643717713); - b = GG(b, c, d, a, m[i+ 0], 20, -373897302); - a = GG(a, b, c, d, m[i+ 5], 5, -701558691); - d = GG(d, a, b, c, m[i+10], 9, 38016083); - c = GG(c, d, a, b, m[i+15], 14, -660478335); - b = GG(b, c, d, a, m[i+ 4], 20, -405537848); - a = GG(a, b, c, d, m[i+ 9], 5, 568446438); - d = GG(d, a, b, c, m[i+14], 9, -1019803690); - c = GG(c, d, a, b, m[i+ 3], 14, -187363961); - b = GG(b, c, d, a, m[i+ 8], 20, 1163531501); - a = GG(a, b, c, d, m[i+13], 5, -1444681467); - d = GG(d, a, b, c, m[i+ 2], 9, -51403784); - c = GG(c, d, a, b, m[i+ 7], 14, 1735328473); - b = GG(b, c, d, a, m[i+12], 20, -1926607734); - - a = HH(a, b, c, d, m[i+ 5], 4, -378558); - d = HH(d, a, b, c, m[i+ 8], 11, -2022574463); - c = HH(c, d, a, b, m[i+11], 16, 1839030562); - b = HH(b, c, d, a, m[i+14], 23, -35309556); - a = HH(a, b, c, d, m[i+ 1], 4, -1530992060); - d = HH(d, a, b, c, m[i+ 4], 11, 1272893353); - c = HH(c, d, a, b, m[i+ 7], 16, -155497632); - b = HH(b, c, d, a, m[i+10], 23, -1094730640); - a = HH(a, b, c, d, m[i+13], 4, 681279174); - d = HH(d, a, b, c, m[i+ 0], 11, -358537222); - c = HH(c, d, a, b, m[i+ 3], 16, -722521979); - b = HH(b, c, d, a, m[i+ 6], 23, 76029189); - a = HH(a, b, c, d, m[i+ 9], 4, -640364487); - d = HH(d, a, b, c, m[i+12], 11, -421815835); - c = HH(c, d, a, b, m[i+15], 16, 530742520); - b = HH(b, c, d, a, m[i+ 2], 23, -995338651); - - a = II(a, b, c, d, m[i+ 0], 6, -198630844); - d = II(d, a, b, c, m[i+ 7], 10, 1126891415); - c = II(c, d, a, b, m[i+14], 15, -1416354905); - b = II(b, c, d, a, m[i+ 5], 21, -57434055); - a = II(a, b, c, d, m[i+12], 6, 1700485571); - d = II(d, a, b, c, m[i+ 3], 10, -1894986606); - c = II(c, d, a, b, m[i+10], 15, -1051523); - b = II(b, c, d, a, m[i+ 1], 21, -2054922799); - a = II(a, b, c, d, m[i+ 8], 6, 1873313359); - d = II(d, a, b, c, m[i+15], 10, -30611744); - c = II(c, d, a, b, m[i+ 6], 15, -1560198380); - b = II(b, c, d, a, m[i+13], 21, 1309151649); - a = II(a, b, c, d, m[i+ 4], 6, -145523070); - d = II(d, a, b, c, m[i+11], 10, -1120210379); - c = II(c, d, a, b, m[i+ 2], 15, 718787259); - b = II(b, c, d, a, m[i+ 9], 21, -343485551); - - a = (a + aa) >>> 0; - b = (b + bb) >>> 0; - c = (c + cc) >>> 0; - d = (d + dd) >>> 0; - } - - return crypt.endian([a, b, c, d]); - }; - - // Auxiliary functions - md5._ff = function (a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._gg = function (a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._hh = function (a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - md5._ii = function (a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + (x >>> 0) + t; - return ((n << s) | (n >>> (32 - s))) + b; - }; - - // Package private blocksize - md5._blocksize = 16; - md5._digestsize = 16; - - module.exports = function (message, options) { - if (message === undefined || message === null) - throw new Error('Illegal argument ' + message); - - var digestbytes = crypt.wordsToBytes(md5(message, options)); - return options && options.asBytes ? digestbytes : - options && options.asString ? bin.bytesToString(digestbytes) : - crypt.bytesToHex(digestbytes); - }; - -})(); - - -/***/ }), - -/***/ 249: -/***/ (function(module, exports) { - -(function() { - var base64map - = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', - - crypt = { - // Bit-wise rotation left - rotl: function(n, b) { - return (n << b) | (n >>> (32 - b)); - }, - - // Bit-wise rotation right - rotr: function(n, b) { - return (n << (32 - b)) | (n >>> b); - }, - - // Swap big-endian to little-endian and vice versa - endian: function(n) { - // If number given, swap endian - if (n.constructor == Number) { - return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00; - } - - // Else, assume array and swap all items - for (var i = 0; i < n.length; i++) - n[i] = crypt.endian(n[i]); - return n; - }, - - // Generate an array of any length of random bytes - randomBytes: function(n) { - for (var bytes = []; n > 0; n--) - bytes.push(Math.floor(Math.random() * 256)); - return bytes; - }, - - // Convert a byte array to big-endian 32-bit words - bytesToWords: function(bytes) { - for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) - words[b >>> 5] |= bytes[i] << (24 - b % 32); - return words; - }, - - // Convert big-endian 32-bit words to a byte array - wordsToBytes: function(words) { - for (var bytes = [], b = 0; b < words.length * 32; b += 8) - bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); - return bytes; - }, - - // Convert a byte array to a hex string - bytesToHex: function(bytes) { - for (var hex = [], i = 0; i < bytes.length; i++) { - hex.push((bytes[i] >>> 4).toString(16)); - hex.push((bytes[i] & 0xF).toString(16)); - } - return hex.join(''); - }, - - // Convert a hex string to a byte array - hexToBytes: function(hex) { - for (var bytes = [], c = 0; c < hex.length; c += 2) - bytes.push(parseInt(hex.substr(c, 2), 16)); - return bytes; - }, - - // Convert a byte array to a base-64 string - bytesToBase64: function(bytes) { - for (var base64 = [], i = 0; i < bytes.length; i += 3) { - var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]; - for (var j = 0; j < 4; j++) - if (i * 8 + j * 6 <= bytes.length * 8) - base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F)); - else - base64.push('='); - } - return base64.join(''); - }, - - // Convert a base-64 string to a byte array - base64ToBytes: function(base64) { - // Remove non-base-64 characters - base64 = base64.replace(/[^A-Z0-9+\/]/ig, ''); - - for (var bytes = [], i = 0, imod4 = 0; i < base64.length; - imod4 = ++i % 4) { - if (imod4 == 0) continue; - bytes.push(((base64map.indexOf(base64.charAt(i - 1)) - & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) - | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2))); - } - return bytes; - } - }; - - module.exports = crypt; -})(); - - -/***/ }), - -/***/ 250: -/***/ (function(module, exports) { - -var charenc = { - // UTF-8 encoding - utf8: { - // Convert a string to a byte array - stringToBytes: function(str) { - return charenc.bin.stringToBytes(unescape(encodeURIComponent(str))); - }, - - // Convert a byte array to a string - bytesToString: function(bytes) { - return decodeURIComponent(escape(charenc.bin.bytesToString(bytes))); - } - }, - - // Binary encoding - bin: { - // Convert a string to a byte array - stringToBytes: function(str) { - for (var bytes = [], i = 0; i < str.length; i++) - bytes.push(str.charCodeAt(i) & 0xFF); - return bytes; - }, - - // Convert a byte array to a string - bytesToString: function(bytes) { - for (var str = [], i = 0; i < bytes.length; i++) - str.push(String.fromCharCode(bytes[i])); - return str.join(''); - } - } -}; - -module.exports = charenc; - - -/***/ }), - -/***/ 251: -/***/ (function(module, exports) { - -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - - /***/ }), /***/ 259: @@ -2022,770 +717,6 @@ function escapeRegExp(string) { module.exports = escapeRegExp; -/***/ }), - -/***/ 334: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -var punycode = __webpack_require__(916); -var util = __webpack_require__(336); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = __webpack_require__(66); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - - -/***/ }), - -/***/ 336: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - - /***/ }), /***/ 6: @@ -2821,18 +752,6 @@ function baseGetTag(value) { module.exports = baseGetTag; -/***/ }), - -/***/ 66: -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.decode = exports.parse = __webpack_require__(121); -exports.encode = exports.stringify = __webpack_require__(122); - - /***/ }), /***/ 7: @@ -2943,35 +862,6 @@ try { module.exports = g; -/***/ }), - -/***/ 793: -/***/ (function(module, exports) { - -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; - - /***/ }), /***/ 8: @@ -3000,546 +890,6 @@ module.exports = freeGlobal; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(792))) -/***/ }), - -/***/ 916: -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - true - ) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return punycode; - }.call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } - -}(this)); - -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(793)(module), __webpack_require__(792))) - /***/ }) /******/ }); diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-highlight.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-highlight.js index bc8af1433f68..bf4590bcc23a 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-highlight.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-editor-highlight.js @@ -10,13 +10,6 @@ add_task(async function() { const { selectors: { getSource }, getState } = dbg; const sourceUrl = EXAMPLE_URL + "long.js"; - async function waitForLoaded(dbg, srcUrl) { - return waitForState( - dbg, - state => findSource(dbg, srcUrl).loadedState == "loaded" - ); - } - // The source itself doesn't even exist yet, and using // `selectSourceURL` will set a pending request to load this source // and highlight a specific line. @@ -24,13 +17,14 @@ add_task(async function() { // Wait for the source text to load and make sure we're in the right // place. - await waitForLoaded(dbg, sourceUrl); + await waitForLoadedSource(dbg, sourceUrl); // TODO: revisit highlighting lines when the debugger opens // assertHighlightLocation(dbg, "long.js", 66); // Jump to line 16 and make sure the editor scrolled. await selectSource(dbg, "long.js", 16); + await waitForElement(dbg, ".CodeMirror-code > .highlight-line"); assertHighlightLocation(dbg, "long.js", 16); // Make sure only one line is ever highlighted and the flash @@ -38,11 +32,6 @@ add_task(async function() { await selectSource(dbg, "long.js", 17); await selectSource(dbg, "long.js", 18); assertHighlightLocation(dbg, "long.js", 18); - is( - findAllElements(dbg, "highlightLine").length, - 1, - "Only 1 line is highlighted" - ); // Test jumping to a line in a source that exists but hasn't been // loaded yet. @@ -51,8 +40,9 @@ add_task(async function() { // Make sure the source is in the loading state, wait for it to be // fully loaded, and check the highlighted line. const simple1 = findSource(dbg, "simple1.js"); - ok(getSource(getState(), simple1.id).get("loadedState")); - await waitForLoaded(dbg, "simple1.js"); + is(getSource(getState(), simple1.id).get("loadedState"), "loading"); + + await waitForLoadedSource(dbg, "simple1.js"); ok(getSource(getState(), simple1.id).get("text")); assertHighlightLocation(dbg, "simple1.js", 6); }); diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js index 67a570f93a21..a878d6370de5 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-minified.js @@ -27,12 +27,12 @@ add_task(async function() { await waitForPaused(dbg); await waitForMappedScopes(dbg); - is(getScopeNodeLabel(dbg, 1), "sum"); - is(getScopeNodeLabel(dbg, 2), ""); - is(getScopeNodeLabel(dbg, 3), "arguments"); + is(getScopeNodeLabel(dbg, 1), "sum", "check scope label"); + is(getScopeNodeLabel(dbg, 2), "", "check scope label"); + is(getScopeNodeLabel(dbg, 3), "arguments", "check scope label"); - is(getScopeNodeLabel(dbg, 4), "first"); - is(getScopeNodeValue(dbg, 4), "40"); - is(getScopeNodeLabel(dbg, 5), "second"); - is(getScopeNodeValue(dbg, 5), "2"); + is(getScopeNodeLabel(dbg, 4), "first", "check scope label"); + is(getScopeNodeValue(dbg, 4), "40", "check scope value"); + is(getScopeNodeLabel(dbg, 5), "second", "check scope label"); + is(getScopeNodeValue(dbg, 5), "2", "check scope value"); }); diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-outline.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-outline.js index e5100d2a29c4..9ed149665be2 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-outline.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-outline.js @@ -17,7 +17,7 @@ add_task(async function() { const { selectors: { getSelectedSource }, getState } = dbg; await selectSource(dbg, "simple1", 1); - await waitForLoadedSource(dbg, "simple1"); + await waitForSelectedSource(dbg, "simple1"); findElementWithSelector(dbg, ".outline-tab").click(); is(getItems(dbg).length, 5, "5 items in the list"); diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-reload.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-reload.js index 477f76530429..f2230a67355a 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-reload.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-reload.js @@ -7,18 +7,29 @@ * 2. re-sync breakpoints */ +async function waitForBreakpoint(dbg, location) { + return waitForState( + dbg, + state => { + return dbg.selectors.getBreakpoint(dbg.getState(), location); + }, + "Waiting for breakpoint" + ); +} + add_task(async function() { const dbg = await initDebugger("reload/doc_reload.html", "sjs_code_reload"); - const sym = waitForDispatch(dbg, "SET_SYMBOLS"); await selectSource(dbg, "sjs_code_reload"); - await sym; - + await waitForSelectedSource(dbg, "sjs_code_reload"); await addBreakpoint(dbg, "sjs_code_reload", 2); - const sync = waitForDispatch(dbg, "SYNC_BREAKPOINT"); await reload(dbg, "sjs_code_reload"); - await sync; + + const source = findSource(dbg, "sjs_code_reload"); + const location = { sourceId: source.id, line: 6 }; + + await waitForBreakpoint(dbg, location); const breakpoints = dbg.selectors.getBreakpoints(dbg.getState()); const breakpointList = breakpoints.valueSeq().toJS(); diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-asm.html b/devtools/client/debugger/new/test/mochitest/examples/doc-asm.html index b10b5de0bd08..09130fed3c22 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-asm.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-asm.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-async.html b/devtools/client/debugger/new/test/mochitest/examples/doc-async.html index 9fc4dd275c50..1271bcf79417 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-async.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-async.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-content-script-sources.html b/devtools/client/debugger/new/test/mochitest/examples/doc-content-script-sources.html index 84a30f3efeaf..1cd5a0ee2838 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-content-script-sources.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-content-script-sources.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-debugger-statements.html b/devtools/client/debugger/new/test/mochitest/examples/doc-debugger-statements.html index 967619d31a9a..892b60cae467 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-debugger-statements.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-debugger-statements.html @@ -1,3 +1,6 @@ + Debugger Statements diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-exceptions.html b/devtools/client/debugger/new/test/mochitest/examples/doc-exceptions.html index 5ca65b755e89..49ecc8e098a2 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-exceptions.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-exceptions.html @@ -1,3 +1,6 @@ + Debugger test page diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-frames.html b/devtools/client/debugger/new/test/mochitest/examples/doc-frames.html index 49274e3d84c5..e111f53e43a6 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-frames.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-frames.html @@ -1,3 +1,6 @@ + Frames diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-iframes.html b/devtools/client/debugger/new/test/mochitest/examples/doc-iframes.html index 26446eaa1cd8..73f1be3f7326 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-iframes.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-iframes.html @@ -1,3 +1,6 @@ + Iframe diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-minified.html b/devtools/client/debugger/new/test/mochitest/examples/doc-minified.html index 4c95a9b4ae84..0877c07822e5 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-minified.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-minified.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-minified2.html b/devtools/client/debugger/new/test/mochitest/examples/doc-minified2.html index 37a6ea5cc4ca..0a934ce523eb 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-minified2.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-minified2.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-return-values.html b/devtools/client/debugger/new/test/mochitest/examples/doc-return-values.html index f58edc63fbc1..d7e5344b691a 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-return-values.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-return-values.html @@ -1,3 +1,6 @@ + Return Values diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html index dc3a28f8c8b1..b7f62bc3de8a 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-script-mutate.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-script-switching.html b/devtools/client/debugger/new/test/mochitest/examples/doc-script-switching.html index 3c71497c25b8..6e5a5fb1ad0e 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-script-switching.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-script-switching.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-scripts.html b/devtools/client/debugger/new/test/mochitest/examples/doc-scripts.html index 180f9c3dd922..1ac89529158d 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-scripts.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-scripts.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemap-bogus.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemap-bogus.html index da448a2cdceb..991ffa29119c 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemap-bogus.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemap-bogus.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps.html index fa0477f43292..a8b3a74ca744 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps2.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps2.html index f66d7c0f54ed..4a4937a839ed 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps2.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps2.html @@ -1,3 +1,6 @@ + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps3.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps3.html index c483608d17d1..393947c663e5 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps3.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sourcemaps3.html @@ -1,3 +1,6 @@ + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html index 68eccbd87023..cf661abf313d 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sources.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html b/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html index 05e8da57737b..696233a95a8a 100644 --- a/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html +++ b/devtools/client/debugger/new/test/mochitest/examples/doc-wasm-sourcemaps.html @@ -1,5 +1,6 @@ - + diff --git a/devtools/client/debugger/new/test/mochitest/head.js b/devtools/client/debugger/new/test/mochitest/head.js index 3acb44ff3dcd..510fd4da0688 100644 --- a/devtools/client/debugger/new/test/mochitest/head.js +++ b/devtools/client/debugger/new/test/mochitest/head.js @@ -352,6 +352,12 @@ function assertHighlightLocation(dbg, source, line) { const lineEl = findElement(dbg, "highlightLine"); ok(lineEl, "Line is highlighted"); + is( + findAllElements(dbg, "highlightLine").length, + 1, + "Only 1 line is highlighted" + ); + ok(isVisibleInEditor(dbg, lineEl), "Highlighted line is visible"); ok( getCM(dbg) diff --git a/devtools/client/themes/images/debugger/react.svg b/devtools/client/themes/images/debugger/react.svg index af7b04c7a890..8991681bc8ff 100644 --- a/devtools/client/themes/images/debugger/react.svg +++ b/devtools/client/themes/images/debugger/react.svg @@ -1,5 +1,6 @@ - - +