Bug 1496401 - Update Debugger Frontend v93. r=dwalsh

This commit is contained in:
Jason Laster 2018-10-04 05:47:00 +03:00
Родитель 3ffe1afee0
Коммит 367d991905
34 изменённых файлов: 2631 добавлений и 1923 удалений

Просмотреть файл

@ -25545,6 +25545,7 @@ const {
const dispatcher = new WorkerDispatcher();
const setAssetRootURL = dispatcher.task("setAssetRootURL");
const getOriginalURLs = dispatcher.task("getOriginalURLs");
const getOriginalRanges = dispatcher.task("getOriginalRanges");
const getGeneratedRanges = dispatcher.task("getGeneratedRanges", {
@ -25581,8 +25582,9 @@ module.exports = {
applySourceMap,
clearSourceMaps,
getOriginalStackFrames,
startSourceMapWorker(workerURL) {
dispatcher.start(workerURL);
startSourceMapWorker(url, assetRoot) {
dispatcher.start(url);
setAssetRootURL(assetRoot);
},
stopSourceMapWorker: dispatcher.stop.bind(dispatcher)
};
@ -25806,6 +25808,10 @@ WorkerDispatcher.prototype = {
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};

Просмотреть файл

@ -270,6 +270,10 @@ WorkerDispatcher.prototype = {
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};

Просмотреть файл

@ -817,6 +817,10 @@ WorkerDispatcher.prototype = {
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};

270
devtools/client/debugger/new/dist/vendors.js поставляемый
Просмотреть файл

@ -5625,6 +5625,10 @@ WorkerDispatcher.prototype = {
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};
@ -6722,7 +6726,7 @@ var _tabs = __webpack_require__(3762);
var reactAriaComponentsTabs = _interopRequireWildcard(_tabs);
var _reselect = __webpack_require__(993);
var _reselect = __webpack_require__(3791);
var reselect = _interopRequireWildcard(_reselect);
@ -8088,6 +8092,138 @@ module.exports = "<!-- This Source Code Form is subject to the terms of the Mozi
/***/ }),
/***/ 3791:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (immutable) */ __webpack_exports__["defaultMemoize"] = defaultMemoize;
/* harmony export (immutable) */ __webpack_exports__["createSelectorCreator"] = createSelectorCreator;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSelector", function() { return createSelector; });
/* harmony export (immutable) */ __webpack_exports__["createStructuredSelector"] = createStructuredSelector;
function defaultEqualityCheck(a, b) {
return a === b;
}
function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
// Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
var length = prev.length;
for (var i = 0; i < length; i++) {
if (!equalityCheck(prev[i], next[i])) {
return false;
}
}
return true;
}
function defaultMemoize(func) {
var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck;
var lastArgs = null;
var lastResult = null;
// we reference arguments instead of spreading them for performance reasons
return function () {
if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
// apply arguments instead of spreading for performance.
lastResult = func.apply(null, arguments);
}
lastArgs = arguments;
return lastResult;
};
}
function getDependencies(funcs) {
var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
if (!dependencies.every(function (dep) {
return typeof dep === 'function';
})) {
var dependencyTypes = dependencies.map(function (dep) {
return typeof dep;
}).join(', ');
throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));
}
return dependencies;
}
function createSelectorCreator(memoize) {
for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
memoizeOptions[_key - 1] = arguments[_key];
}
return function () {
for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
funcs[_key2] = arguments[_key2];
}
var recomputations = 0;
var resultFunc = funcs.pop();
var dependencies = getDependencies(funcs);
var memoizedResultFunc = memoize.apply(undefined, [function () {
recomputations++;
// apply arguments instead of spreading for performance.
return resultFunc.apply(null, arguments);
}].concat(memoizeOptions));
// If a selector is called with the exact same arguments we don't need to traverse our dependencies again.
var selector = memoize(function () {
var params = [];
var length = dependencies.length;
for (var i = 0; i < length; i++) {
// apply arguments instead of spreading and mutate a local list of params for performance.
params.push(dependencies[i].apply(null, arguments));
}
// apply arguments instead of spreading for performance.
return memoizedResultFunc.apply(null, params);
});
selector.resultFunc = resultFunc;
selector.dependencies = dependencies;
selector.recomputations = function () {
return recomputations;
};
selector.resetRecomputations = function () {
return recomputations = 0;
};
return selector;
};
}
var createSelector = createSelectorCreator(defaultMemoize);
function createStructuredSelector(selectors) {
var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector;
if (typeof selectors !== 'object') {
throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));
}
var objectKeys = Object.keys(selectors);
return selectorCreator(objectKeys.map(function (key) {
return selectors[key];
}), function () {
for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
values[_key3] = arguments[_key3];
}
return values.reduce(function (composition, value, index) {
composition[objectKeys[index]] = value;
return composition;
}, {});
});
}
/***/ }),
/***/ 4:
/***/ (function(module, exports) {
@ -9882,138 +10018,6 @@ function listCacheHas(key) {
module.exports = listCacheHas;
/***/ }),
/***/ 993:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.defaultMemoize = defaultMemoize;
exports.createSelectorCreator = createSelectorCreator;
exports.createStructuredSelector = createStructuredSelector;
function defaultEqualityCheck(a, b) {
return a === b;
}
function areArgumentsShallowlyEqual(equalityCheck, prev, next) {
if (prev === null || next === null || prev.length !== next.length) {
return false;
}
// Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.
var length = prev.length;
for (var i = 0; i < length; i++) {
if (!equalityCheck(prev[i], next[i])) {
return false;
}
}
return true;
}
function defaultMemoize(func) {
var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck;
var lastArgs = null;
var lastResult = null;
// we reference arguments instead of spreading them for performance reasons
return function () {
if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {
// apply arguments instead of spreading for performance.
lastResult = func.apply(null, arguments);
}
lastArgs = arguments;
return lastResult;
};
}
function getDependencies(funcs) {
var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
if (!dependencies.every(function (dep) {
return typeof dep === 'function';
})) {
var dependencyTypes = dependencies.map(function (dep) {
return typeof dep;
}).join(', ');
throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));
}
return dependencies;
}
function createSelectorCreator(memoize) {
for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
memoizeOptions[_key - 1] = arguments[_key];
}
return function () {
for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
funcs[_key2] = arguments[_key2];
}
var recomputations = 0;
var resultFunc = funcs.pop();
var dependencies = getDependencies(funcs);
var memoizedResultFunc = memoize.apply(undefined, [function () {
recomputations++;
// apply arguments instead of spreading for performance.
return resultFunc.apply(null, arguments);
}].concat(memoizeOptions));
// If a selector is called with the exact same arguments we don't need to traverse our dependencies again.
var selector = defaultMemoize(function () {
var params = [];
var length = dependencies.length;
for (var i = 0; i < length; i++) {
// apply arguments instead of spreading and mutate a local list of params for performance.
params.push(dependencies[i].apply(null, arguments));
}
// apply arguments instead of spreading for performance.
return memoizedResultFunc.apply(null, params);
});
selector.resultFunc = resultFunc;
selector.recomputations = function () {
return recomputations;
};
selector.resetRecomputations = function () {
return recomputations = 0;
};
return selector;
};
}
var createSelector = exports.createSelector = createSelectorCreator(defaultMemoize);
function createStructuredSelector(selectors) {
var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector;
if (typeof selectors !== 'object') {
throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));
}
var objectKeys = Object.keys(selectors);
return selectorCreator(objectKeys.map(function (key) {
return selectors[key];
}), function () {
for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
values[_key3] = arguments[_key3];
}
return values.reduce(function (composition, value, index) {
composition[objectKeys[index]] = value;
return composition;
}, {});
});
}
/***/ }),
/***/ 997:

Просмотреть файл

@ -20,8 +20,6 @@ var _parser = require("../workers/parser/index");
var _promise = require("./utils/middleware/promise");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _prefs = require("../utils/prefs");
var _source = require("../utils/source");
@ -41,7 +39,11 @@ function setSourceMetaData(sourceId) {
}
const framework = await (0, _parser.getFramework)(source.id);
dispatch((0, _tabs.updateTab)(source.url, framework));
if (framework) {
dispatch((0, _tabs.updateTab)(source, framework));
}
dispatch({
type: "SET_SOURCE_METADATA",
sourceId: source.id,
@ -113,7 +115,7 @@ function compressPausePoints(pausePoints) {
for (const col in pausePoints[line]) {
const point = pausePoints[line][col];
compressed[line][col] = (point.break && 1) | (point.step && 2);
compressed[line][col] = (point.break ? 1 : 0) | (point.step ? 2 : 0);
}
}
@ -139,7 +141,7 @@ function setPausePoints(sourceId) {
const pausePoints = await (0, _parser.getPausePoints)(sourceId);
const compressed = compressPausePoints(pausePoints);
if ((0, _devtoolsSourceMap.isGeneratedId)(sourceId)) {
if ((0, _source.isGenerated)(source)) {
await client.setPausePoints(sourceId, compressed);
}

Просмотреть файл

@ -16,12 +16,12 @@ var _selectors = require("../selectors/index");
var _promise = require("./utils/middleware/promise");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _expressions = require("../utils/expressions");
var _prefs = require("../utils/prefs");
var _source = require("../utils/source");
var _parser = require("../workers/parser/index");
var parser = _interopRequireWildcard(_parser);
@ -187,10 +187,9 @@ function evaluateExpression(expression) {
location
} = frame;
const source = (0, _selectors.getSourceFromId)(getState(), location.sourceId);
const sourceId = source.id;
const selectedSource = (0, _selectors.getSelectedSource)(getState());
if (selectedSource && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) && !(0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id)) {
if (selectedSource && (0, _source.isOriginal)(source) && (0, _source.isOriginal)(selectedSource)) {
const mapResult = await dispatch(getMappedExpression(input));
if (mapResult) {

Просмотреть файл

@ -15,7 +15,7 @@ var _prefs = require("../../utils/prefs");
var _log = require("../../utils/log");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _source = require("../../utils/source");
var _mapScopes = require("../../utils/pause/mapScopes/index");
@ -35,7 +35,7 @@ function mapScopes(scopes, frame) {
type: "MAP_SCOPES",
frame,
[_promise.PROMISE]: async function () {
if (!_prefs.features.mapScopes || !source || !generatedSource || generatedSource.isWasm || source.isPrettyPrinted || (0, _devtoolsSourceMap.isGeneratedId)(frame.location.sourceId)) {
if (!_prefs.features.mapScopes || !source || !generatedSource || generatedSource.isWasm || source.isPrettyPrinted || (0, _source.isGenerated)(source)) {
return null;
}

Просмотреть файл

@ -11,12 +11,12 @@ var _preview = require("../utils/preview");
var _ast = require("../utils/ast");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _promise = require("./utils/middleware/promise");
var _getExpression = require("../utils/editor/get-expression");
var _source = require("../utils/source");
var _selectors = require("../selectors/index");
var _expressions = require("./expressions");
@ -93,10 +93,9 @@ function setPreview(expression, location, tokenPos, cursorPos) {
return;
}
const sourceId = source.id;
const selectedFrame = (0, _selectors.getSelectedFrame)(getState());
if (location && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId)) {
if (location && (0, _source.isOriginal)(source)) {
const mapResult = await dispatch((0, _expressions.getMappedExpression)(expression));
if (mapResult) {

Просмотреть файл

@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
});
exports.loadSourceText = loadSourceText;
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _promise = require("../utils/middleware/promise");
var _selectors = require("../../selectors/index");
@ -41,9 +39,11 @@ async function loadSource(source, {
sourceMaps,
client
}) {
const id = source.id;
const {
id
} = source;
if ((0, _devtoolsSourceMap.isOriginalId)(id)) {
if ((0, _source.isOriginal)(source)) {
return sourceMaps.getOriginalSourceText(source);
}
@ -107,7 +107,7 @@ function loadSourceText(source) {
return;
}
if ((0, _devtoolsSourceMap.isOriginalId)(newSource.id) && !newSource.isWasm) {
if ((0, _source.isOriginal)(newSource) && !newSource.isWasm) {
const generatedSource = (0, _selectors.getGeneratedSource)(getState(), source);
await dispatch(loadSourceText(generatedSource));
}

Просмотреть файл

@ -77,7 +77,7 @@ function loadSourceMap(sourceId) {
}) {
const source = (0, _selectors.getSource)(getState(), sourceId);
if (!source || !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) || !source.sourceMapURL) {
if (!source || (0, _source.isOriginal)(source) || !source.sourceMapURL) {
return;
}

Просмотреть файл

@ -158,7 +158,7 @@ function selectLocation(location, {
const tabSources = (0, _tabs.getSourcesForTabs)(getState());
if (!tabSources.includes(source)) {
dispatch((0, _tabs2.addTab)(source.url));
dispatch((0, _tabs2.addTab)(source));
}
dispatch(setSelectedLocation(source, location));
@ -172,7 +172,7 @@ function selectLocation(location, {
if (keepContext && _prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), loadedSource.id) && (0, _source.shouldPrettyPrint)(loadedSource) && (0, _source.isMinified)(loadedSource)) {
await dispatch((0, _prettyPrint.togglePrettyPrint)(loadedSource.id));
dispatch((0, _tabs2.closeTab)(loadedSource.url));
dispatch((0, _tabs2.closeTab)(loadedSource));
}
dispatch((0, _ast.setSymbols)(loadedSource.id));

Просмотреть файл

@ -9,6 +9,8 @@ exports.moveTab = moveTab;
exports.closeTab = closeTab;
exports.closeTabs = closeTabs;
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _editor = require("../utils/editor/index");
var _sources = require("./sources/index");
@ -23,19 +25,28 @@ var _selectors = require("../selectors/index");
* Redux actions for the editor tabs
* @module actions/tabs
*/
function updateTab(url, framework) {
function updateTab(source, framework) {
const {
url
} = source;
const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.id);
return {
type: "UPDATE_TAB",
url,
framework
framework,
isOriginal
};
}
function addTab(url, framework) {
function addTab(source) {
const {
url
} = source;
const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.id);
return {
type: "ADD_TAB",
url,
framework
isOriginal
};
}
@ -52,14 +63,18 @@ function moveTab(url, tabIndex) {
*/
function closeTab(url) {
function closeTab(source) {
return ({
dispatch,
getState,
client
}) => {
(0, _editor.removeDocument)(url);
const tabs = (0, _selectors.removeSourceFromTabList)((0, _selectors.getSourceTabs)(getState()), url);
const {
id,
url
} = source;
(0, _editor.removeDocument)(id);
const tabs = (0, _selectors.removeSourceFromTabList)((0, _selectors.getSourceTabs)(getState()), source);
const sourceId = (0, _selectors.getNewSelectedSourceId)(getState(), tabs);
dispatch({
type: "CLOSE_TAB",
@ -81,17 +96,12 @@ function closeTabs(urls) {
getState,
client
}) => {
urls.forEach(url => {
const source = (0, _selectors.getSourceByURL)(getState(), url);
if (source) {
(0, _editor.removeDocument)(source.id);
}
});
const tabs = (0, _selectors.removeSourcesFromTabList)((0, _selectors.getSourceTabs)(getState()), urls);
const sources = (0, _selectors.getSourcesByURLs)(getState(), urls);
sources.map(source => (0, _editor.removeDocument)(source.id));
const tabs = (0, _selectors.removeSourcesFromTabList)((0, _selectors.getSourceTabs)(getState()), sources);
dispatch({
type: "CLOSE_TABS",
urls,
sources,
tabs
});
const sourceId = (0, _selectors.getNewSelectedSourceId)(getState(), tabs);

Просмотреть файл

@ -10,8 +10,6 @@ var _react2 = _interopRequireDefault(_react);
var _reactRedux = require("devtools/client/shared/vendor/react-redux");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _classnames = require("devtools/client/debugger/new/dist/vendors").vendored["classnames"];
var _classnames2 = _interopRequireDefault(_classnames);
@ -162,7 +160,7 @@ class SourceFooter extends _react.PureComponent {
selectedSource
} = this.props;
if (!mappedSource || !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.id)) {
if (!mappedSource || !(0, _source.isOriginal)(selectedSource)) {
return null;
}

Просмотреть файл

@ -71,7 +71,7 @@ class Tab extends _react.PureComponent {
const tabMenuItems = (0, _tabs.getTabMenuItems)();
const items = [{
item: { ...tabMenuItems.closeTab,
click: () => closeTab(sourceTab.url)
click: () => closeTab(sourceTab)
}
}, {
item: { ...tabMenuItems.closeOtherTabs,
@ -143,7 +143,7 @@ class Tab extends _react.PureComponent {
function onClickClose(e) {
e.stopPropagation();
closeTab(source.url);
closeTab(source);
}
function handleTabClick(e) {
@ -162,7 +162,7 @@ class Tab extends _react.PureComponent {
key: sourceId,
onClick: handleTabClick // Accommodate middle click to close tab
,
onMouseUp: e => e.button === 1 && closeTab(source.url),
onMouseUp: e => e.button === 1 && closeTab(source),
onContextMenu: e => this.onTabContextMenu(e, sourceId),
title: (0, _source.getFileURL)(source)
}, _react2.default.createElement(_SourceIcon2.default, {

Просмотреть файл

@ -343,7 +343,7 @@ function getSourceForTree(state, source) {
return source;
}
return (0, _sources.getSourceByURL)(state, (0, _source.getRawSourceURL)(source.url));
return (0, _sources.getGeneratedSourceByURL)(state, (0, _source.getRawSourceURL)(source.url));
}
const mapStateToProps = state => {

Просмотреть файл

@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _react = require("devtools/client/shared/vendor/react");
var _react2 = _interopRequireDefault(_react);
@ -32,6 +30,8 @@ var _actions = require("../../actions/index");
var _actions2 = _interopRequireDefault(_actions);
var _source = require("../../utils/source");
var _sourcesTree = require("../../utils/sources-tree/index");
var _clipboard = require("../../utils/clipboard");
@ -220,11 +220,11 @@ class SourceTreeItem extends _react.Component {
}
function getHasMatchingGeneratedSource(state, source) {
if (!source || !_devtoolsSourceMap.isOriginalId(source.id)) {
if (!source || !(0, _source.isOriginal)(source)) {
return false;
}
return !!(0, _selectors.getSourceByURL)(state, source.url, false);
return !!(0, _selectors.getGeneratedSourceByURL)(state, source.url);
}
const mapStateToProps = (state, props) => {

Просмотреть файл

@ -10,8 +10,6 @@ var _react2 = _interopRequireDefault(_react);
var _reactRedux = require("devtools/client/shared/vendor/react-redux");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _classnames = require("devtools/client/debugger/new/dist/vendors").vendored["classnames"];
var _classnames2 = _interopRequireDefault(_classnames);
@ -32,6 +30,8 @@ var _prefs = require("../../../utils/prefs");
var _editor = require("../../../utils/editor/index");
var _source = require("../../../utils/source");
var _selectors = require("../../../selectors/index");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -40,7 +40,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* 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 getMappedLocation(mappedLocation, selectedSource) {
return selectedSource && (0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id) ? mappedLocation.generatedLocation : mappedLocation.location;
return selectedSource && (0, _source.isGenerated)(selectedSource) ? mappedLocation.generatedLocation : mappedLocation.location;
}
class Breakpoint extends _react.PureComponent {
@ -137,7 +137,7 @@ class Breakpoint extends _react.PureComponent {
return condition;
}
if (selectedSource && (0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id)) {
if (selectedSource && (0, _source.isGenerated)(selectedSource)) {
return breakpoint.text;
}

Просмотреть файл

@ -43,7 +43,7 @@ function FrameLocation({
frame
}) {
if (!frame.source) {
return;
return null;
}
if (frame.library) {

Просмотреть файл

@ -204,8 +204,11 @@ function getPausePoint(state, location) {
return;
}
const linePoints = pausePoints[line];
return linePoints && linePoints[column];
const linePoints = pausePoints[String(line)];
if (linePoints && column) {
return linePoints[String(column)];
}
}
function hasPausePoints(state, sourceId) {

Просмотреть файл

@ -7,12 +7,12 @@ exports.getPendingBreakpoints = getPendingBreakpoints;
exports.getPendingBreakpointList = getPendingBreakpointList;
exports.getPendingBreakpointsForSource = getPendingBreakpointsForSource;
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _sources = require("./sources");
var _breakpoint = require("../utils/breakpoint/index");
var _source = require("../utils/source");
/* 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/>. */
@ -175,7 +175,7 @@ function getPendingBreakpointList(state) {
function getPendingBreakpointsForSource(state, source) {
const sources = (0, _sources.getSourcesByURL)(state, source.url);
if (sources.length > 1 && (0, _devtoolsSourceMap.isGeneratedId)(source.id)) {
if (sources.length > 1 && (0, _source.isGenerated)(source)) {
// Don't return pending breakpoints for duplicated generated sources
return [];
}

Просмотреть файл

@ -9,6 +9,9 @@ exports.createSource = createSource;
exports.getBlackBoxList = getBlackBoxList;
exports.getSource = getSource;
exports.getSourceFromId = getSourceFromId;
exports.getOriginalSourceByURL = getOriginalSourceByURL;
exports.getGeneratedSourceByURL = getGeneratedSourceByURL;
exports.getSpecificSourceByURL = getSpecificSourceByURL;
exports.getSourceByURL = getSourceByURL;
exports.getSourcesByURLs = getSourcesByURLs;
exports.getSourcesByURL = getSourcesByURL;
@ -16,6 +19,9 @@ exports.getGeneratedSource = getGeneratedSource;
exports.getPendingSelectedLocation = getPendingSelectedLocation;
exports.getPrettySource = getPrettySource;
exports.hasPrettySource = hasPrettySource;
exports.getOriginalSourceByUrlInSources = getOriginalSourceByUrlInSources;
exports.getGeneratedSourceByUrlInSources = getGeneratedSourceByUrlInSources;
exports.getSpecificSourceByUrlInSources = getSpecificSourceByUrlInSources;
exports.getSourceByUrlInSources = getSourceByUrlInSources;
exports.getSourceInSources = getSourceInSources;
exports.getSources = getSources;
@ -291,6 +297,18 @@ function getSourceFromId(state, id) {
return getSourcesState(state).sources[id];
}
function getOriginalSourceByURL(state, url) {
return getOriginalSourceByUrlInSources(getSources(state), getUrls(state), url);
}
function getGeneratedSourceByURL(state, url) {
return getGeneratedSourceByUrlInSources(getSources(state), getUrls(state), url);
}
function getSpecificSourceByURL(state, url, isOriginal) {
return isOriginal ? getOriginalSourceByUrlInSources(getSources(state), getUrls(state), url) : getGeneratedSourceByUrlInSources(getSources(state), getUrls(state), url);
}
function getSourceByURL(state, url) {
return getSourceByUrlInSources(getSources(state), getUrls(state), url);
}
@ -304,7 +322,7 @@ function getSourcesByURL(state, url) {
}
function getGeneratedSource(state, source) {
if (!(0, _devtoolsSourceMap.isOriginalId)(source.id)) {
if ((0, _source.isGenerated)(source)) {
return source;
}
@ -322,13 +340,37 @@ function getPrettySource(state, id) {
return;
}
return getSourceByURL(state, (0, _source.getPrettySourceURL)(source.url));
return getSpecificSourceByURL(state, (0, _source.getPrettySourceURL)(source.url), true);
}
function hasPrettySource(state, id) {
return !!getPrettySource(state, id);
}
function getOriginalSourceByUrlInSources(sources, urls, url) {
const foundSources = getSourcesByUrlInSources(sources, urls, url);
if (!foundSources) {
return null;
}
return foundSources.find(source => (0, _source.isOriginal)(source) == true);
}
function getGeneratedSourceByUrlInSources(sources, urls, url) {
const foundSources = getSourcesByUrlInSources(sources, urls, url);
if (!foundSources) {
return null;
}
return foundSources.find(source => (0, _source.isOriginal)(source) == false);
}
function getSpecificSourceByUrlInSources(sources, urls, url, isOriginal) {
return isOriginal ? getOriginalSourceByUrlInSources(sources, urls, url) : getGeneratedSourceByUrlInSources(sources, urls, url);
}
function getSourceByUrlInSources(sources, urls, url) {
const foundSources = getSourcesByUrlInSources(sources, urls, url);

Просмотреть файл

@ -10,6 +10,8 @@ exports.getNewSelectedSourceId = getNewSelectedSourceId;
var _reselect = require("devtools/client/debugger/new/dist/vendors").vendored["reselect"];
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _lodashMove = require("devtools/client/debugger/new/dist/vendors").vendored["lodash-move"];
var _lodashMove2 = _interopRequireDefault(_lodashMove);
@ -51,12 +53,12 @@ function update(state = [], action) {
}
}
function removeSourceFromTabList(tabs, url) {
return tabs.filter(tab => tab.url !== url);
function removeSourceFromTabList(tabs, source) {
return tabs.filter(tab => tab.url !== source.url || tab.isOriginal != (0, _devtoolsSourceMap.isOriginalId)(source.id));
}
function removeSourcesFromTabList(tabs, urls) {
return urls.reduce((t, url) => removeSourceFromTabList(t, url), tabs);
function removeSourcesFromTabList(tabs, sources) {
return sources.reduce((t, source) => removeSourceFromTabList(t, source), tabs);
}
/**
* Adds the new source to the tab list if it is not already there
@ -67,14 +69,16 @@ function removeSourcesFromTabList(tabs, urls) {
function updateTabList(tabs, {
url,
framework = null
framework = null,
isOriginal = false
}) {
const currentIndex = tabs.findIndex(tab => tab.url == url);
const currentIndex = tabs.findIndex(tab => isSimilarTab(tab, url, isOriginal));
if (currentIndex === -1) {
tabs = [{
url,
framework
framework,
isOriginal
}, ...tabs];
} else if (framework) {
tabs[currentIndex].framework = framework;
@ -117,7 +121,7 @@ function getNewSelectedSourceId(state, availableTabs) {
return "";
}
const matchingTab = availableTabs.find(tab => tab.url == selectedTab.url);
const matchingTab = availableTabs.find(tab => isSimilarTab(tab, selectedTab.url, (0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId)));
if (matchingTab) {
const sources = state.sources.sources;
@ -126,7 +130,7 @@ function getNewSelectedSourceId(state, availableTabs) {
return "";
}
const selectedSource = (0, _sources.getSourceByURL)(state, selectedTab.url);
const selectedSource = (0, _sources.getSpecificSourceByURL)(state, selectedTab.url, (0, _devtoolsSourceMap.isOriginalId)(selectedTab.id));
if (selectedSource) {
return selectedSource.id;
@ -142,7 +146,7 @@ function getNewSelectedSourceId(state, availableTabs) {
const availableTab = availableTabs[newSelectedTabIndex];
if (availableTab) {
const tabSource = (0, _sources.getSourceByUrlInSources)((0, _sources.getSources)(state), (0, _sources.getUrls)(state), availableTab.url);
const tabSource = (0, _sources.getSpecificSourceByUrlInSources)((0, _sources.getSources)(state), (0, _sources.getUrls)(state), availableTab.url, availableTab.isOriginal);
if (tabSource) {
return tabSource.id;
@ -162,8 +166,8 @@ function getNewSelectedSourceId(state, availableTabs) {
const getTabs = exports.getTabs = state => state.tabs;
const getSourceTabs = exports.getSourceTabs = (0, _reselect.createSelector)(getTabs, _sources.getSources, _sources.getUrls, (tabs, sources, urls) => tabs.filter(tab => (0, _sources.getSourceByUrlInSources)(sources, urls, tab.url)));
const getSourceTabs = exports.getSourceTabs = (0, _reselect.createSelector)(getTabs, _sources.getSources, _sources.getUrls, (tabs, sources, urls) => tabs.filter(tab => (0, _sources.getSpecificSourceByUrlInSources)(sources, urls, tab.url, tab.isOriginal)));
const getSourcesForTabs = exports.getSourcesForTabs = (0, _reselect.createSelector)(getSourceTabs, _sources.getSources, _sources.getUrls, (tabs, sources, urls) => {
return tabs.map(tab => (0, _sources.getSourceByUrlInSources)(sources, urls, tab.url)).filter(source => source);
return tabs.map(tab => (0, _sources.getSpecificSourceByUrlInSources)(sources, urls, tab.url, tab.isOriginal)).filter(Boolean);
});
exports.default = update;

Просмотреть файл

@ -10,25 +10,21 @@ var _sources = require("../reducers/sources");
var _breakpoints = require("../reducers/breakpoints");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _source = require("../utils/source");
/* 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 isGenerated(selectedSource) {
return (0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id);
}
function getColumn(column, selectedSource) {
if (column) {
return column;
}
return isGenerated(selectedSource) ? undefined : 0;
return (0, _source.isGenerated)(selectedSource) ? undefined : 0;
}
function getLocation(bp, selectedSource) {
return isGenerated(selectedSource) ? bp.generatedLocation || bp.location : bp.location;
return (0, _source.isGenerated)(selectedSource) ? bp.generatedLocation || bp.location : bp.location;
}
function getBreakpointsForSource(state, selectedSource) {

Просмотреть файл

@ -12,7 +12,7 @@ var _pause = require("../reducers/pause");
var _frames = require("../utils/pause/frames/index");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _source = require("../utils/source");
var _lodash = require("devtools/client/shared/vendor/lodash");
@ -31,7 +31,7 @@ function getSourceForFrame(sources, frame, isGeneratedSource) {
}
function appendSource(sources, frame, selectedSource) {
const isGeneratedSource = selectedSource && !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.id);
const isGeneratedSource = selectedSource && !(0, _source.isOriginal)(selectedSource);
return { ...frame,
location: getLocation(frame, isGeneratedSource),
source: getSourceForFrame(sources, frame, isGeneratedSource)

Просмотреть файл

@ -110,7 +110,8 @@ function bootstrapWorkers() {
if ((0, _devtoolsEnvironment.isDevelopment)()) {
// When used in Firefox, the toolbox manages the source map worker.
(0, _devtoolsSourceMap.startSourceMapWorker)(`${workerPath}/source-map-worker.js`);
(0, _devtoolsSourceMap.startSourceMapWorker)(`${workerPath}/source-map-worker.js`, // This is relative to the worker itself.
"./source-map-worker-assets/");
}
prettyPrint.start(`${workerPath}/pretty-print-worker.js`);

Просмотреть файл

@ -88,8 +88,6 @@ var _source = require("../source");
var _wasm = require("../wasm");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
let editor;
function getEditor() {
@ -146,7 +144,7 @@ function shouldShowFooter(selectedSource, horizontal) {
return false;
}
return shouldShowPrettyPrint(selectedSource) || (0, _devtoolsSourceMap.isOriginalId)(selectedSource.id);
return shouldShowPrettyPrint(selectedSource) || (0, _source.isOriginal)(selectedSource);
}
function traverseResults(e, ctx, query, dir, modifiers) {

Просмотреть файл

@ -9,6 +9,8 @@ var _lodash = require("devtools/client/shared/vendor/lodash");
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
var _source = require("../../utils/source");
var _selectors = require("../../selectors/index");
/* This Source Code Form is subject to the terms of the Mozilla Public
@ -19,7 +21,7 @@ function getFrameLocation(source, frame) {
return null;
}
return (0, _devtoolsSourceMap.isOriginalId)(source.id) ? frame.location : frame.generatedLocation;
return (0, _source.isOriginal)(source) ? frame.location : frame.generatedLocation;
}
function shouldStep(rootFrame, state, sourceMaps) {

Просмотреть файл

@ -34,6 +34,8 @@ exports.getTextAtPosition = getTextAtPosition;
exports.getSourceClassnames = getSourceClassnames;
exports.getRelativeUrl = getRelativeUrl;
exports.underRoot = underRoot;
exports.isOriginal = isOriginal;
exports.isGenerated = isGenerated;
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
@ -73,7 +75,7 @@ function trimUrlQuery(url) {
}
function shouldPrettyPrint(source) {
if (!source || isPretty(source) || !isJavaScript(source) || (0, _devtoolsSourceMap.isOriginalId)(source.id) || source.sourceMapURL || !_prefs.prefs.clientSourceMapsEnabled) {
if (!source || isPretty(source) || !isJavaScript(source) || isOriginal(source) || source.sourceMapURL || !_prefs.prefs.clientSourceMapsEnabled) {
return false;
}
@ -518,4 +520,14 @@ function getRelativeUrl(source, root) {
function underRoot(source, root) {
return source.url && source.url.includes(root);
}
function isOriginal(source) {
// Pretty-printed sources are given original IDs, so no need
// for any additional check
return (0, _devtoolsSourceMap.isOriginalId)(source.id);
}
function isGenerated(source) {
return (0, _devtoolsSourceMap.isGeneratedId)(source.id);
}

Просмотреть файл

@ -3,7 +3,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.replaceOriginalVariableName = exports.getPausePoints = exports.getFramework = exports.mapExpression = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.getNextStep = exports.clearASTs = exports.clearScopes = exports.clearSymbols = exports.findOutOfScopeLocations = exports.getScopes = exports.getSymbols = exports.getClosestExpression = exports.stop = exports.start = undefined;
exports.getPausePoints = exports.getFramework = exports.mapExpression = exports.hasSyntaxError = exports.clearSources = exports.setSource = exports.hasSource = exports.getSymbols = exports.clearSymbols = exports.clearScopes = exports.getScopes = exports.clearASTs = exports.getNextStep = exports.findOutOfScopeLocations = exports.stop = exports.start = undefined;
var _devtoolsUtils = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-utils"];
@ -14,21 +14,35 @@ const {
WorkerDispatcher
} = _devtoolsUtils.workerUtils;
const dispatcher = new WorkerDispatcher();
const start = exports.start = dispatcher.start.bind(dispatcher);
const stop = exports.stop = dispatcher.stop.bind(dispatcher);
const getClosestExpression = exports.getClosestExpression = dispatcher.task("getClosestExpression");
const getSymbols = exports.getSymbols = dispatcher.task("getSymbols");
const getScopes = exports.getScopes = dispatcher.task("getScopes");
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");
const getNextStep = exports.getNextStep = dispatcher.task("getNextStep");
const hasSource = exports.hasSource = dispatcher.task("hasSource");
const setSource = exports.setSource = dispatcher.task("setSource");
const clearSources = exports.clearSources = dispatcher.task("clearSources");
const hasSyntaxError = exports.hasSyntaxError = dispatcher.task("hasSyntaxError");
const mapExpression = exports.mapExpression = dispatcher.task("mapExpression");
const getFramework = exports.getFramework = dispatcher.task("getFramework");
const getPausePoints = exports.getPausePoints = dispatcher.task("getPausePoints");
const replaceOriginalVariableName = exports.replaceOriginalVariableName = dispatcher.task("replaceOriginalVariableName");
const start = exports.start = url => dispatcher.start(url);
const stop = exports.stop = () => dispatcher.stop();
const findOutOfScopeLocations = exports.findOutOfScopeLocations = async (sourceId, position) => dispatcher.invoke("findOutOfScopeLocations", sourceId, position);
const getNextStep = exports.getNextStep = async (sourceId, pausedPosition) => dispatcher.invoke("getNextStep", sourceId, pausedPosition);
const clearASTs = exports.clearASTs = async () => dispatcher.invoke("clearASTs");
const getScopes = exports.getScopes = async location => dispatcher.invoke("getScopes", location);
const clearScopes = exports.clearScopes = async () => dispatcher.invoke("clearScopes");
const clearSymbols = exports.clearSymbols = async () => dispatcher.invoke("clearSymbols");
const getSymbols = exports.getSymbols = async sourceId => dispatcher.invoke("getSymbols", sourceId);
const hasSource = exports.hasSource = async sourceId => dispatcher.invoke("hasSource", sourceId);
const setSource = exports.setSource = async source => dispatcher.invoke("setSource", source);
const clearSources = exports.clearSources = async () => dispatcher.invoke("clearSources");
const hasSyntaxError = exports.hasSyntaxError = async input => dispatcher.invoke("hasSyntaxError", input);
const mapExpression = exports.mapExpression = async (expression, mappings, bindings, shouldMapBindings, shouldMapAwait) => dispatcher.invoke("mapExpression", expression, mappings, bindings, shouldMapBindings, shouldMapAwait);
const getFramework = exports.getFramework = async sourceId => dispatcher.invoke("getFramework", sourceId);
const getPausePoints = exports.getPausePoints = async sourceId => dispatcher.invoke("getPausePoints", sourceId);

Просмотреть файл

@ -9,6 +9,7 @@ add_task(async function() {
await waitForSources(dbg, "doc-asm.html", "asm.js");
// Make sure sources appear.
is(findAllElements(dbg, "sourceNodes").length, 4);
await selectSource(dbg, "asm.js");

Просмотреть файл

@ -6,10 +6,10 @@
* required from other panel test files.
*/
// Import helpers for the new debugger
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
// Import helpers for the new debugger
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/debugger/new/test/mochitest/helpers/context.js",
this);
var { Toolbox } = require("devtools/client/framework/toolbox");
var { Task } = require("devtools/shared/task");
@ -593,8 +593,7 @@ async function selectSource(dbg, url, line) {
async function closeTab(dbg, url) {
const source = findSource(dbg, url);
await dbg.actions.closeTab(source.url);
await dbg.actions.closeTab(findSource(dbg, url));
}
/**

Двоичный файл не отображается.

Просмотреть файл

@ -436,6 +436,7 @@ const {
const dispatcher = new WorkerDispatcher();
const setAssetRootURL = dispatcher.task("setAssetRootURL");
const getOriginalURLs = dispatcher.task("getOriginalURLs");
const getOriginalRanges = dispatcher.task("getOriginalRanges");
const getGeneratedRanges = dispatcher.task("getGeneratedRanges", {
@ -472,8 +473,9 @@ module.exports = {
applySourceMap,
clearSourceMaps,
getOriginalStackFrames,
startSourceMapWorker(workerURL) {
dispatcher.start(workerURL);
startSourceMapWorker(url, assetRoot) {
dispatcher.start(url);
setAssetRootURL(assetRoot);
},
stopSourceMapWorker: dispatcher.stop.bind(dispatcher)
};
@ -697,6 +699,10 @@ WorkerDispatcher.prototype = {
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};

Разница между файлами не показана из-за своего большого размера Загрузить разницу