mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 862849 - Remove __iterator__ use from the devtools. r=vp
This commit is contained in:
parent
d9c929551a
commit
13f2bac5e1
@ -37,8 +37,8 @@ function getAllBreakpoints(dbg) {
|
||||
let sources = dbg._view.Sources;
|
||||
let { trimUrlLength: trim } = dbg.panelWin.SourceUtils;
|
||||
|
||||
for (let source in sources) {
|
||||
for (let { attachment: breakpoint } in source) {
|
||||
for (let source of sources) {
|
||||
for (let { attachment: breakpoint } of source) {
|
||||
breakpoints.push({
|
||||
url: source.value,
|
||||
label: source.label + ":" + breakpoint.line,
|
||||
|
@ -231,8 +231,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
* The corresponding breakpoints if found, an empty array otherwise.
|
||||
*/
|
||||
getOtherBreakpoints: function(aLocation = {}, aStore = []) {
|
||||
for (let source in this) {
|
||||
for (let breakpointItem in source) {
|
||||
for (let source of this) {
|
||||
for (let breakpointItem of source) {
|
||||
let { url, line } = breakpointItem.attachment;
|
||||
if (url != aLocation.url || line != aLocation.line) {
|
||||
aStore.push(breakpointItem);
|
||||
@ -1340,7 +1340,7 @@ WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, {
|
||||
*/
|
||||
switchExpression: function(aVar, aExpression) {
|
||||
let expressionItem =
|
||||
[i for (i in this) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
[i for (i of this) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
|
||||
// Remove the watch expression if it's going to be empty or a duplicate.
|
||||
if (!aExpression || this.getAllStrings().indexOf(aExpression) != -1) {
|
||||
@ -1366,7 +1366,7 @@ WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, {
|
||||
*/
|
||||
deleteExpression: function(aVar) {
|
||||
let expressionItem =
|
||||
[i for (i in this) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
[i for (i of this) if (i.attachment.currentExpression == aVar.name)][0];
|
||||
|
||||
// Remove the watch expression.
|
||||
this.remove(expressionItem);
|
||||
@ -1998,7 +1998,7 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
||||
_createGlobalResultsUI: function(aGlobalResults) {
|
||||
let i = 0;
|
||||
|
||||
for (let sourceResults in aGlobalResults) {
|
||||
for (let sourceResults of aGlobalResults) {
|
||||
if (i++ == 0) {
|
||||
this._createSourceResultsUI(sourceResults);
|
||||
} else {
|
||||
@ -2123,7 +2123,7 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
||||
|
||||
/**
|
||||
* An object containing all source results, grouped by source location.
|
||||
* Iterable via "for (let [location, sourceResults] in globalResults) { }".
|
||||
* Iterable via "for (let [location, sourceResults] of globalResults) { }".
|
||||
*/
|
||||
function GlobalResults() {
|
||||
this._store = [];
|
||||
@ -2150,7 +2150,7 @@ GlobalResults.prototype = {
|
||||
|
||||
/**
|
||||
* An object containing all the matched lines for a specific source.
|
||||
* Iterable via "for (let [lineNumber, lineResults] in sourceResults) { }".
|
||||
* Iterable via "for (let [lineNumber, lineResults] of sourceResults) { }".
|
||||
*
|
||||
* @param string aUrl
|
||||
* The target source url.
|
||||
@ -2291,7 +2291,7 @@ SourceResults.prototype = {
|
||||
|
||||
/**
|
||||
* An object containing all the matches for a specific line.
|
||||
* Iterable via "for (let chunk in lineResults) { }".
|
||||
* Iterable via "for (let chunk of lineResults) { }".
|
||||
*
|
||||
* @param number aLine
|
||||
* The target line in the source.
|
||||
@ -2436,12 +2436,10 @@ LineResults.prototype = {
|
||||
/**
|
||||
* A generator-iterator over the global, source or line results.
|
||||
*/
|
||||
GlobalResults.prototype.__iterator__ =
|
||||
SourceResults.prototype.__iterator__ =
|
||||
LineResults.prototype.__iterator__ = function() {
|
||||
for (let item of this._store) {
|
||||
yield item;
|
||||
}
|
||||
GlobalResults.prototype["@@iterator"] =
|
||||
SourceResults.prototype["@@iterator"] =
|
||||
LineResults.prototype["@@iterator"] = function*() {
|
||||
yield* this._store;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -615,7 +615,7 @@ StackFramesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
|
||||
// Update the context menu to show the currently selected stackframe item
|
||||
// as a checked entry.
|
||||
for (let otherItem in this) {
|
||||
for (let otherItem of this) {
|
||||
if (otherItem != stackframeItem) {
|
||||
otherItem.attachment.popup.menuitem.removeAttribute("checked");
|
||||
} else {
|
||||
|
@ -107,8 +107,8 @@ function test() {
|
||||
}
|
||||
|
||||
function initialChecks() {
|
||||
for (let source in gSources) {
|
||||
for (let breakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let breakpoint of source) {
|
||||
ok(gBreakpoints._getAdded(breakpoint.attachment),
|
||||
"All breakpoint items should have corresponding promises (1).");
|
||||
ok(!gBreakpoints._getRemoving(breakpoint.attachment),
|
||||
@ -223,8 +223,8 @@ function test() {
|
||||
is(!!selectedBreakpoint.attachment.disabled, false,
|
||||
"The targetted breakpoint should not have been disabled (" + aIndex + ").");
|
||||
|
||||
for (let source in gSources) {
|
||||
for (let otherBreakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let otherBreakpoint of source) {
|
||||
if (otherBreakpoint != selectedBreakpoint) {
|
||||
ok(!gBreakpoints._getAdded(otherBreakpoint.attachment),
|
||||
"There should be no breakpoint client for a disabled breakpoint (9).");
|
||||
@ -235,8 +235,8 @@ function test() {
|
||||
}
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED, 4).then(() => {
|
||||
for (let source in gSources) {
|
||||
for (let someBreakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let someBreakpoint of source) {
|
||||
ok(gBreakpoints._getAdded(someBreakpoint.attachment),
|
||||
"There should be a breakpoint client for all enabled breakpoints (11).");
|
||||
is(someBreakpoint.attachment.disabled, false,
|
||||
@ -245,8 +245,8 @@ function test() {
|
||||
}
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_REMOVED, 5).then(() => {
|
||||
for (let source in gSources) {
|
||||
for (let someBreakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let someBreakpoint of source) {
|
||||
ok(!gBreakpoints._getAdded(someBreakpoint.attachment),
|
||||
"There should be no breakpoint client for a disabled breakpoint (13).");
|
||||
is(someBreakpoint.attachment.disabled, true,
|
||||
@ -255,8 +255,8 @@ function test() {
|
||||
}
|
||||
|
||||
waitForDebuggerEvents(gPanel, gDebugger.EVENTS.BREAKPOINT_ADDED, 5).then(() => {
|
||||
for (let source in gSources) {
|
||||
for (let someBreakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let someBreakpoint of source) {
|
||||
ok(gBreakpoints._getAdded(someBreakpoint.attachment),
|
||||
"There should be a breakpoint client for all enabled breakpoints (15).");
|
||||
is(someBreakpoint.attachment.disabled, false,
|
||||
@ -293,8 +293,8 @@ function test() {
|
||||
ok(!gSources._selectedBreakpointItem,
|
||||
"There should be no breakpoint available after removing all breakpoints.");
|
||||
|
||||
for (let source in gSources) {
|
||||
for (let otherBreakpoint in source) {
|
||||
for (let source of gSources) {
|
||||
for (let otherBreakpoint of source) {
|
||||
ok(false, "It's a trap!");
|
||||
}
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
|
||||
// Apply CSS transforms to each waterfall in this container totalTime
|
||||
// accurately translate and resize as needed.
|
||||
for (let { target, attachment } in this) {
|
||||
for (let { target, attachment } of this) {
|
||||
let timingsNode = $(".requests-menu-timings", target);
|
||||
let startCapNode = $(".requests-menu-timings-cap.start", target);
|
||||
let endCapNode = $(".requests-menu-timings-cap.end", target);
|
||||
@ -1144,7 +1144,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
||||
* Reapplies the current waterfall background on all request items.
|
||||
*/
|
||||
_flushWaterfallBackgrounds: function() {
|
||||
for (let { target } in this) {
|
||||
for (let { target } of this) {
|
||||
let waterfallNode = $(".requests-menu-waterfall", target);
|
||||
waterfallNode.style.backgroundImage = this._cachedWaterfallBackground;
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ function runTests()
|
||||
|
||||
let found = false;
|
||||
|
||||
outer: for (let scope in sidebar.variablesView) {
|
||||
for (let [, obj] in scope) {
|
||||
for (let [, prop] in obj) {
|
||||
outer: for (let scope of sidebar.variablesView) {
|
||||
for (let [, obj] of scope) {
|
||||
for (let [, prop] of obj) {
|
||||
if (prop.name == "a" && prop.value == "foobarBug636725") {
|
||||
found = true;
|
||||
break outer;
|
||||
|
@ -55,7 +55,7 @@ const STR = Services.strings.createBundle(DBG_STRINGS_URI);
|
||||
|
||||
/**
|
||||
* A tree view for inspecting scopes, objects and properties.
|
||||
* Iterable via "for (let [id, scope] in instance) { }".
|
||||
* Iterable via "for (let [id, scope] of instance) { }".
|
||||
* Requires the devtools common.css and debugger.css skin stylesheets.
|
||||
*
|
||||
* To allow replacing variable or property values in this view, provide an
|
||||
@ -1126,7 +1126,7 @@ VariablesView.getterOrSetterDeleteCallback = function(aItem) {
|
||||
|
||||
/**
|
||||
* A Scope is an object holding Variable instances.
|
||||
* Iterable via "for (let [name, variable] in instance) { }".
|
||||
* Iterable via "for (let [name, variable] of instance) { }".
|
||||
*
|
||||
* @param VariablesView aView
|
||||
* The view to contain this scope.
|
||||
@ -2077,7 +2077,7 @@ DevToolsUtils.defineLazyPrototypeGetter(Scope.prototype, "_batchItems", Array);
|
||||
|
||||
/**
|
||||
* A Variable is a Scope holding Property instances.
|
||||
* Iterable via "for (let [name, property] in instance) { }".
|
||||
* Iterable via "for (let [name, property] of instance) { }".
|
||||
*
|
||||
* @param Scope aScope
|
||||
* The scope to contain this variable.
|
||||
@ -2867,7 +2867,7 @@ Variable.prototype = Heritage.extend(Scope.prototype, {
|
||||
|
||||
/**
|
||||
* A Property is a Variable holding additional child Property instances.
|
||||
* Iterable via "for (let [name, property] in instance) { }".
|
||||
* Iterable via "for (let [name, property] of instance) { }".
|
||||
*
|
||||
* @param Variable aVar
|
||||
* The variable to contain this property.
|
||||
@ -2928,13 +2928,11 @@ Property.prototype = Heritage.extend(Variable.prototype, {
|
||||
/**
|
||||
* A generator-iterator over the VariablesView, Scopes, Variables and Properties.
|
||||
*/
|
||||
VariablesView.prototype.__iterator__ =
|
||||
Scope.prototype.__iterator__ =
|
||||
Variable.prototype.__iterator__ =
|
||||
Property.prototype.__iterator__ = function() {
|
||||
for (let item of this._store) {
|
||||
yield item;
|
||||
}
|
||||
VariablesView.prototype["@@iterator"] =
|
||||
Scope.prototype["@@iterator"] =
|
||||
Variable.prototype["@@iterator"] =
|
||||
Property.prototype["@@iterator"] = function*() {
|
||||
yield* this._store;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -405,7 +405,7 @@ ViewHelpers.Prefs.prototype = {
|
||||
/**
|
||||
* A generic Item is used to describe children present in a Widget.
|
||||
* The label, value and description properties are necessarily strings.
|
||||
* Iterable via "for (let childItem in parentItem) { }".
|
||||
* Iterable via "for (let childItem of parentItem) { }".
|
||||
*
|
||||
* @param object aOwnerView
|
||||
* The owner view creating this item.
|
||||
@ -513,7 +513,7 @@ Item.prototype = {
|
||||
if (aItem.finalize) {
|
||||
aItem.finalize(aItem);
|
||||
}
|
||||
for (let childItem in aItem) {
|
||||
for (let childItem of aItem) {
|
||||
aItem.remove(childItem);
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ Item.prototype = {
|
||||
|
||||
/**
|
||||
* Some generic Widget methods handling Item instances.
|
||||
* Iterable via "for (let childItem in wrappedView) { }".
|
||||
* Iterable via "for (let childItem of wrappedView) { }".
|
||||
*
|
||||
* Usage:
|
||||
* function MyView() {
|
||||
@ -1529,7 +1529,7 @@ this.WidgetMethods = {
|
||||
if (aItem.finalize) {
|
||||
aItem.finalize(aItem);
|
||||
}
|
||||
for (let childItem in aItem) {
|
||||
for (let childItem of aItem) {
|
||||
aItem.remove(childItem);
|
||||
}
|
||||
|
||||
@ -1654,9 +1654,7 @@ this.WidgetMethods = {
|
||||
/**
|
||||
* A generator-iterator over all the items in this container.
|
||||
*/
|
||||
Item.prototype.__iterator__ =
|
||||
WidgetMethods.__iterator__ = function() {
|
||||
for (let [, item] of this._itemsByElement) {
|
||||
yield item;
|
||||
}
|
||||
Item.prototype["@@iterator"] =
|
||||
WidgetMethods["@@iterator"] = function*() {
|
||||
yield* this._itemsByElement.values();
|
||||
};
|
||||
|
@ -447,7 +447,7 @@ function findVariableViewProperties(aView, aRules, aOptions)
|
||||
|
||||
function finder(aRules, aVar, aPromises)
|
||||
{
|
||||
for (let [id, prop] in aVar) {
|
||||
for (let [id, prop] of aVar) {
|
||||
for (let rule of aRules) {
|
||||
let matcher = matchVariablesViewProperty(prop, rule, aOptions);
|
||||
aPromises.push(matcher.then(onMatch.bind(null, prop, rule)));
|
||||
|
Loading…
Reference in New Issue
Block a user