Bug 1481628 - Update Debugger Frontend v80. r=dwalsh

This commit is contained in:
Jason Laster 2018-08-07 16:57:53 -04:00
parent d91e5fd1af
commit cfe235196f
24 changed files with 3281 additions and 49 deletions

View File

@ -1,9 +1,9 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Version 79
Version 80
Comparison: https://github.com/devtools-html/debugger.html/compare/release-78...release-79
Comparison: https://github.com/devtools-html/debugger.html/compare/release-79...release-80
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.2

File diff suppressed because it is too large Load Diff

View File

@ -125,7 +125,11 @@ function setPausePoints(sourceId) {
}) => {
const source = (0, _selectors.getSourceFromId)(getState(), sourceId);
if (!_prefs.features.pausePoints || !source || !source.text || source.isWasm) {
if (!_prefs.features.pausePoints || !source || !source.text) {
return;
}
if (source.isWasm) {
return;
}

View File

@ -26,6 +26,7 @@ async function addBreakpointPromise(getState, client, sourceMaps, breakpoint) {
const state = getState();
const source = (0, _selectors.getSource)(state, breakpoint.location.sourceId);
const location = { ...breakpoint.location,
sourceId: source.id,
sourceUrl: source.url
};
const generatedLocation = await (0, _sourceMaps.getGeneratedLocation)(state, source, location, sourceMaps);

View File

@ -219,10 +219,10 @@ function getMappedExpression(expression) {
const mappings = (0, _selectors.getSelectedScopeMappings)(getState());
const bindings = (0, _selectors.getSelectedFrameBindings)(getState());
if (!mappings && !bindings) {
if (!mappings && !bindings && !expression.includes("await")) {
return expression;
}
return parser.mapExpression(expression, mappings, bindings, _prefs.features.mapExpressionBindings);
return parser.mapExpression(expression, mappings, bindings || [], _prefs.features.mapExpressionBindings, _prefs.features.mapAwaitExpression);
};
}

View File

@ -209,7 +209,7 @@ function hasAwait(source, pauseLocation) {
column
} = pauseLocation;
if (!source.text) {
if (source.isWasm || !source.text) {
return false;
}

View File

@ -54,7 +54,7 @@ function updatePreview(target, tokenPos, codeMirror) {
}) => {
const cursorPos = target.getBoundingClientRect();
if ((0, _selectors.getCanRewind)(getState()) || !(0, _selectors.isSelectedFrameVisible)(getState()) || !(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
if (!(0, _selectors.isSelectedFrameVisible)(getState()) || !(0, _selectors.isLineInScope)(getState(), tokenPos.line)) {
return;
}

View File

@ -87,6 +87,7 @@ function loadSourceMap(sourceId) {
// If this source doesn't have a sourcemap, enable it for pretty printing
dispatch({
type: "UPDATE_SOURCE",
// NOTE: Flow https://github.com/facebook/flow/issues/6342 issue
source: { ...source,
sourceMapURL: ""
}

View File

@ -44,16 +44,19 @@ function createFrame(frame) {
function createSource(source, {
supportsWasm
}) {
return {
const createdSource = {
id: source.actor,
url: source.url,
relativeUrl: source.url,
isPrettyPrinted: false,
isWasm: supportsWasm && source.introductionType === "wasm",
isWasm: false,
sourceMapURL: source.sourceMapURL,
isBlackBoxed: false,
loadedState: "unloaded"
};
return Object.assign(createdSource, {
isWasm: supportsWasm && source.introductionType === "wasm"
});
}
function createPause(packet, response) {

View File

@ -74,8 +74,15 @@ function addBreakpoint(state, action) {
const {
breakpoint
breakpoint,
previousLocation
} = action.value;
if (previousLocation) {
const previousLocationId = (0, _breakpoint.makePendingLocationId)(previousLocation);
state = deleteBreakpoint(state, previousLocationId);
}
const locationId = (0, _breakpoint.makePendingLocationId)(breakpoint.location);
const pendingBreakpoint = (0, _breakpoint.createPendingBreakpoint)(breakpoint);
return { ...state,

View File

@ -18,7 +18,7 @@ var _source = require("../utils/source");
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
function getBreakpointsForSource(source, breakpoints) {
const bpList = breakpoints.valueSeq();
return bpList.filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.originalText || bp.condition)).sortBy(bp => bp.location.line).toJS();
return bpList.filter(bp => bp.location.sourceId == source.id && !bp.hidden && (bp.text || bp.originalText || bp.condition || bp.disabled)).sortBy(bp => bp.location.line).toJS();
}
function findBreakpointSources(sources, breakpoints) {

View File

@ -32,6 +32,7 @@ function getRelativeUrl(source, root) {
}
function formatSource(source, root) {
// NOTE: Flow https://github.com/facebook/flow/issues/6342 issue
return { ...source,
relativeUrl: getRelativeUrl(source, root)
};

View File

@ -19,7 +19,7 @@ function findFunctionText(line, source, symbols) {
column: Infinity
});
if (!func || !source.text) {
if (source.isWasm || !func || !source.text) {
return null;
}

View File

@ -20,6 +20,10 @@ function isMinified(source) {
return _minifiedCache.get(source.id);
}
if (source.isWasm) {
return false;
}
let text = source.text;
if (!text) {

View File

@ -69,6 +69,7 @@ if ((0, _devtoolsEnvironment.isDevelopment)()) {
pref("devtools.debugger.features.component-pane", false);
pref("devtools.debugger.features.autocomplete-expressions", false);
pref("devtools.debugger.features.map-expression-bindings", true);
pref("devtools.debugger.features.map-await-expression", true);
}
const prefs = exports.prefs = new _devtoolsModules.PrefsHelper("devtools", {
@ -117,6 +118,7 @@ const features = exports.features = new _devtoolsModules.PrefsHelper("devtools.d
skipPausing: ["Bool", "skip-pausing"],
autocompleteExpression: ["Bool", "autocomplete-expressions"],
mapExpressionBindings: ["Bool", "map-expression-bindings"],
mapAwaitExpression: ["Bool", "map-await-expression"],
componentPane: ["Bool", "component-pane"]
});
const asyncStore = exports.asyncStore = (0, _asyncStoreHelper.asyncStoreHelper)("debugger", {

View File

@ -197,7 +197,7 @@ function getDisplayPath(mySource, sources) {
const filename = getFilename(mySource); // Find sources that have the same filename, but different paths
// as the original source
const similarSources = sources.filter(source => mySource.url != source.url && filename == getFilename(source));
const similarSources = sources.filter(source => getRawSourceURL(mySource.url) != getRawSourceURL(source.url) && filename == getFilename(source));
if (similarSources.length == 0) {
return undefined;
@ -295,7 +295,11 @@ function getSourcePath(url) {
function getSourceLineCount(source) {
if (source.isWasm && !source.error) {
if (source.error) {
return 0;
}
if (source.isWasm) {
const {
binary
} = source.text;
@ -325,14 +329,19 @@ function getSourceLineCount(source) {
function getMode(source, symbols) {
if (source.isWasm) {
return {
name: "text"
};
}
const {
contentType,
text,
isWasm,
url
} = source;
if (!text || isWasm) {
if (!text) {
return {
name: "text"
};
@ -451,7 +460,7 @@ function isLoading(source) {
}
function getTextAtPosition(source, location) {
if (!source || !source.text || source.isWasm) {
if (!source || source.isWasm || !source.text) {
return "";
}

View File

@ -78,7 +78,7 @@ function addSourceToNode(node, url, source) {
const isFile = !(0, _utils.isPathDirectory)(url.path);
if (node.type == "source") {
throw new Error(`wtf ${node.name}`);
throw new Error(`Unexpected type "source" at: ${node.name}`);
} // if we have a file, and the subtree has no elements, overwrite the
// subtree contents with the source

View File

@ -18,7 +18,7 @@ function _collapseTree(node, depth) {
// Node is a folder.
if (node.type === "directory") {
if (!Array.isArray(node.contents)) {
console.log(`WTF: ${node.path}`);
console.log(`Expected array at: ${node.path}`);
} // Node is not a root/domain node, and only contains 1 item.
@ -27,7 +27,7 @@ function _collapseTree(node, depth) {
if (next.type === "directory") {
if (!Array.isArray(next.contents)) {
console.log(`WTF: ${next.name} -- ${node.name} -- ${JSON.stringify(next.contents)}`);
console.log(`Expected array at: ${next.name} -- ${node.name} -- ${JSON.stringify(next.contents)}`);
}
const name = `${node.name}/${next.name}`;

View File

@ -654,6 +654,7 @@ skip-if = !e10s || verify # This test is only valid in e10s
skip-if = (verify && !debug && (os == 'linux'))
[browser_dbg-chrome-debugging.js]
[browser_dbg-console.js]
[browser_dbg-console-async.js]
[browser_dbg-console-link.js]
[browser_dbg-console-map-bindings.js]
[browser_dbg-content-script-sources.js]

View File

@ -0,0 +1,52 @@
// Return a promise with a reference to jsterm, opening the split
// console if necessary. This cleans up the split console pref so
// it won't pollute other tests.
function getSplitConsole(dbg) {
const { toolbox, win } = dbg;
if (!win) {
win = toolbox.win;
}
if (!toolbox.splitConsole) {
pressKey(dbg, "Escape");
}
return new Promise(resolve => {
toolbox.getPanelWhenReady("webconsole").then(() => {
ok(toolbox.splitConsole, "Split console is shown.");
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
resolve(jsterm);
});
});
}
function findMessages(win, query) {
return Array.prototype.filter.call(
win.document.querySelectorAll(".message"),
e => e.innerText.includes(query)
)
}
add_task(async function() {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
const dbg = await initDebugger("doc-script-switching.html");
await selectSource(dbg, "switching-01");
// open the console
await getSplitConsole(dbg);
ok(dbg.toolbox.splitConsole, "Split console is shown.");
const webConsole = await dbg.toolbox.getPanel("webconsole")
const jsterm = webConsole.hud.jsterm;
await jsterm.execute(`let sleep = async (time, v) => new Promise(
res => setTimeout(() => res(v+'!!!'), time)
)`);
await jsterm.execute(`await sleep(200, "DONE")`)
await waitFor(async () => findMessages(webConsole._frameWindow, "DONE!!!").length > 0)
});

View File

@ -47,7 +47,6 @@ add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemapped.html");
await evalInConsoleAtPoint(dbg, "webpack3-babel6", "eval-maps", { line: 14, column: 4 }, [
"one === 1",
"two === 4",

View File

@ -8,7 +8,7 @@ async function waitForSourceCount(dbg, i) {
// source tree batches its rendering.
await waitUntil(() => {
return findAllElements(dbg, "sourceNodes").length === i;
});
}, `waiting for source count ${i}`);
}
function getLabel(dbg, index) {
@ -26,10 +26,13 @@ add_task(async function() {
await waitForSources(dbg, "simple1", "simple2", "nested-source", "long.js");
dump(`>>> contentTask: evaluate evaled.js\n`)
ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js");
});
await waitForSourceCount(dbg, 3);
is(getLabel(dbg, 3), "evaled.js", "evaled exists");
// is(getLabel(dbg, 3), "evaled.js", "evaled exists");
ok(true)
});

View File

@ -482,7 +482,7 @@ function createDebuggerContext(toolbox) {
* Clear all the debugger related preferences.
*/
function clearDebuggerPreferences() {
asyncStorage.clear();
asyncStorage.clear()
Services.prefs.clearUserPref("devtools.recordreplay.enabled");
Services.prefs.clearUserPref("devtools.debugger.pause-on-exceptions");
Services.prefs.clearUserPref("devtools.debugger.pause-on-caught-exceptions");

View File

@ -326,3 +326,10 @@ pref("devtools.aboutdebugging.new-enabled", false);
#else
pref("devtools.aboutdebugging.showSystemAddons", true);
#endif
// Map top-level await expressions in the console
#if defined(RELEASE_OR_BETA)
pref("devtools.debugger.features.map-await-expression", false);
#else
pref("devtools.debugger.features.map-await-expression", true);
#endif