Bug 1167617 - Remove SpiderMonkey specific JS syntax from inspector; r=jryans

--HG--
extra : rebase_source : 95a9daf992adf418831ed362c07ac3402e0c5f5f
extra : histedit_source : 4e2d9d6fadc0da7bb7b29bad6dffd7576df6f16a
This commit is contained in:
Patrick Brosset 2015-05-22 20:50:01 +02:00
Родитель 18a590f139
Коммит 6b0f771384
15 изменённых файлов: 58 добавлений и 45 удалений

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

@ -10,7 +10,7 @@ function test() {
return Task.spawn(spawnTest).then(finish, helpers.handleError);
}
function spawnTest() {
function* spawnTest() {
let options = yield helpers.openTab(TESTCASE_URI);
yield helpers.openToolbar(options);
@ -33,7 +33,7 @@ function spawnTest() {
function inspectAndWaitForCopy() {
let copied = waitForClipboard(() => {}, DIV_COLOR);
let ready = inspectPage(); // resolves once eyedropper is destroyed
return Promise.all([copied, ready]);
}

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

@ -58,7 +58,9 @@ function HTMLBreadcrumbs(inspector) {
exports.HTMLBreadcrumbs = HTMLBreadcrumbs;
HTMLBreadcrumbs.prototype = {
get walker() this.inspector.walker,
get walker() {
return this.inspector.walker;
},
_init: function() {
this.container = this.chromeDoc.getElementById("inspector-breadcrumbs");

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

@ -73,8 +73,9 @@ function SelectorSearch(aInspector, aInputNode) {
exports.SelectorSearch = SelectorSearch;
SelectorSearch.prototype = {
get walker() this.inspector.walker,
get walker() {
return this.inspector.walker;
},
// The possible states of the query.
States: {
@ -445,27 +446,27 @@ SelectorSearch.prototype = {
let lastPart = query.match(/[a-zA-Z][#\.][^#\.\s>+]*$/)[0];
value = query.slice(0, -1 * lastPart.length + 1) + value;
}
let item = {
preLabel: query,
label: value,
count: count
};
// In case of tagNames, change te case to small
// In case of tagNames, change the case to small
if (value.match(/.*[\.#][^\.#]{0,}$/) == null) {
item.label = value.toLowerCase();
}
// In case the query's state is tag and the item's state is id or class
// adjust the preLabel
if (aState === this.States.TAG && state === this.States.CLASS) {
item.preLabel = "." + item.preLabel;
}
if (aState === this.States.TAG && state === this.States.ID) {
item.preLabel = "#" + item.preLabel;
}
// In case the query's state is tag and the item's state is id or class
// adjust the preLabel
if (aState === this.States.TAG && state === this.States.CLASS) {
item.preLabel = "." + item.preLabel;
}
if (aState === this.States.TAG && state === this.States.ID) {
item.preLabel = "#" + item.preLabel;
}
items.unshift(item);
if (++total > MAX_SUGGESTIONS - 1) {
break;
@ -486,9 +487,9 @@ SelectorSearch.prototype = {
*/
showSuggestions: function() {
let query = this.searchBox.value;
let state = this.state;
let state = this.state;
let firstPart = "";
if (state == this.States.TAG) {
// gets the tag that is being completed. For ex. 'div.foo > s' returns 's',
// 'di' returns 'di' and likewise.
@ -510,7 +511,7 @@ SelectorSearch.prototype = {
if (/[\s+>~]$/.test(query)) {
query += "*";
}
this._currentSuggesting = query;
return this.walker.getSuggestionsForQuery(query, firstPart, state).then(result => {
if (this._currentSuggesting != result.query) {
@ -519,14 +520,14 @@ SelectorSearch.prototype = {
return;
}
this._lastToLastValidSearch = this._lastValidSearch;
if (state == this.States.CLASS) {
firstPart = "." + firstPart;
}
else if (state == this.States.ID) {
firstPart = "#" + firstPart;
}
this._showPopup(result.suggestions, firstPart, state);
});
}

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

@ -462,7 +462,7 @@ LayoutView.prototype = {
this.sizeLabel.textContent = newValue;
}
this.elementRules = [e.rule for (e of styleEntries)];
this.elementRules = styleEntries.map(e => e.rule);
this.inspector.emit("layoutview-updated");
}).bind(this)).then(null, console.error);

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

@ -1410,7 +1410,8 @@ MarkupView.prototype = {
if (!this._queuedChildUpdates) {
return promise.resolve(undefined);
}
return promise.all([updatePromise for (updatePromise of this._queuedChildUpdates.values())]);
return promise.all([...this._queuedChildUpdates.values()]);
},
/**
@ -2371,7 +2372,10 @@ function TextEditor(aContainer, aNode, aTemplate) {
}
TextEditor.prototype = {
get selected() this._selected,
get selected() {
return this._selected;
},
set selected(aValue) {
if (aValue === this._selected) {
return;

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

@ -66,7 +66,7 @@ const TEST_URL = "data:text/html," +
"<!DOCTYPE html>" +
"<head><meta charset='utf-8' /></head>" +
"<body>" +
[outer.oldHTML for (outer of TEST_DATA)].join("\n") +
TEST_DATA.map(outer => outer.oldHTML).join("\n") +
"</body>" +
"</html>";

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

@ -89,7 +89,7 @@ const TEST_URL = "data:text/html," +
"<!DOCTYPE html>" +
"<head><meta charset='utf-8' /></head>" +
"<body>" +
[outer.oldHTML for (outer of TEST_DATA)].join("\n") +
TEST_DATA.map(outer => outer.oldHTML).join("\n") +
"</body>" +
"</html>";

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

@ -6,7 +6,7 @@ thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Protocol error (unknownError):
function test() {
waitForExplicitFinish();
SimpleTest.requestCompleteLog();
Task.spawn(function() {
Task.spawn(function*() {
function extractSizeFromString(str) {
let numbers = str.match(/(\d+)[^\d]*(\d+)/);

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

@ -40,7 +40,7 @@ function test() {
key.doCommand();
}
Task.spawn(function() {
Task.spawn(function*() {
yield addTab("data:text/html;charset=utf8,test custom presets in responsive mode");

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

@ -36,9 +36,13 @@ this.StyleEditorPanel = function StyleEditorPanel(panelWin, toolbox) {
exports.StyleEditorPanel = StyleEditorPanel;
StyleEditorPanel.prototype = {
get target() this._toolbox.target,
get target() {
return this._toolbox.target;
},
get panelWindow() this._panelWin,
get panelWindow() {
return this._panelWin;
},
/**
* open is effectively an asynchronous constructor

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

@ -8,7 +8,7 @@
const TEST_URL = TEST_BASE_HTTP + "doc_uncached.html";
add_task(function() {
add_task(function*() {
let isTesting = gDevTools.testing;
gDevTools.testing = true;

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

@ -248,12 +248,14 @@ CssHtmlTree.processTemplate = function CssHtmlTree_processTemplate(aTemplate,
}
};
XPCOMUtils.defineLazyGetter(CssHtmlTree, "_strings", function() Services.strings
.createBundle("chrome://global/locale/devtools/styleinspector.properties"));
XPCOMUtils.defineLazyGetter(CssHtmlTree, "_strings", function() {
return Services.strings.createBundle(
"chrome://global/locale/devtools/styleinspector.properties");
});
XPCOMUtils.defineLazyGetter(this, "clipboardHelper", function() {
return Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
return Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
});
CssHtmlTree.prototype = {

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

@ -257,7 +257,7 @@ ElementStyle.prototype = {
// If we've already included this domRule (for example, when a
// common selector is inherited), ignore it.
if (aOptions.rule &&
this.rules.some(function(rule) rule.domRule === aOptions.rule)) {
this.rules.some(rule => rule.domRule === aOptions.rule)) {
return false;
}
@ -396,7 +396,7 @@ ElementStyle.prototype = {
_updatePropertyOverridden: function(aProp) {
let overridden = true;
let dirty = false;
for each (let computedProp in aProp.computed) {
for (let computedProp of aProp.computed) {
if (!computedProp.overridden) {
overridden = false;
}
@ -739,7 +739,7 @@ Rule.prototype = {
* The property to be removed
*/
removeProperty: function(aProperty) {
this.textProps = this.textProps.filter(function(prop) prop != aProperty);
this.textProps = this.textProps.filter(prop => prop != aProperty);
let modifications = this.style.startModifyingProperties();
modifications.removeProperty(aProperty.name);
// Need to re-apply properties in case removing this TextProperty
@ -782,7 +782,7 @@ Rule.prototype = {
let textProps = [];
for each (let prop in disabledProps) {
for (let prop of disabledProps) {
let value = store.userProperties.getProperty(this.style, prop.name, prop.value);
let textProp = new TextProperty(this, prop.name, value, prop.priority);
textProp.enabled = false;
@ -861,7 +861,7 @@ Rule.prototype = {
_updateTextProperty: function(aNewProp) {
let match = { rank: 0, prop: null };
for each (let prop in this.textProps) {
for (let prop of this.textProps) {
if (prop.name != aNewProp.name)
continue;
@ -2981,7 +2981,7 @@ TextPropertyEditor.prototype = {
}
let showExpander = false;
for each (let computed in this.prop.computed) {
for (let computed of this.prop.computed) {
// Don't bother to duplicate information already
// shown in the text property.
if (computed.name === this.prop.name) {

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

@ -45,7 +45,7 @@ add_task(function*() {
function isPropertyVisible(name, view) {
info("Checking property visibility for " + name);
let propertyViews = view.propertyViews;
for each (let propView in propertyViews) {
for (let propView of propertyViews) {
if (propView.name == name) {
return propView.visible;
}

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

@ -58,7 +58,7 @@ function* testBoxy(inspector, view) {
});
}
function testMoxy(inspector, view) {
function* testMoxy(inspector, view) {
info("Test content and gutter in the keyframes rule of #moxy");
let {