Bug 1290698 - Replace Iterator() with Object.{values, entries}; r?arai
MozReview-Commit-ID: DEoVeqEZWpd
--- a/browser/base/content/browser-gestureSupport.js
+++ b/browser/base/content/browser-gestureSupport.js
@@ -120,17 +120,17 @@ var gGestureSupport = {
* Preference object with the names of preferences and defaults
* @param aInc
* Command to trigger for increasing motion (without gesture name)
* @param aDec
* Command to trigger for decreasing motion (without gesture name)
*/
_setupGesture: function GS__setupGesture(aEvent, aGesture, aPref, aInc, aDec) {
// Try to load user-set values from preferences
- for (let [pref, def] in Iterator(aPref))
+ for (let [pref, def] of Object.entries(aPref))
aPref[pref] = this._getPref(aGesture + "." + pref, def);
// Keep track of the total deltas and latching behavior
let offset = 0;
let latchDir = aEvent.delta > 0 ? 1 : -1;
let isLatched = false;
// Create the update function here to capture closure state
--- a/browser/base/content/sync/aboutSyncTabs.js
+++ b/browser/base/content/sync/aboutSyncTabs.js
@@ -206,17 +206,17 @@ var RemoteTabViewer = {
_generateWeaveTabList: function () {
let engine = Weave.Service.engineManager.get("tabs");
let list = this._tabsList;
let seenURLs = new Set();
let localURLs = engine.getOpenURLs();
- for (let [guid, client] in Iterator(engine.getAllClients())) {
+ for (let [guid, client] of Object.entries(engine.getAllClients())) {
// Create the client node, but don't add it in-case we don't show any tabs
let appendClient = true;
client.tabs.forEach(function({title, urlHistory, icon}) {
let url = urlHistory[0];
if (!url || localURLs.has(url) || seenURLs.has(url)) {
return;
}
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -164,17 +164,17 @@ function BasicNotification(testId) {
this.swappingCallbackTriggered = true;
break;
}
}
};
}
BasicNotification.prototype.addOptions = function(options) {
- for (let [name, value] in Iterator(options))
+ for (let [name, value] of Object.entries(options))
this.options[name] = value;
};
function ErrorNotification() {
this.mainAction.callback = () => {
this.mainActionClicked = true;
throw new Error("Oops!");
};
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1973,17 +1973,17 @@ var CustomizableUIInternal = {
this.beginBatchUpdate();
try {
gRestoring = true;
let restored = false;
if (placementsPreexisted) {
log.debug("Restoring " + aArea + " from pre-existing placements");
- for (let [position, id] in Iterator(gPlacements.get(aArea))) {
+ for (let [position, id] of gPlacements.get(aArea).entries()) {
this.moveWidgetWithinArea(id, position);
}
gDirty = false;
restored = true;
} else {
gPlacements.set(aArea, []);
}
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -56,17 +56,17 @@ XPCOMUtils.defineLazyGetter(this, "log",
};
return new scope.ConsoleAPI(consoleOptions);
});
function setAttributes(aNode, aAttrs) {
let doc = aNode.ownerDocument;
- for (let [name, value] of Iterator(aAttrs)) {
+ for (let [name, value] of Object.entries(aAttrs)) {
if (!value) {
if (aNode.hasAttribute(name))
aNode.removeAttribute(name);
} else {
if (name == "shortcutId") {
continue;
}
if (name == "label" || name == "tooltiptext") {
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -33,17 +33,17 @@ const PanelUI = {
menuButton: "PanelUI-menu-button",
panel: "PanelUI-popup",
scroller: "PanelUI-contents-scroller"
};
},
_initialized: false,
init: function() {
- for (let [k, v] of Iterator(this.kElements)) {
+ for (let [k, v] of Object.entries(this.kElements)) {
// Need to do fresh let-bindings per iteration
let getKey = k;
let id = v;
this.__defineGetter__(getKey, function() {
delete this[getKey];
return this[getKey] = document.getElementById(id);
});
}
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -1023,17 +1023,18 @@ DownloadsPlacesView.prototype = {
_appendDownloadsFragment(aDOMFragment) {
// Workaround multiple reflows hang by removing the richlistbox
// and adding it back when we're done.
// Hack for bug 836283: reset xbl fields to their old values after the
// binding is reattached to avoid breaking the selection state
let xblFields = new Map();
- for (let [key, value] in Iterator(this._richlistbox)) {
+ for (let key of Object.getOwnPropertyNames(this._richlistbox)) {
+ let value = this._richlistbox[key];
xblFields.set(key, value);
}
let parentNode = this._richlistbox.parentNode;
let nextSibling = this._richlistbox.nextSibling;
parentNode.removeChild(this._richlistbox);
this._richlistbox.appendChild(aDOMFragment);
parentNode.insertBefore(this._richlistbox, nextSibling);
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -1375,17 +1375,17 @@ this.PlacesUIUtils = {
catch (ex) {
// doesn't have the annotation
queryName = "";
}
}
else {
// If the left pane has already been built, use the name->id map
// cached in PlacesUIUtils.
- for (let [name, id] in Iterator(this.leftPaneQueries)) {
+ for (let [name, id] of Object.entries(this.leftPaneQueries)) {
if (aItemId == id)
queryName = name;
}
}
return queryName;
},
shouldShowTabsFromOtherComputersMenuitem: function() {
--- a/browser/extensions/pocket/bootstrap.js
+++ b/browser/extensions/pocket/bootstrap.js
@@ -35,17 +35,17 @@ const PREFS = {
enabled: true, // bug 1229937, figure out ui tour support
api: "api.getpocket.com",
site: "getpocket.com",
oAuthConsumerKey: "40249-e88c401e1b1f2242d9e441c4"
};
function setDefaultPrefs() {
let branch = Services.prefs.getDefaultBranch(PREF_BRANCH);
- for (let [key, val] in Iterator(PREFS)) {
+ for (let [key, val] of Object.entries(PREFS)) {
// If someone beat us to setting a default, don't overwrite it. This can
// happen if distribution.ini sets the default first.
if (branch.getPrefType(key) != branch.PREF_INVALID)
continue;
switch (typeof val) {
case "boolean":
branch.setBoolPref(key, val);
break;
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -104,17 +104,17 @@ XPCOMUtils.defineLazyGetter(this, "PALET
result.push("panic-button");
}
return result;
});
XPCOMUtils.defineLazyGetter(this, "DEFAULT_ITEMS", function() {
let result = [];
- for (let [, buttons] of Iterator(DEFAULT_AREA_PLACEMENTS)) {
+ for (let [, buttons] of Object.entries(DEFAULT_AREA_PLACEMENTS)) {
result = result.concat(buttons);
}
return result;
});
XPCOMUtils.defineLazyGetter(this, "ALL_BUILTIN_ITEMS", function() {
// These special cases are for click events on built-in items that are
// contained within customizable items (like the navigation widget).
@@ -240,17 +240,17 @@ this.BrowserUITelemetry = {
* designated by aKeys.
* @returns a reference to the second last object in the chain -
* so in our example, that'd be "b".
*/
_ensureObjectChain: function(aKeys, aEndWith, aRoot) {
let current = aRoot;
let parent = null;
aKeys.unshift(this._bucket);
- for (let [i, key] of Iterator(aKeys)) {
+ for (let [i, key] of aKeys.entries()) {
if (!(key in current)) {
if (i == aKeys.length - 1) {
current[key] = aEndWith;
} else {
current[key] = {};
}
}
parent = current;
--- a/browser/modules/PanelFrame.jsm
+++ b/browser/modules/PanelFrame.jsm
@@ -76,17 +76,17 @@ var PanelFrameInternal = {
"origin": aOrigin,
"src": aSrc
};
if (aType == "social") {
attrs["message"] = "true";
attrs["messagemanagergroup"] = aType;
}
- for (let [k, v] of Iterator(attrs)) {
+ for (let [k, v] of Object.entries(attrs)) {
frame.setAttribute(k, v);
}
aParent.appendChild(frame);
} else {
frame.setAttribute("origin", aOrigin);
frame.setAttribute("src", aSrc);
}
aButton.setAttribute("notificationFrameId", notificationFrameId);