зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543753 - Don't view sources that can't be loaded in the debugger, r=loganfsmyth.
Differential Revision: https://phabricator.services.mozilla.com/D29593 --HG-- extra : rebase_source : 75e76b049d366b1324ea8fa1188fd4ea505c5348
This commit is contained in:
Родитель
11d65b993a
Коммит
13fb1413fb
|
@ -162,6 +162,10 @@ DebuggerPanel.prototype = {
|
|||
return this._actions.selectSource(cx, sourceId, { line, column });
|
||||
},
|
||||
|
||||
canLoadSource(sourceId) {
|
||||
return this._selectors.canLoadSource(this._getState(), sourceId);
|
||||
},
|
||||
|
||||
getSourceByActorId(sourceId) {
|
||||
return this._selectors.getSourceByActorId(this._getState(), sourceId);
|
||||
},
|
||||
|
|
|
@ -888,6 +888,22 @@ export function getSourceActorsForSource(
|
|||
return getSourceActors(state, actors);
|
||||
}
|
||||
|
||||
export function canLoadSource(state: OuterState, sourceId: string) {
|
||||
// Return false if we know that loadSourceText() will fail if called on this
|
||||
// source. This is used to avoid viewing such sources in the debugger.
|
||||
const source = getSource(state, sourceId);
|
||||
if (!source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isOriginalSource(source)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const actors = getSourceActorsForSource(state, sourceId);
|
||||
return actors.length != 0;
|
||||
}
|
||||
|
||||
export function getBreakpointPositions(
|
||||
state: OuterState
|
||||
): BreakpointPositionsMap {
|
||||
|
|
|
@ -63,7 +63,7 @@ exports.viewSourceInDebugger = async function(
|
|||
const dbg = await toolbox.loadTool("jsdebugger");
|
||||
const source =
|
||||
sourceId ? dbg.getSourceByActorId(sourceId) : dbg.getSourceByURL(sourceURL);
|
||||
if (source) {
|
||||
if (source && dbg.canLoadSource(source.id)) {
|
||||
await toolbox.selectTool("jsdebugger", reason);
|
||||
try {
|
||||
await dbg.selectSource(source.id, sourceLine, sourceColumn);
|
||||
|
|
Загрузка…
Ссылка в новой задаче