From 5e64c6d1a65491a3a8784b12a3891d5eed34a298 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 6 Nov 2013 15:13:53 -0800 Subject: [PATCH] Backed out changeset 7dd13d06f132 (bug 862849) for breaking webconsole tests --- browser/devtools/debugger/CmdDebugger.jsm | 4 +-- browser/devtools/debugger/debugger-panes.js | 26 ++++++++++--------- browser/devtools/debugger/debugger-toolbar.js | 2 +- .../browser_dbg_breakpoints-contextmenu.js | 24 ++++++++--------- .../devtools/netmonitor/netmonitor-view.js | 4 +-- .../test/browser_scratchpad_inspect.js | 6 ++--- .../devtools/shared/widgets/VariablesView.jsm | 20 +++++++------- .../devtools/shared/widgets/ViewHelpers.jsm | 16 +++++++----- 8 files changed, 54 insertions(+), 48 deletions(-) diff --git a/browser/devtools/debugger/CmdDebugger.jsm b/browser/devtools/debugger/CmdDebugger.jsm index 59231e23eeb..3f910d7dce8 100644 --- a/browser/devtools/debugger/CmdDebugger.jsm +++ b/browser/devtools/debugger/CmdDebugger.jsm @@ -37,8 +37,8 @@ function getAllBreakpoints(dbg) { let sources = dbg._view.Sources; let { trimUrlLength: trim } = dbg.panelWin.SourceUtils; - for (let source of sources) { - for (let { attachment: breakpoint } of source) { + for (let source in sources) { + for (let { attachment: breakpoint } in source) { breakpoints.push({ url: source.value, label: source.label + ":" + breakpoint.line, diff --git a/browser/devtools/debugger/debugger-panes.js b/browser/devtools/debugger/debugger-panes.js index 1c938ab549f..d42bfc38d17 100644 --- a/browser/devtools/debugger/debugger-panes.js +++ b/browser/devtools/debugger/debugger-panes.js @@ -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 of this) { - for (let breakpointItem of source) { + for (let source in this) { + for (let breakpointItem in 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 of this) if (i.attachment.currentExpression == aVar.name)][0]; + [i for (i in 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 of this) if (i.attachment.currentExpression == aVar.name)][0]; + [i for (i in 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 of aGlobalResults) { + for (let sourceResults in 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] of globalResults) { }". + * Iterable via "for (let [location, sourceResults] in 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] of sourceResults) { }". + * Iterable via "for (let [lineNumber, lineResults] in 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 of lineResults) { }". + * Iterable via "for (let chunk in lineResults) { }". * * @param number aLine * The target line in the source. @@ -2436,10 +2436,12 @@ LineResults.prototype = { /** * A generator-iterator over the global, source or line results. */ -GlobalResults.prototype["@@iterator"] = -SourceResults.prototype["@@iterator"] = -LineResults.prototype["@@iterator"] = function*() { - yield* this._store; +GlobalResults.prototype.__iterator__ = +SourceResults.prototype.__iterator__ = +LineResults.prototype.__iterator__ = function() { + for (let item of this._store) { + yield item; + } }; /** diff --git a/browser/devtools/debugger/debugger-toolbar.js b/browser/devtools/debugger/debugger-toolbar.js index 50ca51265df..4830f4b8fae 100644 --- a/browser/devtools/debugger/debugger-toolbar.js +++ b/browser/devtools/debugger/debugger-toolbar.js @@ -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 of this) { + for (let otherItem in this) { if (otherItem != stackframeItem) { otherItem.attachment.popup.menuitem.removeAttribute("checked"); } else { diff --git a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js index 1212e4fe85c..838c45e2794 100644 --- a/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js +++ b/browser/devtools/debugger/test/browser_dbg_breakpoints-contextmenu.js @@ -107,8 +107,8 @@ function test() { } function initialChecks() { - for (let source of gSources) { - for (let breakpoint of source) { + for (let source in gSources) { + for (let breakpoint in 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 of gSources) { - for (let otherBreakpoint of source) { + for (let source in gSources) { + for (let otherBreakpoint in 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 of gSources) { - for (let someBreakpoint of source) { + for (let source in gSources) { + for (let someBreakpoint in 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 of gSources) { - for (let someBreakpoint of source) { + for (let source in gSources) { + for (let someBreakpoint in 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 of gSources) { - for (let someBreakpoint of source) { + for (let source in gSources) { + for (let someBreakpoint in 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 of gSources) { - for (let otherBreakpoint of source) { + for (let source in gSources) { + for (let otherBreakpoint in source) { ok(false, "It's a trap!"); } } diff --git a/browser/devtools/netmonitor/netmonitor-view.js b/browser/devtools/netmonitor/netmonitor-view.js index a6ce58834a4..09d29c01c25 100644 --- a/browser/devtools/netmonitor/netmonitor-view.js +++ b/browser/devtools/netmonitor/netmonitor-view.js @@ -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 } of this) { + for (let { target, attachment } in 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 } of this) { + for (let { target } in this) { let waterfallNode = $(".requests-menu-waterfall", target); waterfallNode.style.backgroundImage = this._cachedWaterfallBackground; } diff --git a/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js b/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js index 1f1b5651757..b4e81a9916c 100644 --- a/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js +++ b/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js @@ -28,9 +28,9 @@ function runTests() let found = false; - outer: for (let scope of sidebar.variablesView) { - for (let [, obj] of scope) { - for (let [, prop] of obj) { + outer: for (let scope in sidebar.variablesView) { + for (let [, obj] in scope) { + for (let [, prop] in obj) { if (prop.name == "a" && prop.value == "foobarBug636725") { found = true; break outer; diff --git a/browser/devtools/shared/widgets/VariablesView.jsm b/browser/devtools/shared/widgets/VariablesView.jsm index df0cc400d67..50b925fa43a 100644 --- a/browser/devtools/shared/widgets/VariablesView.jsm +++ b/browser/devtools/shared/widgets/VariablesView.jsm @@ -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] of instance) { }". + * Iterable via "for (let [id, scope] in 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] of instance) { }". + * Iterable via "for (let [name, variable] in 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] of instance) { }". + * Iterable via "for (let [name, property] in 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] of instance) { }". + * Iterable via "for (let [name, property] in instance) { }". * * @param Variable aVar * The variable to contain this property. @@ -2928,11 +2928,13 @@ 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*() { - yield* this._store; +VariablesView.prototype.__iterator__ = +Scope.prototype.__iterator__ = +Variable.prototype.__iterator__ = +Property.prototype.__iterator__ = function() { + for (let item of this._store) { + yield item; + } }; /** diff --git a/browser/devtools/shared/widgets/ViewHelpers.jsm b/browser/devtools/shared/widgets/ViewHelpers.jsm index 582dbb147f2..facbb2ba820 100644 --- a/browser/devtools/shared/widgets/ViewHelpers.jsm +++ b/browser/devtools/shared/widgets/ViewHelpers.jsm @@ -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 of parentItem) { }". + * Iterable via "for (let childItem in 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 of aItem) { + for (let childItem in aItem) { aItem.remove(childItem); } @@ -557,7 +557,7 @@ Item.prototype = { /** * Some generic Widget methods handling Item instances. - * Iterable via "for (let childItem of wrappedView) { }". + * Iterable via "for (let childItem in wrappedView) { }". * * Usage: * function MyView() { @@ -1529,7 +1529,7 @@ this.WidgetMethods = { if (aItem.finalize) { aItem.finalize(aItem); } - for (let childItem of aItem) { + for (let childItem in aItem) { aItem.remove(childItem); } @@ -1654,7 +1654,9 @@ this.WidgetMethods = { /** * A generator-iterator over all the items in this container. */ -Item.prototype["@@iterator"] = -WidgetMethods["@@iterator"] = function*() { - yield* this._itemsByElement.values(); +Item.prototype.__iterator__ = +WidgetMethods.__iterator__ = function() { + for (let [, item] of this._itemsByElement) { + yield item; + } };