Bug 1423158 - Update Debugger Frontend (12-5) r=jdescottes

MozReview-Commit-ID: FVjPco3A29I

--HG--
extra : rebase_source : 7ad0910d7a33ec45ef46577659ed8874b5891c3d
This commit is contained in:
yulia 2017-12-13 18:18:50 -06:00
Родитель 8db0f119dc
Коммит 5cb4b0c571
32 изменённых файлов: 6463 добавлений и 3538 удалений

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

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

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

@ -441,10 +441,6 @@ body {
justify-content: center;
}
.modal .close-btn {
padding: 6px;
}
.modal .result-list {
height: calc(100% - 28px);
overflow-y: auto;
@ -529,6 +525,7 @@ body {
:root {
--arrow-width: 10px;
--icon-size: 13px;
}
:root.theme-light,
@ -1069,6 +1066,26 @@ html .arrow.expanded svg {
.theme-dark .webpack {
opacity: 0.5;
}
.function svg {
height: 10px;
width: 15px;
}
.function path {
fill: var(--theme-body-color);
}
.angular svg {
width: 15px;
height: 15px;
margin-right: 5px;
vertical-align: sub;
}
.theme-dark .angular {
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/>. */
@ -1118,52 +1135,44 @@ html[dir="rtl"] .managed-tree .tree .node > div {
* 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);
.close-btn {
width: 14px;
height: 14px;
border: 1px solid transparent;
border-radius: 2px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.close-btn .close {
width: 14px;
height: 14px;
mask: url("chrome://devtools/skin/images/debugger/close.svg") no-repeat;
mask-size: 100%;
background-color: var(--theme-comment-alt);
width: 8px;
height: 8px;
transition: all 0.15s ease-in-out;
border: 1px solid transparent;
border-radius: 2px;
padding: 0;
margin-top: 0;
display: inline-flex;
justify-content: center;
}
.close-btn .close svg {
width: 8px;
.close-btn:hover img.close {
background-color: white;
}
.close-btn:hover {
display: block;
}
.close-btn:hover .close {
background: var(--theme-selection-background);
}
.close-btn:hover .close path {
fill: white;
background-color: var(--theme-selection-background);
}
.close-btn.big {
padding: 11px;
margin-right: 7px;
width: 27px;
height: 40px;
}
.close-btn.big .close {
width: 16px;
height: 16px;
}
.close-btn.big .close svg {
.close-btn.big .close {
width: 9px;
height: 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
@ -1359,9 +1368,13 @@ html[dir="rtl"] .managed-tree .tree .node > div {
flex-grow: 1;
}
.project-text-search .search-field .close-btn.big {
margin-top: 12px;
}
.project-text-search .managed-tree {
overflow-y: auto;
height: calc(100% - 81px);
height: 100%;
}
.project-text-search .managed-tree .tree {
@ -1478,7 +1491,7 @@ html[dir="rtl"] .managed-tree .tree .node > div {
-moz-user-select: none;
user-select: none;
box-sizing: border-box;
height: 29px;
height: 30px;
}
.source-outline-tabs .tab {
@ -1575,7 +1588,6 @@ html[dir="rtl"] .managed-tree .tree .node > div {
list-style: none;
margin: 0;
padding: 0;
padding-left: 10px;
}
.outline-list h2 {
@ -1586,11 +1598,11 @@ html[dir="rtl"] .managed-tree .tree .node > div {
}
.outline-list__element {
color: blue;
padding-bottom: 0.2rem;
padding-bottom: 0.5rem;
padding-right: 0.5rem;
padding-top: 0.2rem;
cursor: default;
white-space: nowrap;
}
.outline-list__element:hover {
@ -1609,7 +1621,7 @@ html[dir="rtl"] .managed-tree .tree .node > div {
}
.function-signature .param {
color: var(--string-color);
color: var(--theme-highlight-red);
}
.function-signature .paren {
@ -1777,8 +1789,8 @@ html .toggle-button-end.vertical svg {
height: var(--editor-searchbar-height);
}
.search-bar .close-btn {
padding: 6px;
.search-field .close-btn {
margin-top: 7px;
}
.search-bottom-bar * {
@ -2206,6 +2218,14 @@ html[dir="rtl"] .arrow svg,
height: 5px;
padding-top: 5px;
}
.popover .preview-popup {
margin-left: -55px;
}
.popover .add-to-expression-bar {
margin-left: -55px;
}
/* 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/>. */
@ -2403,6 +2423,7 @@ html[dir="rtl"] .arrow svg,
background: var(--theme-toolbar-background);
border-top: 1px solid var(--theme-splitter-color);
border-bottom: 1px solid var(--theme-splitter-color);
padding-right: 16px;
}
.conditional-breakpoint-panel .prompt {
@ -2449,6 +2470,11 @@ html[dir="rtl"] .arrow svg,
.editor-wrapper .CodeMirror-linewidget {
margin-right: -7px;
overflow: visible;
}
.editor-wrapper .CodeMirror-sizer {
min-width: 0 !important;
}
.theme-dark {
@ -2854,7 +2880,7 @@ html .breakpoints-list .breakpoint.paused {
.expression-container__close-btn {
position: absolute;
offset-inline-end: 0px;
top: 4px;
top: 0px;
}
.expression-content {
@ -2870,10 +2896,6 @@ html .breakpoints-list .breakpoint.paused {
overflow-x: hidden;
}
.expression-container:hover .close-btn {
display: block;
}
.expression-input {
max-width: 50%;
}
@ -3204,7 +3226,7 @@ html .breakpoints-list .breakpoint.paused {
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
.command-bar {
flex: 0 0 29px;
flex: 0 0 30px;
border-bottom: 1px solid var(--theme-splitter-color);
display: flex;
overflow: hidden;
@ -3335,6 +3357,141 @@ img.resume {
* 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);
border: 1px solid var(--theme-splitter-color);
box-shadow: 0 4px 4px 0 var(--search-overlays-semitransparent);
max-height: 300px;
position: absolute;
right: 0;
top: 23px;
width: var(--width);
z-index: 1000;
overflow: auto;
}
html[dir="rtl"] .dropdown {
right: calc((var(--width) - 11px) * (-1));
}
.dropdown-block {
padding: 0px 2px;
position: relative;
align-self: center;
}
.dropdown-button {
color: var(--theme-content-color3);
background: none;
border: none;
padding: 0;
font-weight: 100;
font-size: 14px;
}
.dropdown li {
transition: all 0.25s ease;
padding: 2px 10px 10px 5px;
overflow: hidden;
height: 30px;
text-overflow: ellipsis;
white-space: nowrap;
}
.dropdown li:hover {
background-color: var(--search-overlays-semitransparent);
}
.dropdown-icon {
width: var(--icon-size);
height: var(--icon-size);
margin-right: 5px;
vertical-align: middle;
}
.dropdown-icon.prettyPrint {
mask: url("chrome://devtools/skin/images/debugger/prettyPrint.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
}
.dropdown-icon.blackBox {
mask: url("chrome://devtools/skin/images/debugger/blackBox.svg") no-repeat;
mask-size: 100%;
background: var(--theme-highlight-blue);
}
.dropdown-icon.file {
mask: url("chrome://devtools/skin/images/debugger/file.svg") no-repeat;
mask-size: 100%;
}
.dropdown ul {
list-style: none;
line-height: 2em;
font-size: 1em;
margin: 0;
padding: 0;
}
.dropdown-mask {
position: fixed;
width: 100%;
height: 100%;
background: transparent;
z-index: 999;
left: 0;
top: 0;
}
.dropdown span.icon-spacer {
margin-left: 8px;
}
.dropdown li.first {
border-bottom: 1px solid var(--theme-toolbar-background-hover);
}
img.pause-next,
img.pause-on-exceptions,
img.pause-uncaught-exceptions,
img.ignore-exceptions {
vertical-align: middle;
width: 16px;
height: 20px;
display: inline-block;
}
.dropdown div > img.pause-next {
mask: url("chrome://devtools/skin/images/debugger/pause.svg") no-repeat;
background-color: var(--theme-body-color);
}
.dropdown div > img.ignore-exceptions {
mask: url("chrome://devtools/skin/images/debugger/pause-exceptions.svg") no-repeat;
background-color: var(--theme-body-color);
}
.dropdown div > img.pause-uncaught-exceptions {
mask: url("chrome://devtools/skin/images/debugger/pause-exceptions.svg") no-repeat;
background-color: var(--theme-highlight-purple);
}
.dropdown div > img.pause-on-exceptions {
mask: url("chrome://devtools/skin/images/debugger/pause-exceptions.svg") no-repeat;
background-color: var(--theme-highlight-blue);
}
.dropdown div.pause-next.active,
.dropdown div.pause-on-exceptions.active,
.dropdown div.pause-uncaught-exceptions.active,
.dropdown div.ignore-exceptions.active > span.icon-spacer {
color: 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/>. */
.object-node.default-property {
opacity: 0.6;
}
@ -3413,6 +3570,25 @@ img.resume {
.theme-dark .secondary-panes .accordion .arrow svg {
fill: var(--theme-content-color3);
}
.secondary-panes .breakpoints-buttons {
display: flex;
}
.secondary-panes .accordion .plus svg {
width: 12px;
margin-top: 3px;
fill: var(--theme-comment-alt);
}
.secondary-panes .accordion .plus.active svg {
fill: var(--theme-highlight-blue);
}
.dropdown {
width: 20em;
overflow: auto;
}
/* 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/>. */
@ -3505,7 +3681,7 @@ html .welcomebox .toggle-button-end.collapsed {
.source-header {
border-bottom: 1px solid var(--theme-splitter-color);
width: 100%;
height: 29px;
height: 30px;
display: flex;
align-items: flex-end;
}
@ -3543,7 +3719,7 @@ html .welcomebox .toggle-button-end.collapsed {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
display: inline-flex;
align-items: flex-end;
align-items: center;
position: relative;
transition: all 0.15s ease;
min-width: 40px;
@ -3602,6 +3778,15 @@ html .welcomebox .toggle-button-end.collapsed {
background: var(--theme-highlight-blue);
}
.source-tab img.react {
mask: url("chrome://devtools/skin/images/debugger/react.svg") no-repeat;
mask-size: 100%;
padding-top: 12px;
height: 14px;
width: 14px;
background: var(--theme-highlight-bluegrey);
}
.source-tab .blackBox path {
fill: var(--theme-textbox-box-shadow);
}
@ -3634,73 +3819,6 @@ html .welcomebox .toggle-button-end.collapsed {
* 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);
border: 1px solid var(--theme-splitter-color);
box-shadow: 0 4px 4px 0 var(--search-overlays-semitransparent);
max-height: 300px;
position: absolute;
right: 0;
top: 23px;
width: var(--width);
z-index: 1000;
overflow: auto;
}
html[dir="rtl"] .dropdown {
right: calc((var(--width) - 11px) * (-1));
}
.dropdown-block {
padding: 0px 2px;
position: relative;
align-self: center;
}
.dropdown-button {
color: var(--theme-content-color3);
background: none;
border: none;
padding: 0;
font-weight: 100;
font-size: 14px;
}
.dropdown li {
transition: all 0.25s ease;
padding: 2px 10px 10px 5px;
overflow: hidden;
height: 30px;
text-overflow: ellipsis;
white-space: nowrap;
}
.dropdown li:hover {
background-color: var(--search-overlays-semitransparent);
}
.dropdown ul {
list-style: none;
line-height: 2em;
font-size: 1em;
margin: 0;
padding: 0;
}
.dropdown-mask {
position: fixed;
width: 100%;
height: 100%;
background: transparent;
z-index: 999;
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;

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -98,8 +98,8 @@ DebuggerPanel.prototype = {
return { frames, selected };
},
selectSource(sourceURL, sourceLine) {
this._actions.selectSourceURL(sourceURL, { line: sourceLine });
selectSource(url, line) {
this._actions.selectSourceURL(url, { location: { line } });
},
getSource(sourceURL) {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -466,7 +466,7 @@ module.exports = __webpack_require__(1631);
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isLoaded = exports.getMode = exports.getSourceLineCount = exports.getSourcePath = exports.getFileURL = exports.getFilenameFromURL = exports.getFilename = exports.getRawSourceURL = exports.getPrettySourceURL = exports.shouldPrettyPrint = exports.isThirdParty = exports.isPretty = exports.isJavaScript = undefined;
exports.isLoading = exports.isLoaded = exports.getMode = exports.getSourceLineCount = exports.getSourcePath = exports.getFileURL = exports.getFilenameFromURL = exports.getFilename = exports.getRawSourceURL = exports.getPrettySourceURL = exports.shouldPrettyPrint = exports.isThirdParty = exports.isPretty = exports.isJavaScript = exports.isMinified = undefined;
var _devtoolsSourceMap = __webpack_require__(1360);
@ -656,6 +656,62 @@ function getSourceLineCount(source) {
return source.text != undefined ? source.text.split("\n").length : 0;
}
// Used to detect minification for automatic pretty printing
const SAMPLE_SIZE = 50;
const INDENT_COUNT_THRESHOLD = 5;
const CHARACTER_LIMIT = 250;
const _minifiedCache = new Map();
/**
*
* Checks if a source is minified based on some heuristics
* @param key
* @param text
* @return boolean
* @memberof utils/source
* @static
*/
function isMinified(key, text) {
if (!key || !text) {
return false;
}
if (_minifiedCache.has(key)) {
return _minifiedCache.get(key);
}
let lineEndIndex = 0;
let lineStartIndex = 0;
let lines = 0;
let indentCount = 0;
let overCharLimit = false;
// Strip comments.
text = text.replace(/\/\*[\S\s]*?\*\/|\/\/(.+|\n)/g, "");
while (lines++ < SAMPLE_SIZE) {
lineEndIndex = text.indexOf("\n", lineStartIndex);
if (lineEndIndex == -1) {
break;
}
if (/^\s+/.test(text.slice(lineStartIndex, lineEndIndex))) {
indentCount++;
}
// For files with no indents but are not minified.
if (lineEndIndex - lineStartIndex > CHARACTER_LIMIT) {
overCharLimit = true;
break;
}
lineStartIndex = lineEndIndex + 1;
}
const minified = indentCount / lines * 100 < INDENT_COUNT_THRESHOLD || overCharLimit;
_minifiedCache.set(key, minified);
return minified;
}
/**
*
* Returns Code Mirror mode for source content type
@ -676,6 +732,17 @@ function getMode(source, sourceMetaData) {
return "jsx";
}
const languageMimeMap = [{ ext: ".c", mode: "text/x-csrc" }, { ext: ".kt", mode: "text/x-kotlin" }, { ext: ".cpp", mode: "text/x-c++src" }, { ext: ".m", mode: "text/x-objectivec" }, { ext: ".rs", mode: "text/x-rustsrc" }];
// check for C and other non JS languages
if (url) {
const result = languageMimeMap.find(({ ext }) => url.endsWith(ext));
if (result !== undefined) {
return result.mode;
}
}
// 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)) {
@ -715,7 +782,11 @@ function getMode(source, sourceMetaData) {
function isLoaded(source) {
return source.loadedState === "loaded";
}
function isLoading(source) {
return source.loadedState === "loading";
}
exports.isMinified = isMinified;
exports.isJavaScript = isJavaScript;
exports.isPretty = isPretty;
exports.isThirdParty = isThirdParty;
@ -729,6 +800,7 @@ exports.getSourcePath = getSourcePath;
exports.getSourceLineCount = getSourceLineCount;
exports.getMode = getMode;
exports.isLoaded = isLoaded;
exports.isLoading = isLoading;
/***/ }),

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

@ -55,7 +55,7 @@
"findElementWithSelector": false,
"findAllElements": false,
"openNewTabAndToolbox": false,
"selectSource": false,
"selectLocation": false,
"stepOver": false,
"stepIn": false,
"stepOut": false,

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

@ -11,6 +11,10 @@ support-files =
examples/sourcemaps2/main.min.js
examples/sourcemaps2/main.js
examples/sourcemaps2/main.js.map
examples/sourcemaps3/bundle.js
examples/sourcemaps3/bundle.js.map
examples/sourcemaps3/sorted.js
examples/sourcemaps3/test.js
examples/wasm-sourcemaps/average.js
examples/wasm-sourcemaps/average.wasm
examples/wasm-sourcemaps/average.wasm.map
@ -36,6 +40,7 @@ support-files =
examples/doc-minified2.html
examples/doc-sourcemaps.html
examples/doc-sourcemaps2.html
examples/doc-sourcemaps3.html
examples/doc-sourcemap-bogus.html
examples/doc-sources.html
examples/doc-return-values.html
@ -75,6 +80,7 @@ skip-if = !e10s # This test is only valid in e10s
[browser_dbg-chrome-create.js]
[browser_dbg-chrome-debugging.js]
[browser_dbg-console.js]
[browser_dbg-console-link.js]
[browser_dbg-content-script-sources.js]
[browser_dbg-debugger-buttons.js]
[browser_dbg-editor-gutter.js]
@ -88,6 +94,7 @@ skip-if = true # regular failures during release in Bug 1415300
[browser_dbg_keyboard-shortcuts.js]
skip-if = os == "linux" # bug 1351952
[browser_dbg-layout-changes.js]
[browser_dbg-outline.js]
[browser_dbg-pause-exceptions.js]
[browser_dbg-navigation.js]
[browser_dbg-minified.js]
@ -106,6 +113,7 @@ skip-if = true # regular failures during release in Bug 1415300
[browser_dbg-sourcemaps.js]
[browser_dbg-sourcemaps-reloading.js]
[browser_dbg-sourcemaps2.js]
[browser_dbg-sourcemaps3.js]
[browser_dbg-sourcemaps-bogus.js]
[browser_dbg-sources.js]
[browser_dbg-tabs.js]

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

@ -0,0 +1,24 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests opening the console first, clicking a link
// opens the editor at the correct location.
async function waitForLink(toolbox) {
const { hud } = toolbox.getPanel("webconsole");
return waitFor(() => hud.ui.outputNode.querySelector(".frame-link-source"));
}
add_task(async function() {
const toolbox = await initPane("doc-script-switching.html", "webconsole");
const node = await waitForLink(toolbox);
node.click();
await waitFor(() => toolbox.getPanel("jsdebugger"));
const dbg = createDebuggerContext(toolbox);
await waitForElement(dbg, ".CodeMirror-code > .highlight-line");
assertHighlightLocation(dbg, "script-switching-02", 14);
});

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

@ -1,6 +1,3 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/* global ExtensionTestUtils, closeTab, openToolboxForTab, assertDebugLine,
@ -32,17 +29,17 @@ async function installAndStartExtension() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"content_scripts": [
content_scripts: [
{
"js": ["content_script.js"],
"matches": ["http://example.com/*"],
"run_at": "document_start",
},
],
js: ["content_script.js"],
matches: ["http://example.com/*"],
run_at: "document_start"
}
]
},
files: {
"content_script.js": contentScript,
},
"content_script.js": contentScript
}
});
await extension.startup();

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

@ -1,6 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test is taking too much time to complete on some hardware since
// release at https://bugzilla.mozilla.org/show_bug.cgi?id=1423158
requestLongerTimeout(3);
/**
* Test debugging a page with iframes
* 1. pause in the main thread

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

@ -0,0 +1,30 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that the editor highlights the correct location when the
// debugger pauses
function getItems(dbg) {
return findAllElements(dbg, "outlineItems");
}
function getNthItem(dbg, index) {
return findElement(dbg, "outlineItem", index);
}
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");
const { selectors: { getSelectedSource }, getState } = dbg;
await selectSource(dbg, "simple1", 1);
await waitForLoadedSource(dbg, "simple1");
findElementWithSelector(dbg, ".outline-tab").click();
is(getItems(dbg).length, 5, "5 items in the list");
// click on an element
const item = getNthItem(dbg, 3);
is(item.innerText, "evaledFunc()", "got evaled func");
item.click();
assertHighlightLocation(dbg, "simple1", 15);
});

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

@ -5,11 +5,6 @@
// Tests that pretty-printing updates console messages.
async function waitFor(condition) {
await BrowserTestUtils.waitForCondition(condition, "waitFor", 10, 500);
return condition();
}
add_task(async function() {
const dbg = await initDebugger("doc-minified.html");
invokeInTab("arithmetic");

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

@ -0,0 +1,86 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests loading sourcemapped sources, setting breakpoints, and
// inspecting restored scopes.
function toggleNode(dbg, index) {
clickElement(dbg, "scopeNode", index);
}
function getLabel(dbg, index) {
return findElement(dbg, "scopeNode", index).innerText;
}
function hasScopeNode(dbg, index) {
return !!findElement(dbg, "scopeNode", index);
}
async function waitForScopeNode(dbg, index) {
const selector = getSelector("scopeNode", index);
return waitForElement(dbg, selector);
}
// This source map does not have source contents, so it's fetched separately
add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
requestLongerTimeout(2);
const dbg = await initDebugger("doc-sourcemaps3.html");
const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg;
toggleScopes(dbg);
await waitForSources(dbg, "bundle.js", "sorted.js", "test.js");
ok(true, "Original sources exist");
const sortedSrc = findSource(dbg, "sorted.js");
await selectSource(dbg, sortedSrc);
// Test that breakpoint is not off by a line.
await addBreakpoint(dbg, sortedSrc, 9);
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
ok(
getBreakpoint(getState(), { sourceId: sortedSrc.id, line: 9, column: 4 }),
"Breakpoint has correct line"
);
invokeInTab("test");
await waitForPaused(dbg);
assertPausedLocation(dbg);
await waitForDispatch(dbg, "MAP_SCOPES");
is(getLabel(dbg, 1), "Block");
is(getLabel(dbg, 2), "<this>");
is(getLabel(dbg, 3), "na");
is(getLabel(dbg, 4), "nb");
is(getLabel(dbg, 5), "Block");
is(
hasScopeNode(dbg, 8) && !hasScopeNode(dbg, 9),
true,
"scope count before expand"
);
toggleNode(dbg, 5);
await waitForScopeNode(dbg, 9);
is(getLabel(dbg, 6), "ma");
is(getLabel(dbg, 7), "mb");
is(
hasScopeNode(dbg, 10) && !hasScopeNode(dbg, 11),
true,
"scope count before expand"
);
toggleNode(dbg, 8);
await waitForScopeNode(dbg, 11);
is(getLabel(dbg, 9), "a");
is(getLabel(dbg, 10), "arguments");
is(getLabel(dbg, 11), "b");
});

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

@ -1,25 +1,9 @@
// Return a promise with a reference to jsterm, opening the split
// console if necessary. This cleans up the split console pref so
// it won't pollute other tests.
function getSplitConsole(dbg) {
const { toolbox, win } = dbg;
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
if (!win) {
win = toolbox.win;
}
"use strict";
if (!toolbox.splitConsole) {
pressKey(dbg, "Escape");
}
return new Promise(resolve => {
toolbox.getPanelWhenReady("webconsole").then(() => {
ok(toolbox.splitConsole, "Split console is shown.");
let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
resolve(jsterm);
});
});
}
// Tests that you can switch tools, without losing your editor position
add_task(async function() {
const dbg = await initDebugger("doc-scripts.html");

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

@ -9,4 +9,4 @@
<body>
</body>
</html>

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

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script type="text/javascript" src="sourcemaps3/bundle.js"></script>
<button onclick="test()">Test</button>
</body>
</html>

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

@ -11,3 +11,4 @@ function secondCall() {
}
var x = true;
console.log("hi")

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

@ -0,0 +1 @@
{ "presets": [ "es2015" ] }

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

@ -0,0 +1,2 @@
node_modules/
package-lock.json

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

@ -0,0 +1,2 @@
!function(n){function e(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};e.m=n,e.c=r,e.d=function(n,r,t){e.o(n,r)||Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:t})},e.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(r,"a",r),r},e.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},e.p="",e(e.s=0)}([function(n,e,r){"use strict";var t=r(1);window.test=function(){var n=["b (30)","a","b (5)","z"],e=(0,t.fancySort)(n);console.log(e)}},function(n,e,r){"use strict";function t(n,e){var r=/.(\d+)\W*$/.exec(n),t=/.(\d+)\W*$/.exec(e);if(null==r||null==t||r[1]==t[1])return n<e?-1:n>e?1:0;var o=+r[1],u=+t[1];return o<u?-1:o>u?1:0}function o(n,e,r){if(0==n.length)return{found:!1,index:0};for(var t=0,o=n.length-1;t<o;){var u=Math.floor((t+o)/2);r(n[u],e)<0?t=u+1:o=u}var c=r(n[t],e);return 0===c?{found:!0,index:t}:{found:!1,index:c<0?t+1:t}}function u(n){return n.reduce(function(n,e){var r=o(n,e,t),u=r.index;return n.splice(u,0,e),n},[])}Object.defineProperty(e,"__esModule",{value:!0}),e.fancySort=u}]);
//# sourceMappingURL=bundle.js.map

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

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

@ -0,0 +1,19 @@
{
"name": "sorted-es6",
"version": "1.0.0",
"description": "",
"main": "sorted.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"webpack": "^3.7.1"
}
}

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

@ -0,0 +1,43 @@
function comparer(a, b) {
const ma = /.(\d+)\W*$/.exec(a);
const mb = /.(\d+)\W*$/.exec(b);
if (ma == null || mb == null || ma[1] == mb[1]) {
return a < b ? -1 : a > b ? 1 : 0;
} else {
const na = +ma[1],
nb = +mb[1];
return na < nb ? -1 : na > nb ? 1 : 0;
}
}
function binaryLookup(ar, i, comparer) {
if (ar.length == 0) {
return { found: false, index: 0 };
}
let l = 0,
r = ar.length - 1;
while (l < r) {
const mid = Math.floor((l + r) / 2);
if (comparer(ar[mid], i) < 0) {
l = mid + 1;
} else {
r = mid;
}
}
const result = comparer(ar[l], i);
if (result === 0) {
return { found: true, index: l };
}
return {
found: false,
index: result < 0 ? l + 1 : l
};
}
export function fancySort(input) {
return input.reduce((ar, i) => {
const { index } = binaryLookup(ar, i, comparer);
ar.splice(index, 0, i);
return ar;
}, []);
}

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

@ -0,0 +1,7 @@
import { fancySort } from "./sorted.js";
window.test = function() {
let test = ["b (30)", "a", "b (5)", "z"];
let result = fancySort(test);
console.log(result);
};

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

@ -0,0 +1,31 @@
const path = require("path");
const webpack = require("webpack");
module.exports = {
entry: "./test.js",
output: {
path: __dirname,
filename: "bundle.js"
},
devtool: "sourcemap",
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true,
output: {
comments: false
}
})
]
};

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

@ -64,6 +64,11 @@ function logThreadEvents(dbg, event) {
});
}
async function waitFor(condition) {
await BrowserTestUtils.waitForCondition(condition, "waitFor", 10, 500);
return condition();
}
// 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"
@ -337,11 +342,16 @@ function assertHighlightLocation(dbg, source, line) {
source = findSource(dbg, source);
// Check the selected source
is(getSelectedSource(getState()).get("url"), source.url);
is(
getSelectedSource(getState()).get("url"),
source.url,
"source url is correct"
);
// Check the highlight line
const lineEl = findElement(dbg, "highlightLine");
ok(lineEl, "Line is highlighted");
ok(isVisibleInEditor(dbg, lineEl), "Highlighted line is visible");
ok(
getCM(dbg)
@ -491,12 +501,15 @@ function clearDebuggerPreferences() {
* @return {Promise} dbg
* @static
*/
function initDebugger(url) {
return Task.spawn(function*() {
async function initDebugger(url) {
clearDebuggerPreferences();
const toolbox = yield openNewTabAndToolbox(EXAMPLE_URL + url, "jsdebugger");
const toolbox = await openNewTabAndToolbox(EXAMPLE_URL + url, "jsdebugger");
return createDebuggerContext(toolbox);
});
}
async function initPane(url, pane) {
clearDebuggerPreferences();
return openNewTabAndToolbox(EXAMPLE_URL + url, pane);
}
window.resumeTest = undefined;
@ -578,7 +591,7 @@ function waitForLoadedSources(dbg) {
function selectSource(dbg, url, line) {
info(`Selecting source: ${url}`);
const source = findSource(dbg, url);
return dbg.actions.selectSource(source.id, { location: { line } });
return dbg.actions.selectLocation({ sourceId: source.id, line });
}
function closeTab(dbg, url) {
@ -933,7 +946,9 @@ const selectors = {
resultItems: ".result-list .result-item",
fileMatch: ".managed-tree .result",
popup: ".popover",
tooltip: ".tooltip"
tooltip: ".tooltip",
outlineItem: i => `.outline-list__element:nth-child(${i})`,
outlineItems: ".outline-list__element"
};
function getSelector(elementName, ...args) {

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

@ -302,12 +302,14 @@ devtools.jar:
# Debugger
skin/images/debugger/arrow.svg (themes/images/debugger/arrow.svg)
skin/images/debugger/blackBox.svg (themes/images/debugger/blackBox.svg)
skin/images/debugger/close.svg (themes/images/debugger/close.svg)
skin/images/debugger/domain.svg (themes/images/debugger/domain.svg)
skin/images/debugger/file.svg (themes/images/debugger/file.svg)
skin/images/debugger/folder.svg (themes/images/debugger/folder.svg)
skin/images/debugger/pause-exceptions.svg (themes/images/debugger/pause-exceptions.svg)
skin/images/debugger/pause.svg (themes/images/debugger/pause.svg)
skin/images/debugger/prettyPrint.svg (themes/images/debugger/prettyPrint.svg)
skin/images/debugger/react.svg (themes/images/debugger/react.svg)
skin/images/debugger/resume.svg (themes/images/debugger/resume.svg)
skin/images/debugger/stepIn.svg (themes/images/debugger/stepIn.svg)
skin/images/debugger/stepOut.svg (themes/images/debugger/stepOut.svg)

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

@ -67,6 +67,22 @@ stepInTooltip=Step in %S
# button that steps out of a function call.
stepOutTooltip=Step out %S
# LOCALIZATION NOTE (pauseButtonItem): The label that is displayed for the dropdown pause
# list item when the debugger is in a running state.
pauseButtonItem=Pause on Next Statement
# LOCALIZATION NOTE (ignoreExceptionsItem): The pause on exceptions button description
# when the debugger will not pause on exceptions.
ignoreExceptionsItem=Ignore exceptions
# LOCALIZATION NOTE (pauseOnUncaughtExceptionsItem): The pause on exceptions dropdown
# item shown when a user is adding a new breakpoint.
pauseOnUncaughtExceptionsItem=Pause on uncaught exceptions
# LOCALIZATION NOTE (pauseOnExceptionsItem): The pause on exceptions button description
# when the debugger will pause on all exceptions.
pauseOnExceptionsItem=Pause on all exceptions
# LOCALIZATION NOTE (workersHeader): The text to display in the events
# header.
workersHeader=Workers
@ -415,7 +431,7 @@ framework.enableGrouping=Enable framework grouping
framework.enableGrouping.accesskey=u
# LOCALIZATION NOTE (generated): Source Map term for a server source location
generated=Generated
generated=generated
# LOCALIZATION NOTE (original): Source Map term for a debugger UI source location
original=original

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

@ -44,3 +44,6 @@ pref("devtools.debugger.features.shortcuts", true);
pref("devtools.debugger.project-directory-root", "");
pref("devtools.debugger.features.root", false);
pref("devtools.debugger.features.column-breakpoints", false);
pref("devtools.debugger.features.map-scopes", true);
pref("devtools.debugger.features.breakpoints-dropdown", false);
pref("devtools.debugger.features.remove-command-bar-options", false);

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

@ -0,0 +1,7 @@
<!-- 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 width="16px" height="16px" viewBox="0 0 6 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M1.35191454,5.27895256 L5.31214367,1.35518468 C5.50830675,1.16082764 5.50977084,0.844248536 5.3154138,0.648085456 C5.12105677,0.451922377 4.80447766,0.450458288 4.60831458,0.644815324 L0.648085456,4.56858321 C0.451922377,4.76294025 0.450458288,5.07951935 0.644815324,5.27568243 C0.83917236,5.47184551 1.15575146,5.4733096 1.35191454,5.27895256 L1.35191454,5.27895256 Z" id="Line" stroke="none" fill="#696969" fill-rule="evenodd"></path>
<path d="M5.31214367,4.56858321 L1.35191454,0.644815324 C1.15575146,0.450458288 0.83917236,0.451922377 0.644815324,0.648085456 C0.450458288,0.844248536 0.451922377,1.16082764 0.648085456,1.35518468 L4.60831458,5.27895256 C4.80447766,5.4733096 5.12105677,5.47184551 5.3154138,5.27568243 C5.50977084,5.07951935 5.50830675,4.76294025 5.31214367,4.56858321 L5.31214367,4.56858321 Z" id="Line-Copy-2" stroke="none" fill="#696969" fill-rule="evenodd"></path>
</svg>

После

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

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

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated by IcoMoon.io -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="34" height="32" viewBox="0 0 34 32">
<path fill="#444444" d="M19.314 15.987c0 1.321-1.071 2.392-2.392 2.392s-2.392-1.071-2.392-2.392c0-1.321 1.071-2.392 2.392-2.392s2.392 1.071 2.392 2.392z"></path>
<path fill="#444444" d="M16.922 24.783c1.878 1.826 3.729 2.906 5.221 2.906 0.489 0 0.952-0.103 1.337-0.334 1.337-0.772 1.826-2.701 1.363-5.453-0.077-0.489-0.18-0.977-0.309-1.492 0.514-0.154 0.977-0.309 1.44-0.463 2.598-1.003 4.038-2.392 4.038-3.909 0-1.543-1.44-2.932-4.038-3.909-0.463-0.18-0.926-0.334-1.44-0.463 0.129-0.514 0.232-1.003 0.309-1.492 0.437-2.803-0.051-4.758-1.389-5.53-0.386-0.231-0.849-0.334-1.337-0.334-1.466 0-3.344 1.080-5.221 2.906-1.852-1.826-3.704-2.906-5.195-2.906-0.489 0-0.952 0.103-1.337 0.334-1.337 0.772-1.826 2.701-1.363 5.453 0.077 0.489 0.18 0.977 0.309 1.492-0.514 0.154-0.977 0.309-1.44 0.463-2.598 1.003-4.038 2.392-4.038 3.909 0 1.543 1.44 2.932 4.038 3.909 0.463 0.18 0.926 0.334 1.44 0.463-0.129 0.514-0.232 1.003-0.309 1.492-0.437 2.752 0.051 4.707 1.363 5.453 0.386 0.232 0.849 0.334 1.337 0.334 1.492 0.051 3.344-1.029 5.221-2.829v0zM15.481 21.311c0.463 0.026 0.952 0.026 1.44 0.026s0.977 0 1.44-0.026c-0.463 0.617-0.952 1.183-1.44 1.723-0.489-0.54-0.977-1.106-1.44-1.723zM12.292 18.662c0.257 0.437 0.489 0.849 0.772 1.26-0.797-0.103-1.543-0.232-2.263-0.386 0.232-0.694 0.489-1.415 0.797-2.135 0.206 0.411 0.437 0.849 0.694 1.26zM10.8 12.463c0.72-0.154 1.466-0.283 2.263-0.386-0.257 0.412-0.514 0.823-0.772 1.26s-0.489 0.849-0.694 1.286c-0.334-0.746-0.592-1.466-0.797-2.161zM12.215 15.987c0.334-0.694 0.694-1.389 1.106-2.083 0.386-0.669 0.823-1.337 1.26-2.006 0.772-0.051 1.543-0.077 2.341-0.077 0.823 0 1.595 0.026 2.341 0.077 0.463 0.669 0.874 1.337 1.26 2.006 0.412 0.694 0.772 1.389 1.106 2.083-0.334 0.694-0.694 1.389-1.106 2.083-0.386 0.669-0.823 1.337-1.26 2.006-0.772 0.051-1.543 0.077-2.341 0.077-0.823 0-1.595-0.026-2.341-0.077-0.463-0.669-0.874-1.337-1.26-2.006-0.412-0.695-0.772-1.389-1.106-2.083v0zM22.272 14.598l-0.694-1.286c-0.257-0.437-0.489-0.849-0.772-1.26 0.797 0.103 1.543 0.232 2.263 0.386-0.231 0.72-0.489 1.44-0.797 2.161v0zM22.272 17.376c0.309 0.72 0.566 1.44 0.797 2.135-0.72 0.154-1.466 0.283-2.263 0.386 0.257-0.412 0.514-0.823 0.772-1.26 0.232-0.386 0.463-0.823 0.694-1.26v0zM22.863 26.301c-0.206 0.129-0.463 0.18-0.746 0.18-1.26 0-2.829-1.029-4.372-2.572 0.746-0.797 1.466-1.698 2.186-2.701 1.209-0.103 2.366-0.283 3.447-0.54 0.129 0.463 0.206 0.926 0.283 1.389 0.36 2.186 0.077 3.755-0.797 4.244zM24.201 12.746c2.881 0.823 4.604 2.083 4.604 3.241 0 1.003-1.183 2.006-3.266 2.804-0.412 0.154-0.874 0.309-1.337 0.437-0.334-1.055-0.746-2.135-1.26-3.241 0.514-1.106 0.952-2.186 1.26-3.241v0zM22.143 5.493c0.283 0 0.514 0.051 0.746 0.18 0.849 0.489 1.157 2.032 0.797 4.244-0.077 0.437-0.18 0.9-0.283 1.389-1.080-0.232-2.238-0.412-3.447-0.54-0.694-1.003-1.44-1.903-2.186-2.701 1.543-1.518 3.112-2.572 4.372-2.572zM18.362 10.663c-0.463-0.026-0.952-0.026-1.44-0.026s-0.977 0-1.44 0.026c0.463-0.617 0.952-1.183 1.44-1.723 0.489 0.54 0.977 1.132 1.44 1.723v0zM10.98 5.673c0.206-0.129 0.463-0.18 0.746-0.18 1.26 0 2.829 1.029 4.372 2.572-0.746 0.797-1.466 1.697-2.186 2.701-1.209 0.103-2.366 0.283-3.447 0.54-0.129-0.463-0.206-0.926-0.283-1.389-0.36-2.186-0.077-3.729 0.797-4.244v0zM9.643 19.228c-2.881-0.823-4.604-2.083-4.604-3.241 0-1.003 1.183-2.006 3.266-2.803 0.412-0.154 0.874-0.309 1.337-0.437 0.334 1.055 0.746 2.135 1.26 3.241-0.514 1.106-0.952 2.212-1.26 3.241zM10.183 22.057c0.077-0.437 0.18-0.9 0.283-1.389 1.080 0.232 2.238 0.412 3.447 0.54 0.694 1.003 1.44 1.903 2.186 2.701-1.543 1.517-3.112 2.572-4.372 2.572-0.283 0-0.514-0.051-0.746-0.18-0.875-0.489-1.157-2.058-0.797-4.244z"></path>
</svg>

После

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