Bug 1415300 - Update Debugger frontend (11-7). r=jdescottes

MozReview-Commit-ID: HdGGdN5Efw8

--HG--
extra : rebase_source : 416a1198f631e4b701c7ac93e2fd8f8c8dac667d
This commit is contained in:
Jason Laster 2017-11-09 12:28:56 +01:00
parent e3b9be5f45
commit 3214f9fa6f
23 changed files with 9955 additions and 1380 deletions

View File

@ -1,7 +1,7 @@
This is the debugger.html project output.
See https://github.com/devtools-html/debugger.html
Taken from upstream commit: d9f18b2cd0792de70289d4dcde5ed3e38be87cf1
Taken from upstream commit: b902ed728543b8ed39b8d145da37a25418aea48e
Packages:
- babel-plugin-transform-es2015-modules-commonjs @6.26.0

View File

@ -410,6 +410,10 @@ body {
padding-left: 3px;
font-weight: normal;
}
/* 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/>. */
.modal-wrapper {
position: fixed;
display: flex;
@ -473,6 +477,10 @@ body {
transform: translateY(30px);
}
}
/* 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/>. */
.shortcuts-content {
padding: 15px;
-moz-column-width: 250px;
@ -486,20 +494,6 @@ body {
color: var(--theme-content-color1);
}
.mac .keystroke {
border-style: solid;
border-width: 1px;
border-radius: 3px;
border-color: var(--theme-graphs-grey);
background-color: var(--theme-selection-color);
width: 21px;
height: 17px;
display: inline-block;
font-size: 10px;
text-align: center;
padding-top: 2px;
}
.shortcuts-section {
display: inline-block;
margin: 5px;
@ -529,6 +523,10 @@ body {
width: 100%;
}
}
/* 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/>. */
:root {
--arrow-width: 10px;
}
@ -544,6 +542,10 @@ body {
--search-overlays-semitransparent: rgba(42, 46, 56, 0.66);
--popup-shadow-color: #5c667b;
}
/* 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/>. */
* {
box-sizing: border-box;
}
@ -602,6 +604,10 @@ button:focus {
left: 50%;
transform: translate(-50%, -50%);
}
/* 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/>. */
menupopup {
position: fixed;
z-index: 10000;
@ -922,6 +928,10 @@ menuseparator {
.split-box.dragging > .uncontrolled {
pointer-events: none;
}
/* 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/>. */
.arrow,
.worker,
.refresh,
@ -1035,6 +1045,10 @@ html .arrow.expanded svg {
.theme-dark .webpack {
opacity: 0.5;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.managed-tree .tree {
-webkit-user-select: none;
-moz-user-select: none;
@ -1076,6 +1090,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.managed-tree .tree-node button {
position: fixed;
}
/* 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/>. */
.close-btn path {
fill: var(--theme-comment-alt);
}
@ -1123,6 +1141,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.close-btn.big .close svg {
width: 9px;
}
/* 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/>. */
.search-field {
width: calc(100% - 1px);
height: 27px;
@ -1229,6 +1251,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.search-field .search-nav-buttons .nav-btn path {
fill: var(--theme-comment);
}
/* 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/>. */
.project-text-search {
flex-grow: 1;
display: flex;
@ -1317,6 +1343,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.project-text-search .managed-tree .tree {
height: 100%;
}
/* 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/>. */
.search-container {
position: absolute;
top: 30px;
@ -1329,6 +1359,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
background-color: var(--theme-body-background);
overflow-y: hidden;
}
/* 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/>. */
.sources-panel {
background-color: var(--theme-sidebar-background);
display: flex;
@ -1420,6 +1454,7 @@ html[dir="rtl"] .managed-tree .tree .node > div {
-moz-user-select: none;
user-select: none;
box-sizing: border-box;
height: 29px;
}
.source-outline-tabs .tab {
@ -1488,6 +1523,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.theme-dark .sources-list .managed-tree .tree .node.focused img.blackBox {
background-color: white;
}
/* 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/>. */
.outline {
overflow-y: auto;
}
@ -1533,6 +1572,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.outline-list__element:hover {
background: var(--theme-toolbar-background-hover);
}
/* 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-signature {
align-self: center;
}
@ -1552,6 +1595,10 @@ html[dir="rtl"] .managed-tree .tree .node > div {
.function-signature .comma {
color: var(--object-color);
}
/* 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/>. */
.toggle-button-start,
.toggle-button-end {
transform: translate(0, 0px);
@ -1597,6 +1644,10 @@ html .toggle-button-end.vertical svg {
.toggle-button-end.collapsed {
transform: rotate(180deg);
}
/* 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/>. */
.source-footer {
background: var(--theme-body-background);
border-top: 1px solid var(--theme-splitter-color);
@ -1683,6 +1734,10 @@ html .toggle-button-end.vertical svg {
.source-footer .blackbox-summary {
color: var(--theme-body-color);
}
/* 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/>. */
.search-bar {
display: flex;
flex-direction: column;
@ -2063,6 +2118,10 @@ html[dir="rtl"] .arrow svg,
opacity: 0.6;
}
/* 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/>. */
.bracket-arrow {
position: absolute;
}
@ -2105,6 +2164,10 @@ html[dir="rtl"] .arrow svg,
border-top-color: var(--theme-body-background);
top: -1px;
}
/* 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/>. */
.popover {
position: fixed;
z-index: 100;
@ -2114,6 +2177,10 @@ html[dir="rtl"] .arrow svg,
height: 5px;
padding-top: 5px;
}
/* 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/>. */
.popover .preview-popup {
background: var(--theme-body-background);
width: 350px;
@ -2238,6 +2305,10 @@ html[dir="rtl"] .arrow svg,
font-size: 14px;
color: var(--theme-content-color3);
}
/* 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/>. */
.call-site {
background: #f0f9ff;
position: relative;
@ -2283,9 +2354,17 @@ html[dir="rtl"] .arrow svg,
.theme-dark .call-site-bp::before {
border-bottom-color: #dd4d4d;
}
/* 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/>. */
.empty-line .CodeMirror-linenumber {
opacity: 0.5;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.conditional-breakpoint-panel {
cursor: initial;
margin: 1em 0;
@ -2320,6 +2399,10 @@ html[dir="rtl"] .arrow svg,
.conditional-breakpoint-panel input:focus {
outline-width: 0;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.editor-wrapper {
--debug-line-border: rgb(145, 188, 219);
--debug-expression-background: rgba(202, 227, 255, 0.5);
@ -2327,6 +2410,7 @@ html[dir="rtl"] .arrow svg,
--editor-second-searchbar-height: 27px;
--debug-line-error-border: rgb(255, 0, 0);
--debug-expression-error-background: rgba(231, 116, 113, 0.3);
--editor-header-height: 30px;
}
.theme-dark .editor-wrapper {
@ -2352,9 +2436,9 @@ html[dir="rtl"] .arrow svg,
*/
.editor-wrapper {
position: absolute;
height: calc(100% - 29px);
height: calc(100% - var(--editor-header-height));
width: calc(100% - 1px);
top: 29px;
top: var(--editor-header-height);
left: 0px;
--editor-footer-height: 24px;
}
@ -2534,6 +2618,10 @@ debug-expression-error {
.visible {
visibility: visible;
}
/* 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/>. */
.cm-highlight {
position: relative;
}
@ -2559,6 +2647,10 @@ debug-expression-error {
border-radius: 2px;
margin: 0 -1px -1px -1px;
}
/* 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/>. */
.breakpoints-toggle {
margin: 2px 3px;
}
@ -2671,6 +2763,10 @@ html .breakpoints-list .breakpoint.paused {
.breakpoint:hover .close {
visibility: visible;
}
/* 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/>. */
.input-expression {
width: 100%;
margin: 0px;
@ -2752,6 +2848,10 @@ html .breakpoints-list .breakpoint.paused {
.expression-input {
max-width: 50%;
}
/* 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/>. */
.frames ul .frames-group .group,
.frames ul .frames-group .group .location {
font-weight: 500;
@ -2775,6 +2875,10 @@ html .breakpoints-list .breakpoint.paused {
border-top: 1px solid var(--theme-splitter-color);
border-bottom: 1px solid var(--theme-splitter-color);
}
/* 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/>. */
.why-paused {
background-color: var(--theme-body-background);
color: var(--theme-body-color);
@ -2803,6 +2907,10 @@ html .breakpoints-list .breakpoint.paused {
font-weight: bold;
font-style: normal;
}
/* 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/>. */
.frames ul {
list-style: none;
margin: 0;
@ -2895,6 +3003,10 @@ html .breakpoints-list .breakpoint.paused {
:root.theme-dark .annotation-logo svg path {
fill: var(--theme-highlight-blue);
}
/* 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/>. */
.event-listeners {
list-style: none;
margin: 0;
@ -2940,6 +3052,10 @@ html .breakpoints-list .breakpoint.paused {
.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 * {
user-select: none;
}
@ -2952,6 +3068,10 @@ html .breakpoints-list .breakpoint.paused {
position: relative;
transition: all 0.25s ease;
}
/* 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/>. */
:root {
--accordion-header-background: var(--theme-toolbar-background);
}
@ -3028,6 +3148,10 @@ html .breakpoints-list .breakpoint.paused {
.accordion .header-buttons button::-moz-focus-inner {
border: none;
}
/* 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/>. */
.command-bar {
flex: 0 0 29px;
border-bottom: 1px solid var(--theme-splitter-color);
@ -3156,6 +3280,10 @@ img.resume {
.command-bar.bottom > button:hover {
color: var(--theme-body-color);
}
/* 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/>. */
.object-node.default-property {
opacity: 0.6;
}
@ -3186,6 +3314,10 @@ img.resume {
.scopes-list .function-signature {
display: inline-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/>. */
.secondary-panes {
overflow: auto;
display: flex;
@ -3230,6 +3362,10 @@ img.resume {
.theme-dark .secondary-panes .accordion .arrow svg {
fill: var(--theme-content-color3);
}
/* 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/>. */
.welcomebox {
width: calc(100% - 1px);
@ -3311,6 +3447,10 @@ html .welcomebox .toggle-button-end.collapsed {
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/>. */
.source-header {
border-bottom: 1px solid var(--theme-splitter-color);
width: 100%;
@ -3439,6 +3579,10 @@ html .welcomebox .toggle-button-end.collapsed {
.source-tab:hover .close-btn {
visibility: visible;
}
/* 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/>. */
.dropdown {
--width: 150px;
background: var(--theme-body-background);
@ -3502,6 +3646,10 @@ html[dir="rtl"] .dropdown {
left: 0;
top: 0;
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.result-list {
list-style: none;
margin: 0px;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -275,6 +275,10 @@ var _devtoolsUtils = __webpack_require__(1363);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
const { workerHandler } = _devtoolsUtils.workerUtils;
function prettyPrint({ url, indent, source }) {

View File

@ -482,7 +482,9 @@ var _url = __webpack_require__(334);
* @memberof utils/source
* @static
*/
/* 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/>. */
/**
* Utils for working with Source URLs
@ -593,7 +595,12 @@ function getFilename(source) {
return getFormattedSourceId(id);
}
return getFilenameFromURL(url);
let filename = getFilenameFromURL(url);
const qMarkIdx = filename.indexOf("?");
if (qMarkIdx > 0) {
filename = filename.slice(0, qMarkIdx);
}
return filename;
}
/**
@ -658,13 +665,17 @@ function getSourceLineCount(source) {
* @static
*/
function getMode(source) {
function getMode(source, sourceMetaData) {
const { contentType, text, isWasm, url } = source;
if (!text || isWasm) {
return { name: "text" };
}
if (url && url.match(/\.jsx$/i) || sourceMetaData && sourceMetaData.isReactComponent) {
return "jsx";
}
// if the url ends with .marko we set the name to Javascript so
// syntax highlighting works for marko too
if (url && url.match(/\.marko$/i)) {
@ -735,7 +746,7 @@ const {
isOriginalId
} = __webpack_require__(1389);
const { workerUtils: { WorkerDispatcher } } = __webpack_require__(1390);
const { workerUtils: { WorkerDispatcher } } = __webpack_require__(1363);
const dispatcher = new WorkerDispatcher();
@ -793,7 +804,9 @@ module.exports = {
Object.defineProperty(exports, "__esModule", {
value: true
});
/* 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/>. */
/**
* Utils for utils, by utils
@ -1111,180 +1124,6 @@ module.exports = {
/***/ }),
/***/ 1390:
/***/ (function(module, exports, __webpack_require__) {
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const networkRequest = __webpack_require__(1391);
const workerUtils = __webpack_require__(1392);
module.exports = {
networkRequest,
workerUtils
};
/***/ }),
/***/ 1391:
/***/ (function(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/. */
function networkRequest(url, opts) {
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {
if (res.status >= 200 && res.status < 300) {
return res.text().then(text => ({ content: text }));
}
return Promise.reject(`request failed with status ${res.status}`);
});
}
module.exports = networkRequest;
/***/ }),
/***/ 1392:
/***/ (function(module, exports) {
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function WorkerDispatcher() {
this.msgId = 1;
this.worker = null;
} /* 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/. */
WorkerDispatcher.prototype = {
start(url) {
this.worker = new Worker(url);
this.worker.onerror = () => {
console.error(`Error in worker ${url}`);
};
},
stop() {
if (!this.worker) {
return;
}
this.worker.terminate();
this.worker = null;
},
task(method) {
return (...args) => {
return new Promise((resolve, reject) => {
const id = this.msgId++;
this.worker.postMessage({ id, method, args });
const listener = ({ data: result }) => {
if (result.id !== id) {
return;
}
this.worker.removeEventListener("message", listener);
if (result.error) {
reject(result.error);
} else {
resolve(result.response);
}
};
this.worker.addEventListener("message", listener);
});
};
}
};
function workerHandler(publicInterface) {
return function (msg) {
const { id, method, args } = msg.data;
try {
const response = publicInterface[method].apply(undefined, args);
if (response instanceof Promise) {
response.then(val => self.postMessage({ id, response: val }),
// Error can't be sent via postMessage, so be sure to
// convert to string.
err => self.postMessage({ id, error: err.toString() }));
} else {
self.postMessage({ id, response });
}
} catch (error) {
// Error can't be sent via postMessage, so be sure to convert to
// string.
self.postMessage({ id, error: error.toString() });
}
};
}
function streamingWorkerHandler(publicInterface, { timeout = 100 } = {}, worker = self) {
let streamingWorker = (() => {
var _ref = _asyncToGenerator(function* (id, tasks) {
let isWorking = true;
const intervalId = setTimeout(function () {
isWorking = false;
}, timeout);
const results = [];
while (tasks.length !== 0 && isWorking) {
const { callback, context, args } = tasks.shift();
const result = yield callback.call(context, args);
results.push(result);
}
worker.postMessage({ id, status: "pending", data: results });
clearInterval(intervalId);
if (tasks.length !== 0) {
yield streamingWorker(id, tasks);
}
});
return function streamingWorker(_x, _x2) {
return _ref.apply(this, arguments);
};
})();
return (() => {
var _ref2 = _asyncToGenerator(function* (msg) {
const { id, method, args } = msg.data;
const workerMethod = publicInterface[method];
if (!workerMethod) {
console.error(`Could not find ${method} defined in worker.`);
}
worker.postMessage({ id, status: "start" });
try {
const tasks = workerMethod(args);
yield streamingWorker(id, tasks);
worker.postMessage({ id, status: "done" });
} catch (error) {
worker.postMessage({ id, status: "error", error });
}
});
return function (_x3) {
return _ref2.apply(this, arguments);
};
})();
}
module.exports = {
WorkerDispatcher,
workerHandler,
streamingWorkerHandler
};
/***/ }),
/***/ 1393:
/***/ (function(module, exports, __webpack_require__) {
@ -1294,6 +1133,10 @@ module.exports = {
Object.defineProperty(exports, "__esModule", {
value: true
});
/* 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 basename(path) {
return path.split("/").pop();
}
@ -1385,8 +1228,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function ignoreWhiteSpace(str) {
return (/^\s{0,2}$/.test(str) ? "(?!\\s*.*)" : str
);
}
} /* 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 wholeMatch(query, wholeWord) {
if (query === "" || !wholeWord) {
@ -1456,7 +1300,9 @@ var _devtoolsUtils = __webpack_require__(1363);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const { workerHandler } = _devtoolsUtils.workerUtils;
const { workerHandler } = _devtoolsUtils.workerUtils; /* 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/>. */
self.onmessage = workerHandler({ getMatches: _getMatches2.default, findSourceMatches: _projectSearch.findSourceMatches });
@ -1496,7 +1342,9 @@ function getMatches(query, text, modifiers) {
}
}
return matchedLocations;
}
} /* 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/>. */
/***/ }),
@ -1541,7 +1389,11 @@ function findSourceMatches(source, queryText) {
matches = [].concat(...matches);
return matches;
} // Maybe reuse file search's functions?
} /* 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/>. */
// Maybe reuse file search's functions?
/***/ }),
@ -1861,7 +1713,7 @@ module.exports = charenc;
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

View File

@ -51,6 +51,7 @@ support-files =
examples/output.js
examples/simple1.js
examples/simple2.js
examples/simple3.js
examples/frames.js
examples/script-mutate.js
examples/script-switching-02.js
@ -65,7 +66,6 @@ support-files =
[browser_dbg-breakpoints.js]
[browser_dbg-breakpoints-toggle.js]
[browser_dbg-breakpoints-reloading.js]
skip-if = true # Bug 1383576
[browser_dbg-breakpoints-cond.js]
[browser_dbg-browser-content-toolbox.js]
skip-if = !e10s # This test is only valid in e10s
@ -73,7 +73,6 @@ skip-if = !e10s # This test is only valid in e10s
[browser_dbg-scopes.js]
[browser_dbg-chrome-create.js]
[browser_dbg-chrome-debugging.js]
skip-if = debug # bug 1374187
[browser_dbg-console.js]
[browser_dbg-debugger-buttons.js]
[browser_dbg-editor-gutter.js]
@ -87,19 +86,18 @@ skip-if = debug # bug 1374187
skip-if = os == "linux" # bug 1351952
[browser_dbg-layout-changes.js]
[browser_dbg-pause-exceptions.js]
skip-if = true # Bug 1393121
[browser_dbg-navigation.js]
[browser_dbg-minified.js]
[browser_dbg-pretty-print.js]
[browser_dbg-pretty-print-console.js]
[browser_dbg-pretty-print-paused.js]
[browser_dbg-preview.js]
[browser_dbg-returnvalues.js]
[browser_dbg-scopes-mutations.js]
[browser_dbg-search-file.js]
skip-if = os == "win" # Bug 1393121
[browser_dbg-quick-open.js]
skip-if = true
[browser_dbg-search-project.js]
skip-if = true # Bug 1393121, 1393299
[browser_dbg-sourcemaps.js]
[browser_dbg-sourcemaps-reloading.js]
[browser_dbg-sourcemaps2.js]

View File

@ -12,16 +12,15 @@ add_task(async function() {
await addBreakpoint(dbg, "scripts.html", 18);
reload(dbg);
await waitForPaused(dbg);
await waitForLoadedSource(dbg, "doc-scripts.html");
assertPausedLocation(dbg);
await resume(dbg);
const paused = waitForPaused(dbg);
// Create an eval script that pauses itself.
invokeInTab("doEval");
await waitForPaused(dbg);
await paused;
await resume(dbg);
const source = getSelectedSource(getState()).toJS();
ok(!source.url, "It is an eval source");

View File

@ -1,21 +1,31 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function clickStepOver(dbg) {
clickElement(dbg, "stepOver");
function clickButton(dbg, button) {
const resumeFired = waitForDispatch(dbg, "COMMAND");
clickElement(dbg, button);
return resumeFired;
}
async function clickStepOver(dbg) {
await clickButton(dbg, "stepOver");
return waitForPaused(dbg);
}
function clickStepIn(dbg) {
clickElement(dbg, "stepIn");
async function clickStepIn(dbg) {
await clickButton(dbg, "stepIn");
return waitForPaused(dbg);
}
function clickStepOut(dbg) {
clickElement(dbg, "stepOut");
async function clickStepOut(dbg) {
await clickButton(dbg, "stepOut");
return waitForPaused(dbg);
}
async function clickResume(dbg) {
return clickButton(dbg, "resume");
}
/**
* Test debugger buttons
* 1. resume
@ -33,7 +43,7 @@ add_task(async function() {
assertPausedLocation(dbg);
// resume
clickElement(dbg, "resume");
await clickResume(dbg)
await waitForPaused(dbg);
assertPausedLocation(dbg);

View File

@ -4,13 +4,6 @@
// Tests that the editor highlights the correct location when the
// debugger pauses
// checks to see if the first breakpoint is visible
function isElementVisible(dbg, elementName) {
const bpLine = findElement(dbg, elementName);
const cm = findElement(dbg, "codeMirror");
return bpLine && isVisibleWithin(cm, bpLine);
}
add_task(async function() {
// This test runs too slowly on linux debug. I'd like to figure out
// which is the slowest part of this and make it run faster, but to
@ -54,5 +47,5 @@ add_task(async function() {
await waitForLoadedSource(dbg, "long.js");
assertPausedLocation(dbg);
ok(isElementVisible(dbg, "breakpoint"), "Breakpoint is visible");
ok(isVisibleInEditor(dbg, findElement(dbg, "breakpoint")), "Breakpoint is visible");
});

View File

@ -40,7 +40,6 @@ async function addExpression(dbg, input) {
findElementWithSelector(dbg, expressionSelectors.input).focus();
type(dbg, input);
pressKey(dbg, "Enter");
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
}
@ -48,10 +47,11 @@ async function editExpression(dbg, input) {
info("updating the expression");
dblClickElement(dbg, "expressionNode", 1);
// Position cursor reliably at the end of the text.
const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION")
pressKey(dbg, "End");
type(dbg, input);
pressKey(dbg, "Enter");
await waitForDispatch(dbg, "EVALUATE_EXPRESSION");
await evaluation;
}
/*
@ -59,13 +59,18 @@ async function editExpression(dbg, input) {
* resume, and wait for the expression to finish being evaluated.
*/
async function addBadExpression(dbg, input) {
const paused = waitForPaused(dbg);
const added = addExpression(dbg, input);
const evaluation = waitForDispatch(dbg, "EVALUATE_EXPRESSION")
findElementWithSelector(dbg, expressionSelectors.input).focus();
type(dbg, input);
pressKey(dbg, "Enter");
await waitForPaused(dbg);
await paused;
ok(dbg.selectors.isEvaluatingExpression(dbg.getState()));
await resume(dbg);
await added;
await evaluation;
}
add_task(async function() {

View File

@ -24,7 +24,7 @@ add_task(async function() {
await waitForLoadedSource(dbg, "simple1");
assertPausedLocation(dbg);
is(countSources(dbg), 4, "4 sources are loaded.");
is(countSources(dbg), 5, "5 sources are loaded.");
await navigate(dbg, "about:blank");
await waitForDispatch(dbg, "NAVIGATE");
@ -36,11 +36,12 @@ add_task(async function() {
"doc-scripts.html",
"simple1.js",
"simple2.js",
"simple3.js",
"long.js",
"scripts.html"
);
is(countSources(dbg), 4, "4 sources are loaded.");
is(countSources(dbg), 5, "5 sources are loaded.");
// Test that the current select source persists across reloads
await selectSource(dbg, "long.js");

View File

@ -19,26 +19,34 @@ function caughtException() {
add_task(async function() {
const dbg = await initDebugger("doc-exceptions.html");
// test skipping an uncaught exception
log("1. test skipping an uncaught exception");
await uncaughtException();
ok(!isPaused(dbg));
// Test pausing on an uncaught exception
log("2. Test pausing on an uncaught exception");
await togglePauseOnExceptions(dbg, true, false);
uncaughtException();
await waitForPaused(dbg);
assertPausedLocation(dbg);
await resume(dbg);
await waitForActive(dbg);
// Test pausing on a caught Error
log("3. Test pausing on a caught Error");
caughtException();
await waitForPaused(dbg);
assertPausedLocation(dbg);
log("3.b Test pausing in the catch statement");
await resume(dbg);
await waitForPaused(dbg);
assertPausedLocation(dbg);
await resume(dbg);
// Test skipping a caught error
log("4. Test skipping a caught error");
await togglePauseOnExceptions(dbg, true, true);
caughtException();
log("4.b Test pausing in the catch statement");
await waitForPaused(dbg);
assertPausedLocation(dbg);
await resume(dbg);

View File

@ -0,0 +1,68 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function getCoordsFromPosition(cm, { line, ch }) {
return cm.charCoords({ line: ~~line, ch: ~~ch });
}
function hoverAtPos(dbg, { line, ch }) {
const cm = getCM(dbg);
const coords = getCoordsFromPosition(cm, { line: line - 1, ch });
const tokenEl = dbg.win.document.elementFromPoint(coords.left, coords.top);
tokenEl.dispatchEvent(
new MouseEvent("mouseover", {
bubbles: true,
cancelable: true,
view: dbg.win
})
);
}
function assertTooltip(dbg, { result, expression }) {
const previewEl = findElement(dbg, "tooltip");
is(previewEl.innerText, result, "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
is(`${preview.result}`, result, "Preview.result");
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
}
function assertPopup(dbg, { field, value, expression }) {
const previewEl = findElement(dbg, "popup");
is(previewEl.innerText, "", "Preview text shown to user");
const preview = dbg.selectors.getPreview(dbg.getState());
is(
`${preview.result.preview.ownProperties[field].value}`,
value,
"Preview.result"
);
is(preview.updating, false, "Preview.updating");
is(preview.expression, expression, "Preview.expression");
}
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
const { selectors: { getSelectedSource }, getState } = dbg;
const simple3 = findSource(dbg, "simple3.js");
await selectSource(dbg, "simple3");
await addBreakpoint(dbg, simple3, 5);
invokeInTab("simple");
await waitForPaused(dbg);
const tooltipPreviewed = waitForDispatch(dbg, "SET_PREVIEW");
hoverAtPos(dbg, { line: 5, ch: 12 });
await tooltipPreviewed;
assertTooltip(dbg, { result: "3", expression: "result" });
const popupPreviewed = waitForDispatch(dbg, "SET_PREVIEW");
hoverAtPos(dbg, { line: 2, ch: 10 });
await popupPreviewed;
assertPopup(dbg, { field: "foo", value: "1", expression: "obj" });
assertPopup(dbg, { field: "bar", value: "2", expression: "obj" });
});

View File

@ -99,7 +99,7 @@ add_task(async function() {
quickOpen(dbg, "#");
is(resultCount(dbg), 1, "one variable result");
const results = findAllElements(dbg, "resultItems");
results.forEach(result => is(result.textContent, "x:13"));
results.forEach(result => is(result.textContent, "x13"));
await waitToClose(dbg);
info("Testing goto line:column");

View File

@ -0,0 +1,69 @@
function getLabel(dbg, index) {
return findElement(dbg, "scopeNode", index).innerText;
}
function getValue(dbg, index) {
return findElement(dbg, "scopeValue", index).innerText;
}
function toggleScopes(dbg) {
return findElement(dbg, "scopesHeader").click();
}
async function testReturnValue(dbg, val) {
invokeInTab("return_something", val);
await waitForPaused(dbg);
// "Step in" 3 times to get to the point where the debugger can
// see the return value.
await stepIn(dbg);
await stepIn(dbg);
await stepIn(dbg);
is(getLabel(dbg, 1), "return_something", "check for return_something");
// We don't show "undefined" but we do show other falsy values.
let label = getLabel(dbg, 2);
if (val === "undefined") {
ok(label !== "<return>", "do not show <return> for undefined");
} else {
is(label, "<return>", "check for <return>");
// The "uneval" call here gives us the way one would write `val` as
// a JavaScript expression, similar to the way the debugger
// displays values, so this test works when `val` is a string.
is(getValue(dbg, 2), uneval(val), `check value is ${uneval(val)}`);
}
await resume(dbg);
assertNotPaused(dbg);
}
async function testThrowValue(dbg, val) {
invokeInTab("throw_something", val);
await waitForPaused(dbg);
// "Step in" once to get to the point where the debugger can see the
// exception.
await stepIn(dbg);
is(getLabel(dbg, 1), "callee", "check for callee");
is(getLabel(dbg, 2), "<exception>", "check for <exception>");
// The "uneval" call here gives us the way one would write `val` as
// a JavaScript expression, similar to the way the debugger
// displays values, so this test works when `val` is a string.
is(getValue(dbg, 2), uneval(val), `check exception is ${uneval(val)}`);
await resume(dbg);
await waitForPaused(dbg);
await resume(dbg);
assertNotPaused(dbg);
}
add_task(async function() {
const dbg = await initDebugger("doc-return-values.html");
toggleScopes(dbg);
await togglePauseOnExceptions(dbg, true, false);
await testReturnValue(dbg, "to sender");
await testThrowValue(dbg, "a fit");
});

View File

@ -78,10 +78,8 @@ add_task(async function() {
'The "lastName" element has the expected "Doe" value'
);
info("Resuming");
onPaused = waitForPaused(dbg);
await resume(dbg);
await onPaused;
await waitForPaused(dbg);
is(
getScopeNodeLabel(dbg, 2),

View File

@ -78,7 +78,6 @@ add_task(async function() {
assertPausedLocation(dbg);
await stepIn(dbg);
// await waitForMappedScopes(dbg);
assertPausedLocation(dbg);
await stepOver(dbg);

View File

@ -1,11 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function assertBpInGutter(dbg, lineNumber) {
const el = findElement(dbg, "breakpoint");
const bpLineNumber = +el.querySelector(".CodeMirror-linenumber").innerText;
is(bpLineNumber, lineNumber);
is(bpLineNumber, lineNumber, "Breakpoint is on the correct line in the gutter");
}
// Tests loading sourcemapped sources, setting breakpoints, and

View File

@ -8,8 +8,10 @@
</head>
<body>
<button onclick="simple()">Click me!</button>
<script src="simple1.js"></script>
<script src="simple2.js"></script>
<script src="simple3.js"></script>
<script src="long.js"></script>
<script>
// This inline script allows this HTML page to show up as a

View File

@ -7,25 +7,33 @@ function main() {
}
function doEval() {
eval("(" + function() {
debugger;
eval(
"(" +
function() {
debugger;
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() + ")()");
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() +
")()"
);
}
function doNamedEval() {
eval("(" + function() {
debugger;
eval(
"(" +
function() {
debugger;
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() + ")();\n //# sourceURL=evaled.js");
window.evaledFunc = function() {
var foo = 1;
var bar = 2;
return foo + bar;
};
}.toString() +
")();\n //# sourceURL=evaled.js"
);
}

View File

@ -0,0 +1,6 @@
function simple() {
const obj = { foo: 1, bar: 2 };
const func = foo(1, 2);
const result = func();
return result;
}

View File

@ -52,6 +52,18 @@ registerCleanupFunction(() => {
delete window.resumeTest;
});
function log(msg, data) {
info(`${msg} ${!data ? "" : JSON.stringify(data)}`);
}
function logThreadEvents(dbg, event) {
const thread = dbg.toolbox.threadClient;
thread.addListener(event, function onEvent(eventName, ...args) {
info(`Thread event '${eventName}' fired.`);
});
}
// Wait until an action of `type` is dispatched. This is different
// then `_afterDispatchDone` because it doesn't wait for async actions
// to be done/errored. Use this if you want to listen for the "start"
@ -109,11 +121,11 @@ function waitForDispatch(dbg, type, eventRepeat = 1) {
let count = 0;
return Task.spawn(function*() {
info("Waiting for " + type + " to dispatch " + eventRepeat + " time(s)");
info(`Waiting for ${type} to dispatch ${eventRepeat} time(s)`);
while (count < eventRepeat) {
yield _afterDispatchDone(dbg.store, type);
count++;
info(type + " dispatched " + count + " time(s)");
info(`${type} dispatched ${count} time(s)`);
}
});
}
@ -128,12 +140,12 @@ function waitForDispatch(dbg, type, eventRepeat = 1) {
* @static
*/
function waitForThreadEvents(dbg, eventName) {
info("Waiting for thread event '" + eventName + "' to fire.");
info(`Waiting for thread event '${eventName}' to fire.`);
const thread = dbg.toolbox.threadClient;
return new Promise(function(resolve, reject) {
thread.addListener(eventName, function onEvent(eventName, ...args) {
info("Thread event '" + eventName + "' fired.");
info(`Thread event '${eventName}' fired.`);
thread.removeListener(eventName, onEvent);
resolve.apply(resolve, args);
});
@ -180,7 +192,7 @@ function waitForSources(dbg, ...sources) {
return Promise.resolve();
}
info("Waiting on sources: " + sources.join(", "));
info(`Waiting on sources: ${sources.join(", ")}`);
const { selectors: { getSources }, store } = dbg;
return Promise.all(
sources.map(url => {
@ -244,6 +256,15 @@ function waitForSelectedSource(dbg, url) {
);
}
/**
* Assert that the debugger is not currently paused.
* @memberof mochitest/asserts
* @static
*/
function assertNotPaused(dbg) {
ok(!isPaused(dbg), "client is not paused");
}
/**
* Assert that the debugger is paused at the correct location.
*
@ -262,6 +283,8 @@ function assertPausedLocation(dbg) {
const pause = getPause(getState());
const pauseLine = pause && pause.frame && pause.frame.location.line;
assertDebugLine(dbg, pauseLine);
ok(isVisibleInEditor(dbg, getCM(dbg).display.gutters), "gutter is visible");
}
function assertDebugLine(dbg, line) {
@ -278,10 +301,15 @@ function assertDebugLine(dbg, line) {
}
ok(
lineInfo.wrapClass.includes("debug-line"),
lineInfo.wrapClass.includes("new-debug-line"),
"Line is highlighted as paused"
);
const debugLine = findElementWithSelector(dbg, ".new-debug-line")
|| findElementWithSelector(dbg, ".new-debug-line-error");
ok(isVisibleInEditor(dbg, debugLine), "debug line is visible");
const markedSpans = lineInfo.handle.markedSpans;
if (markedSpans && markedSpans.length > 0) {
const marker = markedSpans[0].marker;
@ -311,10 +339,7 @@ function assertHighlightLocation(dbg, source, line) {
// Check the highlight line
const lineEl = findElement(dbg, "highlightLine");
ok(lineEl, "Line is highlighted");
ok(
isVisibleWithin(findElement(dbg, "codeMirror"), lineEl),
"Highlighted line is visible"
);
ok(isVisibleInEditor(dbg, lineEl), "Highlighted line is visible");
ok(
getCM(dbg)
.lineInfo(line - 1)
@ -335,6 +360,14 @@ function isPaused(dbg) {
return !!getPause(getState());
}
async function waitForLoadedObjects(dbg) {
const { hasLoadingObjects } = dbg.selectors;
return waitForState(
dbg,
state => !hasLoadingObjects(state),
"loaded objects"
);
}
/**
* Waits for the debugger to be fully paused.
*
@ -343,13 +376,36 @@ function isPaused(dbg) {
* @static
*/
async function waitForPaused(dbg) {
// We want to make sure that we get both a real paused event and
// that the state is fully populated. The client may do some more
// work (call other client methods) before populating the state.
let loading = waitForDispatch(dbg, "LOAD_OBJECT_PROPERTIES");
await waitForThreadEvents(dbg, "paused");
await waitForState(dbg, state => isPaused(dbg));
await loading;
const { getSelectedScope, hasLoadingObjects } = dbg.selectors;
return waitForState(
dbg,
state => {
const paused = isPaused(dbg);
const scope = !!getSelectedScope(state);
const loaded = !hasLoadingObjects(state);
return paused && scope && loaded;
},
"paused"
);
}
/*
* useful for when you want to see what is happening
* e.g await waitForever()
*/
function waitForever() {
return new Promise(r => {});
}
/*
* useful for waiting for a short amount of time as
* a placeholder for a better waitForX handler.
*
* e.g await waitForTime(500)
*/
function waitForTime(ms) {
return new Promise(r => setTimeout(r, ms));
}
/**
@ -475,7 +531,7 @@ function findSource(dbg, url) {
const source = sources.find(s => (s.get("url") || "").includes(url));
if (!source) {
throw new Error("Unable to find source: " + url);
throw new Error(`Unable to find source: ${url}`);
}
return source.toJS();
@ -485,7 +541,7 @@ function waitForLoadedSource(dbg, url) {
return waitForState(
dbg,
state => findSource(dbg, url).loadedState == "loaded",
`loaded source`
"loaded source"
);
}
@ -500,13 +556,13 @@ function waitForLoadedSource(dbg, url) {
* @static
*/
function selectSource(dbg, url, line) {
info("Selecting source: " + url);
info(`Selecting source: ${url}`);
const source = findSource(dbg, url);
return dbg.actions.selectSource(source.id, { location: { line } });
}
function closeTab(dbg, url) {
info("Closing tab: " + url);
info(`Closing tab: ${url}`);
const source = findSource(dbg, url);
return dbg.actions.closeTab(source.url);
}
@ -519,9 +575,9 @@ function closeTab(dbg, url) {
* @return {Promise}
* @static
*/
function stepOver(dbg) {
async function stepOver(dbg) {
info("Stepping over");
dbg.actions.stepOver();
await dbg.actions.stepOver();
return waitForPaused(dbg);
}
@ -533,9 +589,9 @@ function stepOver(dbg) {
* @return {Promise}
* @static
*/
function stepIn(dbg) {
async function stepIn(dbg) {
info("Stepping in");
dbg.actions.stepIn();
await dbg.actions.stepIn();
return waitForPaused(dbg);
}
@ -547,9 +603,9 @@ function stepIn(dbg) {
* @return {Promise}
* @static
*/
function stepOut(dbg) {
async function stepOut(dbg) {
info("Stepping out");
dbg.actions.stepOut();
await dbg.actions.stepOut();
return waitForPaused(dbg);
}
@ -563,8 +619,7 @@ function stepOut(dbg) {
*/
function resume(dbg) {
info("Resuming");
dbg.actions.resume();
return waitForState(dbg, state => !dbg.selectors.isPaused(state), "resumed");
return dbg.actions.resume();
}
function deleteExpression(dbg, input) {
@ -652,7 +707,7 @@ function removeBreakpoint(dbg, sourceId, line, col) {
* @return {Promise}
* @static
*/
function togglePauseOnExceptions(
async function togglePauseOnExceptions(
dbg,
pauseOnExceptions,
ignoreCaughtExceptions
@ -663,26 +718,37 @@ function togglePauseOnExceptions(
);
if (!isPaused(dbg)) {
return waitForThreadEvents(dbg, "resumed");
await waitForThreadEvents(dbg, "resumed");
await waitForLoadedObjects(dbg);
}
return command;
}
function waitForActive(dbg) {
return waitForState(dbg, state => !dbg.selectors.isPaused(state), "active");
}
// Helpers
/**
* Invokes a global function in the debuggee tab.
*
* @memberof mochitest/helpers
* @param {String} fnc
* @param {String} fnc The name of a global function on the content window to
* call. This is applied to structured clones of the
* remaining arguments to invokeInTab.
* @param {Any} ...args Remaining args to serialize and pass to fnc.
* @return {Promise}
* @static
*/
function invokeInTab(fnc) {
info(`Invoking function ${fnc} in tab`);
return ContentTask.spawn(gBrowser.selectedBrowser, fnc, function*(fnc) {
content.wrappedJSObject[fnc](); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
function invokeInTab(fnc, ...args) {
info(`Invoking in tab: ${fnc}(${args.map(uneval).join(",")})`);
return ContentTask.spawn(gBrowser.selectedBrowser, { fnc, args }, function*({
fnc,
args
}) {
content.wrappedJSObject[fnc](...args); // eslint-disable-line mozilla/no-cpows-in-tests, max-len
});
}
@ -755,10 +821,54 @@ function type(dbg, string) {
string.split("").forEach(char => EventUtils.synthesizeKey(char, {}, dbg.win));
}
function isVisibleWithin(outerEl, innerEl) {
/*
* Checks to see if the inner element is visible inside the editor.
*
* @memberof mochitest/helpers
* @param {Object} dbg
* @param {HTMLElement} inner element
* @return {boolean}
* @static
*/
function isVisibleInEditor(dbg, element) {
return isVisible(findElement(dbg, "codeMirror"), element);
}
/*
* Checks to see if the inner element is visible inside the
* outer element.
*
* Note, the inner element does not need to be entirely visible,
* it is possible for it to be somewhat clipped by the outer element's
* bounding element or for it to span the entire length, starting before the
* outer element and ending after.
*
* @memberof mochitest/helpers
* @param {HTMLElement} outer element
* @param {HTMLElement} inner element
* @return {boolean}
* @static
*/
function isVisible(outerEl, innerEl) {
if (!innerEl || !outerEl) {
return false;
}
const innerRect = innerEl.getBoundingClientRect();
const outerRect = outerEl.getBoundingClientRect();
return innerRect.top > outerRect.top && innerRect.bottom < outerRect.bottom;
const verticallyVisible =
(innerRect.top >= outerRect.top || innerRect.bottom <= outerRect.bottom)
|| (innerRect.top < outerRect.top && innerRect.bottom > outerRect.bottom);
const horizontallyVisible =
(innerRect.left >= outerRect.left || innerRect.right <= outerRect.right)
|| (innerRect.left < outerRect.left && innerRect.right > outerRect.right);
const visible = verticallyVisible && horizontallyVisible;
return visible;
}
const selectors = {
@ -785,7 +895,7 @@ const selectors = {
highlightLine: ".CodeMirror-code > .highlight-line",
codeMirror: ".CodeMirror",
resume: ".resume.active",
sourceTabs: `.source-tabs`,
sourceTabs: ".source-tabs",
stepOver: ".stepOver.active",
stepOut: ".stepOut.active",
stepIn: ".stepIn.active",
@ -796,8 +906,10 @@ const selectors = {
sourceNode: i => `.sources-list .tree-node:nth-child(${i})`,
sourceNodes: ".sources-list .tree-node",
sourceArrow: i => `.sources-list .tree-node:nth-child(${i}) .arrow`,
resultItems: `.result-list .result-item`,
fileMatch: `.managed-tree .result`
resultItems: ".result-list .result-item",
fileMatch: ".managed-tree .result",
popup: ".popover",
tooltip: ".tooltip"
};
function getSelector(elementName, ...args) {