Bug 1511352 - Update Debugger Frontend v106. r=dwalsh

This commit is contained in:
Jason Laster 2018-12-01 08:18:57 -05:00
Родитель 09aff89697
Коммит 90f5358757
105 изменённых файлов: 2455 добавлений и 2491 удалений

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

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

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

@ -436,7 +436,8 @@ html[dir="rtl"] .tree-node button.arrow {
} }
.tree-node.focused button.jump-definition, .tree-node.focused button.jump-definition,
.tree-node.focused button.open-inspector { .tree-node.focused button.open-inspector,
.tree-node.focused button.invoke-getter {
background-color: currentColor; background-color: currentColor;
} }
.A11y-mouse :focus { .A11y-mouse :focus {
@ -2312,7 +2313,8 @@ menuseparator {
} }
.source-footer .blackbox-summary, .source-footer .blackbox-summary,
.source-footer .mapped-source { .source-footer .mapped-source,
.source-footer .cursor-position {
color: var(--theme-body-color); color: var(--theme-body-color);
padding-left: 2.5px; padding-left: 2.5px;
} }
@ -2322,6 +2324,10 @@ menuseparator {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.source-footer .cursor-position {
padding: 5px;
}
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
@ -2685,42 +2691,37 @@ menuseparator {
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.call-site { .call-site {
position: relative; display: inline;
}
.call-site svg {
display: inline; display: inline;
cursor: pointer; cursor: pointer;
}
.call-site::before {
content: "";
mask: url("resource://devtools/client/debugger/new/images/column-marker.svg") no-repeat 100% 100%;
mask-size: contain;
display: inline-block;
background-color: var(--blue-55);
opacity: 0.5;
width: 9px;
height: 12px; height: 12px;
width: 9px;
vertical-align: top;
} }
.call-site.active::before { .call-site.active svg {
opacity: 1; fill: var(--blue-50);
stroke: var(--blue-60);
} }
.theme-dark .call-site { .call-site.disabled svg {
border-bottom: none; fill: var(--blue-50);
stroke: var(--blue-40);
fill-opacity: 0.5;
} }
.theme-dark .call-site-bp { .theme-dark .call-site.active svg {
border-bottom: none; fill: var(--blue-55);
stroke: var(--blue-40);
} }
.theme-dark .call-site::before { .theme-dark .call-site.disabled svg {
background-color: var(--blue-60); fill: var(--blue-50);
opacity: 1; stroke: var(--blue-60);
} fill-opacity: 0.5;
.theme-dark .call-site-bp::before {
background-color: var(--blue-50);
opacity: 0.5;
} }
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
@ -2814,10 +2815,18 @@ html[dir="rtl"] .editor-mount {
.theme-light { .theme-light {
--gutter-hover-background-color: #dde1e4; --gutter-hover-background-color: #dde1e4;
--breakpoint-fill: var(--blue-50);
--breakpoint-stroke: var(--blue-60);
--breakpoint-fill-disabled: var(--blue-50);
--breakpoint-stroke-disabled: var(--blue-40);
} }
.theme-dark { .theme-dark {
--gutter-hover-background-color: #414141; --gutter-hover-background-color: #414141;
--breakpoint-fill: var(--blue-55);
--breakpoint-stroke: var(--blue-40);
--breakpoint-fill-disabled: var(--blue-50);
--breakpoint-stroke-disabled: var(--blue-60);
} }
:not(.empty-line):not(.new-breakpoint) :not(.empty-line):not(.new-breakpoint)
@ -2872,7 +2881,8 @@ html[dir="rtl"] .editor-mount {
} }
.editor.new-breakpoint svg { .editor.new-breakpoint svg {
fill: var(--theme-selection-background); fill: var(--breakpoint-fill);
stroke: var(--breakpoint-stroke);
width: 60px; width: 60px;
height: 14px; height: 14px;
position: absolute; position: absolute;
@ -2899,12 +2909,15 @@ html[dir="rtl"] .editor-mount {
right: -16px; right: -16px;
} }
.new-breakpoint.has-condition svg { .new-breakpoint.has-condition .CodeMirror-gutter-wrapper svg {
fill: var(--theme-graphs-yellow); fill: var(--theme-graphs-yellow);
stroke: var(--theme-graphs-orange);
} }
.editor.new-breakpoint.breakpoint-disabled svg { .editor.new-breakpoint.breakpoint-disabled svg {
opacity: 0.3; fill: var(--breakpoint-fill-disabled);
stroke: var(--breakpoint-stroke-disabled);
fill-opacity: 0.5;
} }
.editor.column-breakpoint svg { .editor.column-breakpoint svg {
@ -3629,55 +3642,6 @@ html[dir="rtl"] .breakpoints-list .breakpoint .breakpoint-line {
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.event-listeners {
list-style: none;
margin: 0;
padding: 0;
}
.event-listeners .listener {
padding: 7px 10px 7px 21px;
clear: both;
overflow: hidden;
}
.event-listeners .listener * {
-moz-user-select: none;
user-select: none;
}
.event-listeners .listener:nth-of-type(2n) {
background-color: var(--theme-tab-toolbar-background);
}
.event-listeners .listener .type {
color: var(--theme-highlight-bluegrey);
padding-right: 5px;
}
.event-listeners .listener .selector {
color: var(--theme-content-color2);
}
.event-listeners .listener-checkbox {
margin-left: 0;
}
.event-listeners .listener .close-btn {
float: right;
}
.event-listeners .listener .close {
display: none;
}
.event-listeners .listener:hover .close {
display: block;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.workers-list * { .workers-list * {
user-select: none; user-select: none;
} }

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

@ -1008,10 +1008,8 @@ exports.isYieldExpression = isYieldExpression;
exports.isObjectShorthand = isObjectShorthand; exports.isObjectShorthand = isObjectShorthand;
exports.getObjectExpressionValue = getObjectExpressionValue; exports.getObjectExpressionValue = getObjectExpressionValue;
exports.getCode = getCode; exports.getCode = getCode;
exports.getVariableNames = getVariableNames;
exports.getComments = getComments; exports.getComments = getComments;
exports.getSpecifiers = getSpecifiers; exports.getSpecifiers = getSpecifiers;
exports.isVariable = isVariable;
exports.isComputedExpression = isComputedExpression; exports.isComputedExpression = isComputedExpression;
exports.getMemberExpression = getMemberExpression; exports.getMemberExpression = getMemberExpression;
exports.getVariables = getVariables; exports.getVariables = getVariables;
@ -1026,19 +1024,17 @@ var _generator = __webpack_require__(2365);
var _generator2 = _interopRequireDefault(_generator); var _generator2 = _interopRequireDefault(_generator);
var _flatten = __webpack_require__(706);
var _flatten2 = _interopRequireDefault(_flatten);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
/* 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 isFunction(node) { function isFunction(node) {
return t.isFunction(node) || t.isArrowFunctionExpression(node) || t.isObjectMethod(node) || t.isClassMethod(node); return t.isFunction(node) || t.isArrowFunctionExpression(node) || t.isObjectMethod(node) || t.isClassMethod(node);
} /* 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 isAwaitExpression(path) { function isAwaitExpression(path) {
const { node, parent } = path; const { node, parent } = path;
@ -1074,37 +1070,6 @@ function getCode(node) {
return (0, _generator2.default)(node).code; return (0, _generator2.default)(node).code;
} }
function getVariableNames(path) {
if (t.isObjectProperty(path.node) && !isFunction(path.node.value)) {
if (path.node.key.type === "StringLiteral") {
return [{
name: path.node.key.value,
location: path.node.loc
}];
} else if (path.node.value.type === "Identifier") {
return [{ name: path.node.value.name, location: path.node.loc }];
} else if (path.node.value.type === "AssignmentPattern") {
return [{ name: path.node.value.left.name, location: path.node.loc }];
}
return [{
name: path.node.key.name,
location: path.node.loc
}];
}
if (!path.node.declarations) {
return path.node.params.map(dec => ({
name: dec.name,
location: dec.loc
}));
}
const declarations = path.node.declarations.filter(dec => dec.id.type !== "ObjectPattern").map(getVariables);
return (0, _flatten2.default)(declarations);
}
function getComments(ast) { function getComments(ast) {
if (!ast || !ast.comments) { if (!ast || !ast.comments) {
return []; return [];
@ -1123,11 +1088,6 @@ function getSpecifiers(specifiers) {
return specifiers.map(specifier => specifier.local && specifier.local.name); return specifiers.map(specifier => specifier.local && specifier.local.name);
} }
function isVariable(path) {
const node = path.node;
return t.isVariableDeclaration(node) || isFunction(path) && path.node.params != null && path.node.params.length || t.isObjectProperty(node) && !isFunction(path.node.value);
}
function isComputedExpression(expression) { function isComputedExpression(expression) {
return (/^\[/m.test(expression) return (/^\[/m.test(expression)
); );
@ -1380,10 +1340,6 @@ function getFunctionParameterNames(path) {
/* eslint-disable complexity */ /* eslint-disable complexity */
function extractSymbol(path, symbols) { function extractSymbol(path, symbols) {
if ((0, _helpers.isVariable)(path)) {
symbols.variables.push(...(0, _helpers.getVariableNames)(path));
}
if ((0, _helpers.isFunction)(path)) { if ((0, _helpers.isFunction)(path)) {
symbols.functions.push({ symbols.functions.push({
name: (0, _getFunctionName2.default)(path.node, path.parent), name: (0, _getFunctionName2.default)(path.node, path.parent),
@ -1532,7 +1488,6 @@ function extractSymbol(path, symbols) {
function extractSymbols(sourceId) { function extractSymbols(sourceId) {
const symbols = { const symbols = {
functions: [], functions: [],
variables: [],
callExpressions: [], callExpressions: [],
memberExpressions: [], memberExpressions: [],
objectProperties: [], objectProperties: [],
@ -22972,15 +22927,17 @@ function hasPoint(state, { line, column }) {
return state[line] && state[line][column]; return state[line] && state[line][column];
} }
function addPoint(state, { line, column }, types) { function addPoint(state, location, types) {
if (typeof types === "boolean") { if (typeof types === "boolean") {
types = { step: types, break: types }; types = { step: types, break: types };
} }
const { line, column } = location;
if (!state[line]) { if (!state[line]) {
state[line] = {}; state[line] = {};
} }
state[line][column] = types; state[line][column] = { types, location };
return state; return state;
} }
@ -46586,107 +46543,6 @@ var isArray = Array.isArray;
module.exports = isArray; module.exports = isArray;
/***/ }),
/***/ 706:
/***/ (function(module, exports, __webpack_require__) {
var baseFlatten = __webpack_require__(707);
/**
* Flattens `array` a single level deep.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, [3, [4]], 5]]);
* // => [1, 2, [3, [4]], 5]
*/
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
module.exports = flatten;
/***/ }),
/***/ 707:
/***/ (function(module, exports, __webpack_require__) {
var arrayPush = __webpack_require__(287),
isFlattenable = __webpack_require__(708);
/**
* The base implementation of `_.flatten` with support for restricting flattening.
*
* @private
* @param {Array} array The array to flatten.
* @param {number} depth The maximum recursion depth.
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
* @param {Array} [result=[]] The initial result value.
* @returns {Array} Returns the new flattened array.
*/
function baseFlatten(array, depth, predicate, isStrict, result) {
var index = -1,
length = array.length;
predicate || (predicate = isFlattenable);
result || (result = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
// Recursively flatten arrays (susceptible to call stack limits).
baseFlatten(value, depth - 1, predicate, isStrict, result);
} else {
arrayPush(result, value);
}
} else if (!isStrict) {
result[result.length] = value;
}
}
return result;
}
module.exports = baseFlatten;
/***/ }),
/***/ 708:
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(7),
isArguments = __webpack_require__(208),
isArray = __webpack_require__(70);
/** Built-in value references. */
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
/**
* Checks if `value` is a flattenable `arguments` object or array.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
return isArray(value) || isArguments(value) ||
!!(spreadableSymbol && value && value[spreadableSymbol]);
}
module.exports = isFlattenable;
/***/ }), /***/ }),
/***/ 71: /***/ 71:

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

@ -4552,7 +4552,7 @@ module.exports = "<!-- This Source Code Form is subject to the terms of the Mozi
/***/ 348: /***/ 348:
/***/ (function(module, exports) { /***/ (function(module, exports) {
module.exports = "<!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 16 16\"><path d=\"M8 13.4c-.5 0-.9-.2-1.2-.6L.4 5.2C0 4.7-.1 4.3.2 3.7S1 3 1.6 3h12.8c.6 0 1.2.1 1.4.7.3.6.2 1.1-.2 1.6l-6.4 7.6c-.3.4-.7.5-1.2.5z\"></path></svg>" module.exports = "<!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --><svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 16 16\" fill=\"context-fill #9B9B9B\"><path d=\"M8 13.4c-.5 0-.9-.2-1.2-.6L.4 5.2C0 4.7-.1 4.3.2 3.7S1 3 1.6 3h12.8c.6 0 1.2.1 1.4.7.3.6.2 1.1-.2 1.6l-6.4 7.6c-.3.4-.7.5-1.2.5z\"></path></svg>"
/***/ }), /***/ }),
@ -8433,7 +8433,7 @@ function createStructuredSelector(selectors) {
/***/ 3801: /***/ 3801:
/***/ (function(module, exports) { /***/ (function(module, exports) {
module.exports = "<svg viewBox=\"0 0 9 12\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><g id=\"columnmarkergroup\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><polygon id=\"columnmarker\" fill=\"#1B1B1D\" points=\"0 0 4 0 9 6 4 12 0 12\"></polygon></g></svg>" module.exports = "<svg viewBox=\"0 0 9 12\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><g id=\"columnmarkergroup\" stroke-width=\"1\" fill-rule=\"evenodd\"><polygon id=\"columnmarker\" points=\"0 0 4 0 9 6 4 12 0 12\"></polygon></g></svg>"
/***/ }), /***/ }),

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

@ -1,6 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public <!-- 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 - 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/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" fill="context-fill #9B9B9B">
<path d="M8 13.4c-.5 0-.9-.2-1.2-.6L.4 5.2C0 4.7-.1 4.3.2 3.7S1 3 1.6 3h12.8c.6 0 1.2.1 1.4.7.3.6.2 1.1-.2 1.6l-6.4 7.6c-.3.4-.7.5-1.2.5z"/> <path d="M8 13.4c-.5 0-.9-.2-1.2-.6L.4 5.2C0 4.7-.1 4.3.2 3.7S1 3 1.6 3h12.8c.6 0 1.2.1 1.4.7.3.6.2 1.1-.2 1.6l-6.4 7.6c-.3.4-.7.5-1.2.5z"/>
</svg> </svg>

До

Ширина:  |  Высота:  |  Размер: 465 B

После

Ширина:  |  Высота:  |  Размер: 493 B

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

@ -1,5 +0,0 @@
<svg width="9px" height="12px" viewBox="0 0 9 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="columnmarkergroup" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<polygon id="columnmarker" fill="#1B1B1D" points="0 0 4 0 9 6 4 12 0 12"></polygon>
</g>
</svg>

До

Ширина:  |  Высота:  |  Размер: 344 B

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

@ -12,7 +12,6 @@ DevToolsModules(
'breakpoint.svg', 'breakpoint.svg',
'close.svg', 'close.svg',
'coffeescript.svg', 'coffeescript.svg',
'column-marker.svg',
'command-chevron.svg', 'command-chevron.svg',
'disable-pausing.svg', 'disable-pausing.svg',
'domain.svg', 'domain.svg',

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

@ -18,17 +18,17 @@ import { updateTab } from "./tabs";
import { PROMISE } from "./utils/middleware/promise"; import { PROMISE } from "./utils/middleware/promise";
import { setInScopeLines } from "./ast/setInScopeLines"; import { setInScopeLines } from "./ast/setInScopeLines";
import { updateSymbolLocations } from "./utils/symbols"; import { setPausePoints } from "./ast/setPausePoints";
export { setPausePoints };
import { import {
getSymbols, getSymbols,
findOutOfScopeLocations, findOutOfScopeLocations,
getFramework, getFramework,
getPausePoints,
type AstPosition type AstPosition
} from "../workers/parser"; } from "../workers/parser";
import { features } from "../utils/prefs"; import { isLoaded } from "../utils/source";
import { isLoaded, isGenerated } from "../utils/source";
import type { SourceId } from "../types"; import type { SourceId } from "../types";
import type { ThunkArgs, Action } from "./types"; import type { ThunkArgs, Action } from "./types";
@ -68,15 +68,7 @@ export function setSymbols(sourceId: SourceId) {
await dispatch({ await dispatch({
type: "SET_SYMBOLS", type: "SET_SYMBOLS",
sourceId, sourceId,
[PROMISE]: (async function() { [PROMISE]: getSymbols(sourceId)
const symbols = await getSymbols(sourceId);
const mappedSymbols = updateSymbolLocations(
symbols,
source,
sourceMaps
);
return mappedSymbols;
})()
}); });
if (isPaused(getState())) { if (isPaused(getState())) {
@ -115,45 +107,3 @@ export function setOutOfScopeLocations() {
dispatch(setInScopeLines()); dispatch(setInScopeLines());
}; };
} }
function compressPausePoints(pausePoints) {
const compressed = {};
for (const line in pausePoints) {
compressed[line] = {};
for (const col in pausePoints[line]) {
const point = pausePoints[line][col];
compressed[line][col] = (point.break ? 1 : 0) | (point.step ? 2 : 0);
}
}
return compressed;
}
export function setPausePoints(sourceId: SourceId) {
return async ({ dispatch, getState, client }: ThunkArgs) => {
const source = getSourceFromId(getState(), sourceId);
if (!features.pausePoints || !source || !source.text) {
return;
}
if (source.isWasm) {
return;
}
const pausePoints = await getPausePoints(sourceId);
const compressed = compressPausePoints(pausePoints);
if (isGenerated(source)) {
await client.setPausePoints(sourceId, compressed);
}
dispatch(
({
type: "SET_PAUSE_POINTS",
sourceText: source.text || "",
sourceId,
pausePoints
}: Action)
);
};
}

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

@ -9,4 +9,5 @@ DIRS += [
DebuggerModules( DebuggerModules(
'setInScopeLines.js', 'setInScopeLines.js',
'setPausePoints.js',
) )

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

@ -0,0 +1,66 @@
/* 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/>. */
import { getSourceFromId } from "../../selectors";
import * as parser from "../../workers/parser";
import { isGenerated } from "../../utils/source";
import { mapPausePoints } from "../../utils/pause/pausePoints";
import { features } from "../../utils/prefs";
import type { SourceId } from "../types";
import type { ThunkArgs, Action } from "./types";
function compressPausePoints(pausePoints) {
const compressed = {};
for (const line in pausePoints) {
compressed[line] = {};
for (const col in pausePoints[line]) {
const { types } = pausePoints[line][col];
compressed[line][col] = (types.break ? 1 : 0) | (types.step ? 2 : 0);
}
}
return compressed;
}
async function mapLocations(pausePoints, source, sourceMaps) {
const sourceId = source.id;
return mapPausePoints(pausePoints, async ({ types, location }) => {
const generatedLocation = await sourceMaps.getGeneratedLocation(
{ ...location, sourceId },
source
);
return { types, location, generatedLocation };
});
}
export function setPausePoints(sourceId: SourceId) {
return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => {
const source = getSourceFromId(getState(), sourceId);
if (!features.pausePoints || !source || !source.text) {
return;
}
if (source.isWasm) {
return;
}
let pausePoints = await parser.getPausePoints(sourceId);
pausePoints = await mapLocations(pausePoints, source, sourceMaps);
if (isGenerated(source)) {
const compressed = compressPausePoints(pausePoints);
await client.setPausePoints(sourceId, compressed);
}
dispatch(
({
type: "SET_PAUSE_POINTS",
sourceText: source.text || "",
sourceId,
pausePoints
}: Action)
);
};
}

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

@ -94,7 +94,7 @@ async function addBreakpointPromise(getState, client, sourceMaps, breakpoint) {
* @param location * @param location
* @return {function(ThunkArgs)} * @return {function(ThunkArgs)}
*/ */
export function addHiddenBreakpoint(location: Location) { export function addHiddenBreakpoint(location: SourceLocation) {
return ({ dispatch }: ThunkArgs) => { return ({ dispatch }: ThunkArgs) => {
return dispatch(addBreakpoint(location, { hidden: true })); return dispatch(addBreakpoint(location, { hidden: true }));
}; };
@ -106,9 +106,9 @@ export function addHiddenBreakpoint(location: Location) {
* *
* @memberof actions/breakpoints * @memberof actions/breakpoints
* @static * @static
* @param {Location} $1.location Location value * @param {SourceLocation} $1.location Location value
*/ */
export function enableBreakpoint(location: Location) { export function enableBreakpoint(location: SourceLocation) {
return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => { return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => {
const breakpoint = getBreakpoint(getState(), location); const breakpoint = getBreakpoint(getState(), location);
if (!breakpoint || breakpoint.loading) { if (!breakpoint || breakpoint.loading) {
@ -139,7 +139,7 @@ export function enableBreakpoint(location: Location) {
*/ */
export function addBreakpoint( export function addBreakpoint(
location: Location, location: SourceLocation,
{ condition, hidden }: addBreakpointOptions = {} { condition, hidden }: addBreakpointOptions = {}
) { ) {
const breakpoint = createBreakpoint(location, { condition, hidden }); const breakpoint = createBreakpoint(location, { condition, hidden });

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

@ -32,7 +32,7 @@ import { isEmptyLineInSource } from "../../reducers/ast";
// this will need to be changed so that addCLientBreakpoint is removed // this will need to be changed so that addCLientBreakpoint is removed
import type { ThunkArgs, Action } from "../types"; import type { ThunkArgs, Action } from "../types";
import type { Breakpoint, Location, XHRBreakpoint } from "../../types"; import type { Breakpoint, SourceLocation, XHRBreakpoint } from "../../types";
import { recordEvent } from "../../utils/telemetry"; import { recordEvent } from "../../utils/telemetry";
@ -47,7 +47,7 @@ type addBreakpointOptions = {
* @memberof actions/breakpoints * @memberof actions/breakpoints
* @static * @static
*/ */
export function removeBreakpoint(location: Location) { export function removeBreakpoint(location: SourceLocation) {
return ({ dispatch, getState, client }: ThunkArgs) => { return ({ dispatch, getState, client }: ThunkArgs) => {
const bp = getBreakpoint(getState(), location); const bp = getBreakpoint(getState(), location);
if (!bp || bp.loading) { if (!bp || bp.loading) {
@ -84,7 +84,7 @@ export function removeBreakpoint(location: Location) {
* @memberof actions/breakpoints * @memberof actions/breakpoints
* @static * @static
*/ */
export function disableBreakpoint(location: Location) { export function disableBreakpoint(location: SourceLocation) {
return async ({ dispatch, getState, client }: ThunkArgs) => { return async ({ dispatch, getState, client }: ThunkArgs) => {
const bp = getBreakpoint(getState(), location); const bp = getBreakpoint(getState(), location);
@ -220,14 +220,14 @@ export function remapBreakpoints(sourceId: string) {
* @throws {Error} "not implemented" * @throws {Error} "not implemented"
* @memberof actions/breakpoints * @memberof actions/breakpoints
* @static * @static
* @param {Location} location * @param {SourceLocation} location
* @see DebuggerController.Breakpoints.addBreakpoint * @see DebuggerController.Breakpoints.addBreakpoint
* @param {string} condition * @param {string} condition
* The condition to set on the breakpoint * The condition to set on the breakpoint
* @param {Boolean} $1.disabled Disable value for breakpoint value * @param {Boolean} $1.disabled Disable value for breakpoint value
*/ */
export function setBreakpointCondition( export function setBreakpointCondition(
location: Location, location: SourceLocation,
{ condition }: addBreakpointOptions = {} { condition }: addBreakpointOptions = {}
) { ) {
return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => { return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => {

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

@ -18,7 +18,7 @@ import { getSource } from "../../selectors";
import type { ThunkArgs, Action } from "../types"; import type { ThunkArgs, Action } from "../types";
import type { import type {
Location, SourceLocation,
ASTLocation, ASTLocation,
PendingBreakpoint, PendingBreakpoint,
SourceId, SourceId,
@ -26,13 +26,13 @@ import type {
} from "../../types"; } from "../../types";
type BreakpointSyncData = { type BreakpointSyncData = {
previousLocation: Location, previousLocation: SourceLocation,
breakpoint: ?Breakpoint breakpoint: ?Breakpoint
}; };
async function makeScopedLocation( async function makeScopedLocation(
{ name, offset }: ASTLocation, { name, offset }: ASTLocation,
location: Location, location: SourceLocation,
source source
) { ) {
const scope = await findScopeByName(source, name); const scope = await findScopeByName(source, name);
@ -51,9 +51,9 @@ async function makeScopedLocation(
function createSyncData( function createSyncData(
id: SourceId, id: SourceId,
pendingBreakpoint: PendingBreakpoint, pendingBreakpoint: PendingBreakpoint,
location: Location, location: SourceLocation,
generatedLocation: Location, generatedLocation: SourceLocation,
previousLocation: Location, previousLocation: SourceLocation,
text: string, text: string,
originalText: string originalText: string
): BreakpointSyncData { ): BreakpointSyncData {

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

@ -6,7 +6,6 @@
import * as breakpoints from "./breakpoints"; import * as breakpoints from "./breakpoints";
import * as expressions from "./expressions"; import * as expressions from "./expressions";
import * as eventListeners from "./event-listeners";
import * as pause from "./pause"; import * as pause from "./pause";
import * as navigation from "./navigation"; import * as navigation from "./navigation";
import * as ui from "./ui"; import * as ui from "./ui";
@ -25,7 +24,6 @@ export default {
...navigation, ...navigation,
...breakpoints, ...breakpoints,
...expressions, ...expressions,
...eventListeners,
...sources, ...sources,
...tabs, ...tabs,
...pause, ...pause,

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

@ -14,7 +14,6 @@ DIRS += [
DebuggerModules( DebuggerModules(
'ast.js', 'ast.js',
'debuggee.js', 'debuggee.js',
'event-listeners.js',
'expressions.js', 'expressions.js',
'file-search.js', 'file-search.js',
'index.js', 'index.js',

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

@ -22,7 +22,7 @@ import { getMappedExpression } from "./expressions";
import { getExtra } from "./pause"; import { getExtra } from "./pause";
import type { Action, ThunkArgs } from "./types"; import type { Action, ThunkArgs } from "./types";
import type { ColumnPosition } from "../types"; import type { Position } from "../types";
import type { AstLocation } from "../workers/parser"; import type { AstLocation } from "../workers/parser";
function findExpressionMatch(state, codeMirror, tokenPos) { function findExpressionMatch(state, codeMirror, tokenPos) {
@ -75,7 +75,7 @@ export function updatePreview(
export function setPreview( export function setPreview(
expression: string, expression: string,
location: AstLocation, location: AstLocation,
tokenPos: ColumnPosition, tokenPos: Position,
cursorPos: ClientRect cursorPos: ClientRect
) { ) {
return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => { return async ({ dispatch, getState, client, sourceMaps }: ThunkArgs) => {

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

@ -125,7 +125,12 @@ function checkSelectedSource(sourceId: string) {
} }
await dispatch( await dispatch(
selectLocation({ ...pendingLocation, sourceId: source.id }) selectLocation({
sourceId: source.id,
line:
typeof pendingLocation.line === "number" ? pendingLocation.line : 0,
column: pendingLocation.column
})
); );
} }
}; };

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

@ -34,10 +34,13 @@ import {
getSelectedSource getSelectedSource
} from "../../selectors"; } from "../../selectors";
import type { Location, Position, Source } from "../../types"; import type { SourceLocation, PartialPosition, Source } from "../../types";
import type { ThunkArgs } from "../types"; import type { ThunkArgs } from "../types";
export const setSelectedLocation = (source: Source, location: Location) => ({ export const setSelectedLocation = (
source: Source,
location: SourceLocation
) => ({
type: "SET_SELECTED_LOCATION", type: "SET_SELECTED_LOCATION",
source, source,
location location
@ -64,7 +67,10 @@ export const clearSelectedLocation = () => ({
* @memberof actions/sources * @memberof actions/sources
* @static * @static
*/ */
export function selectSourceURL(url: string, options: Position = { line: 1 }) { export function selectSourceURL(
url: string,
options: PartialPosition = { line: 1 }
) {
return async ({ dispatch, getState, sourceMaps }: ThunkArgs) => { return async ({ dispatch, getState, sourceMaps }: ThunkArgs) => {
const source = getSourceByURL(getState(), url); const source = getSourceByURL(getState(), url);
if (!source) { if (!source) {
@ -93,7 +99,7 @@ export function selectSource(sourceId: string) {
* @static * @static
*/ */
export function selectLocation( export function selectLocation(
location: Location, location: SourceLocation,
{ keepContext = true }: Object = {} { keepContext = true }: Object = {}
) { ) {
return async ({ dispatch, getState, sourceMaps, client }: ThunkArgs) => { return async ({ dispatch, getState, sourceMaps, client }: ThunkArgs) => {
@ -169,7 +175,7 @@ export function selectLocation(
* @memberof actions/sources * @memberof actions/sources
* @static * @static
*/ */
export function selectSpecificLocation(location: Location) { export function selectSpecificLocation(location: SourceLocation) {
return selectLocation(location, { keepContext: false }); return selectLocation(location, { keepContext: false });
} }
@ -177,7 +183,7 @@ export function selectSpecificLocation(location: Location) {
* @memberof actions/sources * @memberof actions/sources
* @static * @static
*/ */
export function jumpToMappedLocation(location: Location) { export function jumpToMappedLocation(location: SourceLocation) {
return async function({ dispatch, getState, client, sourceMaps }: ThunkArgs) { return async function({ dispatch, getState, client, sourceMaps }: ThunkArgs) {
if (!client) { if (!client) {
return; return;

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

@ -82,26 +82,22 @@ function promiseMiddleware({
// Return the promise so action creators can still compose if they // Return the promise so action creators can still compose if they
// want to. // want to.
return new Promise((resolve, reject) => { return Promise.resolve(promiseInst)
promiseInst.then( .finally(() => new Promise(resolve => executeSoon(resolve)))
.then(
value => { value => {
executeSoon(() => { dispatch({ ...action, status: "done", value: value });
dispatch({ ...action, status: "done", value: value }); return value;
resolve(value);
});
}, },
error => { error => {
executeSoon(() => { dispatch({
dispatch({ ...action,
...action, status: "error",
status: "error", error: error.message || error
error: error.message || error
});
reject(error);
}); });
return Promise.reject(error);
} }
); );
});
}; };
} }

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

@ -9,5 +9,4 @@ DIRS += [
DebuggerModules( DebuggerModules(
'create-store.js', 'create-store.js',
'symbols.js',
) )

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

@ -9,7 +9,7 @@ import type {
BreakpointResult, BreakpointResult,
Frame, Frame,
FrameId, FrameId,
Location, SourceLocation,
Script, Script,
Source, Source,
SourceId, SourceId,
@ -129,7 +129,7 @@ function sourceContents(sourceId: SourceId): Source {
return sourceClient.source(); return sourceClient.source();
} }
function getBreakpointByLocation(location: Location) { function getBreakpointByLocation(location: SourceLocation) {
const id = makePendingLocationId(location); const id = makePendingLocationId(location);
const bpClient = bpClients[id]; const bpClient = bpClients[id];
@ -158,7 +158,7 @@ function removeXHRBreakpoint(path: string, method: string) {
} }
function setBreakpoint( function setBreakpoint(
location: Location, location: SourceLocation,
condition: boolean, condition: boolean,
noSliding: boolean noSliding: boolean
): Promise<BreakpointResult> { ): Promise<BreakpointResult> {
@ -184,7 +184,7 @@ function setBreakpoint(
} }
function removeBreakpoint( function removeBreakpoint(
generatedLocation: Location generatedLocation: SourceLocation
): Promise<void> | ?BreakpointResult { ): Promise<void> | ?BreakpointResult {
try { try {
const id = makePendingLocationId(generatedLocation); const id = makePendingLocationId(generatedLocation);
@ -202,7 +202,7 @@ function removeBreakpoint(
function setBreakpointCondition( function setBreakpointCondition(
breakpointId: BreakpointId, breakpointId: BreakpointId,
location: Location, location: SourceLocation,
condition: boolean, condition: boolean,
noSliding: boolean noSliding: boolean
) { ) {

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

@ -5,7 +5,7 @@
// @flow // @flow
// This module converts Firefox specific types to the generic types // This module converts Firefox specific types to the generic types
import type { Frame, Source, Location } from "../../types"; import type { Frame, Source, SourceLocation } from "../../types";
import type { import type {
PausedPacket, PausedPacket,
FramesResponse, FramesResponse,
@ -78,9 +78,9 @@ export function createPause(
// exists, otherwise use `location`. // exists, otherwise use `location`.
export function createBreakpointLocation( export function createBreakpointLocation(
location: Location, location: SourceLocation,
actualLocation?: Object actualLocation?: Object
): Location { ): SourceLocation {
if (!actualLocation) { if (!actualLocation) {
return location; return location;
} }

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

@ -14,7 +14,6 @@ import type {
import { createPause, createSource } from "./create"; import { createPause, createSource } from "./create";
import sourceQueue from "../../utils/source-queue"; import sourceQueue from "../../utils/source-queue";
import { features } from "../../utils/prefs";
const CALL_STACK_PAGE_SIZE = 1000; const CALL_STACK_PAGE_SIZE = 1000;
@ -100,10 +99,6 @@ function resumed(_: "resumed", packet: ResumedPacket) {
function newSource(_: "newSource", { source }: SourcePacket) { function newSource(_: "newSource", { source }: SourcePacket) {
sourceQueue.queue(source); sourceQueue.queue(source);
if (features.eventListeners) {
actions.fetchEventListeners();
}
} }
function workerListChanged() { function workerListChanged() {

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

@ -3,9 +3,11 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow // @flow
import { PureComponent } from "react"; import React, { PureComponent } from "react";
import ReactDOM from "react-dom";
import classnames from "classnames"; import classnames from "classnames";
import { getDocument } from "../../utils/editor"; import { getDocument } from "../../utils/editor";
import Svg from "../shared/Svg";
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
import type { ColumnBreakpoint as ColumnBreakpointType } from "../../selectors/visibleColumnBreakpoints"; import type { ColumnBreakpoint as ColumnBreakpointType } from "../../selectors/visibleColumnBreakpoints";
@ -24,11 +26,11 @@ type Props = {
}; };
const breakpointImg = document.createElement("div"); const breakpointImg = document.createElement("div");
ReactDOM.render(<Svg name={"column-marker"} />, breakpointImg);
function makeBookmark(isActive, { onClick }) { function makeBookmark(isActive, { onClick }) {
const bp = breakpointImg.cloneNode(true); const bp = breakpointImg.cloneNode(true);
bp.className = classnames("call-site", { const className = isActive ? "active" : "disabled";
active: isActive bp.className = classnames("call-site", className);
});
bp.onclick = onClick; bp.onclick = onClick;
return bp; return bp;
} }

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

@ -30,10 +30,16 @@ import type { Source } from "../../types";
import "./Footer.css"; import "./Footer.css";
type CursorPosition = {
line: number,
column: number
};
type Props = { type Props = {
selectedSource: Source, selectedSource: Source,
mappedSource: Source, mappedSource: Source,
endPanelCollapsed: boolean, endPanelCollapsed: boolean,
editor: Object,
horizontal: boolean, horizontal: boolean,
togglePrettyPrint: string => void, togglePrettyPrint: string => void,
toggleBlackBox: Object => void, toggleBlackBox: Object => void,
@ -41,7 +47,27 @@ type Props = {
togglePaneCollapse: () => void togglePaneCollapse: () => void
}; };
class SourceFooter extends PureComponent<Props> { type State = {
cursorPosition: CursorPosition
};
class SourceFooter extends PureComponent<Props, State> {
constructor() {
super();
this.state = { cursorPosition: { line: 1, column: 1 } };
}
componentDidMount() {
const { editor } = this.props;
editor.codeMirror.on("cursorActivity", this.onCursorChange);
}
componentWillUnmount() {
const { editor } = this.props;
editor.codeMirror.off("cursorActivity", this.onCursorChange);
}
prettyPrintButton() { prettyPrintButton() {
const { selectedSource, togglePrettyPrint } = this.props; const { selectedSource, togglePrettyPrint } = this.props;
@ -174,6 +200,22 @@ class SourceFooter extends PureComponent<Props> {
); );
} }
onCursorChange = event => {
const { line, ch } = event.doc.getCursor();
this.setState({ cursorPosition: { line, column: ch } });
};
renderCursorPosition() {
const { cursorPosition } = this.state;
const text = L10N.getFormatStr(
"sourceFooter.currentCursorPosition",
cursorPosition.line + 1,
cursorPosition.column + 1
);
return <span className="cursor-position">{text}</span>;
}
render() { render() {
const { selectedSource, horizontal } = this.props; const { selectedSource, horizontal } = this.props;
@ -184,6 +226,7 @@ class SourceFooter extends PureComponent<Props> {
return ( return (
<div className="source-footer"> <div className="source-footer">
{this.renderCommands()} {this.renderCommands()}
{this.renderCursorPosition()}
{this.renderSourceSummary()} {this.renderSourceSummary()}
{this.renderToggleButton()} {this.renderToggleButton()}
</div> </div>

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

@ -16,17 +16,17 @@ import {
getPauseCommand getPauseCommand
} from "../../selectors"; } from "../../selectors";
import type { Frame, Location, Source } from "../../types"; import type { Frame, SourceLocation, Source } from "../../types";
import type { Command } from "../../reducers/types"; import type { Command } from "../../reducers/types";
type Props = { type Props = {
pauseCommand: Command, pauseCommand: Command,
selectedFrame: Frame, selectedFrame: Frame,
selectedLocation: Location, selectedLocation: SourceLocation,
selectedSource: Source selectedSource: Source
}; };
function isDebugLine(selectedFrame: Frame, selectedLocation: Location) { function isDebugLine(selectedFrame: Frame, selectedLocation: SourceLocation) {
if (!selectedFrame) { if (!selectedFrame) {
return; return;
} }
@ -54,7 +54,10 @@ export class HighlightLine extends Component<Props> {
return this.shouldSetHighlightLine(selectedLocation, selectedSource); return this.shouldSetHighlightLine(selectedLocation, selectedSource);
} }
shouldSetHighlightLine(selectedLocation: Location, selectedSource: Source) { shouldSetHighlightLine(
selectedLocation: SourceLocation,
selectedSource: Source
) {
const { sourceId, line } = selectedLocation; const { sourceId, line } = selectedLocation;
const editorLine = toEditorLine(sourceId, line); const editorLine = toEditorLine(sourceId, line);
@ -90,7 +93,7 @@ export class HighlightLine extends Component<Props> {
} }
setHighlightLine( setHighlightLine(
selectedLocation: Location, selectedLocation: SourceLocation,
selectedFrame: Frame, selectedFrame: Frame,
selectedSource: Source selectedSource: Source
) { ) {
@ -110,7 +113,7 @@ export class HighlightLine extends Component<Props> {
doc.addLineClass(editorLine, "line", "highlight-line"); doc.addLineClass(editorLine, "line", "highlight-line");
} }
clearHighlightLine(selectedLocation: Location, selectedSource: Source) { clearHighlightLine(selectedLocation: SourceLocation, selectedSource: Source) {
if (!isDocumentReady(selectedSource, selectedLocation)) { if (!isDocumentReady(selectedSource, selectedLocation)) {
return; return;
} }

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

@ -67,7 +67,7 @@ import "./Highlight.css";
import type SourceEditor from "../../utils/editor/source-editor"; import type SourceEditor from "../../utils/editor/source-editor";
import type { SymbolDeclarations } from "../../workers/parser"; import type { SymbolDeclarations } from "../../workers/parser";
import type { Location, Source } from "../../types"; import type { SourceLocation, Source } from "../../types";
const cssVars = { const cssVars = {
searchbarHeight: "var(--editor-searchbar-height)", searchbarHeight: "var(--editor-searchbar-height)",
@ -75,7 +75,7 @@ const cssVars = {
}; };
export type Props = { export type Props = {
selectedLocation: ?Location, selectedLocation: ?SourceLocation,
selectedSource: ?Source, selectedSource: ?Source,
searchOn: boolean, searchOn: boolean,
horizontal: boolean, horizontal: boolean,
@ -549,7 +549,7 @@ class Editor extends PureComponent<Props, State> {
<EmptyLines editor={editor} /> <EmptyLines editor={editor} />
<Breakpoints editor={editor} /> <Breakpoints editor={editor} />
<Preview editor={editor} editorRef={this.$editorWrapper} />; <Preview editor={editor} editorRef={this.$editorWrapper} />;
<Footer horizontal={horizontal} /> <Footer editor={editor} horizontal={horizontal} />
<HighlightLines editor={editor} /> <HighlightLines editor={editor} />
<EditorMenu editor={editor} /> <EditorMenu editor={editor} />
<GutterMenu editor={editor} /> <GutterMenu editor={editor} />

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

@ -28,7 +28,7 @@ import ManagedTree from "./shared/ManagedTree";
import SearchInput from "./shared/SearchInput"; import SearchInput from "./shared/SearchInput";
import type { List } from "immutable"; import type { List } from "immutable";
import type { Location } from "../types"; import type { SourceLocation } from "../types";
import type { ActiveSearchType } from "../reducers/types"; import type { ActiveSearchType } from "../reducers/types";
import type { StatusType } from "../reducers/project-text-search"; import type { StatusType } from "../reducers/project-text-search";
type Editor = ?Object; type Editor = ?Object;
@ -68,7 +68,7 @@ type Props = {
closeProjectSearch: () => void, closeProjectSearch: () => void,
searchSources: (query: string) => void, searchSources: (query: string) => void,
clearSearch: () => void, clearSearch: () => void,
selectSpecificLocation: (location: Location, tabIndex?: string) => void, selectSpecificLocation: (location: SourceLocation, tabIndex?: string) => void,
setActiveSearch: (activeSearch?: ActiveSearchType) => void, setActiveSearch: (activeSearch?: ActiveSearchType) => void,
doSearchForHighlight: ( doSearchForHighlight: (
query: string, query: string,
@ -150,7 +150,11 @@ export class ProjectSearch extends Component<Props, State> {
isProjectSearchEnabled = () => this.props.activeSearch === "project"; isProjectSearchEnabled = () => this.props.activeSearch === "project";
selectMatchItem = (matchItem: Match) => { selectMatchItem = (matchItem: Match) => {
this.props.selectSpecificLocation({ ...matchItem }); this.props.selectSpecificLocation({
sourceId: matchItem.sourceId,
line: matchItem.line,
column: matchItem.column
});
this.props.doSearchForHighlight( this.props.doSearchForHighlight(
this.state.inputValue, this.state.inputValue,
getEditor(), getEditor(),

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

@ -35,8 +35,9 @@ import type {
QuickOpenResult QuickOpenResult
} from "../utils/quick-open"; } from "../utils/quick-open";
import type { Location, Source } from "../types"; import type { SourceLocation, Source } from "../types";
import type { QuickOpenType } from "../reducers/quick-open"; import type { QuickOpenType } from "../reducers/quick-open";
import type { Tab } from "../reducers/tabs";
import "./QuickOpenModal.css"; import "./QuickOpenModal.css";
@ -48,9 +49,9 @@ type Props = {
searchType: QuickOpenType, searchType: QuickOpenType,
symbols: FormattedSymbolDeclarations, symbols: FormattedSymbolDeclarations,
symbolsLoading: boolean, symbolsLoading: boolean,
tabs: string[], tabs: Tab[],
shortcutsModalEnabled: boolean, shortcutsModalEnabled: boolean,
selectSpecificLocation: Location => void, selectSpecificLocation: SourceLocation => void,
setQuickOpenQuery: (query: string) => void, setQuickOpenQuery: (query: string) => void,
highlightLineRange: ({ start: number, end: number }) => void, highlightLineRange: ({ start: number, end: number }) => void,
closeQuickOpen: () => void, closeQuickOpen: () => void,
@ -125,12 +126,12 @@ export class QuickOpenModal extends Component<Props, State> {
searchSymbols = (query: string) => { searchSymbols = (query: string) => {
const { const {
symbols: { functions, variables } symbols: { functions, identifiers }
} = this.props; } = this.props;
let results = functions; let results = functions;
if (this.isVariableQuery()) { if (this.isVariableQuery()) {
results = variables; results = identifiers;
} else { } else {
results = results.filter(result => result.title !== "anonymous"); results = results.filter(result => result.title !== "anonymous");
} }
@ -154,8 +155,10 @@ export class QuickOpenModal extends Component<Props, State> {
showTopSources = () => { showTopSources = () => {
const { tabs, sources } = this.props; const { tabs, sources } = this.props;
if (tabs.length > 0) { if (tabs.length > 0) {
const tabUrls = tabs.map((tab: Tab) => tab.url);
this.setState({ this.setState({
results: sources.filter(source => tabs.includes(source.url)) results: sources.filter(source => tabUrls.includes(source.url))
}); });
} else { } else {
this.setState({ results: sources.slice(0, 100) }); this.setState({ results: sources.slice(0, 100) });

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

@ -25,12 +25,12 @@ import type {
Breakpoint as BreakpointType, Breakpoint as BreakpointType,
Frame, Frame,
Source, Source,
Location SourceLocation
} from "../../../types"; } from "../../../types";
type FormattedFrame = { type FormattedFrame = {
...Frame, ...Frame,
selectedLocation: Location selectedLocation: SourceLocation
}; };
import { import {
@ -52,6 +52,7 @@ type Props = {
setBreakpointCondition: typeof actions.setBreakpointCondition, setBreakpointCondition: typeof actions.setBreakpointCondition,
toggleAllBreakpoints: typeof actions.toggleAllBreakpoints, toggleAllBreakpoints: typeof actions.toggleAllBreakpoints,
toggleBreakpoints: typeof actions.toggleBreakpoints, toggleBreakpoints: typeof actions.toggleBreakpoints,
toggleDisabledBreakpoint: typeof actions.toggleDisabledBreakpoint,
openConditionalPanel: typeof actions.openConditionalPanel, openConditionalPanel: typeof actions.openConditionalPanel,
selectSpecificLocation: typeof actions.selectSpecificLocation selectSpecificLocation: typeof actions.selectSpecificLocation
}; };
@ -205,6 +206,7 @@ export default connect(
setBreakpointCondition: actions.setBreakpointCondition, setBreakpointCondition: actions.setBreakpointCondition,
toggleAllBreakpoints: actions.toggleAllBreakpoints, toggleAllBreakpoints: actions.toggleAllBreakpoints,
toggleBreakpoints: actions.toggleBreakpoints, toggleBreakpoints: actions.toggleBreakpoints,
toggleDisabledBreakpoint: actions.toggleDisabledBreakpoint,
openConditionalPanel: actions.openConditionalPanel openConditionalPanel: actions.openConditionalPanel
} }
)(Breakpoint); )(Breakpoint);

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

@ -29,7 +29,6 @@ import Breakpoints from "./Breakpoints";
import Expressions from "./Expressions"; import Expressions from "./Expressions";
import SplitBox from "devtools-splitter"; import SplitBox from "devtools-splitter";
import Frames from "./Frames"; import Frames from "./Frames";
import EventListeners from "./EventListeners";
import Workers from "./Workers"; import Workers from "./Workers";
import Accordion from "../shared/Accordion"; import Accordion from "../shared/Accordion";
import CommandBar from "./CommandBar"; import CommandBar from "./CommandBar";
@ -348,14 +347,6 @@ class SecondaryPanes extends Component<Props, State> {
items.push(this.getXHRItem()); items.push(this.getXHRItem());
} }
if (features.eventListeners) {
items.push({
header: L10N.getStr("eventListenersHeader"),
className: "event-listeners-pane",
component: <EventListeners />
});
}
return items.filter(item => item); return items.filter(item => item);
} }

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

@ -10,7 +10,6 @@ DIRS += [
DebuggerModules( DebuggerModules(
'CommandBar.js', 'CommandBar.js',
'EventListeners.js',
'Expressions.js', 'Expressions.js',
'FrameworkComponent.js', 'FrameworkComponent.js',
'index.js', 'index.js',

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

@ -21,7 +21,7 @@ import type {
} from "../workers/parser"; } from "../workers/parser";
import type { Map } from "immutable"; import type { Map } from "immutable";
import type { Location, Source } from "../types"; import type { SourceLocation, Source } from "../types";
import type { Action, DonePromiseAction } from "../actions/types"; import type { Action, DonePromiseAction } from "../actions/types";
import type { Record } from "../utils/makeRecord"; import type { Record } from "../utils/makeRecord";
@ -209,7 +209,7 @@ export function getPausePoints(
export function getPausePoint( export function getPausePoint(
state: OuterState, state: OuterState,
location: ?Location location: ?SourceLocation
): ?PausePoint { ): ?PausePoint {
if (!location) { if (!location) {
return; return;

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

@ -14,7 +14,7 @@ import * as I from "immutable";
import { isGeneratedId } from "devtools-source-map"; import { isGeneratedId } from "devtools-source-map";
import { makeLocationId } from "../utils/breakpoint"; import { makeLocationId } from "../utils/breakpoint";
import type { XHRBreakpoint, Breakpoint, Location } from "../types"; import type { XHRBreakpoint, Breakpoint, SourceLocation } from "../types";
import type { Action, DonePromiseAction } from "../actions/types"; import type { Action, DonePromiseAction } from "../actions/types";
export type BreakpointsMap = { [string]: Breakpoint }; export type BreakpointsMap = { [string]: Breakpoint };
@ -270,7 +270,7 @@ export function getBreakpointCount(state: OuterState): number {
export function getBreakpoint( export function getBreakpoint(
state: OuterState, state: OuterState,
location: Location location: SourceLocation
): ?Breakpoint { ): ?Breakpoint {
const breakpoints = getBreakpointsMap(state); const breakpoints = getBreakpointsMap(state);
return breakpoints[makeLocationId(location)]; return breakpoints[makeLocationId(location)];
@ -322,7 +322,9 @@ export function getHiddenBreakpoint(state: OuterState): ?Breakpoint {
return breakpoints.find(bp => bp.hidden); return breakpoints.find(bp => bp.hidden);
} }
export function getHiddenBreakpointLocation(state: OuterState): ?Location { export function getHiddenBreakpointLocation(
state: OuterState
): ?SourceLocation {
const hiddenBreakpoint = getHiddenBreakpoint(state); const hiddenBreakpoint = getHiddenBreakpoint(state);
if (!hiddenBreakpoint) { if (!hiddenBreakpoint) {
return null; return null;

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

@ -8,7 +8,6 @@
*/ */
import expressions from "./expressions"; import expressions from "./expressions";
import eventListeners from "./event-listeners";
import sources from "./sources"; import sources from "./sources";
import tabs from "./tabs"; import tabs from "./tabs";
import breakpoints from "./breakpoints"; import breakpoints from "./breakpoints";
@ -26,7 +25,6 @@ import { objectInspector } from "devtools-reps";
export default { export default {
expressions, expressions,
eventListeners,
sources, sources,
tabs, tabs,
breakpoints, breakpoints,

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

@ -12,7 +12,6 @@ DebuggerModules(
'async-requests.js', 'async-requests.js',
'breakpoints.js', 'breakpoints.js',
'debuggee.js', 'debuggee.js',
'event-listeners.js',
'expressions.js', 'expressions.js',
'file-search.js', 'file-search.js',
'index.js', 'index.js',

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

@ -20,7 +20,7 @@ import {
import { originalToGeneratedId } from "devtools-source-map"; import { originalToGeneratedId } from "devtools-source-map";
import { prefs } from "../utils/prefs"; import { prefs } from "../utils/prefs";
import type { Source, SourceId, Location } from "../types"; import type { Source, SourceId, SourceLocation } from "../types";
import type { PendingSelectedLocation } from "./types"; import type { PendingSelectedLocation } from "./types";
import type { Action, DonePromiseAction } from "../actions/types"; import type { Action, DonePromiseAction } from "../actions/types";
import type { LoadSourceAction } from "../actions/types/SourceAction"; import type { LoadSourceAction } from "../actions/types/SourceAction";
@ -34,7 +34,7 @@ export type SourcesState = {
urls: UrlsMap, urls: UrlsMap,
relativeSources: SourcesMap, relativeSources: SourcesMap,
pendingSelectedLocation?: PendingSelectedLocation, pendingSelectedLocation?: PendingSelectedLocation,
selectedLocation: ?Location, selectedLocation: ?SourceLocation,
projectDirectoryRoot: string projectDirectoryRoot: string
}; };
@ -483,7 +483,7 @@ export const getSelectedLocation = createSelector(
export const getSelectedSource = createSelector( export const getSelectedSource = createSelector(
getSelectedLocation, getSelectedLocation,
getSources, getSources,
(selectedLocation: ?Location, sources: SourcesMap): ?Source => { (selectedLocation: ?SourceLocation, sources: SourcesMap): ?Source => {
if (!selectedLocation) { if (!selectedLocation) {
return; return;
} }

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

@ -26,7 +26,7 @@ import type { Action } from "../actions/types";
import type { SourcesState } from "./sources"; import type { SourcesState } from "./sources";
import type { Source } from "../types"; import type { Source } from "../types";
type Tab = { export type Tab = {
url: string, url: string,
framework?: string | null, framework?: string | null,
isOriginal: boolean, isOriginal: boolean,

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

@ -12,7 +12,7 @@
import makeRecord from "../utils/makeRecord"; import makeRecord from "../utils/makeRecord";
import { prefs } from "../utils/prefs"; import { prefs } from "../utils/prefs";
import type { Source, Range } from "../types"; import type { Source, PartialRange } from "../types";
import type { Action, panelPositionType } from "../actions/types"; import type { Action, panelPositionType } from "../actions/types";
import type { Record } from "../utils/makeRecord"; import type { Record } from "../utils/makeRecord";
@ -23,7 +23,7 @@ export type OrientationType = "horizontal" | "vertical";
export type SelectedPrimaryPaneTabType = "sources" | "outline"; export type SelectedPrimaryPaneTabType = "sources" | "outline";
type Viewport = Range; type Viewport = PartialRange;
export type UIState = { export type UIState = {
selectedPrimaryPaneTab: SelectedPrimaryPaneTabType, selectedPrimaryPaneTab: SelectedPrimaryPaneTabType,

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

@ -14,7 +14,12 @@ import {
import { isGenerated, getFilename } from "../utils/source"; import { isGenerated, getFilename } from "../utils/source";
import { getSelectedLocation } from "../utils/source-maps"; import { getSelectedLocation } from "../utils/source-maps";
import type { Source, Breakpoint, BreakpointId, Location } from "../types"; import type {
Source,
Breakpoint,
BreakpointId,
SourceLocation
} from "../types";
import type { SourcesMap } from "../reducers/types"; import type { SourcesMap } from "../reducers/types";
export type BreakpointSources = Array<{ export type BreakpointSources = Array<{
@ -27,7 +32,7 @@ export type FormattedBreakpoint = {|
condition: ?string, condition: ?string,
disabled: boolean, disabled: boolean,
text: string, text: string,
selectedLocation: Location selectedLocation: SourceLocation
|}; |};
function formatBreakpoint( function formatBreakpoint(

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

@ -17,7 +17,6 @@ export * from "../reducers/ast";
export * from "../reducers/project-text-search"; export * from "../reducers/project-text-search";
export * from "../reducers/source-tree"; export * from "../reducers/source-tree";
export { getEventListeners } from "../reducers/event-listeners";
export { export {
getQuickOpenEnabled, getQuickOpenEnabled,
getQuickOpenQuery, getQuickOpenQuery,

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

@ -2,17 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import { groupBy, hasIn } from "lodash"; import { groupBy, hasIn, sortedUniqBy } from "lodash";
import { createSelector } from "reselect"; import { createSelector } from "reselect";
import { getViewport } from "../selectors"; import { getViewport } from "../selectors";
import { getVisibleBreakpoints } from "./visibleBreakpoints"; import { getVisibleBreakpoints } from "./visibleBreakpoints";
import { getVisiblePausePoints } from "./visiblePausePoints"; import { getVisiblePausePoints } from "./visiblePausePoints";
import { makeLocationId } from "../utils/breakpoint";
import type { Location } from "../types"; import type { SourceLocation } from "../types";
export type ColumnBreakpoint = {| export type ColumnBreakpoint = {|
+location: Location, +location: SourceLocation,
+enabled: boolean +enabled: boolean
|}; |};
@ -39,6 +40,19 @@ function isEnabled(location, breakpointMap) {
return hasIn(breakpointMap, [line, column]); return hasIn(breakpointMap, [line, column]);
} }
function getLineCount(columnBreakpoints) {
const lineCount = {};
columnBreakpoints.forEach(({ location: { line } }) => {
if (!lineCount[line]) {
lineCount[line] = 0;
}
lineCount[line] = lineCount[line] + 1;
});
return lineCount;
}
export function formatColumnBreakpoints(columnBreakpoints) { export function formatColumnBreakpoints(columnBreakpoints) {
console.log( console.log(
"Column Breakpoints\n\n", "Column Breakpoints\n\n",
@ -57,10 +71,35 @@ export function getColumnBreakpoints(pausePoints, breakpoints, viewport) {
} }
const breakpointMap = groupBreakpoints(breakpoints); const breakpointMap = groupBreakpoints(breakpoints);
const columnBreakpoints = pausePoints
.filter(({ types }) => types.break) // We only want to show a column breakpoint if several conditions are matched
.filter(({ location }) => breakpointMap[location.line]) // 1. it is a "break" point and not a "step" point
.filter(({ location }) => viewport && contains(location, viewport)); // 2. there is a breakpoint on that line
// 3. the breakpoint is in the current viewport
// 4. it is the first breakpoint to appear at that generated location
// 5. there is atleast one other breakpoint on that line
let columnBreakpoints = pausePoints.filter(
({ types, location }) =>
// 1. check that the pause point is a "break" point
types.break &&
// 2. check that there is a registered breakpoint on the line
breakpointMap[location.line] &&
// 3. check that the breakpoint is visible
viewport &&
contains(location, viewport)
);
// 4. Only show one column breakpoint per generated location
columnBreakpoints = sortedUniqBy(columnBreakpoints, ({ generatedLocation }) =>
makeLocationId(generatedLocation)
);
// 5. Check that there is atleast one other possible breakpoint on the line
const lineCount = getLineCount(columnBreakpoints);
columnBreakpoints = columnBreakpoints.filter(
({ location: { line } }) => lineCount[line] > 1
);
return columnBreakpoints.map(({ location }) => ({ return columnBreakpoints.map(({ location }) => ({
location, location,

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

@ -9,9 +9,9 @@ import { getSelectedFrame } from "../reducers/pause";
import { isOriginalId } from "devtools-source-map"; import { isOriginalId } from "devtools-source-map";
import { createSelector } from "reselect"; import { createSelector } from "reselect";
import type { Frame, Location } from "../types"; import type { Frame, SourceLocation } from "../types";
function getLocation(frame: Frame, location?: Location) { function getLocation(frame: Frame, location?: SourceLocation) {
if (!location) { if (!location) {
return frame.location; return frame.location;
} }

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

@ -7,7 +7,7 @@
import { xor, range } from "lodash"; import { xor, range } from "lodash";
import { convertToList } from "./pause/pausePoints"; import { convertToList } from "./pause/pausePoints";
import type { Location, ColumnPosition } from "../types"; import type { SourceLocation, Position } from "../types";
import type { Symbols } from "../reducers/ast"; import type { Symbols } from "../reducers/ast";
import type { import type {
@ -18,10 +18,7 @@ import type {
ClassDeclaration ClassDeclaration
} from "../workers/parser"; } from "../workers/parser";
export function findBestMatchExpression( export function findBestMatchExpression(symbols: Symbols, tokenPos: Position) {
symbols: Symbols,
tokenPos: ColumnPosition
) {
if (symbols.loading) { if (symbols.loading) {
return null; return null;
} }
@ -75,7 +72,7 @@ export function containsPosition(a: AstLocation, b: AstPosition) {
return startsBefore && endsAfter; return startsBefore && endsAfter;
} }
function findClosestofSymbol(declarations: any[], location: Location) { function findClosestofSymbol(declarations: any[], location: SourceLocation) {
if (!declarations) { if (!declarations) {
return null; return null;
} }
@ -111,7 +108,7 @@ function findClosestofSymbol(declarations: any[], location: Location) {
export function findClosestFunction( export function findClosestFunction(
symbols: ?Symbols, symbols: ?Symbols,
location: Location location: SourceLocation
): FunctionDeclaration | null { ): FunctionDeclaration | null {
if (!symbols || symbols.loading) { if (!symbols || symbols.loading) {
return null; return null;
@ -122,7 +119,7 @@ export function findClosestFunction(
export function findClosestClass( export function findClosestClass(
symbols: Symbols, symbols: Symbols,
location: Location location: SourceLocation
): ClassDeclaration | null { ): ClassDeclaration | null {
if (!symbols || symbols.loading) { if (!symbols || symbols.loading) {
return null; return null;

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

@ -19,7 +19,7 @@ import configureStore from "../actions/utils/create-store";
import reducers from "../reducers"; import reducers from "../reducers";
import * as selectors from "../selectors"; import * as selectors from "../selectors";
import App from "../components/App"; import App from "../components/App";
import { asyncStore } from "./prefs"; import { asyncStore, prefs } from "./prefs";
function renderPanel(component, store) { function renderPanel(component, store) {
const root = document.createElement("div"); const root = document.createElement("div");
@ -43,7 +43,7 @@ export function bootstrapStore(
initialState: Object initialState: Object
) { ) {
const createStore = configureStore({ const createStore = configureStore({
log: isTesting(), log: prefs.logging || isTesting(),
timing: isDevelopment(), timing: isDevelopment(),
makeThunkArgs: (args, state) => { makeThunkArgs: (args, state) => {
return { ...args, client, ...services, ...toolboxActions }; return { ...args, client, ...services, ...toolboxActions };

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

@ -9,12 +9,12 @@ import { findClosestFunction } from "../ast";
import type { SymbolDeclarations } from "../../workers/parser"; import type { SymbolDeclarations } from "../../workers/parser";
import type { Location, Source, ASTLocation } from "../../types"; import type { SourceLocation, Source, ASTLocation } from "../../types";
export function getASTLocation( export function getASTLocation(
source: Source, source: Source,
symbols: SymbolDeclarations, symbols: SymbolDeclarations,
location: Location location: SourceLocation
): ASTLocation { ): ASTLocation {
if (source.isWasm || !symbols || symbols.loading) { if (source.isWasm || !symbols || symbols.loading) {
return { name: undefined, offset: location }; return { name: undefined, offset: location };

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

@ -14,7 +14,7 @@ export { getASTLocation, findScopeByName } from "./astBreakpointLocation";
import type { FormattedBreakpoint } from "../../selectors/breakpointSources"; import type { FormattedBreakpoint } from "../../selectors/breakpointSources";
import type { import type {
Location, SourceLocation,
PendingLocation, PendingLocation,
Breakpoint, Breakpoint,
PendingBreakpoint PendingBreakpoint
@ -33,24 +33,27 @@ export function firstString(...args: string[]) {
return null; return null;
} }
export function locationMoved(location: Location, newLocation: Location) { export function locationMoved(
location: SourceLocation,
newLocation: SourceLocation
) {
return ( return (
location.line !== newLocation.line || location.column !== newLocation.column location.line !== newLocation.line || location.column !== newLocation.column
); );
} }
export function makeLocationId(location: Location) { export function makeLocationId(location: SourceLocation) {
const { sourceId, line, column } = location; const { sourceId, line, column } = location;
const columnString = column || ""; const columnString = column || "";
return `${sourceId}:${line}:${columnString}`; return `${sourceId}:${line}:${columnString}`;
} }
export function getLocationWithoutColumn(location: Location) { export function getLocationWithoutColumn(location: SourceLocation) {
const { sourceId, line } = location; const { sourceId, line } = location;
return `${sourceId}:${line}`; return `${sourceId}:${line}`;
} }
export function makePendingLocationId(location: Location) { export function makePendingLocationId(location: SourceLocation) {
assertPendingLocation(location); assertPendingLocation(location);
const { sourceUrl, line, column } = location; const { sourceUrl, line, column } = location;
const sourceUrlString = sourceUrl || ""; const sourceUrlString = sourceUrl || "";
@ -69,7 +72,7 @@ export function assertPendingBreakpoint(pendingBreakpoint: PendingBreakpoint) {
assertPendingLocation(pendingBreakpoint.generatedLocation); assertPendingLocation(pendingBreakpoint.generatedLocation);
} }
export function assertLocation(location: Location) { export function assertLocation(location: SourceLocation) {
assertPendingLocation(location); assertPendingLocation(location);
const { sourceId } = location; const { sourceId } = location;
assert(!!sourceId, "location must have a source id"); assert(!!sourceId, "location must have a source id");
@ -92,7 +95,7 @@ export function assertPendingLocation(location: PendingLocation) {
// syncing // syncing
export function breakpointAtLocation( export function breakpointAtLocation(
breakpoints: Breakpoint[], breakpoints: Breakpoint[],
{ line, column }: Location { line, column }: SourceLocation
) { ) {
return breakpoints.find(breakpoint => { return breakpoints.find(breakpoint => {
const sameLine = breakpoint.location.line === line; const sameLine = breakpoint.location.line === line;
@ -110,13 +113,13 @@ export function breakpointAtLocation(
}); });
} }
export function breakpointExists(state: State, location: Location) { export function breakpointExists(state: State, location: SourceLocation) {
const currentBp = getBreakpoint(state, location); const currentBp = getBreakpoint(state, location);
return currentBp && !currentBp.disabled; return currentBp && !currentBp.disabled;
} }
export function createBreakpoint( export function createBreakpoint(
location: Location, location: SourceLocation,
overrides: Object = {} overrides: Object = {}
): Breakpoint { ): Breakpoint {
const { const {

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

@ -49,8 +49,9 @@ function getCM() {
} }
function _formatPausePoints(dbg: Object, url: string) { function _formatPausePoints(dbg: Object, url: string) {
const source = dbg.helpers.findSource(url); const source =
const pausePoints = dbg.selectors.getPausePoints(source); dbg.helpers.findSource(url) || dbg.selectors.getSelectedSource();
const pausePoints = dbg.selectors.getPausePoints(source.id);
console.log(formatPausePoints(source.text, pausePoints)); console.log(formatPausePoints(source.text, pausePoints));
} }

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

@ -4,7 +4,7 @@
// @flow // @flow
import type { ColumnPosition } from "../../types"; import type { Position } from "../../types";
type Token = { type Token = {
startColumn: number, startColumn: number,
@ -14,7 +14,7 @@ type Token = {
export function tokenAtTextPosition( export function tokenAtTextPosition(
cm: any, cm: any,
{ line, column }: ColumnPosition { line, column }: Position
): Token | null { ): Token | null {
if (line < 0 || line >= cm.lineCount()) { if (line < 0 || line >= cm.lineCount()) {
return null; return null;
@ -30,7 +30,7 @@ export function tokenAtTextPosition(
// The strategy of querying codeMirror tokens was borrowed // The strategy of querying codeMirror tokens was borrowed
// from Chrome's inital implementation in JavaScriptSourceFrame.js#L414 // from Chrome's inital implementation in JavaScriptSourceFrame.js#L414
export function getExpressionFromCoords(cm: any, coord: ColumnPosition) { export function getExpressionFromCoords(cm: any, coord: Position) {
const token = tokenAtTextPosition(cm, coord); const token = tokenAtTextPosition(cm, coord);
if (!token) { if (!token) {
return null; return null;

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

@ -3,12 +3,12 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// @flow // @flow
import type { ColumnPosition } from "../../types"; import type { Position } from "../../types";
export function getTokenLocation( export function getTokenLocation(
codeMirror: any, codeMirror: any,
tokenEl: HTMLElement tokenEl: HTMLElement
): ColumnPosition { ): Position {
const { left, top, width, height } = tokenEl.getBoundingClientRect(); const { left, top, width, height } = tokenEl.getBoundingClientRect();
const { line, ch } = codeMirror.coordsChar({ const { line, ch } = codeMirror.coordsChar({
left: left + width / 2, left: left + width / 2,

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

@ -18,7 +18,7 @@ import { isWasm, lineToWasmOffset, wasmOffsetToLine } from "../wasm";
import type { AstLocation } from "../../workers/parser"; import type { AstLocation } from "../../workers/parser";
import type { EditorPosition, EditorRange } from "../editor/types"; import type { EditorPosition, EditorRange } from "../editor/types";
import type { Location } from "../../types"; import type { SourceLocation } from "../../types";
type Editor = Object; type Editor = Object;
let editor: ?Editor; let editor: ?Editor;
@ -96,7 +96,7 @@ export function toEditorLine(sourceId: string, lineOrOffset: number): number {
return lineOrOffset ? lineOrOffset - 1 : 1; return lineOrOffset ? lineOrOffset - 1 : 1;
} }
export function toEditorPosition(location: Location): EditorPosition { export function toEditorPosition(location: SourceLocation): EditorPosition {
return { return {
line: toEditorLine(location.sourceId, location.line), line: toEditorLine(location.sourceId, location.line),
column: isWasm(location.sourceId) || !location.column ? 0 : location.column column: isWasm(location.sourceId) || !location.column ? 0 : location.column
@ -201,7 +201,7 @@ export function lineAtHeight(_editor, sourceId, event) {
export function getSourceLocationFromMouseEvent( export function getSourceLocationFromMouseEvent(
_editor: Object, _editor: Object,
selectedLocation: Location, selectedLocation: SourceLocation,
e: MouseEvent e: MouseEvent
) { ) {
const { line, ch } = _editor.codeMirror.coordsChar({ const { line, ch } = _editor.codeMirror.coordsChar({

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

@ -4,7 +4,7 @@
// @flow // @flow
import type { Location, SourceId } from "../types"; import type { SourceLocation, SourceId } from "../types";
type IncompleteLocation = { type IncompleteLocation = {
sourceId: SourceId, sourceId: SourceId,
@ -18,7 +18,7 @@ export function createLocation({
line, line,
column, column,
sourceUrl sourceUrl
}: IncompleteLocation): Location { }: IncompleteLocation): SourceLocation {
return { return {
sourceId, sourceId,
line: line || 0, line: line || 0,

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

@ -12,7 +12,7 @@
* @module utils/log * @module utils/log
*/ */
import { isDevelopment } from "devtools-environment"; import { prefs } from "./prefs";
/** /**
* Produces a formatted console log line by imploding args, prefixed by [log] * Produces a formatted console log line by imploding args, prefixed by [log]
@ -24,9 +24,7 @@ import { isDevelopment } from "devtools-environment";
* @static * @static
*/ */
export function log(...args: any[]) { export function log(...args: any[]) {
if (!isDevelopment()) { if (prefs.logging) {
return; console.log(...args);
} }
console.log.apply(console, ["[log]", ...args]);
} }

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

@ -9,7 +9,7 @@ import { positionCmp } from "./positionCmp";
import { filterSortedArray } from "./filtering"; import { filterSortedArray } from "./filtering";
import { mappingContains } from "./mappingContains"; import { mappingContains } from "./mappingContains";
import type { Source, Location, Position } from "../../../types"; import type { Source, SourceLocation, PartialPosition } from "../../../types";
import type { GeneratedBindingLocation } from "./buildGeneratedBindingList"; import type { GeneratedBindingLocation } from "./buildGeneratedBindingList";
@ -21,8 +21,8 @@ export type ApplicableBinding = {
}; };
type GeneratedRange = { type GeneratedRange = {
start: Position, start: PartialPosition,
end: Position end: PartialPosition
}; };
export async function originalRangeStartsInside( export async function originalRangeStartsInside(
@ -31,8 +31,8 @@ export async function originalRangeStartsInside(
start, start,
end end
}: { }: {
start: Location, start: SourceLocation,
end: Location end: SourceLocation
}, },
sourceMaps: any sourceMaps: any
) { ) {
@ -53,8 +53,8 @@ export async function getApplicableBindingsForOriginalPosition(
start, start,
end end
}: { }: {
start: Location, start: SourceLocation,
end: Location end: SourceLocation
}, },
bindingType: BindingType, bindingType: BindingType,
locationType: BindingLocationType, locationType: BindingLocationType,

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

@ -36,7 +36,7 @@ import {
import { log } from "../../log"; import { log } from "../../log";
import type { import type {
Position, PartialPosition,
Frame, Frame,
Scope, Scope,
Source, Source,
@ -254,7 +254,7 @@ function batchScopeMappings(
} }
}; };
} }
function buildLocationKey(loc: Position): string { function buildLocationKey(loc: PartialPosition): string {
return `${loc.line}:${locColumn(loc)}`; return `${loc.line}:${locColumn(loc)}`;
} }

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

@ -4,9 +4,9 @@
// @flow // @flow
import type { Position } from "../../../types"; import type { PartialPosition } from "../../../types";
export function locColumn(loc: Position): number { export function locColumn(loc: PartialPosition): number {
if (typeof loc.column !== "number") { if (typeof loc.column !== "number") {
// This shouldn't really happen with locations from the AST, but // This shouldn't really happen with locations from the AST, but
// the datatype we are using allows null/undefined column. // the datatype we are using allows null/undefined column.

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

@ -4,12 +4,12 @@
// @flow // @flow
import type { Position } from "../../../types"; import type { PartialPosition } from "../../../types";
import { positionCmp } from "./positionCmp"; import { positionCmp } from "./positionCmp";
export function mappingContains( export function mappingContains(
mapped: { +start: Position, +end: Position }, mapped: { +start: PartialPosition, +end: PartialPosition },
item: { +start: Position, +end: Position } item: { +start: PartialPosition, +end: PartialPosition }
) { ) {
return ( return (
positionCmp(item.start, mapped.start) >= 0 && positionCmp(item.start, mapped.start) >= 0 &&

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

@ -4,7 +4,7 @@
// @flow // @flow
import type { Position } from "../../../types"; import type { PartialPosition } from "../../../types";
import { locColumn } from "./locColumn"; import { locColumn } from "./locColumn";
/** /**
@ -12,7 +12,7 @@ import { locColumn } from "./locColumn";
* * < 0 - first position before second position * * < 0 - first position before second position
* * > 0 - first position after second position * * > 0 - first position after second position
*/ */
export function positionCmp(p1: Position, p2: Position) { export function positionCmp(p1: PartialPosition, p2: PartialPosition) {
if (p1.line === p2.line) { if (p1.line === p2.line) {
const l1 = locColumn(p1); const l1 = locColumn(p1);
const l2 = locColumn(p2); const l2 = locColumn(p2);

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

@ -9,7 +9,7 @@ import { positionCmp } from "./positionCmp";
import { filterSortedArray } from "./filtering"; import { filterSortedArray } from "./filtering";
import type { SourceScope } from "../../../workers/parser"; import type { SourceScope } from "../../../workers/parser";
import type { Position, Frame, Source } from "../../../types"; import type { PartialPosition, Frame, Source } from "../../../types";
type SourceOriginalRange = { type SourceOriginalRange = {
line: number, line: number,
@ -118,7 +118,7 @@ export async function loadRangeMetadata(
export function findMatchingRange( export function findMatchingRange(
sortedOriginalRanges: Array<MappedOriginalRange>, sortedOriginalRanges: Array<MappedOriginalRange>,
bindingRange: { +end: Position, +start: Position } bindingRange: { +end: PartialPosition, +start: PartialPosition }
): ?MappedOriginalRange { ): ?MappedOriginalRange {
return filterSortedArray(sortedOriginalRanges, range => { return filterSortedArray(sortedOriginalRanges, range => {
if (range.line < bindingRange.start.line) { if (range.line < bindingRange.start.line) {

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

@ -6,10 +6,10 @@
import { reverse } from "lodash"; import { reverse } from "lodash";
import type { PausePoints } from "../../workers/parser"; import type { PausePoints } from "../../workers/parser";
import type { ColumnPosition } from "../../types"; import type { Position } from "../../types";
type PausePoint = { type PausePoint = {
location: ColumnPosition, location: Position,
types: { break: boolean, step: boolean } types: { break: boolean, step: boolean }
}; };
@ -23,11 +23,7 @@ export function convertToList(pausePoints: PausePoints): PausePoint[] {
const list = []; const list = [];
for (const line in pausePoints) { for (const line in pausePoints) {
for (const column in pausePoints[line]) { for (const column in pausePoints[line]) {
const point = pausePoints[line][column]; list.push(pausePoints[line][column]);
list.push({
location: { line: parseInt(line, 10), column: parseInt(column, 10) },
types: point
});
} }
} }
return list; return list;
@ -45,3 +41,16 @@ export function formatPausePoints(text: string, pausePoints: PausePoints) {
return lines.join("\n"); return lines.join("\n");
} }
export async function mapPausePoints(pausePoints, iteratee) {
const results = await Promise.all(convertToList(pausePoints).map(iteratee));
for (const line in pausePoints) {
const linePoints = pausePoints[line];
for (const column in linePoints) {
linePoints[column] = results.shift();
}
}
return pausePoints;
}

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

@ -37,7 +37,7 @@ export function shouldStep(rootFrame: ?Frame, state: State, sourceMaps: any) {
const sameLocation = previousFrameLoc && isEqual(previousFrameLoc, frameLoc); const sameLocation = previousFrameLoc && isEqual(previousFrameLoc, frameLoc);
const pausePoint = getPausePoint(state, frameLoc); const pausePoint = getPausePoint(state, frameLoc);
const invalidPauseLocation = pausePoint && !pausePoint.step; const invalidPauseLocation = pausePoint && !pausePoint.types.step;
// We always want to pause in generated locations // We always want to pause in generated locations
if (!frameLoc || isGeneratedId(frameLoc.sourceId)) { if (!frameLoc || isGeneratedId(frameLoc.sourceId)) {

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

@ -14,6 +14,7 @@ const prefsSchemaVersion = "1.0.5";
const pref = Services.pref; const pref = Services.pref;
if (isDevelopment()) { if (isDevelopment()) {
pref("devtools.debugger.logging", false);
pref("devtools.debugger.alphabetize-outline", false); pref("devtools.debugger.alphabetize-outline", false);
pref("devtools.debugger.auto-pretty-print", false); pref("devtools.debugger.auto-pretty-print", false);
pref("devtools.source-map.client-service.enabled", true); pref("devtools.source-map.client-service.enabled", true);
@ -50,7 +51,6 @@ if (isDevelopment()) {
pref("devtools.debugger.features.root", true); pref("devtools.debugger.features.root", true);
pref("devtools.debugger.features.map-scopes", true); pref("devtools.debugger.features.map-scopes", true);
pref("devtools.debugger.features.remove-command-bar-options", true); pref("devtools.debugger.features.remove-command-bar-options", true);
pref("devtools.debugger.features.event-listeners", false);
pref("devtools.debugger.features.code-folding", false); pref("devtools.debugger.features.code-folding", false);
pref("devtools.debugger.features.outline", true); pref("devtools.debugger.features.outline", true);
pref("devtools.debugger.features.column-breakpoints", false); pref("devtools.debugger.features.column-breakpoints", false);
@ -64,6 +64,7 @@ if (isDevelopment()) {
} }
export const prefs = new PrefsHelper("devtools", { export const prefs = new PrefsHelper("devtools", {
logging: ["Bool", "debugger.alphabetize-outline"],
alphabetizeOutline: ["Bool", "debugger.alphabetize-outline"], alphabetizeOutline: ["Bool", "debugger.alphabetize-outline"],
autoPrettyPrint: ["Bool", "debugger.auto-pretty-print"], autoPrettyPrint: ["Bool", "debugger.auto-pretty-print"],
clientSourceMapsEnabled: ["Bool", "source-map.client-service.enabled"], clientSourceMapsEnabled: ["Bool", "source-map.client-service.enabled"],
@ -104,7 +105,6 @@ export const features = new PrefsHelper("devtools.debugger.features", {
mapScopes: ["Bool", "map-scopes"], mapScopes: ["Bool", "map-scopes"],
removeCommandBarOptions: ["Bool", "remove-command-bar-options"], removeCommandBarOptions: ["Bool", "remove-command-bar-options"],
workers: ["Bool", "workers"], workers: ["Bool", "workers"],
eventListeners: ["Bool", "event-listeners"],
outline: ["Bool", "outline"], outline: ["Bool", "outline"],
codeFolding: ["Bool", "code-folding"], codeFolding: ["Bool", "code-folding"],
pausePoints: ["Bool", "pause-points"], pausePoints: ["Bool", "pause-points"],

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

@ -5,7 +5,12 @@
// @flow // @flow
import classnames from "classnames"; import classnames from "classnames";
import { endTruncateStr } from "./utils"; import { endTruncateStr } from "./utils";
import { isPretty, getFilename, getSourceClassnames } from "./source"; import {
isPretty,
getFilename,
getSourceClassnames,
getSourceQueryString
} from "./source";
import type { Location as BabelLocation } from "@babel/types"; import type { Location as BabelLocation } from "@babel/types";
import type { Symbols } from "../reducers/ast"; import type { Symbols } from "../reducers/ast";
@ -53,9 +58,13 @@ export function parseLineColumn(query: string) {
export function formatSourcesForList(source: Source, tabs: TabList) { export function formatSourcesForList(source: Source, tabs: TabList) {
const title = getFilename(source); const title = getFilename(source);
const subtitle = endTruncateStr(source.relativeUrl, 100); const relativeUrlWithQuery = `${source.relativeUrl}${getSourceQueryString(
source
)}`;
const subtitle = endTruncateStr(relativeUrlWithQuery, 100);
const value = relativeUrlWithQuery;
return { return {
value: source.relativeUrl, value,
title, title,
subtitle, subtitle,
icon: tabs.some(tab => tab.url == source.url) icon: tabs.some(tab => tab.url == source.url)
@ -93,13 +102,12 @@ export function formatSymbol(symbol: SymbolDeclaration): QuickOpenResult {
export function formatSymbols(symbols: ?Symbols): FormattedSymbolDeclarations { export function formatSymbols(symbols: ?Symbols): FormattedSymbolDeclarations {
if (!symbols || symbols.loading) { if (!symbols || symbols.loading) {
return { variables: [], functions: [] }; return { functions: [] };
} }
const { variables, functions } = symbols; const { functions } = symbols;
return { return {
variables: variables.map(formatSymbol),
functions: functions.map(formatSymbol) functions: functions.map(formatSymbol)
}; };
} }

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

@ -7,15 +7,15 @@
import { isOriginalId } from "devtools-source-map"; import { isOriginalId } from "devtools-source-map";
import { getSource } from "../selectors"; import { getSource } from "../selectors";
import type { Location, MappedLocation, Source } from "../types"; import type { SourceLocation, MappedLocation, Source } from "../types";
import { isGenerated } from "../utils/source"; import { isGenerated } from "../utils/source";
export async function getGeneratedLocation( export async function getGeneratedLocation(
state: Object, state: Object,
source: Source, source: Source,
location: Location, location: SourceLocation,
sourceMaps: Object sourceMaps: Object
): Promise<Location> { ): Promise<SourceLocation> {
if (!isOriginalId(location.sourceId)) { if (!isOriginalId(location.sourceId)) {
return location; return location;
} }
@ -41,8 +41,8 @@ export async function getGeneratedLocation(
export async function getMappedLocation( export async function getMappedLocation(
state: Object, state: Object,
sourceMaps: Object, sourceMaps: Object,
location: Location location: SourceLocation
): Promise<Location> { ): Promise<SourceLocation> {
const source = getSource(state, location.sourceId); const source = getSource(state, location.sourceId);
if (!source) { if (!source) {

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

@ -21,7 +21,7 @@ export { isMinified } from "./isMinified";
import { getURL, getFileExtension } from "./sources-tree"; import { getURL, getFileExtension } from "./sources-tree";
import { prefs } from "./prefs"; import { prefs } from "./prefs";
import type { Source, Location, JsSource } from "../types"; import type { Source, SourceLocation, JsSource } from "../types";
import type { SourceMetaDataType } from "../reducers/ast"; import type { SourceMetaDataType } from "../reducers/ast";
import type { SymbolDeclarations } from "../workers/parser"; import type { SymbolDeclarations } from "../workers/parser";
@ -386,7 +386,7 @@ export function isLoading(source: Source) {
return source.loadedState === "loading"; return source.loadedState === "loading";
} }
export function getTextAtPosition(source: ?Source, location: Location) { export function getTextAtPosition(source: ?Source, location: SourceLocation) {
if (!source || !source.text) { if (!source || !source.text) {
return ""; return "";
} }

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

@ -27,11 +27,11 @@ export type {
BindingType BindingType
}; };
import type { Location } from "../../../types"; import type { SourceLocation } from "../../../types";
let parsedScopesCache = new Map(); let parsedScopesCache = new Map();
export default function getScopes(location: Location): SourceScope[] { export default function getScopes(location: SourceLocation): SourceScope[] {
const { sourceId } = location; const { sourceId } = location;
let parsedScopes = parsedScopesCache.get(sourceId); let parsedScopes = parsedScopesCache.get(sourceId);
if (!parsedScopes) { if (!parsedScopes) {
@ -50,7 +50,10 @@ export { buildScopeList };
/** /**
* Searches all scopes and their bindings at the specific location. * Searches all scopes and their bindings at the specific location.
*/ */
function findScopes(scopes: ParsedScope[], location: Location): SourceScope[] { function findScopes(
scopes: ParsedScope[],
location: SourceLocation
): SourceScope[] {
// Find inner most in the tree structure. // Find inner most in the tree structure.
let searchInScopes: ?(ParsedScope[]) = scopes; let searchInScopes: ?(ParsedScope[]) = scopes;
const found = []; const found = [];
@ -82,7 +85,7 @@ function findScopes(scopes: ParsedScope[], location: Location): SourceScope[] {
}); });
} }
function compareLocations(a: Location, b: Location): number { function compareLocations(a: SourceLocation, b: SourceLocation): number {
// According to type of Location.column can be undefined, if will not be the // According to type of Location.column can be undefined, if will not be the
// case here, ignoring flow error. // case here, ignoring flow error.
// $FlowIgnore // $FlowIgnore

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

@ -8,7 +8,7 @@ import { workerUtils } from "devtools-utils";
const { WorkerDispatcher } = workerUtils; const { WorkerDispatcher } = workerUtils;
import type { AstLocation, AstPosition, PausePoints } from "./types"; import type { AstLocation, AstPosition, PausePoints } from "./types";
import type { Location, Source, SourceId } from "../../types"; import type { SourceLocation, Source, SourceId } from "../../types";
import type { SourceScope } from "./getScopes/visitor"; import type { SourceScope } from "./getScopes/visitor";
import type { SymbolDeclarations } from "./getSymbols"; import type { SymbolDeclarations } from "./getSymbols";
@ -26,14 +26,15 @@ export const findOutOfScopeLocations = async (
export const getNextStep = async ( export const getNextStep = async (
sourceId: SourceId, sourceId: SourceId,
pausedPosition: AstPosition pausedPosition: AstPosition
): Promise<?Location> => ): Promise<?SourceLocation> =>
dispatcher.invoke("getNextStep", sourceId, pausedPosition); dispatcher.invoke("getNextStep", sourceId, pausedPosition);
export const clearASTs = async (): Promise<void> => export const clearASTs = async (): Promise<void> =>
dispatcher.invoke("clearASTs"); dispatcher.invoke("clearASTs");
export const getScopes = async (location: Location): Promise<SourceScope[]> => export const getScopes = async (
dispatcher.invoke("getScopes", location); location: SourceLocation
): Promise<SourceScope[]> => dispatcher.invoke("getScopes", location);
export const clearScopes = async (): Promise<void> => export const clearScopes = async (): Promise<void> =>
dispatcher.invoke("clearScopes"); dispatcher.invoke("clearScopes");

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

@ -8,7 +8,7 @@ function openFirstBreakpointContextMenu(dbg){
// Tests to see if we can trigger a breakpoint action via the context menu // Tests to see if we can trigger a breakpoint action via the context menu
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple2");
await selectSource(dbg, "simple2"); await selectSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2"); await waitForSelectedSource(dbg, "simple2");
@ -16,7 +16,7 @@ add_task(async function() {
openFirstBreakpointContextMenu(dbg) openFirstBreakpointContextMenu(dbg)
// select "Remove breakpoint" // select "Remove breakpoint"
selectMenuItem(dbg, 1); selectContextMenuItem(dbg, selectors.breakpointContextMenu.remove);
await waitForState(dbg, state => dbg.selectors.getBreakpointCount(state) === 0); await waitForState(dbg, state => dbg.selectors.getBreakpointCount(state) === 0);
ok("successfully removed the breakpoint"); ok("successfully removed the breakpoint");
@ -36,7 +36,7 @@ add_task(async function() {
openFirstBreakpointContextMenu(dbg); openFirstBreakpointContextMenu(dbg);
// select "Disable Others" // select "Disable Others"
let dispatched = waitForDispatch(dbg, "DISABLE_BREAKPOINT", 3); let dispatched = waitForDispatch(dbg, "DISABLE_BREAKPOINT", 3);
selectMenuItem(dbg, 7); selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableOthers);
await waitForState(dbg, state => await waitForState(dbg, state =>
dbg.selectors.getBreakpointsList(state) dbg.selectors.getBreakpointsList(state)
.every(bp => (bp.location.line !== 1) === bp.disabled) .every(bp => (bp.location.line !== 1) === bp.disabled)
@ -47,7 +47,7 @@ add_task(async function() {
openFirstBreakpointContextMenu(dbg); openFirstBreakpointContextMenu(dbg);
// select "Disable All" // select "Disable All"
dispatched = waitForDispatch(dbg, "DISABLE_ALL_BREAKPOINTS"); dispatched = waitForDispatch(dbg, "DISABLE_ALL_BREAKPOINTS");
selectMenuItem(dbg, 9); selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableAll);
await waitForState(dbg, state => await waitForState(dbg, state =>
dbg.selectors.getBreakpointsList(state).every(bp => bp.disabled) dbg.selectors.getBreakpointsList(state).every(bp => bp.disabled)
); );
@ -57,7 +57,7 @@ add_task(async function() {
openFirstBreakpointContextMenu(dbg); openFirstBreakpointContextMenu(dbg);
// select "Enable Others" // select "Enable Others"
dispatched = waitForDispatch(dbg, "ENABLE_BREAKPOINT", 3); dispatched = waitForDispatch(dbg, "ENABLE_BREAKPOINT", 3);
selectMenuItem(dbg, 3); selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableOthers);
await waitForState(dbg, state => await waitForState(dbg, state =>
dbg.selectors.getBreakpointsList(state) dbg.selectors.getBreakpointsList(state)
.every(bp => (bp.location.line === 1) === bp.disabled) .every(bp => (bp.location.line === 1) === bp.disabled)
@ -68,7 +68,7 @@ add_task(async function() {
openFirstBreakpointContextMenu(dbg); openFirstBreakpointContextMenu(dbg);
// select "Remove Others" // select "Remove Others"
dispatched = waitForDispatch(dbg, "REMOVE_BREAKPOINT", 3); dispatched = waitForDispatch(dbg, "REMOVE_BREAKPOINT", 3);
selectMenuItem(dbg, 6); selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeOthers);
await waitForState(dbg, state => await waitForState(dbg, state =>
dbg.selectors.getBreakpointsList(state).length === 1 && dbg.selectors.getBreakpointsList(state).length === 1 &&
dbg.selectors.getBreakpointsList(state)[0].location.line === 1 dbg.selectors.getBreakpointsList(state)[0].location.line === 1

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

@ -38,8 +38,15 @@ async function assertConditionalBreakpointIsFocused(dbg) {
} }
async function setConditionalBreakpoint(dbg, index, condition) { async function setConditionalBreakpoint(dbg, index, condition) {
const {
addConditionalBreakpoint,
editBreakpoint
} = selectors.gutterContextMenu;
// Make this work with either add or edit menu items
const selector = `${addConditionalBreakpoint},${editBreakpoint}`;
rightClickElement(dbg, "gutter", index); rightClickElement(dbg, "gutter", index);
selectMenuItem(dbg, 2); selectContextMenuItem(dbg, selector);
await waitForElement(dbg, "conditionalPanelInput"); await waitForElement(dbg, "conditionalPanelInput");
await assertConditionalBreakpointIsFocused(dbg); await assertConditionalBreakpointIsFocused(dbg);
@ -50,7 +57,7 @@ async function setConditionalBreakpoint(dbg, index, condition) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple2");
await selectSource(dbg, "simple2"); await selectSource(dbg, "simple2");
await waitForSelectedSource(dbg, "simple2"); await waitForSelectedSource(dbg, "simple2");
@ -86,7 +93,7 @@ add_task(async function() {
//right click breakpoint in breakpoints list //right click breakpoint in breakpoints list
rightClickElement(dbg, "breakpointItem", 3) rightClickElement(dbg, "breakpointItem", 3)
// select "remove condition"; // select "remove condition";
selectMenuItem(dbg, 8); selectContextMenuItem(dbg, selectors.breakpointContextMenu.removeCondition);
await bpCondition; await bpCondition;
bp = findBreakpoint(dbg, "simple2", 5); bp = findBreakpoint(dbg, "simple2", 5);
is(bp.condition, undefined, "breakpoint condition removed"); is(bp.condition, undefined, "breakpoint condition removed");

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

@ -25,7 +25,7 @@ function assertEditorBreakpoint(dbg, line) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const { const {
selectors: { getBreakpoints, getBreakpoint }, selectors: { getBreakpoints, getBreakpoint },
getState getState

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

@ -44,8 +44,9 @@ function findBreakpoint(dbg, url, line) {
return getBreakpoint(getState(), { sourceId: source.id, line }); return getBreakpoint(getState(), { sourceId: source.id, line });
} }
// Test enabling and disabling a breakpoint using the check boxes
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple2");
// Create two breakpoints // Create two breakpoints
await selectSource(dbg, "simple2"); await selectSource(dbg, "simple2");
@ -65,3 +66,31 @@ add_task(async function() {
bp2 = findBreakpoint(dbg, "simple2", 5); bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp2.disabled, false, "second breakpoint is enabled"); is(bp2.disabled, false, "second breakpoint is enabled");
}); });
// Test enabling and disabling a breakpoint using the context menu
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
await selectSource(dbg, "simple2");
await addBreakpoint(dbg, "simple2", 3);
await addBreakpoint(dbg, "simple2", 5);
rightClickElement(dbg, "breakpointItem", 3);
const disableBreakpointDispatch = waitForDispatch(dbg, "DISABLE_BREAKPOINT");
selectContextMenuItem(dbg, selectors.breakpointContextMenu.disableSelf);
await disableBreakpointDispatch;
let bp1 = findBreakpoint(dbg, "simple2", 3);
let bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp1.disabled, true, "first breakpoint is disabled");
is(bp2.disabled, false, "second breakpoint is enabled");
rightClickElement(dbg, "breakpointItem", 3);
const enableBreakpointDispatch = waitForDispatch(dbg, "ENABLE_BREAKPOINT");
selectContextMenuItem(dbg, selectors.breakpointContextMenu.enableSelf);
await enableBreakpointDispatch;
bp1 = findBreakpoint(dbg, "simple2", 3);
bp2 = findBreakpoint(dbg, "simple2", 5);
is(bp1.disabled, false, "first breakpoint is enabled");
is(bp2.disabled, false, "second breakpoint is enabled");
});

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

@ -40,7 +40,7 @@ add_task(async function() {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true); Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
Services.prefs.setBoolPref("devtools.debugger.features.map-await-expression", true); Services.prefs.setBoolPref("devtools.debugger.features.map-await-expression", true);
const dbg = await initDebugger("doc-script-switching.html"); const dbg = await initDebugger("doc-script-switching.html", "switching-01");
await selectSource(dbg, "switching-01"); await selectSource(dbg, "switching-01");

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

@ -23,7 +23,7 @@ function getSplitConsole(dbg) {
add_task(async function() { add_task(async function() {
Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true); Services.prefs.setBoolPref("devtools.toolbox.splitconsoleEnabled", true);
const dbg = await initDebugger("doc-script-switching.html"); const dbg = await initDebugger("doc-script-switching.html", "switching-01");
await selectSource(dbg, "switching-01"); await selectSource(dbg, "switching-01");

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

@ -26,7 +26,7 @@ function assertEditorBreakpoint(dbg, line, shouldExist) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const { const {
selectors: { getBreakpoint, getBreakpointCount }, selectors: { getBreakpoint, getBreakpointCount },
getState getState

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

@ -6,7 +6,7 @@
// doesn't exist. // doesn't exist.
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "long.js");
const { const {
selectors: { getSource }, selectors: { getSource },
getState getState

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

@ -4,7 +4,7 @@
// Tests that the editor sets the correct mode for different file // Tests that the editor sets the correct mode for different file
// types // types
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1.js");
await selectSource(dbg, "simple1.js"); await selectSource(dbg, "simple1.js");
is(dbg.win.cm.getOption("mode").name, "javascript", "Mode is correct"); is(dbg.win.cm.getOption("mode").name, "javascript", "Mode is correct");

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

@ -4,7 +4,7 @@
// Tests that keyboard navigation into and out of debugger code editor // Tests that keyboard navigation into and out of debugger code editor
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple2");
let doc = dbg.win.document; let doc = dbg.win.document;
await selectSource(dbg, "simple2"); await selectSource(dbg, "simple2");

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

@ -14,9 +14,7 @@ function getScopeNodeValue(dbg, index) {
add_task(async function() { add_task(async function() {
await pushPref("devtools.debugger.features.map-scopes", true); await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-minified2.html"); const dbg = await initDebugger("doc-minified2.html", "sum.js");
await waitForSources(dbg, "sum.js");
await selectSource(dbg, "sum.js"); await selectSource(dbg, "sum.js");
await addBreakpoint(dbg, "sum.js", 2); await addBreakpoint(dbg, "sum.js", 2);

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

@ -11,7 +11,7 @@ function getNthItem(dbg, index) {
// Tests the outline pane fuzzy filtering of outline items // Tests the outline pane fuzzy filtering of outline items
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "long");
await selectSource(dbg, "long", 1); await selectSource(dbg, "long", 1);
findElementWithSelector(dbg, ".outline-tab").click(); findElementWithSelector(dbg, ".outline-tab").click();

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

@ -11,7 +11,7 @@ function getNthItem(dbg, index) {
// Tests that the length of outline functions for original and pretty printed source matches // Tests that the length of outline functions for original and pretty printed source matches
add_task(async function () { add_task(async function () {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState

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

@ -11,7 +11,7 @@ function getNthItem(dbg, index) {
// Tests that the editor highlights the correct location when the // Tests that the editor highlights the correct location when the
// debugger pauses // debugger pauses
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState

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

@ -29,7 +29,7 @@ async function testCase(dbg, { name, count, steps }) {
} }
add_task(async function test() { add_task(async function test() {
const dbg = await initDebugger("doc-pause-points.html"); const dbg = await initDebugger("doc-pause-points.html", "pause-points.js");
await selectSource(dbg, "pause-points.js") await selectSource(dbg, "pause-points.js")
await testCase(dbg, { await testCase(dbg, {

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

@ -4,7 +4,7 @@
// Tests pretty-printing a source that is currently paused. // Tests pretty-printing a source that is currently paused.
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-minified.html"); const dbg = await initDebugger("doc-minified.html", "math.min.js");
await selectSource(dbg, "math.min.js"); await selectSource(dbg, "math.min.js");
await addBreakpoint(dbg, "math.min.js", 2); await addBreakpoint(dbg, "math.min.js", 2);

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

@ -4,7 +4,7 @@
// Tests basic pretty-printing functionality. // Tests basic pretty-printing functionality.
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-minified.html"); const dbg = await initDebugger("doc-minified.html", "math.min.js");
await selectSource(dbg, "math.min.js", 2); await selectSource(dbg, "math.min.js", 2);
clickElement(dbg, "prettyPrintButton"); clickElement(dbg, "prettyPrintButton");

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

@ -33,13 +33,12 @@ function assertPreviewPopup(dbg, { field, value, expression }) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-sourcemaps.html"); const dbg = await initDebugger("doc-sourcemaps.html", "entry.js", "output.js", "times2.js", "opts.js");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
await selectSource(dbg, "times2"); await selectSource(dbg, "times2");
await addBreakpoint(dbg, "times2", 2); await addBreakpoint(dbg, "times2", 2);

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

@ -14,7 +14,7 @@ async function previews(dbg, fnName, previews) {
// Test hovering on an object, which will show a popup and on a // Test hovering on an object, which will show a popup and on a
// simple value, which will show a tooltip. // simple value, which will show a tooltip.
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-preview.html"); const dbg = await initDebugger("doc-preview.html", "preview.js");
await selectSource(dbg, "preview.js"); await selectSource(dbg, "preview.js");
await previews(dbg, "empties", [ await previews(dbg, "empties", [

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

@ -110,16 +110,6 @@ add_task(async function() {
pressKey(dbg, "Escape"); pressKey(dbg, "Escape");
assertDisabled(dbg); assertDisabled(dbg);
info("Testing variable search");
quickOpen(dbg, "sw2");
pressKey(dbg, "Enter");
quickOpen(dbg, "#");
is(resultCount(dbg), 1, "one variable result");
const results = findAllElements(dbg, "resultItems");
results.forEach(result => is(result.textContent, "x13"));
await waitToClose(dbg);
info("Testing goto line:column"); info("Testing goto line:column");
assertLine(dbg, 0); assertLine(dbg, 0);
assertColumn(dbg, null); assertColumn(dbg, null);

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

@ -1,10 +1,8 @@
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-react.html", "App.js"); const dbg = await initDebugger("doc-react.html", "App.js");
await waitForSource(dbg, "App.js");
await addBreakpoint(dbg, "App.js", 11); await addBreakpoint(dbg, "App.js", 11);
info('Test previewing an immutable Map inside of a react component') info('Test previewing an immutable Map inside of a react component')
invokeInTab("clickButton"); invokeInTab("clickButton");
await waitForPaused(dbg); await waitForPaused(dbg);

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

@ -18,9 +18,8 @@ async function waitForBreakpoint(dbg, location) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("ember/quickstart/dist/"); const dbg = await initDebugger("ember/quickstart/dist/", "ember-application/index.js");
await waitForSource(dbg, "ember-application/index.js");
await selectSource(dbg, "ember-application/index.js"); await selectSource(dbg, "ember-application/index.js");
info("1. reload and hit breakpoint") info("1. reload and hit breakpoint")

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

@ -13,7 +13,7 @@ function getFocusedEl(dbg) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1.js");
const { const {
selectors: { getBreakpoints, getBreakpoint, getActiveSearch }, selectors: { getBreakpoints, getBreakpoint, getActiveSearch },
getState getState

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

@ -39,13 +39,12 @@ function clickGutter(dbg, line) {
add_task(async function() { add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent // NOTE: the CORS call makes the test run times inconsistent
const dbg = await initDebugger("doc-sourcemaps.html"); const dbg = await initDebugger("doc-sourcemaps.html", "entry.js", "output.js", "times2.js", "opts.js");
const { const {
selectors: { getBreakpoint, getBreakpointCount }, selectors: { getBreakpoint, getBreakpointCount },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "entry.js", "output.js", "times2.js", "opts.js");
ok(true, "Original sources exist"); ok(true, "Original sources exist");
const bundleSrc = findSource(dbg, "bundle.js"); const bundleSrc = findSource(dbg, "bundle.js");

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

@ -18,14 +18,12 @@ function assertBpInGutter(dbg, lineNumber) {
// This source map does not have source contents, so it's fetched separately // This source map does not have source contents, so it's fetched separately
add_task(async function() { add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent // NOTE: the CORS call makes the test run times inconsistent
const dbg = await initDebugger("doc-sourcemaps2.html"); const dbg = await initDebugger("doc-sourcemaps2.html", "main.js", "main.min.js");
const { const {
selectors: { getBreakpoint, getBreakpointCount }, selectors: { getBreakpoint, getBreakpointCount },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "main.js", "main.min.js");
ok(true, "Original sources exist"); ok(true, "Original sources exist");
const mainSrc = findSource(dbg, "main.js"); const mainSrc = findSource(dbg, "main.js");

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

@ -10,14 +10,12 @@ add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent // NOTE: the CORS call makes the test run times inconsistent
await pushPref("devtools.debugger.features.map-scopes", true); await pushPref("devtools.debugger.features.map-scopes", true);
const dbg = await initDebugger("doc-sourcemaps3.html"); const dbg = await initDebugger("doc-sourcemaps3.html", "bundle.js", "sorted.js", "test.js");
const { const {
selectors: { getBreakpoint, getBreakpointCount }, selectors: { getBreakpoint, getBreakpointCount },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "bundle.js", "sorted.js", "test.js");
ok(true, "Original sources exist"); ok(true, "Original sources exist");
const sortedSrc = findSource(dbg, "sorted.js"); const sortedSrc = findSource(dbg, "sorted.js");

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

@ -3,8 +3,7 @@
// Test keyboard arrow behaviour // Test keyboard arrow behaviour
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-sources.html"); const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
await waitForSources(dbg, "simple1", "simple2", "nested-source", "long.js");
await clickElement(dbg, "sourceDirectoryLabel", 2); await clickElement(dbg, "sourceDirectoryLabel", 2);
await assertSourceCount(dbg, 7); await assertSourceCount(dbg, 7);

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

@ -18,16 +18,13 @@ function getLabel(dbg, index) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-sources.html"); const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "simple1", "simple2", "nested-source", "long.js"); info(`>>> contentTask: evaluate evaled.js\n`)
dump(`>>> contentTask: evaluate evaled.js\n`)
ContentTask.spawn(gBrowser.selectedBrowser, null, function() { ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js"); content.eval("window.evaledFunc = function() {} //# sourceURL=evaled.js");
}); });

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

@ -10,14 +10,12 @@ function getLabel(dbg, index) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-sources-querystring.html"); const dbg = await initDebugger("doc-sources-querystring.html", "simple1.js?x=1", "simple1.js?x=2");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "simple1.js?x=1", "simple1.js?x=2");
// Expand nodes and make sure more sources appear. // Expand nodes and make sure more sources appear.
await assertSourceCount(dbg, 2); await assertSourceCount(dbg, 2);
await clickElement(dbg, "sourceDirectoryLabel", 2); await clickElement(dbg, "sourceDirectoryLabel", 2);
@ -40,4 +38,8 @@ add_task(async function() {
"simple1.js?x=1", "simple1.js?x=1",
"Breakpoint heading is simple1.js?x=1" "Breakpoint heading is simple1.js?x=1"
); );
pressKey(dbg, "quickOpen");
type(dbg, "simple1.js?x");
ok(findElement(dbg, "resultItems")[0].innerText.includes("simple.js?x=1"));
}); });

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

@ -10,14 +10,12 @@ function getLabel(dbg, index) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-sources.html"); const dbg = await initDebugger("doc-sources.html", "simple1", "simple2", "nested-source", "long.js");
const { const {
selectors: { getSelectedSource }, selectors: { getSelectedSource },
getState getState
} = dbg; } = dbg;
await waitForSources(dbg, "simple1", "simple2", "nested-source", "long.js");
// Expand nodes and make sure more sources appear. // Expand nodes and make sure more sources appear.
await assertSourceCount(dbg, 2); await assertSourceCount(dbg, 2);
await clickElement(dbg, "sourceDirectoryLabel", 2); await clickElement(dbg, "sourceDirectoryLabel", 2);

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

@ -4,7 +4,7 @@
// Tests re-opening pretty printed tabs on load // Tests re-opening pretty printed tabs on load
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-minified.html"); const dbg = await initDebugger("doc-minified.html", "math.min.js");
await selectSource(dbg, "math.min.js"); await selectSource(dbg, "math.min.js");
clickElement(dbg, "prettyPrintButton"); clickElement(dbg, "prettyPrintButton");
@ -15,7 +15,7 @@ add_task(async function() {
await waitForSelectedSource(dbg, "math.min.js:formatted"); await waitForSelectedSource(dbg, "math.min.js:formatted");
ok(true, "Pretty printed source is selected on reload"); ok(true, "Pretty printed source is selected on reload");
await selectSource(dbg, "math.min.js:formatted"); await selectSource(dbg, "math.min.js:formatted");
const source = findSource(dbg, "math.min.js:formatted"); const source = findSource(dbg, "math.min.js:formatted");
dbg.actions.showSource(source.id); dbg.actions.showSource(source.id);

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

@ -8,7 +8,7 @@ function countTabs(dbg) {
} }
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "simple1", "simple2");
await selectSource(dbg, "simple1"); await selectSource(dbg, "simple1");
await selectSource(dbg, "simple2"); await selectSource(dbg, "simple2");

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

@ -6,7 +6,7 @@
// Tests that you can switch tools, without losing your editor position // Tests that you can switch tools, without losing your editor position
add_task(async function() { add_task(async function() {
const dbg = await initDebugger("doc-scripts.html"); const dbg = await initDebugger("doc-scripts.html", "long");
await selectSource(dbg, "long"); await selectSource(dbg, "long");
getCM(dbg).scrollTo(0, 284); getCM(dbg).scrollTo(0, 284);

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше