зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central. a=merge
This commit is contained in:
Коммит
ec46826255
|
@ -916,7 +916,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gleam"
|
||||
version = "0.6.0"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2636,7 +2636,7 @@ dependencies = [
|
|||
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"freetype 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2680,7 +2680,7 @@ dependencies = [
|
|||
"euclid 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nsstring 0.1.0",
|
||||
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2894,7 +2894,7 @@ dependencies = [
|
|||
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
|
||||
"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
|
||||
"checksum gleam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d41e7ac812597988fdae31c9baec3c6d35cadb8ad9ab88a9bf9c0f119ed66c2"
|
||||
"checksum gleam 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ba6539d49223f6bca4f076d9490c001bdbfe07d59cb0ad4079033c75bdc92d"
|
||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
"checksum h2 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "a27e7ed946e8335bdf9a191bc1b9b14a03ba822d013d2f58437f4fabcbd7fc2c"
|
||||
"checksum http 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "dca621d0fa606a5ff2850b6e337b57ad6137ee4d67e940449643ff45af6874c6"
|
||||
|
|
|
@ -1077,7 +1077,9 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
|||
if (markupMap && markupMap->new_func) {
|
||||
RefPtr<Accessible> newAcc =
|
||||
markupMap->new_func(content->AsElement(), aContext);
|
||||
document->BindToDocument(newAcc, aria::GetRoleMap(content->AsElement()));
|
||||
if (newAcc) {
|
||||
document->BindToDocument(newAcc, aria::GetRoleMap(content->AsElement()));
|
||||
}
|
||||
return newAcc;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<style>
|
||||
#a { display: contents }
|
||||
</style>
|
||||
<li id="a">
|
|
@ -6,6 +6,7 @@ load 893515.html
|
|||
load 1072792.xhtml
|
||||
load 1380199.html
|
||||
load 1402999.html
|
||||
load 1463962.html
|
||||
load 1484778.html
|
||||
|
||||
# last_test_to_unload_testsuite.xul MUST be the last test in the list because it
|
||||
|
|
|
@ -33,7 +33,6 @@ pref("extensions.strictCompatibility", false);
|
|||
// extensions.checkCompatibility=false has been set.
|
||||
pref("extensions.checkCompatibility.temporaryThemeOverride_minAppVersion", "29.0a1");
|
||||
|
||||
pref("xpinstall.customConfirmationUI", true);
|
||||
pref("extensions.webextPermissionPrompts", true);
|
||||
pref("extensions.webextOptionalPermissionPrompts", true);
|
||||
|
||||
|
|
|
@ -333,11 +333,7 @@ var gXPInstallObserver = {
|
|||
let notificationElement = [...this.owner.panel.children]
|
||||
.find(n => n.notification == this);
|
||||
if (notificationElement) {
|
||||
if (Services.prefs.getBoolPref("xpinstall.customConfirmationUI", false)) {
|
||||
notificationElement.setAttribute("mainactiondisabled", "true");
|
||||
} else {
|
||||
notificationElement.button.hidden = true;
|
||||
}
|
||||
notificationElement.setAttribute("mainactiondisabled", "true");
|
||||
}
|
||||
break;
|
||||
case "removed":
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
groupbox[closed="true"] > .groupbox-body {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
#thepreviewimage {
|
||||
display: block;
|
||||
/* This following entry can be removed when Bug 522850 is fixed. */
|
||||
|
|
|
@ -3119,14 +3119,10 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
|
||||
if (downloadingCount == 0) {
|
||||
this.destroy();
|
||||
if (Services.prefs.getBoolPref("xpinstall.customConfirmationUI", false)) {
|
||||
this.progressmeter.setAttribute("mode", "undetermined");
|
||||
let status = gNavigatorBundle.getString("addonDownloadVerifying");
|
||||
this.progresstext.setAttribute("value", status);
|
||||
this.progresstext.setAttribute("tooltiptext", status);
|
||||
} else {
|
||||
PopupNotifications.remove(this.notification);
|
||||
}
|
||||
this.progressmeter.setAttribute("mode", "undetermined");
|
||||
let status = gNavigatorBundle.getString("addonDownloadVerifying");
|
||||
this.progresstext.setAttribute("value", status);
|
||||
this.progresstext.setAttribute("tooltiptext", status);
|
||||
} else {
|
||||
this.setProgress(progress, maxProgress);
|
||||
}
|
||||
|
|
|
@ -14,9 +14,10 @@ skip-if = !e10s
|
|||
[test_accepted_cards.html]
|
||||
[test_address_form.html]
|
||||
[test_address_option.html]
|
||||
skip-if = os == "linux" # Bug 1490077 comment 7
|
||||
skip-if = os == "linux" || os == "win" # Bug 1493216
|
||||
[test_address_picker.html]
|
||||
[test_basic_card_form.html]
|
||||
skip-if = debug || asan # Bug 1493349
|
||||
[test_basic_card_option.html]
|
||||
[test_completion_error_page.html]
|
||||
[test_currency_amount.html]
|
||||
|
|
|
@ -9,6 +9,7 @@ support-files =
|
|||
|
||||
[test_bug246699.html]
|
||||
[test_bug292789.html]
|
||||
skip-if = os == 'android'
|
||||
[test_bug423375.html]
|
||||
[test_bug470804.html]
|
||||
[test_bug1367586.html]
|
||||
|
|
|
@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=292789
|
|||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<script src="chrome://global/content/treeUtils.js"></script>
|
||||
<script type="application/javascript" src="chrome://mozapps/content/xpinstall/xpinstallConfirm.js"></script>
|
||||
<script type="application/javascript" src="chrome://mozapps/content/extensions/eula.js"></script>
|
||||
<script id="resjs" type="application/javascript"></script>
|
||||
</div>
|
||||
<pre id="test">
|
||||
|
@ -29,11 +29,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=292789
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let ChromeUtils = {
|
||||
import() {},
|
||||
};
|
||||
|
||||
/** <script src=""> test **/
|
||||
function testScriptSrc(aCallback) {
|
||||
is(typeof gTreeUtils.sort, "function",
|
||||
"content can still load <script> from chrome://global");
|
||||
is(typeof XPInstallConfirm, "undefined",
|
||||
is(typeof Startup, "undefined",
|
||||
"content should not be able to load <script> from chrome://mozapps");
|
||||
|
||||
/** make sure the last one didn't pass because someone
|
||||
|
@ -41,12 +45,12 @@ function testScriptSrc(aCallback) {
|
|||
**/
|
||||
var resjs = document.getElementById("resjs");
|
||||
resjs.onload = scriptOnload;
|
||||
resjs.src = "resource://gre/chrome/toolkit/content/mozapps/xpinstall/xpinstallConfirm.js";
|
||||
resjs.src = "resource://gre/chrome/toolkit/content/mozapps/extensions/eula.js";
|
||||
document.getElementById("content").appendChild(resjs);
|
||||
|
||||
function scriptOnload() {
|
||||
is(typeof XPInstallConfirm, "object",
|
||||
"xpinstallConfirm.js has not moved unexpectedly");
|
||||
is(typeof Startup, "function",
|
||||
"extensions.js has not moved unexpectedly");
|
||||
|
||||
// trigger the callback
|
||||
if (aCallback)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
This is the debugger.html project output.
|
||||
See https://github.com/devtools-html/debugger.html
|
||||
|
||||
Version 88
|
||||
Version 89
|
||||
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-87...release-88
|
||||
Comparison: https://github.com/devtools-html/debugger.html/compare/release-88...release-89
|
||||
|
||||
Packages:
|
||||
- babel-plugin-transform-es2015-modules-commonjs @6.26.2
|
||||
|
|
|
@ -3999,7 +3999,8 @@ html[dir="rtl"] .object-node {
|
|||
}
|
||||
|
||||
.welcomebox__searchSources:hover,
|
||||
.welcomebox__searchProject:hover {
|
||||
.welcomebox__searchProject:hover,
|
||||
.welcomebox__allShortcuts:hover {
|
||||
color: var(--theme-body-color);
|
||||
}
|
||||
|
||||
|
|
|
@ -25458,9 +25458,9 @@ function locationKey(start) {
|
|||
function mapOriginalExpression(expression, mappings) {
|
||||
const ast = (0, _ast.parseScript)(expression, { allowAwaitOutsideFunction: true });
|
||||
const scopes = (0, _getScopes.buildScopeList)(ast, "");
|
||||
let shouldUpdate = false;
|
||||
|
||||
const nodes = new Map();
|
||||
|
||||
const replacements = new Map();
|
||||
|
||||
// The ref-only global bindings are the ones that are accessed, but not
|
||||
|
@ -25471,6 +25471,7 @@ function mapOriginalExpression(expression, mappings) {
|
|||
for (const name of Object.keys(scopes[0].bindings)) {
|
||||
const { refs } = scopes[0].bindings[name];
|
||||
const mapping = mappings[name];
|
||||
|
||||
if (!refs.every(ref => ref.type === "ref") || !mapping || mapping === name) {
|
||||
continue;
|
||||
}
|
||||
|
@ -25507,10 +25508,15 @@ function mapOriginalExpression(expression, mappings) {
|
|||
const replacement = replacements.get(locationKey(node.loc.start));
|
||||
if (replacement) {
|
||||
replaceNode(ancestors, t.cloneNode(replacement));
|
||||
shouldUpdate = true;
|
||||
}
|
||||
});
|
||||
|
||||
return (0, _generator2.default)(ast).code;
|
||||
if (shouldUpdate) {
|
||||
return (0, _generator2.default)(ast).code;
|
||||
}
|
||||
|
||||
return expression;
|
||||
}
|
||||
|
||||
/***/ }),
|
||||
|
@ -25912,9 +25918,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|||
|
||||
function mapExpression(expression, mappings, bindings, shouldMapBindings = true, shouldMapAwait = true) {
|
||||
const mapped = {
|
||||
originalExpression: false,
|
||||
bindings: false,
|
||||
await: false,
|
||||
bindings: false,
|
||||
originalExpression: false
|
||||
};
|
||||
|
||||
try {
|
||||
|
@ -25936,12 +25942,12 @@ function mapExpression(expression, mappings, bindings, shouldMapBindings = true,
|
|||
mapped.await = beforeAwait !== expression;
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
console.warn(`Error when mapping ${expression} expression:`, e);
|
||||
}
|
||||
|
||||
return {
|
||||
expression,
|
||||
mapped,
|
||||
mapped
|
||||
};
|
||||
} /* 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
|
||||
|
@ -26021,7 +26027,9 @@ function hasDestructuring(node) {
|
|||
|
||||
function mapExpressionBindings(expression, bindings = []) {
|
||||
const ast = (0, _ast.parseScript)(expression, { allowAwaitOutsideFunction: true });
|
||||
let isMapped = false;
|
||||
let shouldUpdate = true;
|
||||
|
||||
t.traverse(ast, (node, ancestors) => {
|
||||
const parent = ancestors[ancestors.length - 1];
|
||||
|
||||
|
@ -26037,6 +26045,7 @@ function mapExpressionBindings(expression, bindings = []) {
|
|||
if (t.isAssignmentExpression(node)) {
|
||||
if (t.isIdentifier(node.left)) {
|
||||
const newNode = globalizeAssignment(node, bindings);
|
||||
isMapped = true;
|
||||
return replaceNode(ancestors, newNode);
|
||||
}
|
||||
|
||||
|
@ -26057,11 +26066,12 @@ function mapExpressionBindings(expression, bindings = []) {
|
|||
|
||||
if (!t.isForStatement(parent.node)) {
|
||||
const newNodes = globalizeDeclaration(node, bindings);
|
||||
isMapped = true;
|
||||
replaceNode(ancestors, newNodes);
|
||||
}
|
||||
});
|
||||
|
||||
if (!shouldUpdate) {
|
||||
if (!shouldUpdate || !isMapped) {
|
||||
return expression;
|
||||
}
|
||||
|
||||
|
@ -46723,7 +46733,7 @@ exports.tokTypes = types;
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = handleTopLevelAwait;
|
||||
exports.default = mapTopLevelAwait;
|
||||
|
||||
var _template = __webpack_require__(2397);
|
||||
|
||||
|
@ -46763,11 +46773,11 @@ function wrapExpression(ast) {
|
|||
return (0, _generator2.default)(newAst).code;
|
||||
}
|
||||
|
||||
function handleTopLevelAwait(expression) {
|
||||
function mapTopLevelAwait(expression) {
|
||||
const ast = hasTopLevelAwait(expression);
|
||||
if (ast) {
|
||||
const func = wrapExpression(ast);
|
||||
return (0, _generator2.default)(_template2.default.ast(`(${func})().then(console.log).catch(console.error)`)).code;
|
||||
return (0, _generator2.default)(_template2.default.ast(`(${func})().then(console.log).catch(console.error);`)).code;
|
||||
}
|
||||
|
||||
return expression;
|
||||
|
|
|
@ -44,8 +44,10 @@ async function getReactProps(evaluate, displayName) {
|
|||
}
|
||||
|
||||
async function getImmutableProps(expression, evaluate) {
|
||||
const immutableEntries = await evaluate((exp => `${exp}.toJS()`)(expression));
|
||||
const immutableType = await evaluate((exp => `${exp}.constructor.name`)(expression));
|
||||
// NOTE: it's possible the expression is a statement e.g `_this.fields;`
|
||||
expression = expression.replace(/;$/, "");
|
||||
const immutableEntries = await evaluate(`${expression}.toJS()`);
|
||||
const immutableType = await evaluate(`${expression}.constructor.name`);
|
||||
return {
|
||||
type: immutableType.result,
|
||||
entries: immutableEntries.result
|
||||
|
|
|
@ -166,7 +166,8 @@ class App extends _react.Component {
|
|||
startPanelSize: startPanelSize,
|
||||
endPanelSize: endPanelSize
|
||||
}), !this.props.selectedSource ? _react2.default.createElement(_WelcomeBox2.default, {
|
||||
horizontal: horizontal
|
||||
horizontal: horizontal,
|
||||
toggleShortcutsModal: () => this.toggleShortcutsModal()
|
||||
}) : null, _react2.default.createElement(_ProjectSearch2.default, null)));
|
||||
};
|
||||
|
||||
|
|
|
@ -236,7 +236,8 @@ class Popup extends _react.Component {
|
|||
|
||||
renderObjectPreview() {
|
||||
const {
|
||||
extra
|
||||
extra,
|
||||
value
|
||||
} = this.props;
|
||||
const root = this.getRoot();
|
||||
|
||||
|
@ -252,12 +253,10 @@ class Popup extends _react.Component {
|
|||
|
||||
let header = null;
|
||||
|
||||
if ((0, _preview.isImmutable)(this.getObjectProperties())) {
|
||||
if (extra.immutable && (0, _preview.isImmutablePreview)(value)) {
|
||||
header = this.renderImmutable(extra.immutable);
|
||||
roots = roots.filter(r => r.type != NODE_TYPES.PROTOTYPE);
|
||||
}
|
||||
|
||||
if (extra.react && (0, _preview.isReactComponent)(this.getObjectProperties())) {
|
||||
} else if (extra.react && (0, _preview.isReactComponent)(this.getObjectProperties())) {
|
||||
header = this.renderReact(extra.react);
|
||||
roots = roots.filter(r => ["state", "props"].includes(r.name));
|
||||
}
|
||||
|
|
|
@ -185,6 +185,13 @@ class SearchBar extends _react.Component {
|
|||
return this.doSearch(e.target.value);
|
||||
};
|
||||
|
||||
this.onHistoryScroll = query => {
|
||||
this.setState({
|
||||
query
|
||||
});
|
||||
this.doSearch(query);
|
||||
};
|
||||
|
||||
this.renderSearchModifiers = () => {
|
||||
const {
|
||||
modifiers,
|
||||
|
@ -341,6 +348,7 @@ class SearchBar extends _react.Component {
|
|||
onBlur: this.onBlur,
|
||||
showErrorEmoji: this.shouldShowErrorEmoji(),
|
||||
onKeyDown: this.onKeyDown,
|
||||
onHistoryScroll: this.onHistoryScroll,
|
||||
handleNext: e => this.traverseResults(e, false),
|
||||
handlePrev: e => this.traverseResults(e, true),
|
||||
handleClose: this.closeSearch,
|
||||
|
|
|
@ -119,10 +119,16 @@ class ProjectSearch extends _react.Component {
|
|||
const query = sanitizeQuery(this.state.inputValue);
|
||||
|
||||
if (query) {
|
||||
this.props.searchSources(query);
|
||||
this.doSearch(query);
|
||||
}
|
||||
};
|
||||
|
||||
this.onHistoryScroll = query => {
|
||||
this.setState({
|
||||
inputValue: query
|
||||
});
|
||||
};
|
||||
|
||||
this.onEnterPress = () => {
|
||||
if (this.focusedItem && !this.state.inputFocused) {
|
||||
const {
|
||||
|
@ -276,6 +282,10 @@ class ProjectSearch extends _react.Component {
|
|||
}
|
||||
}
|
||||
|
||||
doSearch(searchTerm) {
|
||||
this.props.searchSources(searchTerm);
|
||||
}
|
||||
|
||||
shouldShowErrorEmoji() {
|
||||
return !this.getResultCount() && this.props.status === _projectTextSearch.statusType.done;
|
||||
}
|
||||
|
@ -296,6 +306,7 @@ class ProjectSearch extends _react.Component {
|
|||
inputFocused: false
|
||||
}),
|
||||
onKeyDown: this.onKeyDown,
|
||||
onHistoryScroll: this.onHistoryScroll,
|
||||
handleClose: this.props.closeProjectSearch,
|
||||
ref: "searchInput"
|
||||
});
|
||||
|
|
|
@ -49,11 +49,14 @@ class WelcomeBox extends _react.Component {
|
|||
render() {
|
||||
const searchSourcesShortcut = (0, _text.formatKeyShortcut)(L10N.getStr("sources.search.key2"));
|
||||
const searchProjectShortcut = (0, _text.formatKeyShortcut)(L10N.getStr("projectTextSearch.key"));
|
||||
const allShortcutsShortcut = (0, _text.formatKeyShortcut)(L10N.getStr("allShortcut.key"));
|
||||
const allShortcutsLabel = L10N.getStr("welcome.allShortcuts");
|
||||
const searchSourcesLabel = L10N.getStr("welcome.search2").substring(2);
|
||||
const searchProjectLabel = L10N.getStr("welcome.findInFiles2").substring(2);
|
||||
const {
|
||||
setActiveSearch,
|
||||
openQuickOpen
|
||||
openQuickOpen,
|
||||
toggleShortcutsModal
|
||||
} = this.props;
|
||||
return _react2.default.createElement("div", {
|
||||
className: "welcomebox"
|
||||
|
@ -79,7 +82,16 @@ class WelcomeBox extends _react.Component {
|
|||
className: "shortcutKey"
|
||||
}, searchProjectShortcut), _react2.default.createElement("span", {
|
||||
className: "shortcutLabel"
|
||||
}, searchProjectLabel))), this.renderToggleButton()));
|
||||
}, searchProjectLabel)), _react2.default.createElement("p", {
|
||||
className: "welcomebox__allShortcuts",
|
||||
role: "button",
|
||||
tabIndex: "0",
|
||||
onClick: () => toggleShortcutsModal()
|
||||
}, _react2.default.createElement("span", {
|
||||
className: "shortcutKey"
|
||||
}, allShortcutsShortcut), _react2.default.createElement("span", {
|
||||
className: "shortcutLabel"
|
||||
}, allShortcutsLabel))), this.renderToggleButton()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,8 +66,52 @@ class SearchInput extends _react.Component {
|
|||
}
|
||||
};
|
||||
|
||||
this.onKeyDown = e => {
|
||||
const {
|
||||
onHistoryScroll,
|
||||
onKeyDown
|
||||
} = this.props;
|
||||
|
||||
if (!onHistoryScroll) {
|
||||
return onKeyDown(e);
|
||||
}
|
||||
|
||||
const inputValue = e.target.value;
|
||||
const {
|
||||
history
|
||||
} = this.state;
|
||||
const currentHistoryIndex = history.indexOf(inputValue);
|
||||
|
||||
if (e.key === "Enter") {
|
||||
this.saveEnteredTerm(inputValue);
|
||||
return onKeyDown(e);
|
||||
}
|
||||
|
||||
if (e.key === "ArrowUp") {
|
||||
const previous = currentHistoryIndex > -1 ? currentHistoryIndex - 1 : history.length - 1;
|
||||
const previousInHistory = history[previous];
|
||||
|
||||
if (previousInHistory) {
|
||||
e.preventDefault();
|
||||
onHistoryScroll(previousInHistory);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.key === "ArrowDown") {
|
||||
const next = currentHistoryIndex + 1;
|
||||
const nextInHistory = history[next];
|
||||
|
||||
if (nextInHistory) {
|
||||
onHistoryScroll(nextInHistory);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.state = {
|
||||
inputFocused: false
|
||||
inputFocused: false,
|
||||
history: []
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -111,6 +155,22 @@ class SearchInput extends _react.Component {
|
|||
return [arrowBtn(handlePrev, "arrow-up", (0, _classnames2.default)("nav-btn", "prev"), L10N.getFormatStr("editor.searchResults.prevResult")), arrowBtn(handleNext, "arrow-down", (0, _classnames2.default)("nav-btn", "next"), L10N.getFormatStr("editor.searchResults.nextResult"))];
|
||||
}
|
||||
|
||||
saveEnteredTerm(query) {
|
||||
const {
|
||||
history
|
||||
} = this.state;
|
||||
const previousIndex = history.indexOf(query);
|
||||
|
||||
if (previousIndex !== -1) {
|
||||
history.splice(previousIndex, 1);
|
||||
}
|
||||
|
||||
history.push(query);
|
||||
this.setState({
|
||||
history
|
||||
});
|
||||
}
|
||||
|
||||
renderSummaryMsg() {
|
||||
const {
|
||||
summaryMsg
|
||||
|
@ -146,7 +206,6 @@ class SearchInput extends _react.Component {
|
|||
expanded,
|
||||
handleClose,
|
||||
onChange,
|
||||
onKeyDown,
|
||||
onKeyUp,
|
||||
placeholder,
|
||||
query,
|
||||
|
@ -160,7 +219,7 @@ class SearchInput extends _react.Component {
|
|||
empty: showErrorEmoji
|
||||
}),
|
||||
onChange,
|
||||
onKeyDown,
|
||||
onKeyDown: e => this.onKeyDown(e),
|
||||
onKeyUp,
|
||||
onFocus: e => this.onFocus(e),
|
||||
onBlur: e => this.onBlur(e),
|
||||
|
|
|
@ -582,6 +582,9 @@ support-files =
|
|||
examples/sourcemaps-reload/doc-sourcemaps-reload.html
|
||||
examples/sourcemaps-reload/doc-sourcemaps-reload2.html
|
||||
examples/sourcemaps-reload/doc-sourcemaps-reload3.html
|
||||
examples/react/build/main.js
|
||||
examples/react/build/main.js.map
|
||||
examples/doc-react.html
|
||||
examples/wasm-sourcemaps/fib.c
|
||||
examples/wasm-sourcemaps/fib.wasm
|
||||
examples/wasm-sourcemaps/fib.wasm.map
|
||||
|
@ -735,6 +738,7 @@ skip-if = debug || (verify && (os == 'win')) || (os == "win" && os_version == "6
|
|||
[browser_dbg-tabs.js]
|
||||
[browser_dbg-tabs-pretty-print.js]
|
||||
[browser_dbg-toggling-tools.js]
|
||||
[browser_dbg-react-app.js]
|
||||
[browser_dbg-wasm-sourcemaps.js]
|
||||
skip-if = true
|
||||
[browser_dbg_rr_breakpoints-01.js]
|
||||
|
|
|
@ -57,7 +57,7 @@ function quickOpen(dbg, query, shortcut = "quickOpen") {
|
|||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-script-switching.html");
|
||||
|
||||
info("Testing opening and closing");
|
||||
info("test opening and closing");
|
||||
quickOpen(dbg, "");
|
||||
pressKey(dbg, "Escape");
|
||||
assertDisabled(dbg);
|
||||
|
@ -81,7 +81,7 @@ add_task(async function() {
|
|||
pressKey(dbg, "Enter");
|
||||
await waitForSelectedSource(dbg, "switching-02");
|
||||
|
||||
info("Testing hitting tab closes the search");
|
||||
info("Testing tab closes the search");
|
||||
quickOpen(dbg, "sw");
|
||||
pressKey(dbg, "Tab");
|
||||
assertDisabled(dbg);
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
add_task(async function() {
|
||||
const dbg = await initDebugger("doc-react.html", "App.js");
|
||||
|
||||
await waitForSource(dbg, "App.js");
|
||||
await addBreakpoint(dbg, "App.js", 11);
|
||||
|
||||
|
||||
info('Test previewing an immutable Map inside of a react component')
|
||||
invokeInTab("clickButton");
|
||||
await waitForPaused(dbg);
|
||||
await waitForState(
|
||||
dbg,
|
||||
state => dbg.selectors.getSelectedScopeMappings(state)
|
||||
);
|
||||
|
||||
await assertPreviewTextValue(dbg, 10, 22, {
|
||||
text: "Map\na: 2",
|
||||
expression: "_this.fields;"
|
||||
});
|
||||
});
|
|
@ -28,19 +28,19 @@ function testForOf(dbg) {
|
|||
{
|
||||
line: 5,
|
||||
column: 7,
|
||||
expression: "doThing;",
|
||||
expression: "doThing",
|
||||
result: "doThing(arg)"
|
||||
},
|
||||
{
|
||||
line: 5,
|
||||
column: 13,
|
||||
expression: "x;",
|
||||
expression: "x",
|
||||
result: "1"
|
||||
},
|
||||
{
|
||||
line: 8,
|
||||
column: 16,
|
||||
expression: "doThing;",
|
||||
expression: "doThing",
|
||||
result: "doThing(arg)"
|
||||
}
|
||||
]);
|
||||
|
@ -60,7 +60,7 @@ function testShadowing(dbg) {
|
|||
{
|
||||
line: 2,
|
||||
column: 9,
|
||||
expression: "aVar;",
|
||||
expression: "aVar",
|
||||
result: '"var3"'
|
||||
},
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ function testShadowing(dbg) {
|
|||
{
|
||||
line: 10,
|
||||
column: 11,
|
||||
expression: "aVar;",
|
||||
expression: "aVar",
|
||||
result: '"var3"'
|
||||
},
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ function testShadowing(dbg) {
|
|||
{
|
||||
line: 14,
|
||||
column: 13,
|
||||
expression: "aVar;",
|
||||
expression: "aVar",
|
||||
result: '"var3"'
|
||||
},
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ function testImportedBindings(dbg) {
|
|||
{
|
||||
line: 24,
|
||||
column: 16,
|
||||
expression: "aNamespace;",
|
||||
expression: "aNamespace",
|
||||
fields: [["aNamed", "a-named"], ["default", "a-default"]]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="text/javascript" src="react/build/main.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
|
@ -0,0 +1,4 @@
|
|||
### React app
|
||||
|
||||
- built with create-react-app
|
||||
-
|
|
@ -0,0 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><title>React App</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/main.js"></script></body></html>
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1 @@
|
|||
"use strict";var precacheConfig=[["/index.html","8e06e5d21664facfd9a8b643baeea2d8"],["/main.js","c5e8e6a9df7d7c5bddda7cfc3090060d"]],cacheName="sw-precache-v3-sw-precache-webpack-plugin-"+(self.registration?self.registration.scope:""),ignoreUrlParametersMatching=[/^utm_/],addDirectoryIndex=function(e,t){var n=new URL(e);return"/"===n.pathname.slice(-1)&&(n.pathname+=t),n.toString()},cleanResponse=function(t){return t.redirected?("body"in t?Promise.resolve(t.body):t.blob()).then(function(e){return new Response(e,{headers:t.headers,status:t.status,statusText:t.statusText})}):Promise.resolve(t)},createCacheKey=function(e,t,n,r){var a=new URL(e);return r&&a.pathname.match(r)||(a.search+=(a.search?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)),a.toString()},isPathWhitelisted=function(e,t){if(0===e.length)return!0;var n=new URL(t).pathname;return e.some(function(e){return n.match(e)})},stripIgnoredUrlParameters=function(e,n){var t=new URL(e);return t.hash="",t.search=t.search.slice(1).split("&").map(function(e){return e.split("=")}).filter(function(t){return n.every(function(e){return!e.test(t[0])})}).map(function(e){return e.join("=")}).join("&"),t.toString()},hashParamName="_sw-precache",urlsToCacheKeys=new Map(precacheConfig.map(function(e){var t=e[0],n=e[1],r=new URL(t,self.location),a=createCacheKey(r,hashParamName,n,/\.\w{8}\./);return[r.toString(),a]}));function setOfCachedUrls(e){return e.keys().then(function(e){return e.map(function(e){return e.url})}).then(function(e){return new Set(e)})}self.addEventListener("install",function(e){e.waitUntil(caches.open(cacheName).then(function(r){return setOfCachedUrls(r).then(function(n){return Promise.all(Array.from(urlsToCacheKeys.values()).map(function(t){if(!n.has(t)){var e=new Request(t,{credentials:"same-origin"});return fetch(e).then(function(e){if(!e.ok)throw new Error("Request for "+t+" returned a response with status "+e.status);return cleanResponse(e).then(function(e){return r.put(t,e)})})}}))})}).then(function(){return self.skipWaiting()}))}),self.addEventListener("activate",function(e){var n=new Set(urlsToCacheKeys.values());e.waitUntil(caches.open(cacheName).then(function(t){return t.keys().then(function(e){return Promise.all(e.map(function(e){if(!n.has(e.url))return t.delete(e)}))})}).then(function(){return self.clients.claim()}))}),self.addEventListener("fetch",function(t){if("GET"===t.request.method){var e,n=stripIgnoredUrlParameters(t.request.url,ignoreUrlParametersMatching),r="index.html";(e=urlsToCacheKeys.has(n))||(n=addDirectoryIndex(n,r),e=urlsToCacheKeys.has(n));var a="/index.html";!e&&"navigate"===t.request.mode&&isPathWhitelisted(["^(?!\\/__).*"],t.request.url)&&(n=new URL(a,self.location).toString(),e=urlsToCacheKeys.has(n)),e&&t.respondWith(caches.open(cacheName).then(function(e){return e.match(urlsToCacheKeys.get(n)).then(function(e){if(e)return e;throw Error("The cached response that was expected is missing.")})}).catch(function(e){return console.warn('Couldn\'t serve response for "%s" from cache: %O',t.request.url,e),fetch(t.request)}))}});
|
|
@ -0,0 +1,16 @@
|
|||
// config-overrides.js
|
||||
module.exports = {
|
||||
webpack: function(config, env) {
|
||||
if (env === "production") {
|
||||
//JS Overrides
|
||||
config.output.filename = '[name].js';
|
||||
config.output.chunkFilename = '[name].chunk.js';
|
||||
}
|
||||
|
||||
// remove minifier
|
||||
const index = config.plugins.findIndex(o => o.options && o.options.compress)
|
||||
config.plugins.splice(index,1)
|
||||
|
||||
return config;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "app",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"immutable": "^3.8.2",
|
||||
"react": "^16.5.1",
|
||||
"react-dom": "^16.5.1",
|
||||
"react-rewired": "^0.5.2",
|
||||
"react-scripts": "1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-app-rewired start",
|
||||
"build": "react-app-rewired build;",
|
||||
"test": "react-app-rewired test --env=jsdom",
|
||||
"eject": "react-app-rewired eject"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-app-rewired": "^1.6.2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="theme-color" content="#000000">
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
import React, { Component } from 'react';
|
||||
import I from "immutable"
|
||||
|
||||
class App extends Component {
|
||||
componentDidMount() {
|
||||
this.fields = new I.Map({a:2})
|
||||
}
|
||||
|
||||
onClick = () => {
|
||||
const f = this.fields
|
||||
console.log(f)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="App">
|
||||
<button onClick={this.onClick}>Click Me</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
window.clickButton = () => document.querySelector("button").click()
|
||||
|
||||
export default App;
|
|
@ -0,0 +1,5 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'));
|
|
@ -1,94 +1,94 @@
|
|||
var rollupTypescriptClasses = (function () {
|
||||
'use strict';
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
function decoratorFactory(opts) {
|
||||
return function decorator(target) {
|
||||
return target;
|
||||
};
|
||||
function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
// This file essentially reproduces an example Angular component to map testing,
|
||||
var AppComponent = /** @class */ (function () {
|
||||
function AppComponent() {
|
||||
this.title = 'app';
|
||||
}
|
||||
AppComponent = __decorate([
|
||||
decoratorFactory({
|
||||
selector: 'app-root'
|
||||
})
|
||||
], AppComponent);
|
||||
return AppComponent;
|
||||
}());
|
||||
var fn = function (arg) {
|
||||
console.log("here");
|
||||
};
|
||||
fn("arg");
|
||||
var AnotherThing = /** @class */ (function () {
|
||||
function AnotherThing() {
|
||||
this.prop = 4;
|
||||
}
|
||||
return AnotherThing;
|
||||
}());
|
||||
var SubDecl = /** @class */ (function (_super) {
|
||||
__extends(SubDecl, _super);
|
||||
function SubDecl() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.prop = 4;
|
||||
return _this;
|
||||
}
|
||||
return SubDecl;
|
||||
}(AnotherThing));
|
||||
var SubVar = /** @class */ (function (_super) {
|
||||
__extends(SubExpr, _super);
|
||||
function SubExpr() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.prop = 4;
|
||||
return _this;
|
||||
}
|
||||
return SubExpr;
|
||||
}(AnotherThing));
|
||||
function test () {
|
||||
// This file is specifically for testing the mappings of classes and things
|
||||
// above, which means we don't want to include _other_ references to then.
|
||||
// To avoid having them be optimized out, we include a no-op eval.
|
||||
eval("");
|
||||
console.log("pause here");
|
||||
function decoratorFactory(opts) {
|
||||
return function decorator(target) {
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
// This file essentially reproduces an example Angular component to map testing,
|
||||
var AppComponent = /** @class */ (function () {
|
||||
function AppComponent() {
|
||||
this.title = 'app';
|
||||
}
|
||||
AppComponent = __decorate([
|
||||
decoratorFactory({
|
||||
selector: 'app-root'
|
||||
})
|
||||
], AppComponent);
|
||||
return AppComponent;
|
||||
}());
|
||||
var fn = function (arg) {
|
||||
console.log("here");
|
||||
};
|
||||
fn("arg");
|
||||
var AnotherThing = /** @class */ (function () {
|
||||
function AnotherThing() {
|
||||
this.prop = 4;
|
||||
}
|
||||
return AnotherThing;
|
||||
}());
|
||||
var SubDecl = /** @class */ (function (_super) {
|
||||
__extends(SubDecl, _super);
|
||||
function SubDecl() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.prop = 4;
|
||||
return _this;
|
||||
}
|
||||
return SubDecl;
|
||||
}(AnotherThing));
|
||||
var SubVar = /** @class */ (function (_super) {
|
||||
__extends(SubExpr, _super);
|
||||
function SubExpr() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.prop = 4;
|
||||
return _this;
|
||||
}
|
||||
return SubExpr;
|
||||
}(AnotherThing));
|
||||
function test () {
|
||||
// This file is specifically for testing the mappings of classes and things
|
||||
// above, which means we don't want to include _other_ references to then.
|
||||
// To avoid having them be optimized out, we include a no-op eval.
|
||||
eval("");
|
||||
console.log("pause here");
|
||||
}
|
||||
|
||||
return test;
|
||||
|
|
|
@ -2754,27 +2754,27 @@ exports[DATA_VIEW] = $DataView;
|
|||
/* 90 */
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
g = g || Function("return this")() || (1,eval)("this");
|
||||
} catch(e) {
|
||||
// This works if the window reference is available
|
||||
if(typeof window === "object")
|
||||
g = window;
|
||||
}
|
||||
|
||||
// g can still be undefined, but nothing to do about it...
|
||||
// We return undefined, instead of nothing here, so it's
|
||||
// easier to handle this case. if(!global) { ...}
|
||||
|
||||
module.exports = g;
|
||||
var g;
|
||||
|
||||
// This works in non-strict mode
|
||||
g = (function() {
|
||||
return this;
|
||||
})();
|
||||
|
||||
try {
|
||||
// This works if eval is allowed (see CSP)
|
||||
g = g || Function("return this")() || (1,eval)("this");
|
||||
} catch(e) {
|
||||
// This works if the window reference is available
|
||||
if(typeof window === "object")
|
||||
g = window;
|
||||
}
|
||||
|
||||
// g can still be undefined, but nothing to do about it...
|
||||
// We return undefined, instead of nothing here, so it's
|
||||
// easier to handle this case. if(!global) { ...}
|
||||
|
||||
module.exports = g;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
|
@ -1266,7 +1266,7 @@ function tryHovering(dbg, line, column, elementName) {
|
|||
async function assertPreviewTextValue(dbg, line, column, { text, expression }) {
|
||||
const previewEl = await tryHovering(dbg, line, column, "previewPopup");
|
||||
|
||||
is(previewEl.innerText, text, "Preview text shown to user");
|
||||
ok(previewEl.innerText.includes(text), "Preview text shown to user");
|
||||
|
||||
const preview = dbg.selectors.getPreview(dbg.getState());
|
||||
is(preview.updating, false, "Preview.updating");
|
||||
|
|
|
@ -15,11 +15,6 @@ support-files =
|
|||
code_binary_search.coffee
|
||||
code_binary_search.js
|
||||
code_binary_search.map
|
||||
code_blackboxing_blackboxme.js
|
||||
code_blackboxing_one.js
|
||||
code_blackboxing_three.js
|
||||
code_blackboxing_two.js
|
||||
code_blackboxing_unblackbox.min.js
|
||||
code_breakpoints-break-on-last-line-of-script-on-reload.js
|
||||
code_breakpoints-other-tabs.js
|
||||
code_bug-896139.js
|
||||
|
@ -55,11 +50,7 @@ support-files =
|
|||
code_WorkerTargetActor.attach-worker1.js
|
||||
code_WorkerTargetActor.attach-worker2.js
|
||||
code_WorkerTargetActor.attachThread-worker.js
|
||||
doc_auto-pretty-print-01.html
|
||||
doc_auto-pretty-print-02.html
|
||||
doc_binary_search.html
|
||||
doc_blackboxing.html
|
||||
doc_blackboxing_unblackbox.html
|
||||
doc_breakpoints-break-on-last-line-of-script-on-reload.html
|
||||
doc_breakpoints-other-tabs.html
|
||||
doc_breakpoints-reload.html
|
||||
|
@ -92,10 +83,6 @@ support-files =
|
|||
doc_native-event-handler.html
|
||||
doc_no-page-sources.html
|
||||
doc_pause-exceptions.html
|
||||
doc_pretty-print.html
|
||||
doc_pretty-print-2.html
|
||||
doc_pretty-print-3.html
|
||||
doc_pretty-print-on-paused.html
|
||||
doc_promise-get-allocation-stack.html
|
||||
doc_promise-get-fulfillment-stack.html
|
||||
doc_promise-get-rejection-stack.html
|
||||
|
@ -143,28 +130,8 @@ tags = addons
|
|||
[browser_dbg_addon-console.js]
|
||||
skip-if = e10s && debug || os == 'win' || verify # bug 1005274
|
||||
tags = addons
|
||||
[browser_dbg_auto-pretty-print-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_auto-pretty-print-02.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_auto-pretty-print-03.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_bfcache.js]
|
||||
skip-if = e10s || true # bug 1113935
|
||||
[browser_dbg_blackboxing-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_blackboxing-02.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_blackboxing-03.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_blackboxing-04.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_blackboxing-05.js]
|
||||
skip-if = true # Bug 1385304
|
||||
[browser_dbg_blackboxing-06.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_blackboxing-07.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_breadcrumbs-access.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_break-in-anon.js]
|
||||
|
@ -200,10 +167,6 @@ uses-unsafe-cpows = true
|
|||
uses-unsafe-cpows = true
|
||||
[browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js]
|
||||
skip-if = e10s # Bug 1093535
|
||||
[browser_dbg_breakpoints-button-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_breakpoints-button-02.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_breakpoints-condition-thrown-message.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
|
@ -316,7 +279,6 @@ skip-if = e10s && debug
|
|||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_globalactor.js]
|
||||
[browser_dbg_hide-toolbar-buttons.js]
|
||||
skip-if = e10s
|
||||
[browser_dbg_host-layout.js]
|
||||
uses-unsafe-cpows = true
|
||||
|
|
|
@ -15,11 +15,6 @@ support-files =
|
|||
code_binary_search.coffee
|
||||
code_binary_search.js
|
||||
code_binary_search.map
|
||||
code_blackboxing_blackboxme.js
|
||||
code_blackboxing_one.js
|
||||
code_blackboxing_three.js
|
||||
code_blackboxing_two.js
|
||||
code_blackboxing_unblackbox.min.js
|
||||
code_breakpoints-break-on-last-line-of-script-on-reload.js
|
||||
code_breakpoints-other-tabs.js
|
||||
code_bug-896139.js
|
||||
|
@ -55,11 +50,7 @@ support-files =
|
|||
code_WorkerTargetActor.attach-worker1.js
|
||||
code_WorkerTargetActor.attach-worker2.js
|
||||
code_WorkerTargetActor.attachThread-worker.js
|
||||
doc_auto-pretty-print-01.html
|
||||
doc_auto-pretty-print-02.html
|
||||
doc_binary_search.html
|
||||
doc_blackboxing.html
|
||||
doc_blackboxing_unblackbox.html
|
||||
doc_breakpoints-break-on-last-line-of-script-on-reload.html
|
||||
doc_breakpoints-other-tabs.html
|
||||
doc_breakpoints-reload.html
|
||||
|
@ -92,10 +83,6 @@ support-files =
|
|||
doc_native-event-handler.html
|
||||
doc_no-page-sources.html
|
||||
doc_pause-exceptions.html
|
||||
doc_pretty-print.html
|
||||
doc_pretty-print-2.html
|
||||
doc_pretty-print-3.html
|
||||
doc_pretty-print-on-paused.html
|
||||
doc_promise-get-allocation-stack.html
|
||||
doc_promise-get-fulfillment-stack.html
|
||||
doc_promise-get-rejection-stack.html
|
||||
|
@ -134,9 +121,6 @@ support-files =
|
|||
[browser_dbg_no-dangling-breakpoints.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_no-page-sources.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_on-pause-raise.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug || os == "linux" # Bug 888811 & bug 891176
|
||||
|
@ -146,32 +130,6 @@ skip-if = e10s && debug
|
|||
[browser_dbg_panel-size.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-01.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-02.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-03.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-04.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-05.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-06.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-07.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-08.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-09.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-10.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_parser-11.js]
|
||||
[browser_dbg_parser-computed-name.js]
|
||||
[browser_dbg_parser-function-defaults.js]
|
||||
[browser_dbg_parser-spread-expression.js]
|
||||
[browser_dbg_parser-template-strings.js]
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pause-exceptions-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
|
@ -191,48 +149,6 @@ skip-if = e10s && debug
|
|||
skip-if = e10s
|
||||
[browser_dbg_post-page.js]
|
||||
uses-unsafe-cpows = true
|
||||
[browser_dbg_pretty-print-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-02.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-03.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-04.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-05.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-06.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-07.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-08.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-09.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-10.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-11.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-12.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-13.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_pretty-print-on-paused.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_progress-listener-bug.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
|
@ -257,15 +173,6 @@ skip-if = e10s && debug
|
|||
[browser_dbg_reload-same-script.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_scripts-switching-01.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_scripts-switching-02.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_scripts-switching-03.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
[browser_dbg_search-autofill-identifier.js]
|
||||
uses-unsafe-cpows = true
|
||||
skip-if = e10s && debug
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test auto pretty printing.
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gEditor, gSources, gPrefs, gOptions, gView;
|
||||
|
||||
var gFirstSource = EXAMPLE_URL + "code_ugly-5.js";
|
||||
var gSecondSource = EXAMPLE_URL + "code_ugly-6.js";
|
||||
|
||||
var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: gFirstSource,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gEditor = gDebugger.DebuggerView.editor;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
gPrefs = gDebugger.Prefs;
|
||||
gOptions = gDebugger.DebuggerView.Options;
|
||||
gView = gDebugger.DebuggerView;
|
||||
|
||||
Task.spawn(function* () {
|
||||
testSourceIsUgly();
|
||||
|
||||
enableAutoPrettyPrint();
|
||||
testAutoPrettyPrintOn();
|
||||
|
||||
reload(gPanel);
|
||||
yield waitForSourceShown(gPanel, gFirstSource);
|
||||
testSourceIsUgly();
|
||||
yield waitForSourceShown(gPanel, gFirstSource);
|
||||
testSourceIsPretty();
|
||||
disableAutoPrettyPrint();
|
||||
testAutoPrettyPrintOff();
|
||||
|
||||
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
|
||||
gSources.selectedIndex = 1;
|
||||
yield finished;
|
||||
|
||||
testSecondSourceLabel();
|
||||
testSourceIsUgly();
|
||||
|
||||
enableAutoPrettyPrint();
|
||||
yield closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSourceIsUgly() {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
}
|
||||
|
||||
function testSecondSourceLabel() {
|
||||
let source = gSources.selectedItem.attachment.source;
|
||||
ok(source.url === gSecondSource,
|
||||
"Second source url is correct.");
|
||||
}
|
||||
|
||||
function testProgressBarShown() {
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, 2, "The progress bar should be shown");
|
||||
}
|
||||
|
||||
function testAutoPrettyPrintOn() {
|
||||
is(gPrefs.autoPrettyPrint, true,
|
||||
"The auto-pretty-print pref should be on.");
|
||||
is(gOptions._autoPrettyPrint.getAttribute("checked"), "true",
|
||||
"The Auto pretty print menu item should be checked.");
|
||||
}
|
||||
|
||||
function disableAutoPrettyPrint() {
|
||||
gOptions._autoPrettyPrint.setAttribute("checked", "false");
|
||||
gOptions._toggleAutoPrettyPrint();
|
||||
gOptions._onPopupHidden();
|
||||
}
|
||||
|
||||
function enableAutoPrettyPrint() {
|
||||
gOptions._autoPrettyPrint.setAttribute("checked", "true");
|
||||
gOptions._toggleAutoPrettyPrint();
|
||||
gOptions._onPopupHidden();
|
||||
}
|
||||
|
||||
function testAutoPrettyPrintOff() {
|
||||
is(gPrefs.autoPrettyPrint, false,
|
||||
"The auto-pretty-print pref should be off.");
|
||||
isnot(gOptions._autoPrettyPrint.getAttribute("checked"), "true",
|
||||
"The Auto pretty print menu item should not be checked.");
|
||||
}
|
||||
|
||||
function testSourceIsPretty() {
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gEditor = null;
|
||||
gSources = null;
|
||||
gOptions = null;
|
||||
gPrefs = null;
|
||||
gView = null;
|
||||
Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", gOriginalPref);
|
||||
});
|
|
@ -1,126 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that auto pretty printing doesn't accidentally toggle
|
||||
* pretty printing off when we switch to a minified source
|
||||
* that is already pretty printed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-02.html";
|
||||
|
||||
var gTab, gDebuggee, gPanel, gDebugger;
|
||||
var gEditor, gSources, gPrefs, gOptions, gView;
|
||||
|
||||
var gFirstSource = EXAMPLE_URL + "code_ugly-6.js";
|
||||
var gSecondSource = EXAMPLE_URL + "code_ugly-7.js";
|
||||
|
||||
var gOriginalPref = Services.prefs.getBoolPref("devtools.debugger.auto-pretty-print");
|
||||
Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", true);
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: gFirstSource,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gDebuggee = aDebuggee;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const gPrefs = gDebugger.Prefs;
|
||||
const gOptions = gDebugger.DebuggerView.Options;
|
||||
const gView = gDebugger.DebuggerView;
|
||||
|
||||
// Should be on by default.
|
||||
testAutoPrettyPrintOn();
|
||||
|
||||
Task.spawn(function* () {
|
||||
|
||||
testSourceIsUgly();
|
||||
|
||||
yield waitForSourceShown(gPanel, gFirstSource);
|
||||
testSourceIsPretty();
|
||||
testPrettyPrintButtonOn();
|
||||
|
||||
// select second source
|
||||
yield selectSecondSource();
|
||||
testSecondSourceLabel();
|
||||
|
||||
// select first source
|
||||
yield selectFirstSource();
|
||||
testFirstSourceLabel();
|
||||
testPrettyPrintButtonOn();
|
||||
|
||||
// Disable auto pretty printing so it does not affect the following tests.
|
||||
yield disableAutoPrettyPrint();
|
||||
|
||||
closeDebuggerAndFinish(gPanel)
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
|
||||
});
|
||||
});
|
||||
|
||||
function selectSecondSource() {
|
||||
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN, 2);
|
||||
gSources.selectedIndex = 1;
|
||||
return finished;
|
||||
}
|
||||
|
||||
function selectFirstSource() {
|
||||
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
|
||||
gSources.selectedIndex = 0;
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testSourceIsUgly() {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
}
|
||||
|
||||
function testFirstSourceLabel() {
|
||||
let source = gSources.selectedItem.attachment.source;
|
||||
ok(source.url === gFirstSource,
|
||||
"First source url is correct.");
|
||||
}
|
||||
|
||||
function testSecondSourceLabel() {
|
||||
let source = gSources.selectedItem.attachment.source;
|
||||
ok(source.url === gSecondSource,
|
||||
"Second source url is correct.");
|
||||
}
|
||||
|
||||
function testAutoPrettyPrintOn() {
|
||||
is(gPrefs.autoPrettyPrint, true,
|
||||
"The auto-pretty-print pref should be on.");
|
||||
is(gOptions._autoPrettyPrint.getAttribute("checked"), "true",
|
||||
"The Auto pretty print menu item should be checked.");
|
||||
}
|
||||
|
||||
function testPrettyPrintButtonOn() {
|
||||
is(gDebugger.document.getElementById("pretty-print").checked, true,
|
||||
"The button should be checked when the source is selected.");
|
||||
}
|
||||
|
||||
function disableAutoPrettyPrint() {
|
||||
gOptions._autoPrettyPrint.setAttribute("checked", "false");
|
||||
gOptions._toggleAutoPrettyPrint();
|
||||
gOptions._onPopupHidden();
|
||||
info("Disabled auto pretty printing.");
|
||||
}
|
||||
|
||||
function testSourceIsPretty() {
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
Services.prefs.setBoolPref("devtools.debugger.auto-pretty-print", gOriginalPref);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* If auto pretty-printing it enabled, make sure that if
|
||||
* pretty-printing fails that it still properly shows the original
|
||||
* source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-02.html";
|
||||
|
||||
var FIRST_SOURCE = EXAMPLE_URL + "code_ugly-6.js";
|
||||
var SECOND_SOURCE = EXAMPLE_URL + "code_ugly-7.js";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: FIRST_SOURCE,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
|
||||
const gController = gDebugger.DebuggerController;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
|
||||
Task.spawn(function* () {
|
||||
const secondSource = queries.getSourceByURL(gController.getState(), SECOND_SOURCE);
|
||||
actions.selectSource(secondSource);
|
||||
|
||||
// It should be showing the loading text
|
||||
is(gEditor.getText(), gDebugger.DebuggerView._loadingText,
|
||||
"The editor loading text is shown");
|
||||
|
||||
gController.dispatch({
|
||||
type: constants.TOGGLE_PRETTY_PRINT,
|
||||
status: "error",
|
||||
source: secondSource,
|
||||
});
|
||||
|
||||
is(gEditor.getText(), gDebugger.DebuggerView._loadingText,
|
||||
"The editor loading text is shown");
|
||||
|
||||
yield waitForSourceShown(gPanel, SECOND_SOURCE);
|
||||
|
||||
ok(gEditor.getText().includes("function foo"),
|
||||
"The second source is shown");
|
||||
|
||||
yield closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that if we black box a source and then refresh, it is still black boxed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_binary_search.coffee",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
|
||||
testBlackBoxSource()
|
||||
.then(testBlackBoxReload)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
const bbButton = getBlackBoxButton(gPanel);
|
||||
ok(!bbButton.checked, "Should not be black boxed by default");
|
||||
|
||||
return toggleBlackBoxing(gPanel).then(source => {
|
||||
ok(source.isBlackBoxed, "The source should be black boxed now.");
|
||||
ok(bbButton.checked, "The checkbox should no longer be checked.");
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxReload() {
|
||||
return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
|
||||
const bbButton = getBlackBoxButton(gPanel);
|
||||
const selectedSource = getSelectedSourceElement(gPanel);
|
||||
ok(bbButton.checked, "Should still be black boxed.");
|
||||
ok(selectedSource.classList.contains("black-boxed"),
|
||||
"'black-boxed' class should still be applied");
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
});
|
|
@ -1,60 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that black boxed frames are compressed into a single frame on the stack
|
||||
* view.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gFrames;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: BLACKBOXME_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
|
||||
testBlackBoxSource()
|
||||
.then(testBlackBoxStack)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
return toggleBlackBoxing(gPanel).then(source => {
|
||||
ok(source.isBlackBoxed, "The source should be black boxed now.");
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxStack() {
|
||||
let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => {
|
||||
is(gFrames.itemCount, 3,
|
||||
"Should only get 3 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them should be the combined black boxed frames.");
|
||||
});
|
||||
|
||||
callInTab(gTab, "runTest");
|
||||
return finished;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
});
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that black boxed frames are compressed into a single frame on the stack
|
||||
* view when we are already paused.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gFrames, gSources;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: BLACKBOXME_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
waitForSourceAndCaretAndScopes(gPanel, ".html", 21)
|
||||
.then(testBlackBoxStack)
|
||||
.then(testBlackBoxSource)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
|
||||
callInTab(gTab, "runTest");
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxStack() {
|
||||
is(gFrames.itemCount, 6,
|
||||
"Should get 6 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 0,
|
||||
"And none of them are black boxed.");
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
return toggleBlackBoxing(gPanel, getSourceActor(gSources, BLACKBOXME_URL)).then(aSource => {
|
||||
ok(aSource.isBlackBoxed, "The source should be black boxed now.");
|
||||
|
||||
is(gFrames.itemCount, 3,
|
||||
"Should only get 3 frames.");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1,
|
||||
"And one of them should be the combined black boxed frames.");
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that we get a stack frame for each black boxed source, not a single one
|
||||
* for all of them.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gFrames, gSources;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: BLACKBOXME_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gFrames = gDebugger.DebuggerView.StackFrames;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
blackBoxSources()
|
||||
.then(testBlackBoxStack)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function blackBoxSources() {
|
||||
let finished = waitForThreadEvents(gPanel, "blackboxchange", 3);
|
||||
|
||||
toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_one.js"));
|
||||
toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_two.js"));
|
||||
toggleBlackBoxing(gPanel, getSourceActor(gSources, EXAMPLE_URL + "code_blackboxing_three.js"));
|
||||
return finished;
|
||||
}
|
||||
|
||||
function testBlackBoxStack() {
|
||||
let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => {
|
||||
is(gFrames.itemCount, 4,
|
||||
"Should get 4 frames (one -> two -> three -> doDebuggerStatement).");
|
||||
is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 3,
|
||||
"And 'one', 'two', and 'three' should each have their own black boxed frame.");
|
||||
});
|
||||
|
||||
callInTab(gTab, "one");
|
||||
return finished;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gFrames = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that a "this source is blackboxed" message is shown when necessary
|
||||
* and can be properly dismissed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_binary_search.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gDeck;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_binary_search.coffee",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gDeck = gDebugger.document.getElementById("editor-deck");
|
||||
|
||||
testSourceEditorShown();
|
||||
toggleBlackBoxing(gPanel)
|
||||
.then(testBlackBoxMessageShown)
|
||||
.then(clickStopBlackBoxingButton)
|
||||
.then(testSourceEditorShownAgain)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSourceEditorShown() {
|
||||
is(gDeck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected (the source editor).");
|
||||
}
|
||||
|
||||
function testBlackBoxMessageShown() {
|
||||
is(gDeck.selectedIndex, "1",
|
||||
"The second item in the deck should be selected (the black box message).");
|
||||
}
|
||||
|
||||
function clickStopBlackBoxingButton() {
|
||||
// Give the test a chance to finish before triggering the click event.
|
||||
executeSoon(() => getEditorBlackboxMessageButton().click());
|
||||
return waitForDispatch(gPanel, gDebugger.constants.BLACKBOX);
|
||||
}
|
||||
|
||||
function testSourceEditorShownAgain() {
|
||||
// Wait a tick for the final check to make sure the frontend's click handlers
|
||||
// have finished.
|
||||
return new Promise(resolve => {
|
||||
is(gDeck.selectedIndex, "0",
|
||||
"The first item in the deck should be selected again (the source editor).");
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function getEditorBlackboxMessageButton() {
|
||||
return gDebugger.document.getElementById("black-boxed-message-button");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gDeck = null;
|
||||
});
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that clicking the black box checkbox when paused doesn't re-select the
|
||||
* currently paused frame's source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gSources;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_blackboxing_blackboxme.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
waitForCaretAndScopes(gPanel, 21)
|
||||
.then(testBlackBox)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
|
||||
callInTab(gTab, "runTest");
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBox() {
|
||||
const selectedActor = gSources.selectedValue;
|
||||
|
||||
let finished = waitForSourceShown(gPanel, "blackboxme.js").then(() => {
|
||||
const newSelectedActor = gSources.selectedValue;
|
||||
isnot(selectedActor, newSelectedActor,
|
||||
"Should not have the same url selected.");
|
||||
|
||||
return toggleBlackBoxing(gPanel).then(() => {
|
||||
is(gSources.selectedValue, newSelectedActor,
|
||||
"The selected source did not change.");
|
||||
});
|
||||
});
|
||||
|
||||
gSources.selectedIndex = 0;
|
||||
return finished;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that if we unblackbox a source which has been automatically blackboxed
|
||||
* and then refresh, it is still unblackboxed.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing_unblackbox.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_blackboxing_unblackbox.min.js",
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
|
||||
testBlackBoxSource()
|
||||
.then(testBlackBoxReload)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxSource() {
|
||||
const bbButton = getBlackBoxButton(gPanel);
|
||||
ok(bbButton.checked, "Should be black boxed by default");
|
||||
|
||||
return toggleBlackBoxing(gPanel).then(aSource => {
|
||||
ok(!aSource.isBlackBoxed, "The source should no longer be blackboxed.");
|
||||
});
|
||||
}
|
||||
|
||||
function testBlackBoxReload() {
|
||||
return reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(() => {
|
||||
const selectedSource = getSelectedSourceElement(gPanel);
|
||||
ok(!selectedSource.isBlackBoxed, "The source should not be blackboxed.");
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
});
|
|
@ -1,55 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test if the breakpoints toggle button works as advertised.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
function checkBreakpointsDisabled(isDisabled, total = 3) {
|
||||
let breakpoints = gDebugger.queries.getBreakpoints(getState());
|
||||
|
||||
is(breakpoints.length, total,
|
||||
"Breakpoints should still be set.");
|
||||
is(breakpoints.filter(bp => bp.disabled === isDisabled).length, total,
|
||||
"Breakpoints should be " + (isDisabled ? "disabled" : "enabled") + ".");
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
yield actions.addBreakpoint({ actor: gSources.values[0], line: 5 });
|
||||
yield actions.addBreakpoint({ actor: gSources.values[1], line: 6 });
|
||||
yield actions.addBreakpoint({ actor: gSources.values[1], line: 7 });
|
||||
yield ensureThreadClientState(gPanel, "resumed");
|
||||
|
||||
gSources.toggleBreakpoints();
|
||||
yield waitForDispatch(gPanel, gDebugger.constants.REMOVE_BREAKPOINT, 3);
|
||||
checkBreakpointsDisabled(true);
|
||||
|
||||
const finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED, 3);
|
||||
gSources.toggleBreakpoints();
|
||||
yield waitForDispatch(gPanel, gDebugger.constants.ADD_BREAKPOINT, 3);
|
||||
checkBreakpointsDisabled(false);
|
||||
|
||||
if (gDebugger.gThreadClient.state !== "attached") {
|
||||
yield waitForThreadEvents(gPanel, "resumed");
|
||||
}
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test if the breakpoints toggle button works as advertised when there are
|
||||
* some breakpoints already disabled.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
function checkBreakpointsDisabled(isDisabled, total = 3) {
|
||||
let breakpoints = gDebugger.queries.getBreakpoints(getState());
|
||||
|
||||
is(breakpoints.length, total,
|
||||
"Breakpoints should still be set.");
|
||||
is(breakpoints.filter(bp => bp.disabled === isDisabled).length, total,
|
||||
"Breakpoints should be " + (isDisabled ? "disabled" : "enabled") + ".");
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
yield promise.all([
|
||||
actions.addBreakpoint({ actor: gSources.values[0], line: 5 }),
|
||||
actions.addBreakpoint({ actor: gSources.values[1], line: 6 }),
|
||||
actions.addBreakpoint({ actor: gSources.values[1], line: 7 })
|
||||
]);
|
||||
if (gDebugger.gThreadClient.state !== "attached") {
|
||||
yield waitForThreadEvents(gPanel, "resumed");
|
||||
}
|
||||
|
||||
yield promise.all([
|
||||
actions.disableBreakpoint({ actor: gSources.values[0], line: 5 }),
|
||||
actions.disableBreakpoint({ actor: gSources.values[1], line: 6 })
|
||||
]);
|
||||
|
||||
gSources.toggleBreakpoints();
|
||||
yield waitForDispatch(gPanel, gDebugger.constants.REMOVE_BREAKPOINT, 1);
|
||||
checkBreakpointsDisabled(true);
|
||||
|
||||
gSources.toggleBreakpoints();
|
||||
yield waitForDispatch(gPanel, gDebugger.constants.ADD_BREAKPOINT, 3);
|
||||
checkBreakpointsDisabled(false);
|
||||
|
||||
if (gDebugger.gThreadClient.state !== "attached") {
|
||||
yield waitForThreadEvents(gPanel, "resumed");
|
||||
}
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Bug 1093349: Test that the pretty-printing and blackboxing buttons
|
||||
* are hidden if the server doesn't support them
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_auto-pretty-print-01.html";
|
||||
|
||||
var { RootActor } = require("devtools/server/actors/root");
|
||||
|
||||
function test() {
|
||||
RootActor.prototype.traits.noBlackBoxing = true;
|
||||
RootActor.prototype.traits.noPrettyPrinting = true;
|
||||
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly-5.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
|
||||
let document = aPanel.panelWin.document;
|
||||
let ppButton = document.querySelector("#pretty-print");
|
||||
let bbButton = document.querySelector("#black-box");
|
||||
let sep = document.querySelector("#sources-toolbar .devtools-separator");
|
||||
|
||||
is(ppButton.style.display, "none", "The pretty-print button is hidden");
|
||||
is(bbButton.style.display, "none", "The blackboxing button is hidden");
|
||||
is(sep.style.display, "none", "The separator is hidden");
|
||||
closeDebuggerAndFinish(aPanel);
|
||||
});
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure the right text shows when the page has no sources.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html";
|
||||
|
||||
var gTab, gDebuggee, gPanel, gDebugger;
|
||||
var gEditor, gSources;
|
||||
|
||||
function test() {
|
||||
initDebugger(TAB_URL, { source: null }).then(([aTab, aDebuggee, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gDebuggee = aDebuggee;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gEditor = gDebugger.DebuggerView.editor;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
|
||||
reloadActiveTab(gPanel);
|
||||
waitForNavigation(gPanel)
|
||||
.then(testSourcesEmptyText)
|
||||
.then(() => closeDebuggerAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSourcesEmptyText() {
|
||||
is(gSources.itemCount, 0,
|
||||
"Found no entries in the sources widget.");
|
||||
|
||||
is(gEditor.getText().length, 0,
|
||||
"The source editor should not have any text displayed.");
|
||||
|
||||
is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-text").getAttribute("value"),
|
||||
gDebugger.L10N.getStr("noSourcesText"),
|
||||
"The sources widget should now display 'This page has no sources'.");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gDebuggee = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gEditor = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,33 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that simple JS can be parsed and cached with the reflection API.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = "let x = 42;";
|
||||
let parser = new Parser();
|
||||
let first = parser.get(source);
|
||||
let second = parser.get(source);
|
||||
|
||||
isnot(first, second,
|
||||
"The two syntax trees should be different.");
|
||||
|
||||
let third = parser.get(source, "url");
|
||||
let fourth = parser.get(source, "url");
|
||||
|
||||
isnot(first, third,
|
||||
"The new syntax trees should be different than the old ones.");
|
||||
is(third, fourth,
|
||||
"The new syntax trees were cached once an identifier was specified.");
|
||||
|
||||
is(parser.errors.length, 0,
|
||||
"There should be no errors logged when parsing.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that syntax errors are reported correctly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = "let x + 42;";
|
||||
let parser = new Parser();
|
||||
// Don't pollute the logs with exceptions that we are going to check anyhow.
|
||||
parser.logExceptions = false;
|
||||
let parsed = parser.get(source);
|
||||
|
||||
ok(parsed,
|
||||
"An object should be returned even though the source had a syntax error.");
|
||||
|
||||
is(parser.errors.length, 1,
|
||||
"There should be one error logged when parsing.");
|
||||
is(parser.errors[0].name, "SyntaxError",
|
||||
"The correct exception was caught.");
|
||||
is(parser.errors[0].message, "unexpected token: \'+\'",
|
||||
"The correct exception was caught.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that JS inside HTML can be separated and parsed correctly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = [
|
||||
"<!doctype html>",
|
||||
"<head>",
|
||||
"<script>",
|
||||
"let a = 42;",
|
||||
"</script>",
|
||||
"<script type='text/javascript'>",
|
||||
"let b = 42;",
|
||||
"</script>",
|
||||
"<script type='text/javascript'>",
|
||||
"let c = 42;",
|
||||
"</script>",
|
||||
"</head>"
|
||||
].join("\n");
|
||||
let parser = new Parser();
|
||||
let parsed = parser.get(source);
|
||||
|
||||
ok(parsed,
|
||||
"HTML code should be parsed correctly.");
|
||||
is(parser.errors.length, 0,
|
||||
"There should be no errors logged when parsing.");
|
||||
|
||||
is(parsed.scriptCount, 3,
|
||||
"There should be 3 scripts parsed in the parent HTML source.");
|
||||
|
||||
is(parsed.getScriptInfo(0).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"There is no script at the beginning of the parent source.");
|
||||
is(parsed.getScriptInfo(source.length - 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"There is no script at the end of the parent source.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a")).toSource(), "({start:31, length:13, index:0})",
|
||||
"The first script was located correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b")).toSource(), "({start:85, length:13, index:1})",
|
||||
"The second script was located correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c")).toSource(), "({start:139, length:13, index:2})",
|
||||
"The third script was located correctly.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a") - 1).toSource(), "({start:31, length:13, index:0})",
|
||||
"The left edge of the first script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b") - 1).toSource(), "({start:85, length:13, index:1})",
|
||||
"The left edge of the second script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c") - 1).toSource(), "({start:139, length:13, index:2})",
|
||||
"The left edge of the third script was interpreted correctly.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a") - 2).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The left outside of the first script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b") - 2).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The left outside of the second script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c") - 2).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The left outside of the third script was interpreted correctly.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a") + 12).toSource(), "({start:31, length:13, index:0})",
|
||||
"The right edge of the first script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b") + 12).toSource(), "({start:85, length:13, index:1})",
|
||||
"The right edge of the second script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c") + 12).toSource(), "({start:139, length:13, index:2})",
|
||||
"The right edge of the third script was interpreted correctly.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a") + 13).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The right outside of the first script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b") + 13).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The right outside of the second script was interpreted correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c") + 13).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The right outside of the third script was interpreted correctly.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that faulty JS inside HTML can be separated and identified correctly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = [
|
||||
"<!doctype html>",
|
||||
"<head>",
|
||||
"<SCRIPT>",
|
||||
"let a + 42;",
|
||||
"</SCRIPT>",
|
||||
"<script type='text/javascript'>",
|
||||
"let b = 42;",
|
||||
"</SCRIPT>",
|
||||
"<script type='text/javascript'>",
|
||||
"let c + 42;",
|
||||
"</SCRIPT>",
|
||||
"</head>"
|
||||
].join("\n");
|
||||
let parser = new Parser();
|
||||
// Don't pollute the logs with exceptions that we are going to check anyhow.
|
||||
parser.logExceptions = false;
|
||||
let parsed = parser.get(source);
|
||||
|
||||
ok(parsed,
|
||||
"HTML code should be parsed correctly.");
|
||||
is(parser.errors.length, 2,
|
||||
"There should be two errors logged when parsing.");
|
||||
|
||||
is(parser.errors[0].name, "SyntaxError",
|
||||
"The correct first exception was caught.");
|
||||
is(parser.errors[0].message, "unexpected token: \'+\'",
|
||||
"The correct first exception was caught.");
|
||||
|
||||
is(parser.errors[1].name, "SyntaxError",
|
||||
"The correct second exception was caught.");
|
||||
is(parser.errors[1].message, "unexpected token: \'+\'",
|
||||
"The correct second exception was caught.");
|
||||
|
||||
is(parsed.scriptCount, 1,
|
||||
"There should be 1 script parsed in the parent HTML source.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a")).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The first script shouldn't be considered valid.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let b")).toSource(), "({start:85, length:13, index:0})",
|
||||
"The second script was located correctly.");
|
||||
is(parsed.getScriptInfo(source.indexOf("let c")).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"The third script shouldn't be considered valid.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that JS code containing strings that might look like <script> tags
|
||||
* inside an HTML source is parsed correctly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = [
|
||||
"let a = [];",
|
||||
"a.push('<script>');",
|
||||
"a.push('var a = 42;');",
|
||||
"a.push('</script>');",
|
||||
"a.push('<script type=\"text/javascript\">');",
|
||||
"a.push('var b = 42;');",
|
||||
"a.push('</script>');",
|
||||
"a.push('<script type=\"text/javascript\">');",
|
||||
"a.push('var c = 42;');",
|
||||
"a.push('</script>');"
|
||||
].join("\n");
|
||||
let parser = new Parser();
|
||||
let parsed = parser.get(source);
|
||||
|
||||
ok(parsed,
|
||||
"The javascript code should be parsed correctly.");
|
||||
is(parser.errors.length, 0,
|
||||
"There should be no errors logged when parsing.");
|
||||
|
||||
is(parsed.scriptCount, 1,
|
||||
"There should be 1 script parsed in the parent source.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("let a")).toSource(), "({start:0, length:249, index:0})",
|
||||
"The script location is correct (1).");
|
||||
is(parsed.getScriptInfo(source.indexOf("<script>")).toSource(), "({start:0, length:249, index:0})",
|
||||
"The script location is correct (2).");
|
||||
is(parsed.getScriptInfo(source.indexOf("</script>")).toSource(), "({start:0, length:249, index:0})",
|
||||
"The script location is correct (3).");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that some potentially problematic identifier nodes have the
|
||||
* right location information attached.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser, ParserHelpers, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
function verify(source, predicate, [sline, scol], [eline, ecol]) {
|
||||
let ast = Parser.reflectionAPI.parse(source);
|
||||
let node = SyntaxTreeVisitor.filter(ast, predicate).pop();
|
||||
let loc = ParserHelpers.getNodeLocation(node);
|
||||
|
||||
is(loc.start.toSource(), { line: sline, column: scol }.toSource(),
|
||||
"The start location was correct for the identifier in: '" + source + "'.");
|
||||
is(loc.end.toSource(), { line: eline, column: ecol }.toSource(),
|
||||
"The end location was correct for the identifier in: '" + source + "'.");
|
||||
}
|
||||
|
||||
// FunctionDeclarations and FunctionExpressions.
|
||||
|
||||
// The location is unavailable for the identifier node "foo".
|
||||
verify("function foo(){}", e => e.name == "foo", [1, 9], [1, 12]);
|
||||
verify("\nfunction\nfoo\n(\n)\n{\n}\n", e => e.name == "foo", [3, 0], [3, 3]);
|
||||
|
||||
verify("({bar:function foo(){}})", e => e.name == "foo", [1, 15], [1, 18]);
|
||||
verify("(\n{\nbar\n:\nfunction\nfoo\n(\n)\n{\n}\n}\n)", e => e.name == "foo", [6, 0], [6, 3]);
|
||||
|
||||
// Just to be sure, check the identifier node "bar" as well.
|
||||
verify("({bar:function foo(){}})", e => e.name == "bar", [1, 2], [1, 5]);
|
||||
verify("(\n{\nbar\n:\nfunction\nfoo\n(\n)\n{\n}\n}\n)", e => e.name == "bar", [3, 0], [3, 3]);
|
||||
|
||||
// MemberExpressions.
|
||||
|
||||
// The location is unavailable for the identifier node "bar".
|
||||
verify("foo.bar", e => e.name == "bar", [1, 4], [1, 7]);
|
||||
verify("\nfoo\n.\nbar\n", e => e.name == "bar", [4, 0], [4, 3]);
|
||||
|
||||
// Just to be sure, check the identifier node "foo" as well.
|
||||
verify("foo.bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n.\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
|
||||
// VariableDeclarator
|
||||
|
||||
// The location is incorrect for the identifier node "foo".
|
||||
verify("let foo = bar", e => e.name == "foo", [1, 4], [1, 7]);
|
||||
verify("\nlet\nfoo\n=\nbar\n", e => e.name == "foo", [3, 0], [3, 3]);
|
||||
|
||||
// Just to be sure, check the identifier node "bar" as well.
|
||||
verify("let foo = bar", e => e.name == "bar", [1, 10], [1, 13]);
|
||||
verify("\nlet\nfoo\n=\nbar\n", e => e.name == "bar", [5, 0], [5, 3]);
|
||||
|
||||
// Just to be sure, check AssignmentExpreesions as well.
|
||||
verify("foo = bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n=\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
verify("foo = bar", e => e.name == "bar", [1, 6], [1, 9]);
|
||||
verify("\nfoo\n=\nbar\n", e => e.name == "bar", [4, 0], [4, 3]);
|
||||
|
||||
// LabeledStatement, BreakStatement and ContinueStatement, because it's 1968 again
|
||||
|
||||
verify("foo: bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n:\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
|
||||
verify("foo: for(;;) break foo", e => e.name == "foo", [1, 19], [1, 22]);
|
||||
verify("\nfoo\n:\nfor(\n;\n;\n)\nbreak\nfoo\n", e => e.name == "foo", [9, 0], [9, 3]);
|
||||
|
||||
verify("foo: bar", e => e.name == "foo", [1, 0], [1, 3]);
|
||||
verify("\nfoo\n:\nbar\n", e => e.name == "foo", [2, 0], [2, 3]);
|
||||
|
||||
verify("foo: for(;;) continue foo", e => e.name == "foo", [1, 22], [1, 25]);
|
||||
verify("\nfoo\n:\nfor(\n;\n;\n)\ncontinue\nfoo\n", e => e.name == "foo", [9, 0], [9, 3]);
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Check that nodes with locaiton information attached can be properly
|
||||
* verified for containing lines and columns.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { ParserHelpers } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let node1 = { loc: {
|
||||
start: { line: 1, column: 10 },
|
||||
end: { line: 10, column: 1 }
|
||||
}};
|
||||
let node2 = { loc: {
|
||||
start: { line: 1, column: 10 },
|
||||
end: { line: 1, column: 20 }
|
||||
}};
|
||||
|
||||
ok(ParserHelpers.nodeContainsLine(node1, 1), "1st check.");
|
||||
ok(ParserHelpers.nodeContainsLine(node1, 5), "2nd check.");
|
||||
ok(ParserHelpers.nodeContainsLine(node1, 10), "3rd check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsLine(node1, 0), "4th check.");
|
||||
ok(!ParserHelpers.nodeContainsLine(node1, 11), "5th check.");
|
||||
|
||||
ok(ParserHelpers.nodeContainsLine(node2, 1), "6th check.");
|
||||
ok(!ParserHelpers.nodeContainsLine(node2, 0), "7th check.");
|
||||
ok(!ParserHelpers.nodeContainsLine(node2, 2), "8th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 1, 10), "9th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 10, 1), "10th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 0, 10), "11th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 11, 1), "12th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 1, 9), "13th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node1, 10, 2), "14th check.");
|
||||
|
||||
ok(ParserHelpers.nodeContainsPoint(node2, 1, 10), "15th check.");
|
||||
ok(ParserHelpers.nodeContainsPoint(node2, 1, 15), "16th check.");
|
||||
ok(ParserHelpers.nodeContainsPoint(node2, 1, 20), "17th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 0, 10), "18th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 2, 20), "19th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 0, 9), "20th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 2, 21), "21th check.");
|
||||
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 1, 9), "22th check.");
|
||||
ok(!ParserHelpers.nodeContainsPoint(node2, 1, 21), "23th check.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,291 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that inferring anonymous function information is done correctly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser, ParserHelpers, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
function verify(source, predicate, details) {
|
||||
let { name, chain } = details;
|
||||
let [[sline, scol], [eline, ecol]] = details.loc;
|
||||
let ast = Parser.reflectionAPI.parse(source);
|
||||
let node = SyntaxTreeVisitor.filter(ast, predicate).pop();
|
||||
let info = ParserHelpers.inferFunctionExpressionInfo(node);
|
||||
|
||||
is(info.name, name,
|
||||
"The function expression assignment property name is correct.");
|
||||
is(chain ? info.chain.toSource() : info.chain, chain ? chain.toSource() : chain,
|
||||
"The function expression assignment property chain is correct.");
|
||||
is(info.loc.start.toSource(), { line: sline, column: scol }.toSource(),
|
||||
"The start location was correct for the identifier in: '" + source + "'.");
|
||||
is(info.loc.end.toSource(), { line: eline, column: ecol }.toSource(),
|
||||
"The end location was correct for the identifier in: '" + source + "'.");
|
||||
}
|
||||
|
||||
// VariableDeclarator
|
||||
|
||||
verify("var foo=function(){}", e => e.type == "FunctionExpression", {
|
||||
name: "foo",
|
||||
chain: null,
|
||||
loc: [[1, 4], [1, 7]]
|
||||
});
|
||||
verify("\nvar\nfoo\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression", {
|
||||
name: "foo",
|
||||
chain: null,
|
||||
loc: [[3, 0], [3, 3]]
|
||||
});
|
||||
|
||||
// AssignmentExpression
|
||||
|
||||
verify("foo=function(){}", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[1, 0], [1, 3]] });
|
||||
|
||||
verify("\nfoo\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[2, 0], [2, 3]] });
|
||||
|
||||
verify("foo.bar=function(){}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 0], [1, 7]] });
|
||||
|
||||
verify("\nfoo.bar\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[2, 0], [2, 7]] });
|
||||
|
||||
verify("this.foo=function(){}", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: ["this"], loc: [[1, 0], [1, 8]] });
|
||||
|
||||
verify("\nthis.foo\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: ["this"], loc: [[2, 0], [2, 8]] });
|
||||
|
||||
verify("this.foo.bar=function(){}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[1, 0], [1, 12]] });
|
||||
|
||||
verify("\nthis.foo.bar\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[2, 0], [2, 12]] });
|
||||
|
||||
verify("foo.this.bar=function(){}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo", "this"], loc: [[1, 0], [1, 12]] });
|
||||
|
||||
verify("\nfoo.this.bar\n=\nfunction\n(\n)\n{\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo", "this"], loc: [[2, 0], [2, 12]] });
|
||||
|
||||
// ObjectExpression
|
||||
|
||||
verify("({foo:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[1, 2], [1, 5]] });
|
||||
|
||||
verify("(\n{\nfoo\n:\nfunction\n(\n)\n{\n}\n}\n)", e => e.type == "FunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[3, 0], [3, 3]] });
|
||||
|
||||
verify("({foo:{bar:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 7], [1, 10]] });
|
||||
|
||||
verify("(\n{\nfoo\n:\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n}\n)", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] });
|
||||
|
||||
// AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 5], [1, 8]] });
|
||||
|
||||
verify("\nfoo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "foo"], loc: [[1, 12], [1, 15]] });
|
||||
|
||||
verify("\nnested.foo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "foo", "bar"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.foo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nthis.foo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["this", "foo", "bar"], loc: [[1, 15], [1, 18]] });
|
||||
|
||||
verify("\nthis.foo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["this", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.nested.foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "nested", "foo"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nthis.nested.foo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["this", "nested", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.nested.foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nthis.nested.foo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.this.foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "this", "foo"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.this.foo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "this", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.this.foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nnested.this.foo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
// VariableDeclarator + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("let foo={bar:function(){}}", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 9], [1, 12]] });
|
||||
|
||||
verify("\nlet\nfoo\n=\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] });
|
||||
|
||||
verify("let foo={bar:{baz:function(){}}}", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[1, 14], [1, 17]] });
|
||||
|
||||
verify("\nlet\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[9, 0], [9, 3]] });
|
||||
|
||||
// New/CallExpression + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 5], [1, 8]] });
|
||||
|
||||
verify("\nfoo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 12], [1, 15]] });
|
||||
|
||||
verify("\nnested.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nthis.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 15], [1, 18]] });
|
||||
|
||||
verify("\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.nested.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nthis.nested.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.nested.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.this.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.this.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.this.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
// New/CallExpression + VariableDeclarator + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("let target=foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 16], [1, 19]] });
|
||||
|
||||
verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 21], [1, 24]] });
|
||||
|
||||
verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=nested.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 23], [1, 26]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=nested.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=this.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 21], [1, 24]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=this.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 26], [1, 29]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=this.nested.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=this.nested.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=nested.this.foo({bar:function(){}})", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\nfunction\n(\n)\n{\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=nested.this.foo({bar:{baz:function(){}}})", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\nfunction\n(\n)\n{\n}\n}\n}\n)\n", e => e.type == "FunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that inferring anonymous function information is done correctly
|
||||
* from arrow expressions.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser, ParserHelpers, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
function verify(source, predicate, details) {
|
||||
let { name, chain } = details;
|
||||
let [[sline, scol], [eline, ecol]] = details.loc;
|
||||
let ast = Parser.reflectionAPI.parse(source);
|
||||
let node = SyntaxTreeVisitor.filter(ast, predicate).pop();
|
||||
let info = ParserHelpers.inferFunctionExpressionInfo(node);
|
||||
|
||||
is(info.name, name,
|
||||
"The function expression assignment property name is correct.");
|
||||
is(chain ? info.chain.toSource() : info.chain, chain ? chain.toSource() : chain,
|
||||
"The function expression assignment property chain is correct.");
|
||||
is(info.loc.start.toSource(), { line: sline, column: scol }.toSource(),
|
||||
"The start location was correct for the identifier in: '" + source + "'.");
|
||||
is(info.loc.end.toSource(), { line: eline, column: ecol }.toSource(),
|
||||
"The end location was correct for the identifier in: '" + source + "'.");
|
||||
}
|
||||
|
||||
// VariableDeclarator
|
||||
|
||||
verify("var foo=()=>{}", e => e.type == "ArrowFunctionExpression", {
|
||||
name: "foo",
|
||||
chain: null,
|
||||
loc: [[1, 4], [1, 7]]
|
||||
});
|
||||
verify("\nvar\nfoo\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression", {
|
||||
name: "foo",
|
||||
chain: null,
|
||||
loc: [[3, 0], [3, 3]]
|
||||
});
|
||||
|
||||
// AssignmentExpression
|
||||
|
||||
verify("foo=()=>{}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[1, 0], [1, 3]] });
|
||||
|
||||
verify("\nfoo\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[2, 0], [2, 3]] });
|
||||
|
||||
verify("foo.bar=()=>{}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 0], [1, 7]] });
|
||||
|
||||
verify("\nfoo.bar\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[2, 0], [2, 7]] });
|
||||
|
||||
verify("this.foo=()=>{}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: ["this"], loc: [[1, 0], [1, 8]] });
|
||||
|
||||
verify("\nthis.foo\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: ["this"], loc: [[2, 0], [2, 8]] });
|
||||
|
||||
verify("this.foo.bar=()=>{}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[1, 0], [1, 12]] });
|
||||
|
||||
verify("\nthis.foo.bar\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[2, 0], [2, 12]] });
|
||||
|
||||
verify("foo.this.bar=()=>{}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo", "this"], loc: [[1, 0], [1, 12]] });
|
||||
|
||||
verify("\nfoo.this.bar\n=\n(\n)=>\n{\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo", "this"], loc: [[2, 0], [2, 12]] });
|
||||
|
||||
// ObjectExpression
|
||||
|
||||
verify("({foo:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[1, 2], [1, 5]] });
|
||||
|
||||
verify("(\n{\nfoo\n:\n(\n)=>\n{\n}\n}\n)", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "foo", chain: [], loc: [[3, 0], [3, 3]] });
|
||||
|
||||
verify("({foo:{bar:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 7], [1, 10]] });
|
||||
|
||||
verify("(\n{\nfoo\n:\n{\nbar\n:\n(\n)=>\n{\n}\n}\n}\n)", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] });
|
||||
|
||||
// AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 5], [1, 8]] });
|
||||
|
||||
verify("\nfoo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "foo"], loc: [[1, 12], [1, 15]] });
|
||||
|
||||
verify("\nnested.foo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "foo", "bar"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nthis.foo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["this", "foo", "bar"], loc: [[1, 15], [1, 18]] });
|
||||
|
||||
verify("\nthis.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["this", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.nested.foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "nested", "foo"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nthis.nested.foo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["this", "nested", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.nested.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nthis.nested.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["this", "nested", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.this.foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "this", "foo"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.this.foo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["nested", "this", "foo"], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.this.foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nnested.this.foo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["nested", "this", "foo", "bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
// VariableDeclarator + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("let foo={bar:()=>{}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[1, 9], [1, 12]] });
|
||||
|
||||
verify("\nlet\nfoo\n=\n{\nbar\n:\n(\n)=>\n{\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["foo"], loc: [[6, 0], [6, 3]] });
|
||||
|
||||
verify("let foo={bar:{baz:()=>{}}}", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[1, 14], [1, 17]] });
|
||||
|
||||
verify("\nlet\nfoo\n=\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["foo", "bar"], loc: [[9, 0], [9, 3]] });
|
||||
|
||||
// New/CallExpression + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 5], [1, 8]] });
|
||||
|
||||
verify("\nfoo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 12], [1, 15]] });
|
||||
|
||||
verify("\nnested.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 10], [1, 13]] });
|
||||
|
||||
verify("\nthis.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 15], [1, 18]] });
|
||||
|
||||
verify("\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("this.nested.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nthis.nested.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("this.nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
verify("nested.this.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[1, 17], [1, 20]] });
|
||||
|
||||
verify("\nnested.this.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: [], loc: [[5, 0], [5, 3]] });
|
||||
|
||||
verify("nested.this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[1, 22], [1, 25]] });
|
||||
|
||||
verify("\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["bar"], loc: [[8, 0], [8, 3]] });
|
||||
|
||||
// New/CallExpression + VariableDeclarator + AssignmentExpression + ObjectExpression
|
||||
|
||||
verify("let target=foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 16], [1, 19]] });
|
||||
|
||||
verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 21], [1, 24]] });
|
||||
|
||||
verify("\nlet\ntarget=\nfoo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=nested.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 23], [1, 26]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=this.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 21], [1, 24]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 26], [1, 29]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=this.nested.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=this.nested.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] });
|
||||
|
||||
verify("\nlet\ntarget=\nthis.nested.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
verify("let target=nested.this.foo({bar:()=>{}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[1, 28], [1, 31]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\n(\n)=>\n{\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "bar", chain: ["target"], loc: [[7, 0], [7, 3]] });
|
||||
|
||||
verify("let target=nested.this.foo({bar:{baz:()=>{}}})", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[1, 33], [1, 36]] });
|
||||
|
||||
verify("\nlet\ntarget=\nnested.this.foo\n(\n{\nbar\n:\n{\nbaz\n:\n(\n)=>\n{\n}\n}\n}\n)\n", e => e.type == "ArrowFunctionExpression",
|
||||
{ name: "baz", chain: ["target", "bar"], loc: [[10, 0], [10, 3]] });
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,129 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that creating an evaluation string for certain nodes works properly.
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser, ParserHelpers, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
function verify(source, predicate, string) {
|
||||
let ast = Parser.reflectionAPI.parse(source);
|
||||
let node = SyntaxTreeVisitor.filter(ast, predicate).pop();
|
||||
let info = ParserHelpers.getIdentifierEvalString(node);
|
||||
is(info, string, "The identifier evaluation string is correct.");
|
||||
}
|
||||
|
||||
// Indentifier or Literal
|
||||
|
||||
verify("foo", e => e.type == "Identifier", "foo");
|
||||
verify("undefined", e => e.type == "Identifier", "undefined");
|
||||
verify("null", e => e.type == "Literal", "null");
|
||||
verify("42", e => e.type == "Literal", "42");
|
||||
verify("true", e => e.type == "Literal", "true");
|
||||
verify("\"nasu\"", e => e.type == "Literal", "\"nasu\"");
|
||||
|
||||
// MemberExpression or ThisExpression
|
||||
|
||||
verify("this", e => e.type == "ThisExpression", "this");
|
||||
verify("foo.bar", e => e.name == "foo", "foo");
|
||||
verify("foo.bar", e => e.name == "bar", "foo.bar");
|
||||
|
||||
// MemberExpression + ThisExpression
|
||||
|
||||
verify("this.foo.bar", e => e.type == "ThisExpression", "this");
|
||||
verify("this.foo.bar", e => e.name == "foo", "this.foo");
|
||||
verify("this.foo.bar", e => e.name == "bar", "this.foo.bar");
|
||||
|
||||
verify("foo.this.bar", e => e.name == "foo", "foo");
|
||||
verify("foo.this.bar", e => e.name == "this", "foo.this");
|
||||
verify("foo.this.bar", e => e.name == "bar", "foo.this.bar");
|
||||
|
||||
// ObjectExpression + VariableDeclarator
|
||||
|
||||
verify("let foo={bar:baz}", e => e.name == "baz", "baz");
|
||||
verify("let foo={bar:undefined}", e => e.name == "undefined", "undefined");
|
||||
verify("let foo={bar:null}", e => e.type == "Literal", "null");
|
||||
verify("let foo={bar:42}", e => e.type == "Literal", "42");
|
||||
verify("let foo={bar:true}", e => e.type == "Literal", "true");
|
||||
verify("let foo={bar:\"nasu\"}", e => e.type == "Literal", "\"nasu\"");
|
||||
verify("let foo={bar:this}", e => e.type == "ThisExpression", "this");
|
||||
|
||||
verify("let foo={bar:{nested:baz}}", e => e.name == "baz", "baz");
|
||||
verify("let foo={bar:{nested:undefined}}", e => e.name == "undefined", "undefined");
|
||||
verify("let foo={bar:{nested:null}}", e => e.type == "Literal", "null");
|
||||
verify("let foo={bar:{nested:42}}", e => e.type == "Literal", "42");
|
||||
verify("let foo={bar:{nested:true}}", e => e.type == "Literal", "true");
|
||||
verify("let foo={bar:{nested:\"nasu\"}}", e => e.type == "Literal", "\"nasu\"");
|
||||
verify("let foo={bar:{nested:this}}", e => e.type == "ThisExpression", "this");
|
||||
|
||||
verify("let foo={bar:baz}", e => e.name == "bar", "foo.bar");
|
||||
verify("let foo={bar:baz}", e => e.name == "foo", "foo");
|
||||
|
||||
verify("let foo={bar:{nested:baz}}", e => e.name == "nested", "foo.bar.nested");
|
||||
verify("let foo={bar:{nested:baz}}", e => e.name == "bar", "foo.bar");
|
||||
verify("let foo={bar:{nested:baz}}", e => e.name == "foo", "foo");
|
||||
|
||||
// ObjectExpression + MemberExpression
|
||||
|
||||
verify("parent.foo={bar:baz}", e => e.name == "bar", "parent.foo.bar");
|
||||
verify("parent.foo={bar:baz}", e => e.name == "foo", "parent.foo");
|
||||
verify("parent.foo={bar:baz}", e => e.name == "parent", "parent");
|
||||
|
||||
verify("parent.foo={bar:{nested:baz}}", e => e.name == "nested", "parent.foo.bar.nested");
|
||||
verify("parent.foo={bar:{nested:baz}}", e => e.name == "bar", "parent.foo.bar");
|
||||
verify("parent.foo={bar:{nested:baz}}", e => e.name == "foo", "parent.foo");
|
||||
verify("parent.foo={bar:{nested:baz}}", e => e.name == "parent", "parent");
|
||||
|
||||
verify("this.foo={bar:{nested:baz}}", e => e.name == "nested", "this.foo.bar.nested");
|
||||
verify("this.foo={bar:{nested:baz}}", e => e.name == "bar", "this.foo.bar");
|
||||
verify("this.foo={bar:{nested:baz}}", e => e.name == "foo", "this.foo");
|
||||
verify("this.foo={bar:{nested:baz}}", e => e.type == "ThisExpression", "this");
|
||||
|
||||
verify("this.parent.foo={bar:{nested:baz}}", e => e.name == "nested", "this.parent.foo.bar.nested");
|
||||
verify("this.parent.foo={bar:{nested:baz}}", e => e.name == "bar", "this.parent.foo.bar");
|
||||
verify("this.parent.foo={bar:{nested:baz}}", e => e.name == "foo", "this.parent.foo");
|
||||
verify("this.parent.foo={bar:{nested:baz}}", e => e.name == "parent", "this.parent");
|
||||
verify("this.parent.foo={bar:{nested:baz}}", e => e.type == "ThisExpression", "this");
|
||||
|
||||
verify("parent.this.foo={bar:{nested:baz}}", e => e.name == "nested", "parent.this.foo.bar.nested");
|
||||
verify("parent.this.foo={bar:{nested:baz}}", e => e.name == "bar", "parent.this.foo.bar");
|
||||
verify("parent.this.foo={bar:{nested:baz}}", e => e.name == "foo", "parent.this.foo");
|
||||
verify("parent.this.foo={bar:{nested:baz}}", e => e.name == "this", "parent.this");
|
||||
verify("parent.this.foo={bar:{nested:baz}}", e => e.name == "parent", "parent");
|
||||
|
||||
// FunctionExpression
|
||||
|
||||
verify("function foo(){}", e => e.name == "foo", "foo");
|
||||
verify("var foo=function(){}", e => e.name == "foo", "foo");
|
||||
verify("var foo=function bar(){}", e => e.name == "bar", "bar");
|
||||
|
||||
// New/CallExpression
|
||||
|
||||
verify("foo()", e => e.name == "foo", "foo");
|
||||
verify("new foo()", e => e.name == "foo", "foo");
|
||||
|
||||
verify("foo(bar)", e => e.name == "bar", "bar");
|
||||
verify("foo(bar, baz)", e => e.name == "baz", "baz");
|
||||
verify("foo(undefined)", e => e.name == "undefined", "undefined");
|
||||
verify("foo(null)", e => e.type == "Literal", "null");
|
||||
verify("foo(42)", e => e.type == "Literal", "42");
|
||||
verify("foo(true)", e => e.type == "Literal", "true");
|
||||
verify("foo(\"nasu\")", e => e.type == "Literal", "\"nasu\"");
|
||||
verify("foo(this)", e => e.type == "ThisExpression", "this");
|
||||
|
||||
// New/CallExpression + ObjectExpression + MemberExpression
|
||||
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.name == "nested", "this.parent.foo.bar.nested");
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.name == "bar", "this.parent.foo.bar");
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.name == "foo", "this.parent.foo");
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.name == "parent", "this.parent");
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.type == "ThisExpression", "this");
|
||||
verify("fun(this.parent.foo={bar:{nested:baz}})", e => e.name == "fun", "fun");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Checks if self-closing <script/> tags are parsed by Parser.jsm
|
||||
*/
|
||||
|
||||
function test() {
|
||||
let { Parser } = ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let source = [
|
||||
'<script type="text/javascript" src="chrome://foo.js"/>',
|
||||
'<script type="application/javascript" src="chrome://baz.js"/>',
|
||||
'<script async defer src="chrome://foobar.js"/>',
|
||||
'<script type="application/javascript"/>"hello third"',
|
||||
'<script type="application/javascript">"hello fourth"</script>',
|
||||
].join("\n");
|
||||
let parser = new Parser();
|
||||
let parsed = parser.get(source);
|
||||
|
||||
is(parser.errors.length, 0,
|
||||
"There should be no errors logged when parsing.");
|
||||
is(parsed.scriptCount, 5,
|
||||
"There should be 5 scripts parsed in the parent HTML source.");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("foo.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the first script is empty");
|
||||
is(parsed.getScriptInfo(source.indexOf("baz.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the second script is empty");
|
||||
is(parsed.getScriptInfo(source.indexOf("foobar.js\"/>") + 1).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"the third script is empty");
|
||||
|
||||
is(parsed.getScriptInfo(source.indexOf("hello third!")).toSource(), "({start:-1, length:-1, index:-1})",
|
||||
"Inline script on self-closing tag not considered a script");
|
||||
is(parsed.getScriptInfo(source.indexOf("hello fourth")).toSource(), "({start:255, length:14, index:4})",
|
||||
"The fourth script was located correctly.");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that template strings are correctly processed.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
let { Parser, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let ast = Parser.reflectionAPI.parse("({ [i]: 1 })");
|
||||
let nodes = SyntaxTreeVisitor.filter(ast, e => e.type == "ComputedName");
|
||||
ok(nodes && nodes.length === 1, "Found the ComputedName node");
|
||||
|
||||
let name = nodes[0].name;
|
||||
ok(name, "The ComputedName node has a name property");
|
||||
is(name.type, "Identifier", "The name has a correct type");
|
||||
is(name.name, "i", "The name has a correct name");
|
||||
|
||||
let identNodes = SyntaxTreeVisitor.filter(ast, e => e.type == "Identifier");
|
||||
ok(identNodes && identNodes.length === 1, "Found the Identifier node");
|
||||
|
||||
is(identNodes[0].type, "Identifier", "The identifier has a correct type");
|
||||
is(identNodes[0].name, "i", "The identifier has a correct name");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that function default arguments are correctly processed.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
let { Parser, ParserHelpers, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
function verify(source, predicate, string) {
|
||||
let ast = Parser.reflectionAPI.parse(source);
|
||||
let node = SyntaxTreeVisitor.filter(ast, predicate).pop();
|
||||
let info = ParserHelpers.getIdentifierEvalString(node);
|
||||
is(info, string, "The identifier evaluation string is correct.");
|
||||
}
|
||||
|
||||
// FunctionDeclaration
|
||||
verify("function foo(a, b='b') {}", e => e.type == "Literal", "\"b\"");
|
||||
// FunctionExpression
|
||||
verify("let foo=function(a, b='b') {}", e => e.type == "Literal", "\"b\"");
|
||||
// ArrowFunctionExpression
|
||||
verify("let foo=(a, b='b')=> {}", e => e.type == "Literal", "\"b\"");
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that spread expressions work both in arrays and function calls.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
let { Parser, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
const SCRIPTS = ["[...a]", "foo(...a)"];
|
||||
|
||||
for (let script of SCRIPTS) {
|
||||
info(`Testing spread expression in '${script}'`);
|
||||
let ast = Parser.reflectionAPI.parse(script);
|
||||
let nodes = SyntaxTreeVisitor.filter(ast,
|
||||
e => e.type == "SpreadExpression");
|
||||
ok(nodes && nodes.length === 1, "Found the SpreadExpression node");
|
||||
|
||||
let expr = nodes[0].expression;
|
||||
ok(expr, "The SpreadExpression node has the sub-expression");
|
||||
is(expr.type, "Identifier", "The sub-expression is an Identifier");
|
||||
is(expr.name, "a", "The sub-expression identifier has a correct name");
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that template strings are correctly processed.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
let { Parser, SyntaxTreeVisitor } =
|
||||
ChromeUtils.import("resource://devtools/shared/Parser.jsm", {});
|
||||
|
||||
let ast = Parser.reflectionAPI.parse("`foo${i}bar`");
|
||||
let nodes = SyntaxTreeVisitor.filter(ast, e => e.type == "TemplateLiteral");
|
||||
ok(nodes && nodes.length === 1, "Found the TemplateLiteral node");
|
||||
|
||||
let elements = nodes[0].elements;
|
||||
ok(elements, "The TemplateLiteral node has elements");
|
||||
is(elements.length, 3, "There are 3 elements in the literal");
|
||||
|
||||
["Literal", "Identifier", "Literal"].forEach((type, i) => {
|
||||
is(elements[i].type, type, `Element at index ${i} is '${type}'`);
|
||||
});
|
||||
|
||||
finish();
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that clicking the pretty print button prettifies the source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
Task.spawn(function* () {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
|
||||
const finished = waitForSourceShown(gPanel, "code_ugly.js");
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, 2, "The progress bar should be shown");
|
||||
yield finished;
|
||||
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
is(deck.selectedIndex, 0, "The editor should be shown");
|
||||
|
||||
const source = queries.getSelectedSource(getState());
|
||||
const { loading, text } = queries.getSourceText(getState(), source.actor);
|
||||
ok(!loading, "Source text is not loading");
|
||||
ok(text.includes("\n "),
|
||||
"Subsequent calls to getText return the pretty printed source.");
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that right clicking and selecting the pretty print context menu
|
||||
* item prettifies the source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gContextMenu = gDebugger.document.getElementById("sourceEditorContextMenu");
|
||||
|
||||
Task.spawn(function* () {
|
||||
const finished = waitForSourceShown(gPanel, "code_ugly.js");
|
||||
once(gContextMenu, "popupshown").then(() => {
|
||||
const menuItem = gDebugger.document.getElementById("se-dbg-cMenu-prettyPrint");
|
||||
menuItem.click();
|
||||
});
|
||||
gContextMenu.openPopup(gEditor.container, "overlap", 0, 0, true, false);
|
||||
yield finished;
|
||||
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that we have the correct line selected after pretty printing.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
|
||||
Task.spawn(function* () {
|
||||
yield doResume(gPanel);
|
||||
|
||||
const paused = waitForPause(gDebugger.gThreadClient);
|
||||
callInTab(gTab, "foo");
|
||||
yield paused;
|
||||
|
||||
const finished = promise.all([
|
||||
waitForSourceShown(gPanel, "code_ugly.js"),
|
||||
waitForCaretUpdated(gPanel, 7)
|
||||
]);
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
yield finished;
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that the function searching works with pretty printed sources.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
|
||||
|
||||
Task.spawn(function* () {
|
||||
let popupShown = promise.defer();
|
||||
once(gDebugger, "popupshown").then(() => {
|
||||
ok(isCaretPos(gPanel, 2, 10),
|
||||
"The bar function's non-pretty-printed location should be shown.");
|
||||
popupShown.resolve();
|
||||
});
|
||||
setText(gSearchBox, "@bar");
|
||||
yield popupShown.promise;
|
||||
|
||||
const finished = waitForSourceShown(gPanel, "code_ugly.js");
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
yield finished;
|
||||
|
||||
popupShown = promise.defer();
|
||||
once(gDebugger, "popupshown").then(() => {
|
||||
ok(isCaretPos(gPanel, 6, 10),
|
||||
"The bar function's pretty printed location should be shown.");
|
||||
popupShown.resolve();
|
||||
});
|
||||
setText(gSearchBox, "@bar");
|
||||
yield popupShown.promise;
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that prettifying HTML sources doesn't do anything.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_included-script.html";
|
||||
const SCRIPT_URL = EXAMPLE_URL + "code_location-changes.js";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: SCRIPT_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
Task.spawn(function* () {
|
||||
// Now, select the html page
|
||||
const sourceShown = waitForSourceShown(gPanel, TAB_URL);
|
||||
gSources.selectedValue = getSourceActor(gSources, TAB_URL);
|
||||
yield sourceShown;
|
||||
|
||||
// From this point onward, the source editor's text should never change.
|
||||
gEditor.once("change", () => {
|
||||
ok(false, "The source editor text shouldn't have changed.");
|
||||
});
|
||||
|
||||
is(getSelectedSourceURL(gSources), TAB_URL,
|
||||
"The correct source is currently selected.");
|
||||
ok(gEditor.getText().includes("myFunction"),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
|
||||
const source = queries.getSelectedSource(getState());
|
||||
try {
|
||||
yield actions.togglePrettyPrint(source);
|
||||
ok(false, "An error occurred while pretty-printing");
|
||||
}
|
||||
catch (err) {
|
||||
is(err.message, "Can't prettify non-javascript files.",
|
||||
"The promise was correctly rejected with a meaningful message.");
|
||||
}
|
||||
|
||||
const { text } = yield queries.getSourceText(getState(), source.actor);
|
||||
is(getSelectedSourceURL(gSources), TAB_URL,
|
||||
"The correct source is still selected.");
|
||||
ok(gEditor.getText().includes("myFunction"),
|
||||
"The displayed source hasn't changed.");
|
||||
ok(text.includes("myFunction"),
|
||||
"The cached source text wasn't altered in any way.");
|
||||
|
||||
yield closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that prettifying JS sources with type errors works as expected.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_included-script.html";
|
||||
const JS_URL = EXAMPLE_URL + "code_location-changes.js";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: JS_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gClient = gDebugger.gClient;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
let gPrettyPrinted = false;
|
||||
|
||||
// We can't feed javascript files with syntax errors to the debugger,
|
||||
// because they will never run, thus sometimes getting gc'd before the
|
||||
// debugger is opened, or even before the target finishes navigating.
|
||||
// Make the client lie about being able to parse perfectly fine code.
|
||||
gClient.request = (function (aOriginalRequestMethod) {
|
||||
return function (aPacket, aCallback) {
|
||||
if (aPacket.type == "prettyPrint") {
|
||||
gPrettyPrinted = true;
|
||||
return promise.reject({ error: "prettyPrintError" });
|
||||
}
|
||||
return aOriginalRequestMethod(aPacket, aCallback);
|
||||
};
|
||||
}(gClient.request));
|
||||
|
||||
Task.spawn(function* () {
|
||||
// From this point onward, the source editor's text should never change.
|
||||
gEditor.once("change", () => {
|
||||
ok(false, "The source editor text shouldn't have changed.");
|
||||
});
|
||||
|
||||
is(getSelectedSourceURL(gSources), JS_URL,
|
||||
"The correct source is currently selected.");
|
||||
ok(gEditor.getText().includes("myFunction"),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
|
||||
const source = queries.getSelectedSource(getState());
|
||||
try {
|
||||
yield actions.togglePrettyPrint(source);
|
||||
ok(false, "The promise for a prettified source should be rejected!");
|
||||
} catch (error) {
|
||||
ok(error.error, "Error came from a RDP request");
|
||||
ok(error.error.includes("prettyPrintError"),
|
||||
"The promise was correctly rejected with a meaningful message.");
|
||||
}
|
||||
|
||||
const { text } = yield queries.getSourceText(getState(), source.actor);
|
||||
is(getSelectedSourceURL(gSources), JS_URL,
|
||||
"The correct source is still selected.");
|
||||
ok(gEditor.getText().includes("myFunction"),
|
||||
"The displayed source hasn't changed.");
|
||||
ok(text.includes("myFunction"),
|
||||
"The cached source text wasn't altered in any way.");
|
||||
|
||||
is(gPrettyPrinted, true,
|
||||
"The hijacked pretty print method was executed.");
|
||||
|
||||
yield closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test basic pretty printing functionality. Would be an xpcshell test, except
|
||||
// for bug 921252.
|
||||
|
||||
var gTab, gPanel, gClient, gThreadClient, gSource;
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly-2.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gClient = gPanel.panelWin.gClient;
|
||||
gThreadClient = gPanel.panelWin.DebuggerController.activeThread;
|
||||
|
||||
findSource();
|
||||
});
|
||||
}
|
||||
|
||||
function findSource() {
|
||||
gThreadClient.getSources(({ error, sources }) => {
|
||||
ok(!error);
|
||||
sources = sources.filter(s => s.url.includes("code_ugly-2.js"));
|
||||
is(sources.length, 1);
|
||||
gSource = sources[0];
|
||||
prettyPrintSource();
|
||||
});
|
||||
}
|
||||
|
||||
function prettyPrintSource() {
|
||||
gThreadClient.source(gSource).prettyPrint(4).then(testPrettyPrinted);
|
||||
}
|
||||
|
||||
function testPrettyPrinted({ error, source }) {
|
||||
ok(!error, "Should not get an error while pretty-printing");
|
||||
ok(source.includes("\n "),
|
||||
"Source should be pretty-printed");
|
||||
disablePrettyPrint();
|
||||
}
|
||||
|
||||
function disablePrettyPrint() {
|
||||
gThreadClient.source(gSource).disablePrettyPrint().then(testUgly);
|
||||
}
|
||||
|
||||
function testUgly({ error, source }) {
|
||||
ok(!error, "Should not get an error while disabling pretty-printing");
|
||||
ok(!source.includes("\n "),
|
||||
"Source should not be pretty after disabling pretty-printing");
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = gPanel = gClient = gThreadClient = gSource = null;
|
||||
});
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test stepping through pretty printed sources.
|
||||
|
||||
var gTab, gPanel, gClient, gThreadClient, gSource;
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly-2.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gClient = gPanel.panelWin.gClient;
|
||||
gThreadClient = gPanel.panelWin.DebuggerController.activeThread;
|
||||
|
||||
findSource();
|
||||
});
|
||||
}
|
||||
|
||||
const BP_LOCATION = {
|
||||
line: 5,
|
||||
// column: 0
|
||||
};
|
||||
|
||||
function findSource() {
|
||||
gThreadClient.getSources(({ error, sources }) => {
|
||||
ok(!error, "error should exist");
|
||||
sources = sources.filter(s => s.url.includes("code_ugly-3.js"));
|
||||
is(sources.length, 1, "sources.length should be 1");
|
||||
[gSource] = sources;
|
||||
BP_LOCATION.actor = gSource.actor;
|
||||
|
||||
prettyPrintSource(sources[0]);
|
||||
});
|
||||
}
|
||||
|
||||
function prettyPrintSource(source) {
|
||||
gThreadClient.source(gSource).prettyPrint(2).then(runCode);
|
||||
}
|
||||
|
||||
function runCode({ error }) {
|
||||
ok(!error);
|
||||
gClient.addOneTimeListener("paused", testDbgStatement);
|
||||
callInTab(gTab, "main3");
|
||||
}
|
||||
|
||||
function testDbgStatement(event, { why, frame }) {
|
||||
is(why.type, "debuggerStatement");
|
||||
const { source, line, column } = frame.where;
|
||||
is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor");
|
||||
is(line, 3, "the line should be 3");
|
||||
setBreakpoint();
|
||||
}
|
||||
|
||||
function setBreakpoint() {
|
||||
gThreadClient.source(gSource).setBreakpoint(
|
||||
{ line: BP_LOCATION.line,
|
||||
column: BP_LOCATION.column })
|
||||
.then(([{ actualLocation }]) => {
|
||||
ok(!actualLocation, "actualLocation should not exist");
|
||||
testStepping();
|
||||
});
|
||||
}
|
||||
|
||||
function testStepping() {
|
||||
gClient.addOneTimeListener("paused", (event, { why, frame }) => {
|
||||
is(why.type, "resumeLimit");
|
||||
const { source, line } = frame.where;
|
||||
is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor");
|
||||
is(line, 4, "the line should be 4");
|
||||
testHitBreakpoint();
|
||||
});
|
||||
gThreadClient.stepIn();
|
||||
}
|
||||
|
||||
function testHitBreakpoint() {
|
||||
gClient.addOneTimeListener("paused", (event, { why, frame }) => {
|
||||
is(why.type, "breakpoint");
|
||||
const { source, line } = frame.where;
|
||||
is(source.actor, BP_LOCATION.actor, "source.actor should be the right actor");
|
||||
is(line, BP_LOCATION.line, "the line should the right line");
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
gThreadClient.resume();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = gPanel = gClient = gThreadClient = gSource = null;
|
||||
});
|
|
@ -1,92 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test pretty printing source mapped sources.
|
||||
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gSource;
|
||||
|
||||
var gTab, gPanel, gClient, gThreadClient, gSource;
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-2.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly-2.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gClient = gPanel.panelWin.gClient;
|
||||
gThreadClient = gPanel.panelWin.DebuggerController.activeThread;
|
||||
|
||||
findSource();
|
||||
});
|
||||
}
|
||||
|
||||
const dataUrl = s => "data:text/javascript," + s;
|
||||
|
||||
// These should match the instructions in code_ugly-4.js.
|
||||
const A = "function a(){b()}";
|
||||
const A_URL = dataUrl(A);
|
||||
const B = "function b(){debugger}";
|
||||
const B_URL = dataUrl(B);
|
||||
|
||||
function findSource() {
|
||||
gThreadClient.getSources(({ error, sources }) => {
|
||||
ok(!error);
|
||||
sources = sources.filter(s => s.url === B_URL);
|
||||
is(sources.length, 1);
|
||||
gSource = sources[0];
|
||||
prettyPrint();
|
||||
});
|
||||
}
|
||||
|
||||
function prettyPrint() {
|
||||
gThreadClient.source(gSource).prettyPrint(2).then(runCode);
|
||||
}
|
||||
|
||||
function runCode({ error }) {
|
||||
ok(!error);
|
||||
gClient.addOneTimeListener("paused", testDbgStatement);
|
||||
callInTab(gTab, "a");
|
||||
}
|
||||
|
||||
function testDbgStatement(event, { frame, why }) {
|
||||
is(why.type, "debuggerStatement");
|
||||
const { source, line } = frame.where;
|
||||
is(source.url, B_URL);
|
||||
is(line, 2);
|
||||
|
||||
disablePrettyPrint();
|
||||
}
|
||||
|
||||
function disablePrettyPrint() {
|
||||
gThreadClient.source(gSource).disablePrettyPrint().then(testUgly);
|
||||
}
|
||||
|
||||
function testUgly({ error, source }) {
|
||||
ok(!error);
|
||||
ok(!source.includes("\n "));
|
||||
getFrame();
|
||||
}
|
||||
|
||||
function getFrame() {
|
||||
gThreadClient.getFrames(0, 1, testFrame);
|
||||
}
|
||||
|
||||
function testFrame({ frames: [frame] }) {
|
||||
const { source, line } = frame.where;
|
||||
is(source.url, B_URL);
|
||||
is(line, 1);
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = gPanel = gClient = gThreadClient = null;
|
||||
});
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that we disable the pretty print button for black boxed sources,
|
||||
* and that clicking it doesn't do anything.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
Task.spawn(function* () {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
|
||||
yield toggleBlackBoxing(gPanel);
|
||||
|
||||
// Wait a tick before clicking to make sure the frontend's blackboxchange
|
||||
// handlers have finished.
|
||||
yield waitForTick();
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
// Make sure the text updates
|
||||
yield waitForTick();
|
||||
|
||||
const source = queries.getSelectedSource(getState());
|
||||
const { text } = queries.getSourceText(getState(), source.actor);
|
||||
ok(!text.includes("\n "));
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that pretty printing is maintained across refreshes.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print.html";
|
||||
|
||||
var gTab, gPanel, gDebugger;
|
||||
var gEditor, gSources;
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly.js",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gEditor = gDebugger.DebuggerView.editor;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
testSourceIsUgly();
|
||||
const finished = waitForCaretUpdated(gPanel, 7);
|
||||
clickPrettyPrintButton();
|
||||
finished.then(testSourceIsPretty)
|
||||
.then(() => {
|
||||
const finished = waitForCaretUpdated(gPanel, 7);
|
||||
const reloaded = reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCE_SHOWN);
|
||||
return Promise.all([finished, reloaded]);
|
||||
})
|
||||
.then(testSourceIsPretty)
|
||||
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
||||
.catch(aError => {
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(aError));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSourceIsUgly() {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
}
|
||||
|
||||
function clickPrettyPrintButton() {
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
}
|
||||
|
||||
function testSourceIsPretty() {
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gEditor = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,51 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that we don't leave the pretty print button checked when we fail to
|
||||
* pretty print a source (because it isn't a JS file, for example).
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html";
|
||||
const SCRIPT_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: SCRIPT_URL,
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
Task.spawn(function* () {
|
||||
const source = getSourceForm(gSources, TAB_URL);
|
||||
let shown = ensureSourceIs(gPanel, TAB_URL, true);
|
||||
actions.selectSource(source);
|
||||
yield shown;
|
||||
|
||||
try {
|
||||
yield actions.togglePrettyPrint(source);
|
||||
ok(false, "An error occurred while pretty-printing");
|
||||
}
|
||||
catch (err) {
|
||||
is(err.message, "Can't prettify non-javascript files.",
|
||||
"The promise was correctly rejected with a meaningful message.");
|
||||
}
|
||||
|
||||
is(gDebugger.document.getElementById("pretty-print").checked, false,
|
||||
"The button shouldn't be checked after trying to pretty print a non-js file.");
|
||||
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that clicking the pretty print button prettifies the source, even
|
||||
* when the source URL does not end in ".js", but the content type is
|
||||
* JavaScript.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-3.html";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_ugly-8",
|
||||
line: 2
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
const queries = gDebugger.require("./content/queries");
|
||||
const constants = gDebugger.require("./content/constants");
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const getState = gDebugger.DebuggerController.getState;
|
||||
|
||||
Task.spawn(function* () {
|
||||
ok(!gEditor.getText().includes("\n "),
|
||||
"The source shouldn't be pretty printed yet.");
|
||||
|
||||
const finished = waitForSourceShown(gPanel, "code_ugly-8");
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
const deck = gDebugger.document.getElementById("editor-deck");
|
||||
is(deck.selectedIndex, 2, "The progress bar should be shown");
|
||||
yield finished;
|
||||
|
||||
ok(gEditor.getText().includes("\n "),
|
||||
"The source should be pretty printed.");
|
||||
is(deck.selectedIndex, 0, "The editor should be shown");
|
||||
|
||||
const source = queries.getSelectedSource(getState());
|
||||
const { text } = queries.getSourceText(getState(), source.actor);
|
||||
ok(text.includes("\n "),
|
||||
"Subsequent calls to getText return the pretty printed source.");
|
||||
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
})
|
||||
});
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test that pretty printing when the debugger is paused does not switch away
|
||||
* from the selected source.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_pretty-print-on-paused.html";
|
||||
|
||||
var gTab, gPanel, gDebugger, gThreadClient, gSources;
|
||||
|
||||
const SECOND_SOURCE_VALUE = EXAMPLE_URL + "code_ugly-2.js";
|
||||
|
||||
function test() {
|
||||
// Wait for debugger panel to be fully set and break on debugger statement
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-02.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
gTab = aTab;
|
||||
gPanel = aPanel;
|
||||
gDebugger = gPanel.panelWin;
|
||||
gThreadClient = gDebugger.gThreadClient;
|
||||
gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
Task.spawn(function* () {
|
||||
try {
|
||||
yield doInterrupt(gPanel);
|
||||
|
||||
let source = gThreadClient.source(getSourceForm(gSources, SECOND_SOURCE_VALUE));
|
||||
yield source.setBreakpoint({
|
||||
line: 6
|
||||
});
|
||||
yield doResume(gPanel);
|
||||
|
||||
const bpHit = waitForCaretAndScopes(gPanel, 6);
|
||||
callInTab(gTab, "secondCall");
|
||||
yield bpHit;
|
||||
|
||||
info("Switch to the second source.");
|
||||
const sourceShown = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
|
||||
gSources.selectedValue = getSourceActor(gSources, SECOND_SOURCE_VALUE);
|
||||
yield sourceShown;
|
||||
|
||||
info("Pretty print the source.");
|
||||
const prettyPrinted = waitForSourceShown(gPanel, SECOND_SOURCE_VALUE);
|
||||
gDebugger.document.getElementById("pretty-print").click();
|
||||
yield prettyPrinted;
|
||||
|
||||
yield resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
} catch (e) {
|
||||
DevToolsUtils.reportException("browser_dbg_pretty-print-on-paused.js", e);
|
||||
ok(false, "Got an error: " + DevToolsUtils.safeErrorString(e));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gTab = null;
|
||||
gPanel = null;
|
||||
gDebugger = null;
|
||||
gThreadClient = null;
|
||||
gSources = null;
|
||||
});
|
|
@ -1,162 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that switching the displayed source in the UI works as advertised.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
const gLabel1 = "code_script-switching-01.js";
|
||||
const gLabel2 = "code_script-switching-02.js";
|
||||
|
||||
function testSourcesDisplay() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
is(gSources.itemCount, 2,
|
||||
"Found the expected number of sources. (1)");
|
||||
|
||||
is(gSources.items[0].target.querySelector(".dbg-source-item").getAttribute("tooltiptext"),
|
||||
EXAMPLE_URL + "code_script-switching-01.js",
|
||||
"The correct tooltip text is displayed for the first source. (1)");
|
||||
is(gSources.items[1].target.querySelector(".dbg-source-item").getAttribute("tooltiptext"),
|
||||
EXAMPLE_URL + "code_script-switching-02.js",
|
||||
"The correct tooltip text is displayed for the second source. (1)");
|
||||
|
||||
ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1),
|
||||
"First source url is incorrect. (1)");
|
||||
ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2),
|
||||
"Second source url is incorrect. (1)");
|
||||
|
||||
ok(gSources.getItemForAttachment(e => e.label == gLabel1),
|
||||
"First source label is incorrect. (1)");
|
||||
ok(gSources.getItemForAttachment(e => e.label == gLabel2),
|
||||
"Second source label is incorrect. (1)");
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (1)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2,
|
||||
"The selected value is the sources pane is incorrect. (1)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), -1,
|
||||
"The first source is not displayed. (1)");
|
||||
is(gEditor.getText().search(/debugger/), 166,
|
||||
"The second source is displayed. (1)");
|
||||
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (1)");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (1)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately (1).");
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gSources.selectedIndex = 0;
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchPaused1() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (2)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
|
||||
"The selected value is the sources pane is incorrect. (2)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), 118,
|
||||
"The first source is displayed. (2)");
|
||||
is(gEditor.getText().search(/debugger/), -1,
|
||||
"The second source is not displayed. (2)");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
ok(isCaretPos(gPanel, 1),
|
||||
"Editor caret location is correct. (2)");
|
||||
is(gEditor.getDebugLocation(), null,
|
||||
"Editor debugger location is correct. (2)");
|
||||
ok(!gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line highlight was removed. (2)");
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gSources.selectedIndex = 1;
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchPaused2() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (3)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2,
|
||||
"The selected value is the sources pane is incorrect. (3)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), -1,
|
||||
"The first source is not displayed. (3)");
|
||||
is(gEditor.getText().search(/debugger/), 166,
|
||||
"The second source is displayed. (3)");
|
||||
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (3)");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (3)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately (3).");
|
||||
|
||||
// Step out twice.
|
||||
waitForThreadEvents(gPanel, "paused").then(() => {
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gDebugger.gThreadClient.stepOut();
|
||||
});
|
||||
gDebugger.gThreadClient.stepOut();
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchRunning() {
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (4)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
|
||||
"The selected value is the sources pane is incorrect. (4)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), 118,
|
||||
"The first source is displayed. (4)");
|
||||
is(gEditor.getText().search(/debugger/), -1,
|
||||
"The second source is not displayed. (4)");
|
||||
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (4)");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (4)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately (3). (4)");
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
const shown = waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
|
||||
callInTab(gTab, "firstCall");
|
||||
yield shown;
|
||||
|
||||
yield testSourcesDisplay();
|
||||
yield testSwitchPaused1();
|
||||
yield testSwitchPaused2();
|
||||
yield testSwitchRunning();
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that switching the displayed source in the UI works as advertised.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_script-switching-02.html";
|
||||
|
||||
var gLabel1 = "code_script-switching-01.js";
|
||||
var gLabel2 = "code_script-switching-02.js";
|
||||
var gParams = "?foo=bar,baz|lol";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gSources = gDebugger.DebuggerView.Sources;
|
||||
|
||||
function testSourcesDisplay() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
is(gSources.itemCount, 2,
|
||||
"Found the expected number of sources. (1)");
|
||||
|
||||
ok(getSourceActor(gSources, EXAMPLE_URL + gLabel1),
|
||||
"First source url is incorrect. (1)");
|
||||
ok(getSourceActor(gSources, EXAMPLE_URL + gLabel2 + gParams),
|
||||
"Second source url is incorrect. (1)");
|
||||
|
||||
ok(gSources.getItemForAttachment(e => e.label == gLabel1),
|
||||
"First source label is incorrect. (1)");
|
||||
ok(gSources.getItemForAttachment(e => e.label == gLabel2),
|
||||
"Second source label is incorrect. (1)");
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (1)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams,
|
||||
"The selected value is the sources pane is incorrect. (1)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), -1,
|
||||
"The first source is not displayed. (1)");
|
||||
is(gEditor.getText().search(/debugger/), 166,
|
||||
"The second source is displayed. (1)");
|
||||
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (1)");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (1)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately. (1)");
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gSources.selectedItem = e => e.attachment.label == gLabel1;
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchPaused1() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (2)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
|
||||
"The selected value is the sources pane is incorrect. (2)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), 118,
|
||||
"The first source is displayed. (2)");
|
||||
is(gEditor.getText().search(/debugger/), -1,
|
||||
"The second source is not displayed. (2)");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
ok(isCaretPos(gPanel, 1),
|
||||
"Editor caret location is correct. (2)");
|
||||
|
||||
is(gEditor.getDebugLocation(), null,
|
||||
"Editor debugger location is correct. (2)");
|
||||
ok(!gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line highlight was removed. (2)");
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gSources.selectedItem = e => e.attachment.label == gLabel2;
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchPaused2() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (3)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel2 + gParams,
|
||||
"The selected value is the sources pane is incorrect. (3)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), -1,
|
||||
"The first source is not displayed. (3)");
|
||||
is(gEditor.getText().search(/debugger/), 166,
|
||||
"The second source is displayed. (3)");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (3)");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (3)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately. (3)");
|
||||
|
||||
// Step out three times.
|
||||
waitForThreadEvents(gPanel, "paused").then(() => {
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_SHOWN).then(deferred.resolve);
|
||||
gDebugger.gThreadClient.stepOut();
|
||||
});
|
||||
gDebugger.gThreadClient.stepOut();
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testSwitchRunning() {
|
||||
let deferred = promise.defer();
|
||||
|
||||
ok(gSources.selectedItem,
|
||||
"There should be a selected item in the sources pane. (4)");
|
||||
is(getSelectedSourceURL(gSources), EXAMPLE_URL + gLabel1,
|
||||
"The selected value is the sources pane is incorrect. (4)");
|
||||
|
||||
is(gEditor.getText().search(/firstCall/), 118,
|
||||
"The first source is displayed. (4)");
|
||||
is(gEditor.getText().search(/debugger/), -1,
|
||||
"The second source is not displayed. (4)");
|
||||
|
||||
// The editor's debug location takes a tick to update.
|
||||
ok(isCaretPos(gPanel, 6),
|
||||
"Editor caret location is correct. (4)");
|
||||
is(gEditor.getDebugLocation(), 5,
|
||||
"Editor debugger location is correct. (4)");
|
||||
ok(gEditor.hasLineClass(5, "debug-line"),
|
||||
"The debugged line is highlighted appropriately. (4)");
|
||||
|
||||
deferred.resolve();
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
|
||||
yield testSourcesDisplay();
|
||||
yield testSwitchPaused1();
|
||||
yield testSwitchPaused2();
|
||||
yield testSwitchRunning();
|
||||
resumeDebuggerThenCloseAndFinish(gPanel);
|
||||
});
|
||||
|
||||
callInTab(gTab, "firstCall");
|
||||
});
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Make sure that the DebuggerView error loading source text is correct.
|
||||
*/
|
||||
|
||||
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
||||
|
||||
function test() {
|
||||
let options = {
|
||||
source: EXAMPLE_URL + "code_script-switching-01.js",
|
||||
line: 1
|
||||
};
|
||||
initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
|
||||
const gTab = aTab;
|
||||
const gPanel = aPanel;
|
||||
const gDebugger = gPanel.panelWin;
|
||||
const gView = gDebugger.DebuggerView;
|
||||
const gEditor = gDebugger.DebuggerView.editor;
|
||||
const gL10N = gDebugger.L10N;
|
||||
const require = gDebugger.require;
|
||||
const actions = bindActionCreators(gPanel);
|
||||
const constants = require("./content/constants");
|
||||
const controller = gDebugger.DebuggerController;
|
||||
|
||||
function showBogusSource() {
|
||||
const source = { actor: "fake.actor", url: "http://fake.url/" };
|
||||
actions.newSource(source);
|
||||
|
||||
controller.dispatch({
|
||||
type: constants.LOAD_SOURCE_TEXT,
|
||||
source: source,
|
||||
status: "start"
|
||||
});
|
||||
|
||||
controller.dispatch({
|
||||
type: constants.SELECT_SOURCE,
|
||||
source: source
|
||||
});
|
||||
|
||||
controller.dispatch({
|
||||
type: constants.LOAD_SOURCE_TEXT,
|
||||
source: source,
|
||||
status: "error",
|
||||
error: "bogus actor"
|
||||
});
|
||||
}
|
||||
|
||||
function testDebuggerLoadingError() {
|
||||
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText3", "")),
|
||||
"The valid error loading message is displayed.");
|
||||
}
|
||||
|
||||
Task.spawn(function* () {
|
||||
showBogusSource();
|
||||
testDebuggerLoadingError();
|
||||
closeDebuggerAndFinish(gPanel);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
function blackboxme(fn) {
|
||||
(function one() {
|
||||
(function two() {
|
||||
(function three() {
|
||||
fn();
|
||||
}());
|
||||
}());
|
||||
}());
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function one() { two(); }
|
|
@ -1,4 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function three() { doDebuggerStatement(); }
|
|
@ -1,4 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function two() { three(); }
|
|
@ -1 +0,0 @@
|
|||
function blackboxme() {one();} function one() {}
|
|
@ -1,14 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Auto Pretty Printing Test Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="code_ugly-5.js"></script>
|
||||
<script src="code_ugly-6.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,14 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Auto Pretty Printing Test Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="code_ugly-6.js"></script>
|
||||
<script src="code_ugly-7.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!doctype html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger test page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script type="text/javascript" src="code_blackboxing_blackboxme.js"></script>
|
||||
<script type="text/javascript" src="code_blackboxing_one.js"></script>
|
||||
<script type="text/javascript" src="code_blackboxing_two.js"></script>
|
||||
<script type="text/javascript" src="code_blackboxing_three.js"></script>
|
||||
<script>
|
||||
function runTest() {
|
||||
blackboxme(doDebuggerStatement);
|
||||
}
|
||||
function doDebuggerStatement() {
|
||||
debugger;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,11 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Debugger test page</title>
|
||||
<script type="text/javascript" src="code_blackboxing_unblackbox.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger Pretty Printing Test Page</title>
|
||||
</head>
|
||||
<script src="code_ugly-2.js"></script>
|
||||
<script src="code_ugly-3.js"></script>
|
||||
<script src="code_ugly-4.js"></script>
|
||||
<script>
|
||||
function noop(x) {
|
||||
return x;
|
||||
}
|
||||
</script>
|
|
@ -1,8 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Debugger Pretty Printing Test Page</title>
|
||||
</head>
|
||||
<script src="code_ugly-8"></script>
|
|
@ -1,14 +0,0 @@
|
|||
<!-- Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Pretty printing when debugger is paused Test Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="code_ugly-2.js"></script>
|
||||
<script src="code_script-switching-02.js"></script>
|
||||
</body>
|
||||
</html>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче