mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1472735 - Update Debugger Frontend v67. r=jdescottes
This commit is contained in:
parent
93bed26733
commit
c367b58df7
13
devtools/client/debugger/new/dist/debugger.css
vendored
13
devtools/client/debugger/new/dist/debugger.css
vendored
@ -247,6 +247,7 @@ body {
|
||||
border-radius: 8px;
|
||||
background: rgba(113, 113, 113, 0.5);
|
||||
}
|
||||
|
||||
/* 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/>. */
|
||||
@ -2707,7 +2708,7 @@ html[dir="rtl"] .editor-mount {
|
||||
:not(.empty-line):not(.new-breakpoint) > .CodeMirror-gutter-wrapper:hover {
|
||||
width: 60px;
|
||||
height: 13px;
|
||||
margin-left: -25px;
|
||||
left: -55px !important;
|
||||
background-color: var(--gutter-hover-background-color) !important;
|
||||
mask: url("chrome://devtools/skin/images/debugger/breakpoint.svg") no-repeat;
|
||||
mask-size: 100%;
|
||||
@ -3114,8 +3115,8 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
|
||||
}
|
||||
|
||||
.breakpoint .close-btn {
|
||||
inset-inline-end: 15px;
|
||||
inset-inline-start: auto;
|
||||
offset-inline-end: 15px;
|
||||
offset-inline-start: auto;
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
display: none;
|
||||
@ -3264,7 +3265,7 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
|
||||
|
||||
.expression-container__close-btn {
|
||||
position: absolute;
|
||||
inset-inline-end: 0px;
|
||||
offset-inline-end: 0px;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
@ -3948,8 +3949,8 @@ html[dir="rtl"] .object-node {
|
||||
.welcomebox .command-bar-button {
|
||||
position: absolute;
|
||||
top: auto;
|
||||
inset-inline-end: 0;
|
||||
inset-inline-start: auto;
|
||||
offset-inline-end: 0;
|
||||
offset-inline-start: auto;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
|
1792
devtools/client/debugger/new/dist/vendors.js
vendored
1792
devtools/client/debugger/new/dist/vendors.js
vendored
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,8 @@ var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
|
||||
|
||||
var _prefs = require("../utils/prefs");
|
||||
|
||||
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/>. */
|
||||
@ -32,7 +34,7 @@ function setSourceMetaData(sourceId) {
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
|
||||
if (!source || !source.text || source.isWasm) {
|
||||
if (!source || !(0, _source.isLoaded)(source) || source.isWasm) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,9 +54,9 @@ function setSymbols(sourceId) {
|
||||
dispatch,
|
||||
getState
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
|
||||
if (!source || !source.text || source.isWasm || (0, _selectors.hasSymbols)(getState(), source)) {
|
||||
if (source.isWasm || (0, _selectors.hasSymbols)(getState(), source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -85,11 +87,11 @@ function setOutOfScopeLocations() {
|
||||
return;
|
||||
}
|
||||
|
||||
const source = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), location.sourceId);
|
||||
let locations = null;
|
||||
|
||||
if (location.line && source && (0, _selectors.isPaused)(getState())) {
|
||||
locations = await (0, _parser.findOutOfScopeLocations)(source.get("id"), location);
|
||||
locations = await (0, _parser.findOutOfScopeLocations)(source.id, location);
|
||||
}
|
||||
|
||||
dispatch({
|
||||
@ -121,7 +123,7 @@ function setPausePoints(sourceId) {
|
||||
getState,
|
||||
client
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
|
||||
if (!_prefs.features.pausePoints || !source || !source.text || source.isWasm) {
|
||||
return;
|
||||
@ -136,7 +138,7 @@ function setPausePoints(sourceId) {
|
||||
|
||||
dispatch({
|
||||
type: "SET_PAUSE_POINTS",
|
||||
sourceText: source.text,
|
||||
sourceText: source.text || "",
|
||||
sourceId,
|
||||
pausePoints
|
||||
});
|
||||
|
@ -27,15 +27,15 @@ function setInScopeLines() {
|
||||
dispatch,
|
||||
getState
|
||||
}) => {
|
||||
const sourceRecord = (0, _selectors.getSelectedSource)(getState());
|
||||
const source = (0, _selectors.getSelectedSource)(getState());
|
||||
const outOfScopeLocations = (0, _selectors.getOutOfScopeLocations)(getState());
|
||||
|
||||
if (!sourceRecord || !sourceRecord.text) {
|
||||
if (!source || !source.text) {
|
||||
return;
|
||||
}
|
||||
|
||||
const linesOutOfScope = getOutOfScopeLines(outOfScopeLocations);
|
||||
const sourceNumLines = (0, _source.getSourceLineCount)(sourceRecord);
|
||||
const sourceNumLines = (0, _source.getSourceLineCount)(source);
|
||||
const sourceLines = (0, _lodash.range)(1, sourceNumLines + 1);
|
||||
const inScopeLines = !linesOutOfScope ? sourceLines : (0, _lodash.without)(sourceLines, ...linesOutOfScope);
|
||||
dispatch({
|
||||
|
@ -56,9 +56,9 @@ function createSyncData(id, pendingBreakpoint, location, generatedLocation, prev
|
||||
|
||||
async function syncClientBreakpoint(getState, client, sourceMaps, sourceId, pendingBreakpoint) {
|
||||
(0, _breakpoint.assertPendingBreakpoint)(pendingBreakpoint);
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
const generatedSourceId = sourceMaps.isOriginalId(sourceId) ? (0, _devtoolsSourceMap.originalToGeneratedId)(sourceId) : sourceId;
|
||||
const generatedSource = (0, _selectors.getSource)(getState(), generatedSourceId);
|
||||
const generatedSource = (0, _selectors.getSourceFromId)(getState(), generatedSourceId);
|
||||
const {
|
||||
location,
|
||||
astLocation
|
||||
|
@ -103,7 +103,7 @@ function formatListeners(state, listeners) {
|
||||
return {
|
||||
selector: l.node.selector,
|
||||
type: l.type,
|
||||
sourceId: (0, _selectors.getSourceByURL)(state, l.function.location.url).get("id"),
|
||||
sourceId: (0, _selectors.getSourceByURL)(state, l.function.location.url).id,
|
||||
line: l.function.location.line
|
||||
};
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.addExpression = addExpression;
|
||||
exports.autocomplete = autocomplete;
|
||||
exports.clearAutocomplete = clearAutocomplete;
|
||||
exports.clearExpressionError = clearExpressionError;
|
||||
exports.updateExpression = updateExpression;
|
||||
exports.deleteExpression = deleteExpression;
|
||||
@ -86,6 +87,12 @@ function autocomplete(input, cursor) {
|
||||
};
|
||||
}
|
||||
|
||||
function clearAutocomplete() {
|
||||
return {
|
||||
type: "CLEAR_AUTOCOMPLETE"
|
||||
};
|
||||
}
|
||||
|
||||
function clearExpressionError() {
|
||||
return {
|
||||
type: "CLEAR_EXPRESSION_ERROR"
|
||||
@ -177,11 +184,11 @@ function evaluateExpression(expression) {
|
||||
const {
|
||||
location
|
||||
} = frame;
|
||||
const source = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
const sourceId = source.get("id");
|
||||
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.get("id"))) {
|
||||
if (selectedSource && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) && !(0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id)) {
|
||||
input = await dispatch(getMappedExpression(input));
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ function navigated() {
|
||||
}) {
|
||||
await (0, _utils.waitForMs)(100);
|
||||
|
||||
if ((0, _sources.getSources)(getState()).size == 0) {
|
||||
if (Object.keys((0, _sources.getSources)(getState())).length == 0) {
|
||||
const sources = await client.fetchSources();
|
||||
dispatch((0, _sources2.newSources)(sources));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ function updateFrameLocations(frames, sourceMaps) {
|
||||
|
||||
function mapDisplayNames(frames, getState) {
|
||||
return frames.map(frame => {
|
||||
const source = (0, _selectors.getSource)(getState(), frame.location.sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), frame.location.sourceId);
|
||||
const symbols = (0, _selectors.getSymbols)(getState(), source);
|
||||
|
||||
if (!symbols || !symbols.functions) {
|
||||
|
@ -29,9 +29,9 @@ function mapScopes(scopes, frame) {
|
||||
client,
|
||||
sourceMaps
|
||||
}) {
|
||||
const generatedSourceRecord = (0, _selectors.getSource)(getState(), frame.generatedLocation.sourceId);
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), frame.location.sourceId);
|
||||
const shouldMapScopes = _prefs.features.mapScopes && !generatedSourceRecord.isWasm && !sourceRecord.isPrettyPrinted && !(0, _devtoolsSourceMap.isGeneratedId)(frame.location.sourceId);
|
||||
const generatedSource = (0, _selectors.getSourceFromId)(getState(), frame.generatedLocation.sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), frame.location.sourceId);
|
||||
const shouldMapScopes = _prefs.features.mapScopes && !generatedSource.isWasm && !source.isPrettyPrinted && !(0, _devtoolsSourceMap.isGeneratedId)(frame.location.sourceId);
|
||||
await dispatch({
|
||||
type: "MAP_SCOPES",
|
||||
frame,
|
||||
@ -40,10 +40,10 @@ function mapScopes(scopes, frame) {
|
||||
return null;
|
||||
}
|
||||
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(sourceRecord));
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(source));
|
||||
|
||||
try {
|
||||
return await (0, _mapScopes.buildMappedScopes)(sourceRecord.toJS(), frame, (await scopes), sourceMaps, client);
|
||||
return await (0, _mapScopes.buildMappedScopes)(source, frame, (await scopes), sourceMaps, client);
|
||||
} catch (e) {
|
||||
(0, _log.log)(e);
|
||||
return null;
|
||||
|
@ -33,7 +33,7 @@ var _fetchScopes = require("./fetchScopes");
|
||||
* 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/>. */
|
||||
async function getOriginalSourceForFrame(state, frame) {
|
||||
return (0, _selectors.getSources)(state).get(frame.location.sourceId);
|
||||
return (0, _selectors.getSources)(state)[frame.location.sourceId];
|
||||
}
|
||||
/**
|
||||
* Debugger has just paused
|
||||
|
@ -22,9 +22,8 @@ function toggleSkipPausing() {
|
||||
getState,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const skipPausing = !(0, _selectors.getSkipPausing)(getState()); // NOTE: enable this when we land the endpoint in m-c
|
||||
// await client.setSkipPausing(skipPausing);
|
||||
|
||||
const skipPausing = !(0, _selectors.getSkipPausing)(getState());
|
||||
await client.setSkipPausing(skipPausing);
|
||||
dispatch({
|
||||
type: "TOGGLE_SKIP_PAUSING",
|
||||
skipPausing
|
||||
|
@ -28,6 +28,11 @@ var _pause = require("./pause/index");
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
function findExpressionMatch(state, codeMirror, tokenPos) {
|
||||
const source = (0, _selectors.getSelectedSource)(state);
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const symbols = (0, _selectors.getSymbols)(state, source);
|
||||
let match;
|
||||
|
||||
|
@ -88,8 +88,7 @@ function searchSources(query) {
|
||||
await dispatch(clearSearchResults());
|
||||
await dispatch(addSearchQuery(query));
|
||||
dispatch(updateSearchStatus(_projectTextSearch.statusType.fetching));
|
||||
const sources = (0, _selectors.getSources)(getState());
|
||||
const validSources = sources.valueSeq().filter(source => !(0, _selectors.hasPrettySource)(getState(), source.id) && !(0, _source.isThirdParty)(source));
|
||||
const validSources = (0, _selectors.getSourceList)(getState()).filter(source => !(0, _selectors.hasPrettySource)(getState(), source.id) && !(0, _source.isThirdParty)(source));
|
||||
|
||||
for (const source of validSources) {
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(source));
|
||||
@ -105,18 +104,18 @@ function searchSource(sourceId, query) {
|
||||
dispatch,
|
||||
getState
|
||||
}) => {
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
|
||||
if (!sourceRecord) {
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const matches = await (0, _search.findSourceMatches)(sourceRecord.toJS(), query);
|
||||
const matches = await (0, _search.findSourceMatches)(source, query);
|
||||
|
||||
if (!matches.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
dispatch(addSearchResult(sourceRecord.id, sourceRecord.url, matches));
|
||||
dispatch(addSearchResult(source.id, source.url, matches));
|
||||
};
|
||||
}
|
@ -17,12 +17,12 @@ var parser = _interopRequireWildcard(_parser);
|
||||
|
||||
var _source = require("../../utils/source");
|
||||
|
||||
var _devtoolsModules = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-modules"];
|
||||
|
||||
var _defer = require("../../utils/defer");
|
||||
|
||||
var _defer2 = _interopRequireDefault(_defer);
|
||||
|
||||
var _devtoolsModules = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-modules"];
|
||||
|
||||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
@ -30,21 +30,23 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return 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 <http://mozilla.org/MPL/2.0/>. */
|
||||
const requests = new Map();
|
||||
const requests = new Map(); // Measures the time it takes for a source to load
|
||||
|
||||
const loadSourceHistogram = _devtoolsModules.Services.telemetry.getHistogramById("DEVTOOLS_DEBUGGER_LOAD_SOURCE_MS");
|
||||
const loadSourceHistogram = "DEVTOOLS_DEBUGGER_LOAD_SOURCE_MS";
|
||||
const telemetry = new _devtoolsModules.Telemetry();
|
||||
|
||||
async function loadSource(source, {
|
||||
sourceMaps,
|
||||
client
|
||||
}) {
|
||||
const id = source.get("id");
|
||||
const id = source.id;
|
||||
|
||||
if ((0, _devtoolsSourceMap.isOriginalId)(id)) {
|
||||
return sourceMaps.getOriginalSourceText(source.toJS());
|
||||
return sourceMaps.getOriginalSourceText(source);
|
||||
}
|
||||
|
||||
const response = await client.sourceContents(id);
|
||||
telemetry.finish(loadSourceHistogram, source);
|
||||
return {
|
||||
id,
|
||||
text: response.source,
|
||||
@ -64,7 +66,7 @@ function loadSourceText(source) {
|
||||
client,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const id = source.get("id"); // Fetch the source text only once.
|
||||
const id = source.id; // Fetch the source text only once.
|
||||
|
||||
if (requests.has(id)) {
|
||||
return requests.get(id);
|
||||
@ -74,9 +76,9 @@ function loadSourceText(source) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const telemetryStart = performance.now();
|
||||
const deferred = (0, _defer2.default)();
|
||||
requests.set(id, deferred.promise);
|
||||
telemetry.start(loadSourceHistogram, source);
|
||||
|
||||
try {
|
||||
await dispatch({
|
||||
@ -93,7 +95,7 @@ function loadSourceText(source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newSource = (0, _selectors.getSource)(getState(), source.get("id")).toJS();
|
||||
const newSource = (0, _selectors.getSourceFromId)(getState(), source.id);
|
||||
|
||||
if ((0, _devtoolsSourceMap.isOriginalId)(newSource.id) && !newSource.isWasm) {
|
||||
const generatedSource = (0, _selectors.getGeneratedSource)(getState(), source);
|
||||
@ -107,8 +109,6 @@ function loadSourceText(source) {
|
||||
|
||||
deferred.resolve();
|
||||
requests.delete(id);
|
||||
const telemetryEnd = performance.now();
|
||||
const duration = telemetryEnd - telemetryStart;
|
||||
loadSourceHistogram.add(duration);
|
||||
return source;
|
||||
};
|
||||
}
|
@ -64,9 +64,9 @@ function loadSourceMap(sourceId) {
|
||||
getState,
|
||||
sourceMaps
|
||||
}) {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId).toJS();
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
|
||||
if (!sourceMaps || !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) || !source.sourceMapURL) {
|
||||
if (!source || !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) || !source.sourceMapURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ function checkSelectedSource(sourceId) {
|
||||
dispatch,
|
||||
getState
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
const pendingLocation = (0, _selectors.getPendingSelectedLocation)(getState());
|
||||
|
||||
if (!pendingLocation || !pendingLocation.url || !source.url) {
|
||||
@ -128,8 +128,8 @@ function checkPendingBreakpoints(sourceId) {
|
||||
getState
|
||||
}) => {
|
||||
// source may have been modified by selectLocation
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const pendingBreakpoints = (0, _selectors.getPendingBreakpointsForSource)(getState(), source.get("url"));
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
const pendingBreakpoints = (0, _selectors.getPendingBreakpointsForSource)(getState(), source.url);
|
||||
|
||||
if (!pendingBreakpoints.size) {
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ function createPrettySource(sourceId) {
|
||||
getState,
|
||||
sourceMaps
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
|
||||
const url = (0, _source.getPrettySourceURL)(source.url);
|
||||
const id = await sourceMaps.generatedToOriginalId(sourceId, url);
|
||||
const prettySource = {
|
||||
@ -120,8 +120,7 @@ function togglePrettyPrint(sourceId) {
|
||||
}
|
||||
|
||||
if (prettySource) {
|
||||
const _sourceId = prettySource.get("id");
|
||||
|
||||
const _sourceId = prettySource.id;
|
||||
return dispatch((0, _sources.selectLocation)(_objectSpread({}, options.location, {
|
||||
sourceId: _sourceId
|
||||
})));
|
||||
|
@ -116,9 +116,9 @@ function selectLocation(location) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
const source = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
|
||||
if (!sourceRecord) {
|
||||
if (!source) {
|
||||
// If there is no source we deselect the current selected source
|
||||
return dispatch(clearSelectedLocation());
|
||||
}
|
||||
@ -129,24 +129,22 @@ function selectLocation(location) {
|
||||
dispatch((0, _ui.closeActiveSearch)());
|
||||
}
|
||||
|
||||
const source = sourceRecord.toJS();
|
||||
dispatch((0, _tabs.addTab)(source.url, 0));
|
||||
dispatch(setSelectedLocation(source, location));
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(sourceRecord));
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(getState());
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(source));
|
||||
const loadedSource = (0, _selectors.getSource)(getState(), source.id);
|
||||
|
||||
if (!selectedSource) {
|
||||
if (!loadedSource) {
|
||||
// If there was a navigation while we were loading the loadedSource
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceId = selectedSource.id;
|
||||
|
||||
if (_prefs.prefs.autoPrettyPrint && !(0, _selectors.getPrettySource)(getState(), sourceId) && (0, _source.shouldPrettyPrint)(selectedSource) && (0, _source.isMinified)(selectedSource)) {
|
||||
await dispatch((0, _prettyPrint.togglePrettyPrint)(sourceId));
|
||||
dispatch((0, _tabs.closeTab)(source.url));
|
||||
if (_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, _tabs.closeTab)(loadedSource.url));
|
||||
}
|
||||
|
||||
dispatch((0, _ast.setSymbols)(sourceId));
|
||||
dispatch((0, _ast.setSymbols)(loadedSource.id));
|
||||
dispatch((0, _ast.setOutOfScopeLocations)());
|
||||
};
|
||||
}
|
||||
@ -168,9 +166,9 @@ function selectSpecificLocation(location) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceRecord = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
const source = (0, _selectors.getSource)(getState(), location.sourceId);
|
||||
|
||||
if (!sourceRecord) {
|
||||
if (!source) {
|
||||
// If there is no source we deselect the current selected source
|
||||
return dispatch(clearSelectedLocation());
|
||||
}
|
||||
@ -181,17 +179,16 @@ function selectSpecificLocation(location) {
|
||||
dispatch((0, _ui.closeActiveSearch)());
|
||||
}
|
||||
|
||||
const source = sourceRecord.toJS();
|
||||
dispatch((0, _tabs.addTab)(source, 0));
|
||||
dispatch((0, _tabs.addTab)(source.url, 0));
|
||||
dispatch(setSelectedLocation(source, location));
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(sourceRecord));
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(getState());
|
||||
await dispatch((0, _loadSourceText.loadSourceText)(source));
|
||||
const loadedSource = (0, _selectors.getSource)(getState(), source.id);
|
||||
|
||||
if (!selectedSource) {
|
||||
if (!loadedSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceId = selectedSource.id;
|
||||
const sourceId = loadedSource.id;
|
||||
dispatch((0, _ast.setSymbols)(sourceId));
|
||||
dispatch((0, _ast.setOutOfScopeLocations)());
|
||||
};
|
||||
@ -235,7 +232,7 @@ function jumpToMappedLocation(location) {
|
||||
if ((0, _devtoolsSourceMap.isOriginalId)(location.sourceId)) {
|
||||
pairedLocation = await (0, _sourceMaps.getGeneratedLocation)(getState(), source, location, sourceMaps);
|
||||
} else {
|
||||
pairedLocation = await sourceMaps.getOriginalLocation(location, source.toJS());
|
||||
pairedLocation = await sourceMaps.getOriginalLocation(location, source);
|
||||
}
|
||||
|
||||
return dispatch(selectLocation(_objectSpread({}, pairedLocation)));
|
||||
|
@ -76,7 +76,7 @@ function closeTabs(urls) {
|
||||
const source = (0, _selectors.getSourceByURL)(getState(), url);
|
||||
|
||||
if (source) {
|
||||
(0, _editor.removeDocument)(source.get("id"));
|
||||
(0, _editor.removeDocument)(source.id);
|
||||
}
|
||||
});
|
||||
const tabs = (0, _selectors.removeSourcesFromTabList)((0, _selectors.getSourceTabs)(getState()), urls);
|
||||
|
@ -99,6 +99,10 @@ function showSource(sourceId) {
|
||||
}) => {
|
||||
const source = (0, _selectors.getSource)(getState(), sourceId);
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((0, _selectors.getPaneCollapse)(getState(), "start")) {
|
||||
dispatch({
|
||||
type: "TOGGLE_PANE",
|
||||
@ -114,7 +118,7 @@ function showSource(sourceId) {
|
||||
});
|
||||
dispatch({
|
||||
type: "SHOW_SOURCE",
|
||||
sourceUrl: (0, _source.getRawSourceURL)(source.get("url"))
|
||||
sourceUrl: (0, _source.getRawSourceURL)(source.url)
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ async function setSkipPausing(shouldSkip) {
|
||||
return threadClient.request({
|
||||
skip: shouldSkip,
|
||||
to: threadClient.actor,
|
||||
type: "skipPausing"
|
||||
type: "skipBreakpoints"
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Breakpoints extends _react.Component {
|
||||
editor
|
||||
} = this.props;
|
||||
|
||||
if (!selectedSource || !breakpoints || selectedSource.get("isBlackBoxed")) {
|
||||
if (!selectedSource || !breakpoints || selectedSource.isBlackBoxed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class CallSite extends _react.Component {
|
||||
source
|
||||
} = nextProps || this.props;
|
||||
const className = !breakpoint ? "call-site" : "call-site-bp";
|
||||
const sourceId = source.get("id");
|
||||
const sourceId = source.id;
|
||||
const editorRange = (0, _editor.toEditorRange)(sourceId, callSite.location);
|
||||
this.marker = (0, _editor.markText)(editor, className, editorRange);
|
||||
};
|
||||
|
@ -146,7 +146,7 @@ class CallSites extends _react.Component {
|
||||
} else {
|
||||
addBreakpoint({
|
||||
sourceId: sourceId,
|
||||
sourceUrl: selectedSource.get("url"),
|
||||
sourceUrl: selectedSource.url,
|
||||
line: line,
|
||||
column: column
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ function getMenuItems(event, {
|
||||
toggleBlackBox
|
||||
}) {
|
||||
// variables
|
||||
const hasSourceMap = !!selectedSource.get("sourceMapURL");
|
||||
const hasSourceMap = !!selectedSource.sourceMapURL;
|
||||
const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(selectedLocation.sourceId);
|
||||
const isPrettyPrinted = (0, _source.isPretty)(selectedSource);
|
||||
const isPrettified = isPrettyPrinted || hasPrettyPrint;
|
||||
@ -104,7 +104,7 @@ function getMenuItems(event, {
|
||||
disabled: false,
|
||||
click: () => (0, _clipboard.copyToTheClipboard)((0, _source.getRawSourceURL)(selectedSource.url))
|
||||
};
|
||||
const sourceId = selectedSource.get("id");
|
||||
const sourceId = selectedSource.id;
|
||||
const sourceLine = (0, _editor.toSourceLine)(sourceId, line);
|
||||
const functionText = getFunctionText(sourceLine);
|
||||
const copyFunctionItem = {
|
||||
@ -146,7 +146,7 @@ function getMenuItems(event, {
|
||||
label: toggleBlackBoxLabel,
|
||||
accesskey: blackboxKey,
|
||||
disabled: isOriginal || isPrettyPrinted || hasSourceMap,
|
||||
click: () => toggleBlackBox(selectedSource.toJS())
|
||||
click: () => toggleBlackBox(selectedSource)
|
||||
};
|
||||
const watchExpressionItem = {
|
||||
id: "node-menu-add-watch-expression",
|
||||
|
@ -37,7 +37,7 @@ class EmptyLines extends _react.Component {
|
||||
|
||||
editor.codeMirror.operation(() => {
|
||||
emptyLines.forEach(emptyLine => {
|
||||
const line = (0, _editor.toEditorLine)(selectedSource.get("id"), emptyLine);
|
||||
const line = (0, _editor.toEditorLine)(selectedSource.id, emptyLine);
|
||||
editor.codeMirror.removeLineClass(line, "line", "empty-line");
|
||||
});
|
||||
});
|
||||
@ -56,7 +56,7 @@ class EmptyLines extends _react.Component {
|
||||
|
||||
editor.codeMirror.operation(() => {
|
||||
emptyLines.forEach(emptyLine => {
|
||||
const line = (0, _editor.toEditorLine)(selectedSource.get("id"), emptyLine);
|
||||
const line = (0, _editor.toEditorLine)(selectedSource.id, emptyLine);
|
||||
editor.codeMirror.addLineClass(line, "line", "empty-line");
|
||||
});
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ class SourceFooter extends _react.PureComponent {
|
||||
const tooltip = L10N.getStr("sourceTabs.prettyPrint");
|
||||
const type = "prettyPrint";
|
||||
return _react2.default.createElement("button", {
|
||||
onClick: () => togglePrettyPrint(selectedSource.get("id")),
|
||||
onClick: () => togglePrettyPrint(selectedSource.id),
|
||||
className: (0, _classnames2.default)("action", type, {
|
||||
active: sourceLoaded,
|
||||
pretty: (0, _source.isPretty)(selectedSource)
|
||||
@ -78,7 +78,7 @@ class SourceFooter extends _react.PureComponent {
|
||||
const tooltip = L10N.getStr("sourceFooter.blackbox");
|
||||
const type = "black-box";
|
||||
return _react2.default.createElement("button", {
|
||||
onClick: () => toggleBlackBox(selectedSource.toJS()),
|
||||
onClick: () => toggleBlackBox(selectedSource),
|
||||
className: (0, _classnames2.default)("action", type, {
|
||||
active: sourceLoaded,
|
||||
blackboxed: blackboxed
|
||||
@ -153,7 +153,7 @@ class SourceFooter extends _react.PureComponent {
|
||||
const tooltip = L10N.getFormatStr("sourceFooter.mappedSourceTooltip", filename);
|
||||
const title = L10N.getFormatStr("sourceFooter.mappedSource", filename);
|
||||
const mappedSourceLocation = {
|
||||
sourceId: selectedSource.get("id"),
|
||||
sourceId: selectedSource.id,
|
||||
line: 1,
|
||||
column: 1
|
||||
};
|
||||
|
@ -139,7 +139,7 @@ class GutterContextMenuComponent extends _react.Component {
|
||||
const {
|
||||
event
|
||||
} = contextMenu;
|
||||
const sourceId = props.selectedSource ? props.selectedSource.get("id") : "";
|
||||
const sourceId = props.selectedSource ? props.selectedSource.id : "";
|
||||
const line = (0, _editor.lineAtHeight)(props.editor, sourceId, event);
|
||||
const breakpoint = nextProps.breakpoints.find(bp => bp.location.line === line);
|
||||
|
||||
|
@ -64,7 +64,7 @@ const {
|
||||
function inPreview(event) {
|
||||
const relatedTarget = event.relatedTarget;
|
||||
|
||||
if (!relatedTarget || relatedTarget.classList.contains("preview-expression")) {
|
||||
if (!relatedTarget || relatedTarget.classList && relatedTarget.classList.contains("preview-expression")) {
|
||||
return true;
|
||||
} // $FlowIgnore
|
||||
|
||||
@ -336,4 +336,4 @@ const mapDispatchToProps = {
|
||||
setPopupObjectProperties,
|
||||
openLink
|
||||
};
|
||||
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Popup);
|
||||
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(Popup);
|
@ -169,7 +169,7 @@ class Preview extends _react.PureComponent {
|
||||
return null;
|
||||
}
|
||||
|
||||
const editorRange = (0, _editor.toEditorRange)(selectedSource.get("id"), location);
|
||||
const editorRange = (0, _editor.toEditorRange)(selectedSource.id, location);
|
||||
return _react2.default.createElement(_Popup2.default, {
|
||||
value: value,
|
||||
editor: this.props.editor,
|
||||
|
@ -133,7 +133,7 @@ class SearchBar extends _react.Component {
|
||||
selectedSource
|
||||
} = this.props;
|
||||
|
||||
if (!selectedSource || !selectedSource.get("text")) {
|
||||
if (!selectedSource || !selectedSource.text) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ class Tab extends _react.PureComponent {
|
||||
togglePrettyPrint,
|
||||
selectedSource
|
||||
} = this.props;
|
||||
const otherTabs = tabSources.filter(t => t.get("id") !== tab);
|
||||
const sourceTab = tabSources.find(t => t.get("id") == tab);
|
||||
const tabURLs = tabSources.map(t => t.get("url"));
|
||||
const otherTabURLs = otherTabs.map(t => t.get("url"));
|
||||
const otherTabs = tabSources.filter(t => t.id !== tab);
|
||||
const sourceTab = tabSources.find(t => t.id == tab);
|
||||
const tabURLs = tabSources.map(t => t.url);
|
||||
const otherTabURLs = otherTabs.map(t => t.url);
|
||||
|
||||
if (!sourceTab) {
|
||||
return;
|
||||
@ -76,7 +76,7 @@ class Tab extends _react.PureComponent {
|
||||
const tabMenuItems = (0, _tabs.getTabMenuItems)();
|
||||
const items = [{
|
||||
item: _objectSpread({}, tabMenuItems.closeTab, {
|
||||
click: () => closeTab(sourceTab.get("url"))
|
||||
click: () => closeTab(sourceTab.url)
|
||||
})
|
||||
}, {
|
||||
item: _objectSpread({}, tabMenuItems.closeOtherTabs, {
|
||||
@ -86,7 +86,7 @@ class Tab extends _react.PureComponent {
|
||||
}, {
|
||||
item: _objectSpread({}, tabMenuItems.closeTabsToEnd, {
|
||||
click: () => {
|
||||
const tabIndex = tabSources.findIndex(t => t.get("id") == tab);
|
||||
const tabIndex = tabSources.findIndex(t => t.id == tab);
|
||||
closeTabs(tabURLs.filter((t, i) => i > tabIndex));
|
||||
}
|
||||
}),
|
||||
@ -101,12 +101,12 @@ class Tab extends _react.PureComponent {
|
||||
}
|
||||
}, {
|
||||
item: _objectSpread({}, tabMenuItems.copyToClipboard, {
|
||||
disabled: selectedSource.get("id") !== tab,
|
||||
disabled: selectedSource.id !== tab,
|
||||
click: () => (0, _clipboard.copyToTheClipboard)(sourceTab.text)
|
||||
})
|
||||
}, {
|
||||
item: _objectSpread({}, tabMenuItems.copySourceUri2, {
|
||||
click: () => (0, _clipboard.copyToTheClipboard)((0, _source.getRawSourceURL)(sourceTab.get("url")))
|
||||
click: () => (0, _clipboard.copyToTheClipboard)((0, _source.getRawSourceURL)(sourceTab.url))
|
||||
})
|
||||
}];
|
||||
items.push({
|
||||
@ -143,7 +143,7 @@ class Tab extends _react.PureComponent {
|
||||
} = this.props;
|
||||
const filename = (0, _source.getFilename)(source);
|
||||
const sourceId = source.id;
|
||||
const active = selectedSource && sourceId == selectedSource.get("id") && !this.isProjectSearchEnabled() && !this.isSourceSearchEnabled();
|
||||
const active = selectedSource && sourceId == selectedSource.id && !this.isProjectSearchEnabled() && !this.isSourceSearchEnabled();
|
||||
const isPrettyCode = (0, _source.isPretty)(source);
|
||||
|
||||
function onClickClose(e) {
|
||||
|
@ -10,10 +10,6 @@ var _react2 = _interopRequireDefault(_react);
|
||||
|
||||
var _reactRedux = require("devtools/client/shared/vendor/react-redux");
|
||||
|
||||
var _immutable = require("devtools/client/shared/vendor/immutable");
|
||||
|
||||
var I = _interopRequireWildcard(_immutable);
|
||||
|
||||
var _selectors = require("../../selectors/index");
|
||||
|
||||
var _ui = require("../../utils/ui");
|
||||
@ -38,8 +34,6 @@ var _Dropdown = require("../shared/Dropdown");
|
||||
|
||||
var _Dropdown2 = _interopRequireDefault(_Dropdown);
|
||||
|
||||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
@ -62,7 +56,7 @@ class Tabs extends _react.PureComponent {
|
||||
const sourceTabEls = this.refs.sourceTabs.children;
|
||||
const hiddenTabs = (0, _tabs.getHiddenTabs)(tabSources, sourceTabEls);
|
||||
|
||||
if ((0, _ui.isVisible)() && hiddenTabs.indexOf(selectedSource) !== -1) {
|
||||
if ((0, _ui.isVisible)() && hiddenTabs.find(tab => tab.id == selectedSource.id)) {
|
||||
return moveTab(selectedSource.url, 0);
|
||||
}
|
||||
|
||||
@ -71,25 +65,25 @@ class Tabs extends _react.PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
this.renderDropdownSource = sourceRecord => {
|
||||
this.renderDropdownSource = source => {
|
||||
const {
|
||||
selectSpecificSource
|
||||
} = this.props;
|
||||
const filename = (0, _source.getFilename)(sourceRecord);
|
||||
const filename = (0, _source.getFilename)(source);
|
||||
|
||||
const onClick = () => selectSpecificSource(sourceRecord.id);
|
||||
const onClick = () => selectSpecificSource(source.id);
|
||||
|
||||
return _react2.default.createElement("li", {
|
||||
key: sourceRecord.id,
|
||||
key: source.id,
|
||||
onClick: onClick
|
||||
}, _react2.default.createElement("img", {
|
||||
className: `dropdown-icon ${this.getIconClass(sourceRecord)}`
|
||||
className: `dropdown-icon ${this.getIconClass(source)}`
|
||||
}), filename);
|
||||
};
|
||||
|
||||
this.state = {
|
||||
dropdownShown: false,
|
||||
hiddenTabs: I.List()
|
||||
hiddenTabs: []
|
||||
};
|
||||
this.onResize = (0, _lodash.debounce)(() => {
|
||||
this.updateHiddenTabs();
|
||||
@ -122,12 +116,12 @@ class Tabs extends _react.PureComponent {
|
||||
}));
|
||||
}
|
||||
|
||||
getIconClass(sourceRecord) {
|
||||
if ((0, _source.isPretty)(sourceRecord)) {
|
||||
getIconClass(source) {
|
||||
if ((0, _source.isPretty)(source)) {
|
||||
return "prettyPrint";
|
||||
}
|
||||
|
||||
if (sourceRecord.isBlackBoxed) {
|
||||
if (source.isBlackBoxed) {
|
||||
return "blackBox";
|
||||
}
|
||||
|
||||
@ -155,7 +149,7 @@ class Tabs extends _react.PureComponent {
|
||||
renderDropdown() {
|
||||
const hiddenTabs = this.state.hiddenTabs;
|
||||
|
||||
if (!hiddenTabs || hiddenTabs.size == 0) {
|
||||
if (!hiddenTabs || hiddenTabs.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ class Editor extends _react.PureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceLine = (0, _editor.toSourceLine)(selectedSource.get("id"), line);
|
||||
const sourceLine = (0, _editor.toSourceLine)(selectedSource.id, line);
|
||||
|
||||
if (ev.altKey) {
|
||||
return continueToHere(sourceLine);
|
||||
@ -344,7 +344,7 @@ class Editor extends _react.PureComponent {
|
||||
selectedSource
|
||||
} = this.props;
|
||||
const line = (0, _editor.getCursorLine)(codeMirror);
|
||||
return (0, _editor.toSourceLine)(selectedSource.get("id"), line);
|
||||
return (0, _editor.toSourceLine)(selectedSource.id, line);
|
||||
}
|
||||
|
||||
onKeyDown(e) {
|
||||
@ -439,8 +439,8 @@ class Editor extends _react.PureComponent {
|
||||
column
|
||||
} = (0, _editor.toEditorPosition)(nextProps.selectedLocation);
|
||||
|
||||
if ((0, _editor.hasDocument)(nextProps.selectedSource.get("id"))) {
|
||||
const doc = (0, _editor.getDocument)(nextProps.selectedSource.get("id"));
|
||||
if ((0, _editor.hasDocument)(nextProps.selectedSource.id)) {
|
||||
const doc = (0, _editor.getDocument)(nextProps.selectedSource.id);
|
||||
const lineText = doc.getLine(line);
|
||||
column = Math.max(column, (0, _indentation.getIndentation)(lineText));
|
||||
}
|
||||
@ -478,12 +478,12 @@ class Editor extends _react.PureComponent {
|
||||
return (0, _editor.showLoading)(this.state.editor);
|
||||
}
|
||||
|
||||
if (selectedSource.get("error")) {
|
||||
return this.showErrorMessage(selectedSource.get("error"));
|
||||
if (selectedSource.error) {
|
||||
return this.showErrorMessage(selectedSource.error);
|
||||
}
|
||||
|
||||
if (selectedSource) {
|
||||
return (0, _editor.showSourceText)(this.state.editor, selectedSource.toJS(), symbols);
|
||||
return (0, _editor.showSourceText)(this.state.editor, selectedSource, symbols);
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ Editor.contextTypes = {
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(state);
|
||||
const sourceId = selectedSource ? selectedSource.get("id") : "";
|
||||
const sourceId = selectedSource ? selectedSource.id : "";
|
||||
return {
|
||||
selectedLocation: (0, _selectors.getSelectedLocation)(state),
|
||||
selectedSource,
|
||||
|
@ -45,7 +45,7 @@ class Outline extends _react.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedSourceId = selectedSource.get("id");
|
||||
const selectedSourceId = selectedSource.id;
|
||||
const startLine = location.start.line;
|
||||
selectLocation({
|
||||
sourceId: selectedSourceId,
|
||||
|
@ -85,7 +85,7 @@ class SourcesTree extends _react.Component {
|
||||
sourceTree
|
||||
} = this.state;
|
||||
|
||||
if (projectRoot != nextProps.projectRoot || debuggeeUrl != nextProps.debuggeeUrl || nextProps.sources.size === 0) {
|
||||
if (projectRoot != nextProps.projectRoot || debuggeeUrl != nextProps.debuggeeUrl || nextProps.sourceCount === 0) {
|
||||
// early recreate tree because of changes
|
||||
// to project root, debugee url or lack of sources
|
||||
return this.setState((0, _sourcesTree.createTree)({
|
||||
@ -108,8 +108,8 @@ class SourcesTree extends _react.Component {
|
||||
}
|
||||
|
||||
if (nextProps.selectedSource && nextProps.selectedSource != selectedSource) {
|
||||
const highlightItems = (0, _sourcesTree.getDirectories)((0, _source.getRawSourceURL)(nextProps.selectedSource.get("url")), sourceTree);
|
||||
return this.setState({
|
||||
const highlightItems = (0, _sourcesTree.getDirectories)((0, _source.getRawSourceURL)(nextProps.selectedSource.url), sourceTree);
|
||||
this.setState({
|
||||
highlightItems
|
||||
});
|
||||
} // NOTE: do not run this every time a source is clicked,
|
||||
@ -130,7 +130,13 @@ class SourcesTree extends _react.Component {
|
||||
|
||||
// NOTE: we get the source from sources because item.contents is cached
|
||||
getSource(item) {
|
||||
return this.props.sources.get(item.contents.id);
|
||||
const source = (0, _sourcesTree.getSourceFromNode)(item);
|
||||
|
||||
if (source) {
|
||||
return this.props.sources[source.id];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
@ -141,12 +147,19 @@ class SourcesTree extends _react.Component {
|
||||
}
|
||||
|
||||
renderItemName(name) {
|
||||
const hosts = {
|
||||
"ng://": "Angular",
|
||||
"webpack://": "Webpack",
|
||||
"moz-extension://": L10N.getStr("extensionsText")
|
||||
};
|
||||
return hosts[name] || name;
|
||||
switch (name) {
|
||||
case "ng://":
|
||||
return "Angular";
|
||||
|
||||
case "webpack://":
|
||||
return "Webpack";
|
||||
|
||||
case "moz-extension://":
|
||||
return L10N.getStr("extensionsText");
|
||||
|
||||
default:
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
renderEmptyElement(message) {
|
||||
@ -207,7 +220,8 @@ class SourcesTree extends _react.Component {
|
||||
onCollapse: this.onCollapse,
|
||||
onExpand: this.onExpand,
|
||||
onFocus: this.focusItem,
|
||||
renderItem: this.renderItem
|
||||
renderItem: this.renderItem,
|
||||
preventBlur: true
|
||||
};
|
||||
return _react2.default.createElement(_ManagedTree2.default, treeProps);
|
||||
}
|
||||
@ -254,7 +268,9 @@ var _initialiseProps = function () {
|
||||
};
|
||||
|
||||
this.selectItem = item => {
|
||||
if (!(0, _sourcesTree.isDirectory)(item)) {
|
||||
if (!(0, _sourcesTree.isDirectory)(item) && // This second check isn't strictly necessary, but it ensures that Flow
|
||||
// knows that we are doing the correct thing.
|
||||
!Array.isArray(item.contents)) {
|
||||
this.props.selectSource(item.contents.id);
|
||||
}
|
||||
};
|
||||
@ -267,7 +283,7 @@ var _initialiseProps = function () {
|
||||
}
|
||||
|
||||
const source = this.getSource(item);
|
||||
const blackBoxedPart = source.isBlackBoxed ? ":blackboxed" : "";
|
||||
const blackBoxedPart = source && source.isBlackBoxed ? ":blackboxed" : "";
|
||||
return `${path}${blackBoxedPart}`;
|
||||
};
|
||||
|
||||
@ -306,9 +322,14 @@ var _initialiseProps = function () {
|
||||
}
|
||||
|
||||
const source = this.getSource(item);
|
||||
return _react2.default.createElement(_SourceIcon2.default, {
|
||||
source: source
|
||||
});
|
||||
|
||||
if (source) {
|
||||
return _react2.default.createElement(_SourceIcon2.default, {
|
||||
source: source
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
this.onContextMenu = (event, item) => {
|
||||
@ -322,14 +343,21 @@ var _initialiseProps = function () {
|
||||
const menuOptions = [];
|
||||
|
||||
if (!(0, _sourcesTree.isDirectory)(item)) {
|
||||
const copySourceUri2 = {
|
||||
id: "node-menu-copy-source",
|
||||
label: copySourceUri2Label,
|
||||
accesskey: copySourceUri2Key,
|
||||
disabled: false,
|
||||
click: () => (0, _clipboard.copyToTheClipboard)(item.contents.url)
|
||||
};
|
||||
menuOptions.push(copySourceUri2);
|
||||
// Flow requires some extra handling to ensure the value of contents.
|
||||
const {
|
||||
contents
|
||||
} = item;
|
||||
|
||||
if (!Array.isArray(contents)) {
|
||||
const copySourceUri2 = {
|
||||
id: "node-menu-copy-source",
|
||||
label: copySourceUri2Label,
|
||||
accesskey: copySourceUri2Key,
|
||||
disabled: false,
|
||||
click: () => (0, _clipboard.copyToTheClipboard)(contents.url)
|
||||
};
|
||||
menuOptions.push(copySourceUri2);
|
||||
}
|
||||
}
|
||||
|
||||
if ((0, _sourcesTree.isDirectory)(item) && _prefs.features.root) {
|
||||
@ -382,7 +410,7 @@ var _initialiseProps = function () {
|
||||
this.renderItem = (item, depth, focused, _, expanded, {
|
||||
setExpanded
|
||||
}) => {
|
||||
const arrow = (0, _sourcesTree.nodeHasChildren)(item) ? _react2.default.createElement("img", {
|
||||
const arrow = (0, _sourcesTree.isDirectory)(item) ? _react2.default.createElement("img", {
|
||||
className: (0, _classnames2.default)("arrow", {
|
||||
expanded: expanded
|
||||
})
|
||||
@ -443,7 +471,8 @@ const mapStateToProps = state => {
|
||||
debuggeeUrl: (0, _selectors.getDebuggeeUrl)(state),
|
||||
expanded: (0, _selectors.getExpandedState)(state),
|
||||
projectRoot: (0, _selectors.getProjectDirectoryRoot)(state),
|
||||
sources: (0, _selectors.getRelativeSources)(state)
|
||||
sources: (0, _selectors.getRelativeSources)(state),
|
||||
sourceCount: (0, _selectors.getSourceCount)(state)
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -201,9 +201,8 @@ class QuickOpenModal extends _react.Component {
|
||||
if (this.isVariableQuery()) {
|
||||
const line = item.location && item.location.start ? item.location.start.line : 0;
|
||||
return selectLocation({
|
||||
sourceId: selectedSource.get("id"),
|
||||
line,
|
||||
column: null
|
||||
sourceId: selectedSource.id,
|
||||
line
|
||||
});
|
||||
}
|
||||
|
||||
@ -212,7 +211,7 @@ class QuickOpenModal extends _react.Component {
|
||||
start: item.location.start.line,
|
||||
end: item.location.end.line
|
||||
} : {}, {
|
||||
sourceId: selectedSource.get("id")
|
||||
sourceId: selectedSource.id
|
||||
}));
|
||||
}
|
||||
};
|
||||
@ -240,14 +239,14 @@ class QuickOpenModal extends _react.Component {
|
||||
selectLocation,
|
||||
selectedSource
|
||||
} = this.props;
|
||||
const selectedSourceId = selectedSource ? selectedSource.get("id") : "";
|
||||
const selectedSourceId = selectedSource ? selectedSource.id : "";
|
||||
|
||||
if (location != null) {
|
||||
const sourceId = location.sourceId ? location.sourceId : selectedSourceId;
|
||||
selectLocation({
|
||||
sourceId,
|
||||
line: location.line,
|
||||
column: location.column || null
|
||||
column: location.column
|
||||
});
|
||||
this.closeModal();
|
||||
}
|
||||
@ -259,7 +258,7 @@ class QuickOpenModal extends _react.Component {
|
||||
setQuickOpenQuery
|
||||
} = this.props;
|
||||
setQuickOpenQuery(e.target.value);
|
||||
const noSource = !selectedSource || !selectedSource.get("text");
|
||||
const noSource = !selectedSource || !selectedSource.text;
|
||||
|
||||
if (this.isSymbolSearch() && noSource || this.isGotoQuery()) {
|
||||
return;
|
||||
@ -473,13 +472,13 @@ function mapStateToProps(state) {
|
||||
const selectedSource = (0, _selectors.getSelectedSource)(state);
|
||||
return {
|
||||
enabled: (0, _selectors.getQuickOpenEnabled)(state),
|
||||
sources: (0, _quickOpen.formatSources)((0, _selectors.getRelativeSources)(state), (0, _selectors.getTabs)(state).toArray()),
|
||||
sources: (0, _quickOpen.formatSources)((0, _selectors.getRelativeSources)(state), (0, _selectors.getTabs)(state)),
|
||||
selectedSource,
|
||||
symbols: (0, _quickOpen.formatSymbols)((0, _selectors.getSymbols)(state, selectedSource)),
|
||||
symbolsLoading: (0, _selectors.isSymbolsLoading)(state, selectedSource),
|
||||
query: (0, _selectors.getQuickOpenQuery)(state),
|
||||
searchType: (0, _selectors.getQuickOpenType)(state),
|
||||
tabs: (0, _selectors.getTabs)(state).toArray()
|
||||
tabs: (0, _selectors.getTabs)(state)
|
||||
};
|
||||
}
|
||||
/* istanbul ignore next: ignoring testing of redux connection stuff */
|
||||
|
@ -191,6 +191,7 @@ class Breakpoint extends _react.PureComponent {
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
breakpoints: (0, _selectors.getBreakpoints)(state),
|
||||
frame: (0, _selectors.getTopFrame)(state),
|
||||
selectedSource: (0, _selectors.getSelectedSource)(state)
|
||||
});
|
||||
|
@ -258,7 +258,7 @@ class CommandBar extends _react.Component {
|
||||
}
|
||||
|
||||
return _react2.default.createElement("button", {
|
||||
className: (0, _classnames2.default)("command-bar-button", {
|
||||
className: (0, _classnames2.default)("command-bar-button", "command-bar-skip-pausing", {
|
||||
active: skipPausing
|
||||
}),
|
||||
title: L10N.getStr("skipPausingTooltip"),
|
||||
|
@ -102,8 +102,7 @@ const mapStateToProps = state => {
|
||||
return _objectSpread({}, listener, {
|
||||
breakpoint: (0, _selectors.getBreakpoint)(state, {
|
||||
sourceId: listener.sourceId,
|
||||
line: listener.line,
|
||||
column: null
|
||||
line: listener.line
|
||||
})
|
||||
});
|
||||
});
|
||||
|
@ -14,6 +14,8 @@ var _classnames = require("devtools/client/debugger/new/dist/vendors").vendored[
|
||||
|
||||
var _classnames2 = _interopRequireDefault(_classnames);
|
||||
|
||||
var _prefs = require("../../utils/prefs");
|
||||
|
||||
var _devtoolsReps = require("devtools/client/shared/components/reps/reps.js");
|
||||
|
||||
var _actions = require("../../actions/index");
|
||||
@ -28,11 +30,12 @@ var _firefox = require("../../client/firefox");
|
||||
|
||||
var _Button = require("../shared/Button/index");
|
||||
|
||||
var _lodash = require("devtools/client/shared/vendor/lodash");
|
||||
|
||||
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 <http://mozilla.org/MPL/2.0/>. */
|
||||
function _extends() { _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; }; return _extends.apply(this, arguments); }
|
||||
|
||||
class Expressions extends _react.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -49,11 +52,24 @@ class Expressions extends _react.Component {
|
||||
};
|
||||
|
||||
this.handleChange = e => {
|
||||
const target = e.target;
|
||||
|
||||
if (_prefs.features.autocompleteExpression) {
|
||||
this.findAutocompleteMatches(target.value, target.selectionStart);
|
||||
}
|
||||
|
||||
this.setState({
|
||||
inputValue: e.target.value
|
||||
inputValue: target.value
|
||||
});
|
||||
};
|
||||
|
||||
this.findAutocompleteMatches = (0, _lodash.debounce)((value, selectionStart) => {
|
||||
const {
|
||||
autocomplete
|
||||
} = this.props;
|
||||
autocomplete(value, selectionStart);
|
||||
}, 250);
|
||||
|
||||
this.handleKeyDown = e => {
|
||||
if (e.key === "Escape") {
|
||||
this.clear();
|
||||
@ -97,6 +113,8 @@ class Expressions extends _react.Component {
|
||||
if (!this.props.expressionError) {
|
||||
this.hideInput();
|
||||
}
|
||||
|
||||
this.props.clearAutocomplete();
|
||||
};
|
||||
|
||||
this.renderExpression = (expression, index) => {
|
||||
@ -187,9 +205,10 @@ class Expressions extends _react.Component {
|
||||
const {
|
||||
expressions,
|
||||
expressionError,
|
||||
showInput
|
||||
showInput,
|
||||
autocompleteMatches
|
||||
} = this.props;
|
||||
return expressions !== nextProps.expressions || expressionError !== nextProps.expressionError || editing !== nextState.editing || inputValue !== nextState.inputValue || nextProps.showInput !== showInput || focused !== nextState.focused;
|
||||
return autocompleteMatches !== nextProps.autocompleteMatches || expressions !== nextProps.expressions || expressionError !== nextProps.expressionError || editing !== nextState.editing || inputValue !== nextState.inputValue || nextProps.showInput !== showInput || focused !== nextState.focused;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
@ -228,6 +247,31 @@ class Expressions extends _react.Component {
|
||||
this.hideInput();
|
||||
}
|
||||
|
||||
renderAutoCompleteMatches() {
|
||||
if (!_prefs.features.autocompleteExpression) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {
|
||||
autocompleteMatches
|
||||
} = this.props;
|
||||
|
||||
if (autocompleteMatches) {
|
||||
return _react2.default.createElement("datalist", {
|
||||
id: "autocomplete-matches"
|
||||
}, autocompleteMatches.map((match, index) => {
|
||||
return _react2.default.createElement("option", {
|
||||
key: index,
|
||||
value: match
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
return _react2.default.createElement("datalist", {
|
||||
id: "autocomplete-matches"
|
||||
});
|
||||
}
|
||||
|
||||
renderNewExpressionInput() {
|
||||
const {
|
||||
expressionError,
|
||||
@ -248,7 +292,7 @@ class Expressions extends _react.Component {
|
||||
}, _react2.default.createElement("form", {
|
||||
className: "expression-input-form",
|
||||
onSubmit: this.handleNewSubmit
|
||||
}, _react2.default.createElement("input", {
|
||||
}, _react2.default.createElement("input", _extends({
|
||||
className: "input-expression",
|
||||
type: "text",
|
||||
placeholder: placeholder,
|
||||
@ -259,7 +303,9 @@ class Expressions extends _react.Component {
|
||||
autoFocus: showInput,
|
||||
value: !editing ? inputValue : "",
|
||||
ref: c => this._input = c
|
||||
}), _react2.default.createElement("input", {
|
||||
}, _prefs.features.autocompleteExpression && {
|
||||
list: "autocomplete-matches"
|
||||
})), this.renderAutoCompleteMatches(), _react2.default.createElement("input", {
|
||||
type: "submit",
|
||||
style: {
|
||||
display: "none"
|
||||
@ -286,7 +332,7 @@ class Expressions extends _react.Component {
|
||||
}, _react2.default.createElement("form", {
|
||||
className: "expression-input-form",
|
||||
onSubmit: e => this.handleExistingSubmit(e, expression)
|
||||
}, _react2.default.createElement("input", {
|
||||
}, _react2.default.createElement("input", _extends({
|
||||
className: (0, _classnames2.default)("input-expression", {
|
||||
error
|
||||
}),
|
||||
@ -297,7 +343,9 @@ class Expressions extends _react.Component {
|
||||
onFocus: this.onFocus,
|
||||
value: editing ? inputValue : expression.input,
|
||||
ref: c => this._input = c
|
||||
}), _react2.default.createElement("input", {
|
||||
}, _prefs.features.autocompleteExpression && {
|
||||
list: "autocomplete-matches"
|
||||
})), this.renderAutoCompleteMatches(), _react2.default.createElement("input", {
|
||||
type: "submit",
|
||||
style: {
|
||||
display: "none"
|
||||
@ -317,9 +365,12 @@ class Expressions extends _react.Component {
|
||||
|
||||
}
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
expressions: (0, _selectors.getExpressions)(state),
|
||||
expressionError: (0, _selectors.getExpressionError)(state)
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
autocompleteMatches: (0, _selectors.getAutocompleteMatchset)(state),
|
||||
expressions: (0, _selectors.getExpressions)(state),
|
||||
expressionError: (0, _selectors.getExpressionError)(state)
|
||||
};
|
||||
};
|
||||
|
||||
exports.default = (0, _reactRedux.connect)(mapStateToProps, _actions2.default)(Expressions);
|
@ -126,7 +126,7 @@ const mapStateToProps = state => {
|
||||
const {
|
||||
scope: originalFrameScopes,
|
||||
pending: originalPending
|
||||
} = (0, _selectors.getOriginalFrameScope)(state, selectedSource && selectedSource.get("id"), selectedFrame && selectedFrame.id) || {
|
||||
} = (0, _selectors.getOriginalFrameScope)(state, selectedSource && selectedSource.id, selectedFrame && selectedFrame.id) || {
|
||||
scope: null,
|
||||
pending: false
|
||||
};
|
||||
|
@ -125,8 +125,11 @@ class ManagedTree extends _react.Component {
|
||||
} else {
|
||||
// Look at folders starting from the top-level until finds a
|
||||
// closed folder and highlights this folder
|
||||
const index = highlightItems.reverse().findIndex(item => !expanded.has(this.props.getPath(item)));
|
||||
this.focusItem(highlightItems[index]);
|
||||
const index = highlightItems.reverse().findIndex(item => !expanded.has(this.props.getPath(item)) && item.name !== "root");
|
||||
|
||||
if (highlightItems[index]) {
|
||||
this.focusItem(highlightItems[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
const createExpressionState = exports.createExpressionState = (0, _makeRecord2.default)({
|
||||
expressions: (0, _immutable.List)(restoreExpressions()),
|
||||
expressionError: false,
|
||||
autocompleteMatches: (0, _immutable.Map)({})
|
||||
autocompleteMatches: (0, _immutable.Map)({}),
|
||||
currentAutocompleteInput: null
|
||||
});
|
||||
|
||||
function update(state = createExpressionState(), action) {
|
||||
@ -89,7 +90,10 @@ function update(state = createExpressionState(), action) {
|
||||
matchProp,
|
||||
matches
|
||||
} = action.result;
|
||||
return state.updateIn(["autocompleteMatches", matchProp], list => matches);
|
||||
return state.updateIn(["autocompleteMatches", matchProp], list => matches).set("currentAutocompleteInput", matchProp);
|
||||
|
||||
case "CLEAR_AUTOCOMPLETE":
|
||||
return state.updateIn(["autocompleteMatches", ""], list => []).set("currentAutocompleteInput", "");
|
||||
}
|
||||
|
||||
return state;
|
||||
@ -163,7 +167,8 @@ function getExpression(state, input) {
|
||||
return getExpressions(state).find(exp => exp.input == input);
|
||||
}
|
||||
|
||||
function getAutocompleteMatchset(state, input) {
|
||||
function getAutocompleteMatchset(state) {
|
||||
const input = state.expressions.get("currentAutocompleteInput");
|
||||
return getAutocompleteMatches(state).get(input);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ function getSelectedScope(state) {
|
||||
const frameId = getSelectedFrameId(state);
|
||||
const {
|
||||
scope
|
||||
} = getFrameScope(state, sourceRecord && sourceRecord.get("id"), frameId) || {};
|
||||
} = getFrameScope(state, sourceRecord && sourceRecord.id, frameId) || {};
|
||||
return scope || null;
|
||||
}
|
||||
|
||||
|
@ -3,74 +3,65 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getSelectedSource = exports.getSelectedLocation = exports.getSourcesForTabs = exports.getSourceTabs = exports.getTabs = exports.getSources = exports.RelativeSourceRecordClass = exports.SourceRecordClass = undefined;
|
||||
exports.getSelectedSource = exports.getSelectedLocation = exports.getSourcesForTabs = exports.getSourceTabs = exports.getTabs = undefined;
|
||||
exports.initialSourcesState = initialSourcesState;
|
||||
exports.createSourceRecord = createSourceRecord;
|
||||
exports.createSource = createSource;
|
||||
exports.removeSourceFromTabList = removeSourceFromTabList;
|
||||
exports.removeSourcesFromTabList = removeSourcesFromTabList;
|
||||
exports.getBlackBoxList = getBlackBoxList;
|
||||
exports.getNewSelectedSourceId = getNewSelectedSourceId;
|
||||
exports.getSource = getSource;
|
||||
exports.getSourceFromId = getSourceFromId;
|
||||
exports.getSourceByURL = getSourceByURL;
|
||||
exports.getGeneratedSource = getGeneratedSource;
|
||||
exports.getPendingSelectedLocation = getPendingSelectedLocation;
|
||||
exports.getPrettySource = getPrettySource;
|
||||
exports.hasPrettySource = hasPrettySource;
|
||||
exports.getSourceInSources = getSourceInSources;
|
||||
|
||||
var _immutable = require("devtools/client/shared/vendor/immutable");
|
||||
|
||||
var I = _interopRequireWildcard(_immutable);
|
||||
exports.getSources = getSources;
|
||||
exports.getSourceList = getSourceList;
|
||||
exports.getSourceCount = getSourceCount;
|
||||
|
||||
var _reselect = require("devtools/client/debugger/new/dist/vendors").vendored["reselect"];
|
||||
|
||||
var _makeRecord = require("../utils/makeRecord");
|
||||
|
||||
var _makeRecord2 = _interopRequireDefault(_makeRecord);
|
||||
var _lodashMove = require("devtools/client/debugger/new/dist/vendors").vendored["lodash-move"];
|
||||
|
||||
var _source = require("../utils/source");
|
||||
|
||||
var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
|
||||
|
||||
var _devtoolsEnvironment = require("devtools/client/debugger/new/dist/vendors").vendored["devtools-environment"];
|
||||
|
||||
var _lodash = require("devtools/client/shared/vendor/lodash");
|
||||
|
||||
var _prefs = require("../utils/prefs");
|
||||
|
||||
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)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function initialSourcesState() {
|
||||
return (0, _makeRecord2.default)({
|
||||
sources: I.Map(),
|
||||
return {
|
||||
sources: {},
|
||||
selectedLocation: undefined,
|
||||
pendingSelectedLocation: _prefs.prefs.pendingSelectedLocation,
|
||||
sourcesText: I.Map(),
|
||||
tabs: I.List(restoreTabs())
|
||||
})();
|
||||
tabs: restoreTabs()
|
||||
};
|
||||
}
|
||||
|
||||
const sourceRecordProperties = {
|
||||
id: undefined,
|
||||
url: undefined,
|
||||
sourceMapURL: undefined,
|
||||
isBlackBoxed: false,
|
||||
isPrettyPrinted: false,
|
||||
isWasm: false,
|
||||
text: undefined,
|
||||
contentType: "",
|
||||
error: undefined,
|
||||
loadedState: "unloaded"
|
||||
};
|
||||
const SourceRecordClass = exports.SourceRecordClass = new I.Record(sourceRecordProperties);
|
||||
const RelativeSourceRecordClass = exports.RelativeSourceRecordClass = new I.Record(_objectSpread({}, sourceRecordProperties, {
|
||||
relativeUrl: undefined
|
||||
}));
|
||||
|
||||
function createSourceRecord(source) {
|
||||
return new SourceRecordClass(source);
|
||||
function createSource(source) {
|
||||
return _objectSpread({
|
||||
id: undefined,
|
||||
url: undefined,
|
||||
sourceMapURL: undefined,
|
||||
isBlackBoxed: false,
|
||||
isPrettyPrinted: false,
|
||||
isWasm: false,
|
||||
text: undefined,
|
||||
contentType: "",
|
||||
error: undefined,
|
||||
loadedState: "unloaded"
|
||||
}, source);
|
||||
}
|
||||
|
||||
function update(state = initialSourcesState(), action) {
|
||||
@ -99,18 +90,22 @@ function update(state = initialSourcesState(), action) {
|
||||
url: action.source.url
|
||||
});
|
||||
_prefs.prefs.pendingSelectedLocation = location;
|
||||
return state.set("selectedLocation", _objectSpread({
|
||||
sourceId: action.source.id
|
||||
}, action.location)).set("pendingSelectedLocation", location);
|
||||
return _objectSpread({}, state, {
|
||||
selectedLocation: _objectSpread({
|
||||
sourceId: action.source.id
|
||||
}, action.location),
|
||||
pendingSelectedLocation: location
|
||||
});
|
||||
|
||||
case "CLEAR_SELECTED_LOCATION":
|
||||
location = {
|
||||
url: ""
|
||||
};
|
||||
_prefs.prefs.pendingSelectedLocation = location;
|
||||
return state.set("selectedLocation", {
|
||||
sourceId: ""
|
||||
}).set("pendingSelectedLocation", location);
|
||||
return _objectSpread({}, state, {
|
||||
selectedLocation: null,
|
||||
pendingSelectedLocation: location
|
||||
});
|
||||
|
||||
case "SET_PENDING_SELECTED_LOCATION":
|
||||
location = {
|
||||
@ -118,27 +113,29 @@ function update(state = initialSourcesState(), action) {
|
||||
line: action.line
|
||||
};
|
||||
_prefs.prefs.pendingSelectedLocation = location;
|
||||
return state.set("pendingSelectedLocation", location);
|
||||
return _objectSpread({}, state, {
|
||||
pendingSelectedLocation: location
|
||||
});
|
||||
|
||||
case "ADD_TAB":
|
||||
return state.merge({
|
||||
return _objectSpread({}, state, {
|
||||
tabs: updateTabList(state.tabs, action.url)
|
||||
});
|
||||
|
||||
case "MOVE_TAB":
|
||||
return state.merge({
|
||||
return _objectSpread({}, state, {
|
||||
tabs: updateTabList(state.tabs, action.url, action.tabIndex)
|
||||
});
|
||||
|
||||
case "CLOSE_TAB":
|
||||
_prefs.prefs.tabs = action.tabs;
|
||||
return state.merge({
|
||||
return _objectSpread({}, state, {
|
||||
tabs: action.tabs
|
||||
});
|
||||
|
||||
case "CLOSE_TABS":
|
||||
_prefs.prefs.tabs = action.tabs;
|
||||
return state.merge({
|
||||
return _objectSpread({}, state, {
|
||||
tabs: action.tabs
|
||||
});
|
||||
|
||||
@ -147,25 +144,31 @@ function update(state = initialSourcesState(), action) {
|
||||
|
||||
case "BLACKBOX":
|
||||
if (action.status === "done") {
|
||||
const url = action.source.url;
|
||||
const {
|
||||
id,
|
||||
url
|
||||
} = action.source;
|
||||
const {
|
||||
isBlackBoxed
|
||||
} = action.value;
|
||||
updateBlackBoxList(url, isBlackBoxed);
|
||||
return state.setIn(["sources", action.source.id, "isBlackBoxed"], isBlackBoxed);
|
||||
return updateSource(state, {
|
||||
id,
|
||||
isBlackBoxed
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "NAVIGATE":
|
||||
const source = state.selectedLocation && state.sources.get(state.selectedLocation.sourceId);
|
||||
const source = state.selectedLocation && state.sources[state.selectedLocation.sourceId];
|
||||
const url = source && source.url;
|
||||
|
||||
if (!url) {
|
||||
return initialSourcesState();
|
||||
}
|
||||
|
||||
return initialSourcesState().set("pendingSelectedLocation", {
|
||||
return _objectSpread({}, initialSourcesState(), {
|
||||
url
|
||||
});
|
||||
}
|
||||
@ -213,18 +216,17 @@ function updateSource(state, source) {
|
||||
return state;
|
||||
}
|
||||
|
||||
const existingSource = state.sources.get(source.id);
|
||||
|
||||
if (existingSource) {
|
||||
const updatedSource = existingSource.merge(source);
|
||||
return state.setIn(["sources", source.id], updatedSource);
|
||||
}
|
||||
|
||||
return state.setIn(["sources", source.id], createSourceRecord(source));
|
||||
const existingSource = state.sources[source.id];
|
||||
const updatedSource = existingSource ? _objectSpread({}, existingSource, source) : createSource(source);
|
||||
return _objectSpread({}, state, {
|
||||
sources: _objectSpread({}, state.sources, {
|
||||
[source.id]: updatedSource
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function removeSourceFromTabList(tabs, url) {
|
||||
return tabs.filter(tab => tab != url);
|
||||
return tabs.filter(tab => tab !== url);
|
||||
}
|
||||
|
||||
function removeSourcesFromTabList(tabs, urls) {
|
||||
@ -242,19 +244,16 @@ function restoreTabs() {
|
||||
*/
|
||||
|
||||
|
||||
function updateTabList(tabs, url, tabIndex) {
|
||||
const urlIndex = tabs.indexOf(url);
|
||||
const includesUrl = !!tabs.find(tab => tab == url);
|
||||
function updateTabList(tabs, url, newIndex) {
|
||||
const currentIndex = tabs.indexOf(url);
|
||||
|
||||
if (includesUrl) {
|
||||
if (tabIndex != undefined) {
|
||||
tabs = tabs.delete(urlIndex).insert(tabIndex, url);
|
||||
}
|
||||
} else {
|
||||
tabs = tabs.insert(0, url);
|
||||
if (currentIndex === -1) {
|
||||
tabs = [url, ...tabs];
|
||||
} else if (newIndex !== undefined) {
|
||||
tabs = (0, _lodashMove.move)(tabs, currentIndex, newIndex);
|
||||
}
|
||||
|
||||
_prefs.prefs.tabs = tabs.toJS();
|
||||
_prefs.prefs.tabs = tabs;
|
||||
return tabs;
|
||||
}
|
||||
|
||||
@ -294,17 +293,20 @@ function getNewSelectedSourceId(state, availableTabs) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const selectedTab = state.sources.sources.get(selectedLocation.sourceId);
|
||||
const selectedTabUrl = selectedTab ? selectedTab.url : "";
|
||||
const selectedTab = getSource(state, selectedLocation.sourceId);
|
||||
|
||||
if (availableTabs.includes(selectedTabUrl)) {
|
||||
if (!selectedTab) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (availableTabs.includes(selectedTab.url)) {
|
||||
const sources = state.sources.sources;
|
||||
|
||||
if (!sources) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const selectedSource = sources.find(source => source.url == selectedTabUrl);
|
||||
const selectedSource = getSourceByURL(state, selectedTab.url);
|
||||
|
||||
if (selectedSource) {
|
||||
return selectedSource.id;
|
||||
@ -314,10 +316,10 @@ function getNewSelectedSourceId(state, availableTabs) {
|
||||
}
|
||||
|
||||
const tabUrls = state.sources.tabs;
|
||||
const leftNeighborIndex = Math.max(tabUrls.indexOf(selectedTabUrl) - 1, 0);
|
||||
const lastAvailbleTabIndex = availableTabs.size - 1;
|
||||
const leftNeighborIndex = Math.max(tabUrls.indexOf(selectedTab.url) - 1, 0);
|
||||
const lastAvailbleTabIndex = availableTabs.length - 1;
|
||||
const newSelectedTabIndex = Math.min(leftNeighborIndex, lastAvailbleTabIndex);
|
||||
const availableTab = availableTabs.get(newSelectedTabIndex);
|
||||
const availableTab = availableTabs[newSelectedTabIndex];
|
||||
const tabSource = getSourceByUrlInSources(state.sources.sources, availableTab);
|
||||
|
||||
if (tabSource) {
|
||||
@ -341,16 +343,20 @@ function getSource(state, id) {
|
||||
return getSourceInSources(getSources(state), id);
|
||||
}
|
||||
|
||||
function getSourceFromId(state, id) {
|
||||
return getSourcesState(state).sources[id];
|
||||
}
|
||||
|
||||
function getSourceByURL(state, url) {
|
||||
return getSourceByUrlInSources(state.sources.sources, url);
|
||||
}
|
||||
|
||||
function getGeneratedSource(state, sourceRecord) {
|
||||
if (!sourceRecord || !(0, _devtoolsSourceMap.isOriginalId)(sourceRecord.id)) {
|
||||
return null;
|
||||
function getGeneratedSource(state, source) {
|
||||
if (!(0, _devtoolsSourceMap.isOriginalId)(source.id)) {
|
||||
return source;
|
||||
}
|
||||
|
||||
return getSource(state, (0, _devtoolsSourceMap.originalToGeneratedId)(sourceRecord.id));
|
||||
return getSourceFromId(state, (0, _devtoolsSourceMap.originalToGeneratedId)(source.id));
|
||||
}
|
||||
|
||||
function getPendingSelectedLocation(state) {
|
||||
@ -376,14 +382,24 @@ function getSourceByUrlInSources(sources, url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return sources.find(source => source.url === url);
|
||||
return (0, _lodash.find)(sources, source => source.url === url);
|
||||
}
|
||||
|
||||
function getSourceInSources(sources, id) {
|
||||
return sources.get(id);
|
||||
return sources[id];
|
||||
}
|
||||
|
||||
const getSources = exports.getSources = sources => sources.sources.sources;
|
||||
function getSources(state) {
|
||||
return state.sources.sources;
|
||||
}
|
||||
|
||||
function getSourceList(state) {
|
||||
return Object.values(getSources(state));
|
||||
}
|
||||
|
||||
function getSourceCount(state) {
|
||||
return Object.keys(getSources(state)).length;
|
||||
}
|
||||
|
||||
const getTabs = exports.getTabs = (0, _reselect.createSelector)(getSourcesState, sources => sources.tabs);
|
||||
const getSourceTabs = exports.getSourceTabs = (0, _reselect.createSelector)(getTabs, getSources, (tabs, sources) => tabs.filter(tab => getSourceByUrlInSources(sources, tab)));
|
||||
@ -396,6 +412,16 @@ const getSelectedSource = exports.getSelectedSource = (0, _reselect.createSelect
|
||||
return;
|
||||
}
|
||||
|
||||
return sources.get(selectedLocation.sourceId);
|
||||
const source = sources[selectedLocation.sourceId]; // TODO: remove this when the immutable refactor lands in m-c
|
||||
|
||||
if (_devtoolsEnvironment.isTesting) {
|
||||
const testSource = _objectSpread({}, source, {
|
||||
get: field => source[field]
|
||||
});
|
||||
|
||||
return testSource;
|
||||
}
|
||||
|
||||
return source;
|
||||
});
|
||||
exports.default = update;
|
@ -15,8 +15,7 @@ var _devtoolsSourceMap = require("devtools/client/shared/source-map/index.js");
|
||||
* 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) {
|
||||
const sourceId = selectedSource.get("id");
|
||||
return (0, _devtoolsSourceMap.isGeneratedId)(sourceId);
|
||||
return (0, _devtoolsSourceMap.isGeneratedId)(selectedSource.id);
|
||||
}
|
||||
|
||||
function getColumn(column, selectedSource) {
|
||||
@ -35,7 +34,7 @@ function getBreakpointsForSource(state, selectedSource) {
|
||||
const breakpoints = (0, _breakpoints.getBreakpoints)(state);
|
||||
return breakpoints.filter(bp => {
|
||||
const location = getLocation(bp, selectedSource);
|
||||
return location.sourceId === selectedSource.get("id");
|
||||
return location.sourceId === selectedSource.id;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,11 +23,11 @@ function getBreakpointsForSource(source, breakpoints) {
|
||||
|
||||
function findBreakpointSources(sources, breakpoints) {
|
||||
const sourceIds = (0, _lodash.uniq)(breakpoints.valueSeq().filter(bp => !bp.hidden).map(bp => bp.location.sourceId).toJS());
|
||||
const breakpointSources = sourceIds.map(id => (0, _selectors.getSourceInSources)(sources, id)).filter(source => source && !source.isBlackBoxed);
|
||||
const breakpointSources = sourceIds.map(id => sources[id]).filter(source => source && !source.isBlackBoxed);
|
||||
return (0, _lodash.sortBy)(breakpointSources, source => (0, _source.getFilenameFromURL)(source.url));
|
||||
}
|
||||
|
||||
function _getBreakpointSources(breakpoints, sources, selectedSource) {
|
||||
function _getBreakpointSources(breakpoints, sources) {
|
||||
const breakpointSources = findBreakpointSources(sources, breakpoints);
|
||||
return breakpointSources.map(source => ({
|
||||
source,
|
||||
|
@ -32,10 +32,10 @@ function getSourceForFrame(sources, frame, isGeneratedSource) {
|
||||
}
|
||||
|
||||
function appendSource(sources, frame, selectedSource) {
|
||||
const isGeneratedSource = selectedSource && !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.get("id"));
|
||||
const isGeneratedSource = selectedSource && !(0, _devtoolsSourceMap.isOriginalId)(selectedSource.id);
|
||||
return _objectSpread({}, frame, {
|
||||
location: getLocation(frame, isGeneratedSource),
|
||||
source: getSourceForFrame(sources, frame, isGeneratedSource).toJS()
|
||||
source: getSourceForFrame(sources, frame, isGeneratedSource)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,16 @@ exports.getRelativeSources = undefined;
|
||||
|
||||
var _selectors = require("../selectors/index");
|
||||
|
||||
var _sources = require("../reducers/sources");
|
||||
var _lodash = require("devtools/client/shared/vendor/lodash");
|
||||
|
||||
var _source = require("../utils/source");
|
||||
|
||||
var _reselect = require("devtools/client/debugger/new/dist/vendors").vendored["reselect"];
|
||||
|
||||
/* 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 _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function getRelativeUrl(url, root) {
|
||||
if (!root) {
|
||||
return (0, _source.getSourcePath)(url);
|
||||
@ -26,7 +27,13 @@ function getRelativeUrl(url, root) {
|
||||
}
|
||||
|
||||
function formatSource(source, root) {
|
||||
return new _sources.RelativeSourceRecordClass(source).set("relativeUrl", getRelativeUrl(source.url, root));
|
||||
return _objectSpread({}, source, {
|
||||
relativeUrl: getRelativeUrl(source.url, root)
|
||||
});
|
||||
}
|
||||
|
||||
function underRoot(source, root) {
|
||||
return source.url && source.url.includes(root);
|
||||
}
|
||||
/*
|
||||
* Gets the sources that are below a project root
|
||||
@ -34,5 +41,6 @@ function formatSource(source, root) {
|
||||
|
||||
|
||||
const getRelativeSources = exports.getRelativeSources = (0, _reselect.createSelector)(_selectors.getSources, _selectors.getProjectDirectoryRoot, (sources, root) => {
|
||||
return sources.filter(source => source.url && source.url.includes(root)).map(source => formatSource(source, root));
|
||||
const relativeSources = (0, _lodash.chain)(sources).pickBy(source => underRoot(source, root)).mapValues(source => formatSource(source, root)).value();
|
||||
return relativeSources;
|
||||
});
|
@ -22,6 +22,11 @@ function inComponent(state) {
|
||||
}
|
||||
|
||||
const source = (0, _.getSource)(state, selectedFrame.location.sourceId);
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const symbols = (0, _.getSymbols)(state, source);
|
||||
|
||||
if (!symbols) {
|
||||
|
@ -25,7 +25,7 @@ function formatBreakpoint(breakpoint, selectedSource) {
|
||||
disabled,
|
||||
hidden
|
||||
} = breakpoint;
|
||||
const sourceId = selectedSource.get("id");
|
||||
const sourceId = selectedSource.id;
|
||||
const isGeneratedSource = (0, _devtoolsSourceMap.isGeneratedId)(sourceId);
|
||||
return {
|
||||
location: getLocation(breakpoint, isGeneratedSource),
|
||||
@ -37,16 +37,14 @@ function formatBreakpoint(breakpoint, selectedSource) {
|
||||
}
|
||||
|
||||
function isVisible(breakpoint, selectedSource) {
|
||||
const sourceId = selectedSource.get("id");
|
||||
const sourceId = selectedSource.id;
|
||||
const isGeneratedSource = (0, _devtoolsSourceMap.isGeneratedId)(sourceId);
|
||||
const location = getLocation(breakpoint, isGeneratedSource);
|
||||
return location.sourceId === sourceId;
|
||||
}
|
||||
/*
|
||||
* Finds the breakpoints, which appear in the selected source.
|
||||
*
|
||||
* This
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
function getVisibleBreakpoints(state) {
|
||||
|
@ -23,13 +23,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
||||
|
||||
function findSource(dbg, url) {
|
||||
const sources = dbg.selectors.getSources();
|
||||
const source = sources.find(s => (s.get("url") || "").includes(url));
|
||||
const source = sources.find(s => (s.url || "").includes(url));
|
||||
|
||||
if (!source) {
|
||||
return;
|
||||
}
|
||||
|
||||
return source.toJS();
|
||||
return source;
|
||||
}
|
||||
|
||||
function sendPacket(dbg, packet, callback) {
|
||||
|
@ -124,7 +124,7 @@ function shouldShowFooter(selectedSource, horizontal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return shouldShowPrettyPrint(selectedSource) || (0, _devtoolsSourceMap.isOriginalId)(selectedSource.get("id"));
|
||||
return shouldShowPrettyPrint(selectedSource) || (0, _devtoolsSourceMap.isOriginalId)(selectedSource.id);
|
||||
}
|
||||
|
||||
function traverseResults(e, ctx, query, dir, modifiers) {
|
||||
|
@ -76,7 +76,7 @@ function updateDocument(editor, source) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceId = source.get("id");
|
||||
const sourceId = source.id;
|
||||
const doc = getDocument(sourceId) || editor.createDocument();
|
||||
editor.replaceDocument(doc);
|
||||
updateLineNumberFormat(editor, sourceId);
|
||||
|
@ -20,7 +20,7 @@ function isMinified(source) {
|
||||
return _minifiedCache.get(source.id);
|
||||
}
|
||||
|
||||
let text = source.get("text");
|
||||
let text = source.text;
|
||||
|
||||
if (!text) {
|
||||
return false;
|
||||
|
@ -186,7 +186,6 @@ function generateClientScope(scopes, originalScopes) {
|
||||
variables = _objectWithoutProperties(_orig$generatedBindin, ["this"]);
|
||||
|
||||
return _objectSpread({
|
||||
// Flow doesn't like casting 'parent'.
|
||||
parent: acc,
|
||||
actor: `originalActor${i}`,
|
||||
type: orig.type,
|
||||
|
@ -38,7 +38,12 @@ async function loadRangeMetadata(source, frame, originalAstScopes, sourceMaps) {
|
||||
}
|
||||
|
||||
while (i < sortedOriginalAstBindings.length && sortedOriginalAstBindings[i].start.line === range.line && (0, _locColumn.locColumn)(sortedOriginalAstBindings[i].start) >= range.columnStart && (0, _locColumn.locColumn)(sortedOriginalAstBindings[i].start) < range.columnEnd) {
|
||||
bindings.push(sortedOriginalAstBindings[i]);
|
||||
const lastBinding = bindings[bindings.length - 1]; // Only add bindings when they're in new positions
|
||||
|
||||
if (!lastBinding || (0, _positionCmp.positionCmp)(lastBinding.start, sortedOriginalAstBindings[i].start) !== 0) {
|
||||
bindings.push(sortedOriginalAstBindings[i]);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -62,8 +62,10 @@ if (isDevelopment()) {
|
||||
pref("devtools.debugger.features.column-breakpoints", true);
|
||||
pref("devtools.debugger.features.replay", true);
|
||||
pref("devtools.debugger.features.pause-points", true);
|
||||
pref("devtools.debugger.features.component-stack", true);
|
||||
pref("devtools.debugger.features.skip-pausing", false);
|
||||
pref("devtools.debugger.features.component-pane", false);
|
||||
pref("devtools.debugger.features.skip-pausing", true);
|
||||
pref("devtools.debugger.features.autocomplete-expressions", false);
|
||||
}
|
||||
|
||||
const prefs = exports.prefs = new PrefsHelper("devtools", {
|
||||
@ -110,8 +112,9 @@ const features = exports.features = new PrefsHelper("devtools.debugger.features"
|
||||
codeFolding: ["Bool", "code-folding"],
|
||||
replay: ["Bool", "replay"],
|
||||
pausePoints: ["Bool", "pause-points"],
|
||||
componentStack: ["Bool", "component-stack"],
|
||||
skipPausing: ["Bool", "skip-pausing"]
|
||||
skipPausing: ["Bool", "skip-pausing"],
|
||||
componentPane: ["Bool", "component-pane"],
|
||||
autocompleteExpression: ["Bool", "autocomplete-expressions"]
|
||||
});
|
||||
|
||||
if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) {
|
||||
|
@ -123,7 +123,8 @@ function formatShortcutResults() {
|
||||
}
|
||||
|
||||
function formatSources(sources, tabs) {
|
||||
return sources.valueSeq().toArray().filter(source => !(0, _source.isPretty)(source)).filter(({
|
||||
const sourceList = Object.values(sources);
|
||||
return sourceList.filter(source => !(0, _source.isPretty)(source)).filter(({
|
||||
relativeUrl
|
||||
}) => !!relativeUrl).map(source => formatSourcesForList(source, tabs));
|
||||
}
|
@ -19,7 +19,7 @@ async function getGeneratedLocation(state, source, location, sourceMaps) {
|
||||
line,
|
||||
sourceId,
|
||||
column
|
||||
} = await sourceMaps.getGeneratedLocation(location, source.toJS());
|
||||
} = await sourceMaps.getGeneratedLocation(location, source);
|
||||
const generatedSource = (0, _selectors.getSource)(state, sourceId);
|
||||
|
||||
if (!generatedSource) {
|
||||
|
@ -76,7 +76,7 @@ function shouldPrettyPrint(source) {
|
||||
const _isJavaScript = isJavaScript(source);
|
||||
|
||||
const isOriginal = (0, _devtoolsSourceMap.isOriginalId)(source.id);
|
||||
const hasSourceMap = source.get("sourceMapURL");
|
||||
const hasSourceMap = source.sourceMapURL;
|
||||
|
||||
if (_isPretty || isOriginal || hasSourceMap || !_isJavaScript) {
|
||||
return false;
|
||||
@ -421,11 +421,11 @@ function getMode(source, symbols) {
|
||||
}
|
||||
|
||||
function isLoaded(source) {
|
||||
return source.get("loadedState") === "loaded";
|
||||
return source.loadedState === "loaded";
|
||||
}
|
||||
|
||||
function isLoading(source) {
|
||||
return source.get("loadedState") === "loading";
|
||||
return source.loadedState === "loading";
|
||||
}
|
||||
|
||||
function getTextAtPosition(source, location) {
|
||||
|
@ -15,7 +15,7 @@ var _getURL = require("./getURL");
|
||||
* 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 createNodeInTree(part, path, tree, index) {
|
||||
const node = (0, _utils.createNode)(part, path, []); // we are modifying the tree
|
||||
const node = (0, _utils.createDirectoryNode)(part, path, []); // we are modifying the tree
|
||||
|
||||
const contents = tree.contents.slice(0);
|
||||
contents.splice(index, 0, node);
|
||||
@ -46,7 +46,7 @@ function findOrCreateNode(parts, subTree, path, part, index, url, debuggeeHost)
|
||||
const child = subTree.contents[childIndex];
|
||||
const childIsFile = !(0, _utils.nodeHasChildren)(child); // if we have a naming conflict, we'll create a new node
|
||||
|
||||
if (childIsFile && !addedPartIsFile || !childIsFile && addedPartIsFile) {
|
||||
if (child.type === "source" || !childIsFile && addedPartIsFile) {
|
||||
return createNodeInTree(part, path, subTree, childIndex);
|
||||
} // if there is no naming conflict, we can traverse into the child
|
||||
|
||||
@ -60,7 +60,6 @@ function findOrCreateNode(parts, subTree, path, part, index, url, debuggeeHost)
|
||||
|
||||
|
||||
function traverseTree(url, tree, debuggeeHost) {
|
||||
url.path = decodeURIComponent(url.path);
|
||||
const parts = url.path.split("/").filter(p => p !== "");
|
||||
parts.unshift(url.group);
|
||||
let path = "";
|
||||
@ -76,10 +75,17 @@ function traverseTree(url, tree, debuggeeHost) {
|
||||
|
||||
|
||||
function addSourceToNode(node, url, source) {
|
||||
const isFile = !(0, _utils.isDirectory)(url); // if we have a file, and the subtree has no elements, overwrite the
|
||||
const isFile = !(0, _utils.isPathDirectory)(url.path);
|
||||
|
||||
if (node.type == "source") {
|
||||
throw new Error(`wtf ${node.name}`);
|
||||
} // if we have a file, and the subtree has no elements, overwrite the
|
||||
// subtree contents with the source
|
||||
|
||||
|
||||
if (isFile) {
|
||||
// $FlowIgnore
|
||||
node.type = "source";
|
||||
return source;
|
||||
}
|
||||
|
||||
@ -94,12 +100,16 @@ function addSourceToNode(node, url, source) {
|
||||
|
||||
if (childFound) {
|
||||
const existingNode = node.contents[childIndex];
|
||||
existingNode.contents = source;
|
||||
|
||||
if (existingNode.type === "source") {
|
||||
existingNode.contents = source;
|
||||
}
|
||||
|
||||
return node.contents;
|
||||
} // if this is a new file, add the new file;
|
||||
|
||||
|
||||
const newNode = (0, _utils.createNode)(filename, source.get("url"), source);
|
||||
const newNode = (0, _utils.createSourceNode)(filename, source.url, source);
|
||||
const contents = node.contents.slice(0);
|
||||
contents.splice(childIndex, 0, newNode);
|
||||
return contents;
|
||||
@ -118,6 +128,7 @@ function addToTree(tree, source, debuggeeUrl, projectRoot) {
|
||||
return;
|
||||
}
|
||||
|
||||
const finalNode = traverseTree(url, tree, debuggeeHost);
|
||||
const finalNode = traverseTree(url, tree, debuggeeHost); // $FlowIgnore
|
||||
|
||||
finalNode.contents = addSourceToNode(finalNode, url, source);
|
||||
}
|
@ -14,22 +14,38 @@ var _utils = require("./utils");
|
||||
/**
|
||||
* Take an existing source tree, and return a new one with collapsed nodes.
|
||||
*/
|
||||
function collapseTree(node, depth = 0) {
|
||||
function _collapseTree(node, depth) {
|
||||
// Node is a folder.
|
||||
if (Array.isArray(node.contents)) {
|
||||
// Node is not a root/domain node, and only contains 1 item.
|
||||
if (node.type === "directory") {
|
||||
if (!Array.isArray(node.contents)) {
|
||||
console.log(`WTF: ${node.path}`);
|
||||
} // Node is not a root/domain node, and only contains 1 item.
|
||||
|
||||
|
||||
if (depth > 1 && node.contents.length === 1) {
|
||||
const next = node.contents[0]; // Do not collapse if the next node is a leaf node.
|
||||
|
||||
if ((0, _utils.nodeHasChildren)(next)) {
|
||||
return collapseTree((0, _utils.createNode)(`${node.name}/${next.name}`, next.path, next.contents), depth + 1);
|
||||
if (next.type === "directory") {
|
||||
if (!Array.isArray(next.contents)) {
|
||||
console.log(`WTF: ${next.name} -- ${node.name} -- ${JSON.stringify(next.contents)}`);
|
||||
}
|
||||
|
||||
const name = `${node.name}/${next.name}`;
|
||||
const nextNode = (0, _utils.createDirectoryNode)(name, next.path, next.contents);
|
||||
return _collapseTree(nextNode, depth + 1);
|
||||
}
|
||||
} // Map the contents.
|
||||
|
||||
|
||||
return (0, _utils.createNode)(node.name, node.path, node.contents.map(next => collapseTree(next, depth + 1)));
|
||||
return (0, _utils.createDirectoryNode)(node.name, node.path, node.contents.map(next => _collapseTree(next, depth + 1)));
|
||||
} // Node is a leaf, not a folder, do not modify it.
|
||||
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function collapseTree(node) {
|
||||
const tree = _collapseTree(node, 0);
|
||||
|
||||
return tree;
|
||||
}
|
@ -19,9 +19,10 @@ function createTree({
|
||||
debuggeeUrl,
|
||||
projectRoot
|
||||
}) {
|
||||
const uncollapsedTree = (0, _utils.createNode)("root", "", []);
|
||||
const uncollapsedTree = (0, _utils.createDirectoryNode)("root", "", []);
|
||||
|
||||
for (const source of sources.valueSeq()) {
|
||||
for (const sourceId in sources) {
|
||||
const source = sources[sourceId];
|
||||
(0, _addToTree.addToTree)(uncollapsedTree, source, debuggeeUrl, projectRoot);
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,13 @@ exports.formatTree = formatTree;
|
||||
function formatTree(tree, depth = 0, str = "") {
|
||||
const whitespace = new Array(depth * 2).join(" ");
|
||||
|
||||
if (Array.isArray(tree.contents)) {
|
||||
if (tree.type === "directory") {
|
||||
str += `${whitespace} - ${tree.name} path=${tree.path} \n`;
|
||||
tree.contents.forEach(t => {
|
||||
str = formatTree(t, depth + 1, str);
|
||||
});
|
||||
} else {
|
||||
const id = tree.contents.get("id");
|
||||
const id = tree.contents.id;
|
||||
str += `${whitespace} - ${tree.name} path=${tree.path} source_id=${id} \n`;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ function findSource(sourceTree, sourceUrl) {
|
||||
let returnTarget = null;
|
||||
|
||||
function _traverse(subtree) {
|
||||
if ((0, _utils.nodeHasChildren)(subtree)) {
|
||||
if (subtree.type === "directory") {
|
||||
for (const child of subtree.contents) {
|
||||
_traverse(child);
|
||||
}
|
||||
@ -28,7 +28,7 @@ function findSource(sourceTree, sourceUrl) {
|
||||
}
|
||||
}
|
||||
|
||||
sourceTree.contents.forEach(_traverse);
|
||||
sourceTree.contents.forEach(node => _traverse(node));
|
||||
|
||||
if (!returnTarget) {
|
||||
return sourceTree;
|
||||
|
@ -90,51 +90,12 @@ Object.defineProperty(exports, "updateTree", {
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
Object.defineProperty(exports, "createNode", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.createNode;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createParentMap", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.createParentMap;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getFileExtension", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.getFileExtension;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getRelativePath", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.getRelativePath;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isDirectory", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.isDirectory;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isExactUrlMatch", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.isExactUrlMatch;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isNotJavaScript", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.isNotJavaScript;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "nodeHasChildren", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.nodeHasChildren;
|
||||
}
|
||||
Object.keys(_utils).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils[key];
|
||||
}
|
||||
});
|
||||
});
|
@ -58,11 +58,7 @@ function isExactDomainMatch(part, debuggeeHost) {
|
||||
* lookup value.
|
||||
*/
|
||||
function findNodeInContents(tree, matcher) {
|
||||
const {
|
||||
contents
|
||||
} = tree;
|
||||
|
||||
if (contents.length === 0) {
|
||||
if (tree.type === "source" || tree.contents.length === 0) {
|
||||
return {
|
||||
found: false,
|
||||
index: 0
|
||||
@ -70,19 +66,19 @@ function findNodeInContents(tree, matcher) {
|
||||
}
|
||||
|
||||
let left = 0;
|
||||
let right = contents.length - 1;
|
||||
let right = tree.contents.length - 1;
|
||||
|
||||
while (left < right) {
|
||||
const middle = Math.floor((left + right) / 2);
|
||||
|
||||
if (matcher(contents[middle]) < 0) {
|
||||
if (matcher(tree.contents[middle]) < 0) {
|
||||
left = middle + 1;
|
||||
} else {
|
||||
right = middle;
|
||||
}
|
||||
}
|
||||
|
||||
const result = matcher(contents[left]);
|
||||
const result = matcher(tree.contents[left]);
|
||||
|
||||
if (result === 0) {
|
||||
return {
|
||||
|
@ -11,13 +11,15 @@ var _collapseTree = require("./collapseTree");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _lodash = require("devtools/client/shared/vendor/lodash");
|
||||
|
||||
/* 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 newSourcesSet(newSources, prevSources) {
|
||||
const next = newSources.toSet();
|
||||
const prev = prevSources.toSet();
|
||||
return next.subtract(prev);
|
||||
const newSourceIds = (0, _lodash.difference)(Object.keys(newSources), Object.keys(prevSources));
|
||||
const uniqSources = newSourceIds.map(id => newSources[id]);
|
||||
return uniqSources;
|
||||
}
|
||||
|
||||
function updateTree({
|
||||
|
@ -5,12 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.nodeHasChildren = nodeHasChildren;
|
||||
exports.isExactUrlMatch = isExactUrlMatch;
|
||||
exports.isPathDirectory = isPathDirectory;
|
||||
exports.isDirectory = isDirectory;
|
||||
exports.getSourceFromNode = getSourceFromNode;
|
||||
exports.isSource = isSource;
|
||||
exports.getFileExtension = getFileExtension;
|
||||
exports.isNotJavaScript = isNotJavaScript;
|
||||
exports.isInvalidUrl = isInvalidUrl;
|
||||
exports.partIsFile = partIsFile;
|
||||
exports.createNode = createNode;
|
||||
exports.createDirectoryNode = createDirectoryNode;
|
||||
exports.createSourceNode = createSourceNode;
|
||||
exports.createParentMap = createParentMap;
|
||||
exports.getRelativePath = getRelativePath;
|
||||
|
||||
@ -24,7 +28,7 @@ var _source = require("../source");
|
||||
const IGNORED_URLS = ["debugger eval code", "XStringBundle"];
|
||||
|
||||
function nodeHasChildren(item) {
|
||||
return Array.isArray(item.contents);
|
||||
return Array.isArray(item.contents) && item.type === "directory";
|
||||
}
|
||||
|
||||
function isExactUrlMatch(pathPart, debuggeeUrl) {
|
||||
@ -40,11 +44,29 @@ function isExactUrlMatch(pathPart, debuggeeUrl) {
|
||||
return host.replace(/^www\./, "") === pathPart.replace(/^www\./, "");
|
||||
}
|
||||
|
||||
function isDirectory(url) {
|
||||
const parts = url.path.split("/").filter(p => p !== ""); // Assume that all urls point to files except when they end with '/'
|
||||
function isPathDirectory(path) {
|
||||
// Assume that all urls point to files except when they end with '/'
|
||||
// Or directory node has children
|
||||
const parts = path.split("/").filter(p => p !== "");
|
||||
return parts.length === 0 || path.slice(-1) === "/";
|
||||
}
|
||||
|
||||
return (parts.length === 0 || url.path.slice(-1) === "/" || nodeHasChildren(url)) && url.name != "(index)";
|
||||
function isDirectory(item) {
|
||||
return (isPathDirectory(item.path) || item.type === "directory") && item.name != "(index)";
|
||||
}
|
||||
|
||||
function getSourceFromNode(item) {
|
||||
const {
|
||||
contents
|
||||
} = item;
|
||||
|
||||
if (!isDirectory(item) && !Array.isArray(contents)) {
|
||||
return contents;
|
||||
}
|
||||
}
|
||||
|
||||
function isSource(item) {
|
||||
return item.type === "source";
|
||||
}
|
||||
|
||||
function getFileExtension(url = "") {
|
||||
@ -70,8 +92,18 @@ function partIsFile(index, parts, url) {
|
||||
return !isDirectory(url) && isLastPart;
|
||||
}
|
||||
|
||||
function createNode(name, path, contents) {
|
||||
function createDirectoryNode(name, path, contents) {
|
||||
return {
|
||||
type: "directory",
|
||||
name,
|
||||
path,
|
||||
contents
|
||||
};
|
||||
}
|
||||
|
||||
function createSourceNode(name, path, contents) {
|
||||
return {
|
||||
type: "source",
|
||||
name,
|
||||
path,
|
||||
contents
|
||||
@ -82,18 +114,21 @@ function createParentMap(tree) {
|
||||
const map = new WeakMap();
|
||||
|
||||
function _traverse(subtree) {
|
||||
if (nodeHasChildren(subtree)) {
|
||||
if (subtree.type === "directory") {
|
||||
for (const child of subtree.contents) {
|
||||
map.set(child, subtree);
|
||||
|
||||
_traverse(child);
|
||||
}
|
||||
}
|
||||
} // Don't link each top-level path to the "root" node because the
|
||||
// user never sees the root
|
||||
}
|
||||
|
||||
if (tree.type === "directory") {
|
||||
// Don't link each top-level path to the "root" node because the
|
||||
// user never sees the root
|
||||
tree.contents.forEach(_traverse);
|
||||
}
|
||||
|
||||
tree.contents.forEach(_traverse);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -161,10 +161,12 @@ skip-if = os == "win" # Bug 1448523, Bug 1448450
|
||||
[browser_dbg-breaking.js]
|
||||
[browser_dbg-breaking-from-console.js]
|
||||
[browser_dbg-breakpoints.js]
|
||||
[browser_dbg-breakpoints-reloading.js]
|
||||
[browser_dbg-breakpoints-actions.js]
|
||||
[browser_dbg-breakpoints-cond.js]
|
||||
[browser_dbg-browser-content-toolbox.js]
|
||||
skip-if = !e10s || verify # This test is only valid in e10s
|
||||
[browser_dbg-breakpoints-reloading.js]
|
||||
[browser_dbg-breakpoint-skipping.js]
|
||||
[browser_dbg-call-stack.js]
|
||||
[browser_dbg-scopes.js]
|
||||
[browser_dbg-chrome-create.js]
|
||||
|
@ -31,6 +31,5 @@ add_task(async function() {
|
||||
// Make sure the thread is paused in the right source and location
|
||||
await waitForPaused(dbg);
|
||||
is(getCM(dbg).getValue(), "debugger");
|
||||
const source = getSelectedSource(getState()).toJS();
|
||||
assertPausedLocation(dbg);
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ add_task(async function() {
|
||||
await waitForPaused(dbg);
|
||||
|
||||
await resume(dbg);
|
||||
const source = getSelectedSource(getState()).toJS();
|
||||
const source = getSelectedSource(getState())
|
||||
ok(!source.url, "It is an eval source");
|
||||
|
||||
await addBreakpoint(dbg, source, 5);
|
||||
|
@ -0,0 +1,16 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function skipPausing(dbg) {
|
||||
clickElementWithSelector(dbg, ".command-bar-skip-pausing");
|
||||
return waitForState(dbg, state => dbg.selectors.getSkipPausing(state))
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
let dbg = await initDebugger("doc-scripts.html");
|
||||
await addBreakpoint(dbg, "simple3", 2);
|
||||
|
||||
await skipPausing(dbg);
|
||||
const res = await invokeInTab("simple")
|
||||
is(res, 3, "simple() successfully completed")
|
||||
});
|
@ -0,0 +1,21 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
async function removeBreakpoint(dbg) {
|
||||
rightClickElement(dbg, "breakpointItem", 3)
|
||||
selectMenuItem(dbg, 1);
|
||||
}
|
||||
|
||||
|
||||
// Tests to see if we can trigger a breakpoint action via the context menu
|
||||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-scripts.html");
|
||||
await selectSource(dbg, "simple2");
|
||||
await waitForSelectedSource(dbg, "simple2");
|
||||
|
||||
await addBreakpoint(dbg, "simple2", 3);
|
||||
await removeBreakpoint(dbg);
|
||||
|
||||
await waitForState(dbg, state => dbg.selectors.getBreakpoints(state).size == 0)
|
||||
ok("successfully removed the breakpoint")
|
||||
});
|
@ -40,7 +40,7 @@ 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");
|
||||
is(getSource(getState(), simple1.id).get("loadedState"), "loading");
|
||||
is(getSource(getState(), simple1.id).loadedState, "loading");
|
||||
|
||||
await waitForSelectedSource(dbg, "simple1.js");
|
||||
ok(getSource(getState(), simple1.id).text);
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* 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 countSources(dbg) {
|
||||
const sources = dbg.selectors.getSources(dbg.getState());
|
||||
return sources.size;
|
||||
return dbg.selectors.getSourceCount(dbg.getState());
|
||||
}
|
||||
|
||||
const sources = [
|
||||
|
@ -157,7 +157,18 @@ add_task(async function() {
|
||||
"root()"
|
||||
]);
|
||||
|
||||
await breakpointScopes(dbg, "babel-classes", { line: 12, column: 6 }, [
|
||||
await breakpointScopes(dbg, "babel-classes", { line: 6, column: 6 }, [
|
||||
"Class",
|
||||
"Thing()",
|
||||
"Function Body",
|
||||
"Another()",
|
||||
"one",
|
||||
"Thing()",
|
||||
"Module",
|
||||
"root()"
|
||||
]);
|
||||
|
||||
await breakpointScopes(dbg, "babel-classes", { line: 16, column: 6 }, [
|
||||
"Function Body",
|
||||
["three", "3"],
|
||||
["two", "2"],
|
||||
|
@ -9,7 +9,7 @@ add_task(async function() {
|
||||
// NOTE: the CORS call makes the test run times inconsistent
|
||||
const dbg = await initDebugger("doc-sourcemap-bogus.html");
|
||||
const {
|
||||
selectors: { getSources },
|
||||
selectors: { getSourceCount },
|
||||
getState
|
||||
} = dbg;
|
||||
|
||||
@ -24,5 +24,5 @@ add_task(async function() {
|
||||
|
||||
// Make sure that only the single generated source exists. The
|
||||
// sourcemap failed to download.
|
||||
is(getSources(getState()).size, 1, "Only 1 source exists");
|
||||
is(getSourceCount(getState()), 1, "Only 1 source exists");
|
||||
});
|
||||
|
@ -1,7 +1,11 @@
|
||||
export default function root() {
|
||||
let one = 1;
|
||||
|
||||
class Thing {}
|
||||
class Thing {
|
||||
one() {
|
||||
console.log("pause here");
|
||||
}
|
||||
}
|
||||
|
||||
class Another {
|
||||
method() {
|
||||
@ -14,4 +18,5 @@ export default function root() {
|
||||
}
|
||||
|
||||
new Another().method();
|
||||
new Thing().one();
|
||||
}
|
||||
|
@ -78,9 +78,20 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
||||
function root() {
|
||||
var one = 1;
|
||||
|
||||
var Thing = function Thing() {
|
||||
_classCallCheck(this, Thing);
|
||||
};
|
||||
var Thing = function () {
|
||||
function Thing() {
|
||||
_classCallCheck(this, Thing);
|
||||
}
|
||||
|
||||
_createClass(Thing, [{
|
||||
key: "one",
|
||||
value: function one() {
|
||||
console.log("pause here");
|
||||
}
|
||||
}]);
|
||||
|
||||
return Thing;
|
||||
}();
|
||||
|
||||
var Another = function () {
|
||||
function Another() {
|
||||
@ -102,6 +113,7 @@ function root() {
|
||||
}();
|
||||
|
||||
new Another().method();
|
||||
new Thing().one();
|
||||
}
|
||||
|
||||
/***/ })
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sources":["webpack:///webpack/bootstrap 506487d51ad6252294dd","webpack:///./fixtures/babel-classes/input.js"],"names":["root","one","Thing","Another","two","three","console","log","method"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AC7De,SAASA,IAAT,GAAgB;AAC7B,MAAIC,MAAM,CAAV;;AAD6B,MAGvBC,KAHuB;AAAA;AAAA;;AAAA,MAKvBC,OALuB;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,+BAMlB;AACP,YAAIC,MAAM,CAAV;;AAEA,YAAMC,QAAQ,CAAd;;AAEAC,gBAAQC,GAAR,CAAY,YAAZ,EAA0BJ,OAA1B,EAAmCF,GAAnC,EAAwCC,KAAxC,EAA+CF,IAA/C;AACD;AAZ0B;;AAAA;AAAA;;AAe7B,MAAIG,OAAJ,GAAcK,MAAd;AACD,C","file":"fixtures/babel-classes/output.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 506487d51ad6252294dd","export default function root() {\n let one = 1;\n\n class Thing {}\n\n class Another {\n method() {\n let two = 2;\n\n const three = 3;\n\n console.log(\"pause here\", Another, one, Thing, root);\n }\n }\n\n new Another().method();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./fixtures/babel-classes/input.js"],"sourceRoot":""}
|
||||
{"version":3,"sources":["webpack:///webpack/bootstrap f822bade65c0f7424528","webpack:///./fixtures/babel-classes/input.js"],"names":["root","one","Thing","console","log","Another","two","three","method"],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;;;AC7De,SAASA,IAAT,GAAgB;AAC7B,MAAIC,MAAM,CAAV;;AAD6B,MAGvBC,KAHuB;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,4BAIrB;AACJC,gBAAQC,GAAR,CAAY,YAAZ;AACD;AAN0B;;AAAA;AAAA;;AAAA,MASvBC,OATuB;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,+BAUlB;AACP,YAAIC,MAAM,CAAV;;AAEA,YAAMC,QAAQ,CAAd;;AAEAJ,gBAAQC,GAAR,CAAY,YAAZ,EAA0BC,OAA1B,EAAmCJ,GAAnC,EAAwCC,KAAxC,EAA+CF,IAA/C;AACD;AAhB0B;;AAAA;AAAA;;AAmB7B,MAAIK,OAAJ,GAAcG,MAAd;AACA,MAAIN,KAAJ,GAAYD,GAAZ;AACD,C","file":"fixtures/babel-classes/output.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f822bade65c0f7424528","export default function root() {\n let one = 1;\n\n class Thing {\n one() {\n console.log(\"pause here\");\n }\n }\n\n class Another {\n method() {\n let two = 2;\n\n const three = 3;\n\n console.log(\"pause here\", Another, one, Thing, root);\n }\n }\n\n new Another().method();\n new Thing().one();\n}\n\n\n\n// WEBPACK FOOTER //\n// ./fixtures/babel-classes/input.js"],"sourceRoot":""}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -10,7 +10,7 @@ var { Toolbox } = require("devtools/client/framework/toolbox");
|
||||
var { Task } = require("devtools/shared/task");
|
||||
|
||||
const sourceUtils = {
|
||||
isLoaded: source => source.get("loadedState") === "loaded"
|
||||
isLoaded: source => source.loadedState === "loaded"
|
||||
};
|
||||
|
||||
function log(msg, data) {
|
||||
@ -194,7 +194,7 @@ function waitForSource(dbg, url) {
|
||||
dbg,
|
||||
state => {
|
||||
const sources = dbg.selectors.getSources(state);
|
||||
return sources.find(s => (s.get("url") || "").includes(url));
|
||||
return Object.values(sources).find(s => (s.url || "").includes(url));
|
||||
},
|
||||
`source exists`
|
||||
);
|
||||
@ -359,11 +359,7 @@ function assertHighlightLocation(dbg, source, line) {
|
||||
source = findSource(dbg, source);
|
||||
|
||||
// Check the selected source
|
||||
is(
|
||||
getSelectedSource(getState()).get("url"),
|
||||
source.url,
|
||||
"source url is correct"
|
||||
);
|
||||
is(getSelectedSource(getState()).url, source.url, "source url is correct");
|
||||
|
||||
// Check the highlight line
|
||||
const lineEl = findElement(dbg, "highlightLine");
|
||||
@ -456,7 +452,7 @@ function isSelectedFrameSelected(dbg, state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isLoaded = source.has("loadedState") && sourceUtils.isLoaded(source);
|
||||
const isLoaded = source.loadedState && sourceUtils.isLoaded(source);
|
||||
if (!isLoaded) {
|
||||
return false;
|
||||
}
|
||||
@ -494,6 +490,7 @@ function clearDebuggerPreferences() {
|
||||
Services.prefs.clearUserPref("devtools.debugger.expressions");
|
||||
Services.prefs.clearUserPref("devtools.debugger.call-stack-visible");
|
||||
Services.prefs.clearUserPref("devtools.debugger.scopes-visible");
|
||||
Services.prefs.clearUserPref("devtools.debugger.skip-pausing");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -550,8 +547,8 @@ function findSource(dbg, url, { silent } = { silent: false }) {
|
||||
return source;
|
||||
}
|
||||
|
||||
const sources = dbg.selectors.getSources(dbg.getState());
|
||||
const source = sources.find(s => (s.get("url") || "").includes(url));
|
||||
const sources = Object.values(dbg.selectors.getSources(dbg.getState()));
|
||||
const source = sources.find(s => (s.url || "").includes(url));
|
||||
|
||||
if (!source) {
|
||||
if (silent) {
|
||||
@ -561,7 +558,7 @@ function findSource(dbg, url, { silent } = { silent: false }) {
|
||||
throw new Error(`Unable to find source: ${url}`);
|
||||
}
|
||||
|
||||
return source.toJS();
|
||||
return source;
|
||||
}
|
||||
|
||||
function sourceExists(dbg, url) {
|
||||
@ -580,10 +577,7 @@ function waitForLoadedSources(dbg) {
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
const sources = dbg.selectors
|
||||
.getSources(state)
|
||||
.valueSeq()
|
||||
.toJS();
|
||||
const sources = Object.values(dbg.selectors.getSources(state));
|
||||
return !sources.some(source => source.loadedState == "loading");
|
||||
},
|
||||
"loaded source"
|
||||
@ -896,7 +890,7 @@ function invokeInTab(fnc, ...args) {
|
||||
fnc,
|
||||
args
|
||||
}) {
|
||||
content.wrappedJSObject[fnc](...args); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
|
||||
return content.wrappedJSObject[fnc](...args); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
|
||||
});
|
||||
}
|
||||
|
||||
@ -1032,7 +1026,7 @@ const selectors = {
|
||||
expressionInput: ".expressions-list input.input-expression",
|
||||
expressionNodes: ".expressions-list .tree-node",
|
||||
scopesHeader: ".scopes-pane ._header",
|
||||
breakpointItem: i => `.breakpoints-list .breakpoint:nth-of-type(${i})`,
|
||||
breakpointItem: i => `.breakpoints-list div:nth-of-type(${i})`,
|
||||
breakpointItems: `.breakpoints-list .breakpoint`,
|
||||
scopes: ".scopes-list",
|
||||
scopeNode: i => `.scopes-list .tree-node:nth-child(${i}) .object-label`,
|
||||
@ -1217,10 +1211,9 @@ async function waitForScrolling(codeMirror) {
|
||||
return new Promise(resolve => {
|
||||
codeMirror.on("scroll", resolve);
|
||||
setTimeout(resolve, 500);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
async function hoverAtPos(dbg, { line, ch }) {
|
||||
info(`Hovering at ${line}, ${ch}`);
|
||||
const cm = getCM(dbg);
|
||||
|
@ -64,4 +64,5 @@ pref("devtools.debugger.features.replay", false);
|
||||
pref("devtools.debugger.features.pause-points", true);
|
||||
pref("devtools.debugger.features.component-stack", false);
|
||||
pref("devtools.debugger.features.async-stepping", true);
|
||||
pref("devtools.debugger.features.skip-pausing", false);
|
||||
pref("devtools.debugger.features.skip-pausing", true);
|
||||
pref("devtools.debugger.features.autocomplete-expressions", false);
|
||||
|
@ -3993,7 +3993,9 @@ class Tree extends Component {
|
||||
// Additional classes to add to the root element.
|
||||
className: _propTypes2.default.string,
|
||||
// style object to be applied to the root element.
|
||||
style: _propTypes2.default.object
|
||||
style: _propTypes2.default.object,
|
||||
// Prevents blur when Tree loses focus
|
||||
preventBlur: _propTypes2.default.bool
|
||||
};
|
||||
}
|
||||
|
||||
@ -4244,7 +4246,9 @@ class Tree extends Component {
|
||||
* Sets the state to have no focused item.
|
||||
*/
|
||||
_onBlur() {
|
||||
this._focus(undefined);
|
||||
if (!this.props.preventBlur) {
|
||||
this._focus(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ async function waitUntil(predicate, msg) {
|
||||
|
||||
function findSource(dbg, url) {
|
||||
const sources = dbg.selectors.getSources(dbg.getState());
|
||||
return sources.find(s => (s.get("url") || "").includes(url));
|
||||
return Object.values(sources).find(s => (s.url || "").includes(url));
|
||||
}
|
||||
|
||||
function getCM(dbg) {
|
||||
@ -107,7 +107,7 @@ function waitForMetaData(dbg) {
|
||||
const source = dbg.selectors.getSelectedSource(state);
|
||||
// wait for metadata -- this involves parsing the file to determine its type.
|
||||
// if the object is empty, the data has not yet loaded
|
||||
const metaData = dbg.selectors.getSourceMetaData(state, source.get("id"));
|
||||
const metaData = dbg.selectors.getSourceMetaData(state, source.id);
|
||||
return !!Object.keys(metaData).length;
|
||||
},
|
||||
"has file metadata"
|
||||
@ -117,8 +117,7 @@ function waitForMetaData(dbg) {
|
||||
function waitForSources(dbg, expectedSources) {
|
||||
const { selectors } = dbg;
|
||||
function countSources(state) {
|
||||
const sources = selectors.getSources(state);
|
||||
return sources.size >= expectedSources;
|
||||
return selectors.getSourceCount(state) >= expectedSources;
|
||||
}
|
||||
return waitForState(dbg, countSources, "count sources");
|
||||
}
|
||||
@ -168,19 +167,19 @@ function selectSource(dbg, url) {
|
||||
dump(`Selecting source: ${url}\n`);
|
||||
const line = 1;
|
||||
const source = findSource(dbg, url);
|
||||
dbg.actions.selectLocation({ sourceId: source.get("id"), line });
|
||||
dbg.actions.selectLocation({ sourceId: source.id, line });
|
||||
return waitForState(
|
||||
dbg,
|
||||
state => {
|
||||
const source = dbg.selectors.getSelectedSource(state);
|
||||
const isLoaded = source && source.get("loadedState") === "loaded";
|
||||
const isLoaded = source && source.loadedState === "loaded";
|
||||
if (!isLoaded) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wait for symbols -- a flat map of all named variables in a file -- to be calculated.
|
||||
// this is a slow process and becomes slower the larger the file is
|
||||
return dbg.selectors.hasSymbols(state, source.toJS());
|
||||
return dbg.selectors.hasSymbols(state, source);
|
||||
},
|
||||
"selected source"
|
||||
);
|
||||
@ -230,7 +229,7 @@ async function addBreakpoint(dbg, line, url) {
|
||||
dump(`add breakpoint\n`);
|
||||
const source = findSource(dbg, url);
|
||||
const location = {
|
||||
sourceId: source.get("id"),
|
||||
sourceId: source.id,
|
||||
line,
|
||||
column: 0
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user