Bug 1229519: Fix toolkit/content to pass eslint checks. r=MattN

--HG--
extra : commitid : 932plqWTl9j
extra : rebase_source : dd7016124f54cb236d74ee5a120ae4e1543ec89b
This commit is contained in:
Dave Townsend 2015-12-03 10:02:22 -08:00
parent 76a557581f
commit 35e95f3cca
7 changed files with 67 additions and 63 deletions

View File

@ -52,8 +52,10 @@ var snapshotFormatters = {
$("safemode-box").textContent = data.safeMode;
},
#ifdef MOZ_CRASHREPORTER
crashes: function crashes(data) {
if (!AppConstants.MOZ_CRASHREPORTER)
return;
let strings = stringBundle();
let daysRange = Troubleshoot.kMaxCrashAge / (24 * 60 * 60 * 1000);
$("crashes-title").textContent =
@ -117,7 +119,6 @@ var snapshotFormatters = {
]);
}));
},
#endif
extensions: function extensions(data) {
$.append($("extensions-tbody"), data.map(function (extension) {
@ -373,8 +374,10 @@ var snapshotFormatters = {
$("prefs-user-js-section").className = "";
},
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
sandbox: function sandbox(data) {
if (AppConstants.platform != "linux" || !AppConstants.MOZ_SANDBOX)
return;
let strings = stringBundle();
let tbody = $("sandbox-tbody");
for (let key in data) {
@ -389,7 +392,6 @@ var snapshotFormatters = {
]));
}
},
#endif
};
var $ = document.getElementById.bind(document);
@ -470,15 +472,15 @@ function copyRawDataToClipboard(button) {
Cc["@mozilla.org/widget/clipboard;1"].
getService(Ci.nsIClipboard).
setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard);
#ifdef ANDROID
// Present a toast notification.
let message = {
type: "Toast:Show",
message: stringBundle().GetStringFromName("rawDataCopied"),
duration: "short"
};
Services.androidBridge.handleGeckoMessage(message);
#endif
if (AppConstants.platform == "android") {
// Present a toast notification.
let message = {
type: "Toast:Show",
message: stringBundle().GetStringFromName("rawDataCopied"),
duration: "short"
};
Services.androidBridge.handleGeckoMessage(message);
}
});
}
catch (err) {
@ -524,15 +526,15 @@ function copyContentsToClipboard() {
.getService(Ci.nsIClipboard);
clipboard.setData(transferable, null, clipboard.kGlobalClipboard);
#ifdef ANDROID
// Present a toast notification.
let message = {
type: "Toast:Show",
message: stringBundle().GetStringFromName("textCopied"),
duration: "short"
};
Services.androidBridge.handleGeckoMessage(message);
#endif
if (AppConstants.platform == "android") {
// Present a toast notification.
let message = {
type: "Toast:Show",
message: stringBundle().GetStringFromName("textCopied"),
duration: "short"
};
Services.androidBridge.handleGeckoMessage(message);
}
}
// Return the plain text representation of an element. Do a little bit
@ -542,9 +544,9 @@ function createTextForElement(elem) {
let text = serializer.serialize(elem);
// Actual CR/LF pairs are needed for some Windows text editors.
#ifdef XP_WIN
text = text.replace(/\n/g, "\r\n");
#endif
if (AppConstants.platform == "win") {
text = text.replace(/\n/g, "\r\n");
}
return text;
}

View File

@ -372,10 +372,10 @@ var PingPicker = {
return d;
};
this._weeks = [for (startTime of weekStartDates.values()) {
this._weeks = Array.from(weekStartDates.values(), startTime => ({
startDate: new Date(startTime),
endDate: plusOneWeek(new Date(startTime)),
}];
}));
// Render the archive data.
this._renderWeeks();
@ -1041,7 +1041,7 @@ var Histogram = {
},
processHistogram: function(aHgram, aName) {
const values = [for (k of Object.keys(aHgram.values)) aHgram.values[k]];
const values = Object.keys(aHgram.values).map(k => aHgram.values[k]);
if (!values.length) {
// If we have no values collected for this histogram, just return
// zero values so we still render it.
@ -1058,7 +1058,7 @@ var Histogram = {
const average = Math.round(aHgram.sum * 10 / sample_count) / 10;
const max_value = Math.max(...values);
const labelledValues = [for (k of Object.keys(aHgram.values)) [Number(k), aHgram.values[k]]];
const labelledValues = Object.keys(aHgram.values).map(k => [Number(k), aHgram.values[k]]);
let result = {
values: labelledValues,

View File

@ -1,6 +1,6 @@
# 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
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
/* 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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gToolboxDocument = null;
var gToolbox = null;
@ -10,6 +10,7 @@ var gToolboxSheet = false;
var gPaletteBox = null;
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
function onLoad()
{
@ -199,10 +200,10 @@ function wrapToolbarItems()
{
forEachCustomizableToolbar(function (toolbar) {
Array.forEach(toolbar.childNodes, function (item) {
#ifdef XP_MACOSX
if (item.firstChild && item.firstChild.localName == "menubar")
return;
#endif
if (AppConstants.platform == "macosx") {
if (item.firstChild && item.firstChild.localName == "menubar")
return;
}
if (isToolbarItem(item)) {
let wrapper = wrapToolbarItem(item);
cleanupItemForToolbar(item, wrapper);

View File

@ -4,29 +4,30 @@
function closeWindow(aClose, aPromptFunction)
{
# Closing the last window doesn't quit the application on OS X.
#ifndef XP_MACOSX
var windowCount = 0;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var e = wm.getEnumerator(null);
while (e.hasMoreElements()) {
var w = e.getNext();
if (w.closed) {
continue;
// Closing the last window doesn't quit the application on OS X.
if (AppConstants.platform != "macosx") {
var windowCount = 0;
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var e = wm.getEnumerator(null);
while (e.hasMoreElements()) {
var w = e.getNext();
if (w.closed) {
continue;
}
if (++windowCount == 2)
break;
}
if (++windowCount == 2)
break;
}
// If we're down to the last window and someone tries to shut down, check to make sure we can!
if (windowCount == 1 && !canQuitApplication("lastwindow"))
return false;
else if (windowCount != 1)
#endif
if (typeof(aPromptFunction) == "function" && !aPromptFunction())
// If we're down to the last window and someone tries to shut down, check to make sure we can!
if (windowCount == 1 && !canQuitApplication("lastwindow"))
return false;
if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction())
return false;
} else if (typeof(aPromptFunction) == "function" && !aPromptFunction()) {
return false;
}
if (aClose) {
window.close();

View File

@ -28,7 +28,7 @@ toolkit.jar:
content/global/aboutwebrtc/aboutWebrtc.css (aboutwebrtc/aboutWebrtc.css)
content/global/aboutwebrtc/aboutWebrtc.js (aboutwebrtc/aboutWebrtc.js)
content/global/aboutwebrtc/aboutWebrtc.xhtml (aboutwebrtc/aboutWebrtc.xhtml)
* content/global/aboutSupport.js
content/global/aboutSupport.js
* content/global/aboutSupport.xhtml
content/global/aboutTelemetry.js
content/global/aboutTelemetry.xhtml
@ -41,7 +41,7 @@ toolkit.jar:
*+ content/global/buildconfig.html
* content/global/contentAreaUtils.js
content/global/customizeToolbar.css
* content/global/customizeToolbar.js
content/global/customizeToolbar.js
content/global/customizeToolbar.xul
content/global/devicestorage.properties
content/global/editMenuOverlay.js
@ -50,7 +50,7 @@ toolkit.jar:
*+ content/global/finddialog.xul
content/global/findUtils.js
content/global/filepicker.properties
*+ content/global/globalOverlay.js
+ content/global/globalOverlay.js
+ content/global/mozilla.xhtml
content/global/nsDragAndDrop.js
content/global/process-content.js

View File

@ -27,7 +27,7 @@ function copyToTemporaryFile(f)
return tmpf;
}
function dirIter(directory)
function* dirIter(directory)
{
var ioSvc = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
@ -69,7 +69,7 @@ function copyDirToTempProfile(path, subdirname) {
}
// The SimpleTest directory is hidden
var files = [file for (file in dirIter('file://' +rootDir))];
var files = Array.from(dirIter('file://' + rootDir));
for (f in files) {
files[f].copyTo(tmpdir, "");
}

View File

@ -944,7 +944,7 @@ TileManager.CrawlIterator = function CrawlIterator(tileCache, startRect) {
};
TileManager.CrawlIterator.prototype = {
__iterator__: function() {
__iterator__: function*() {
while (true) {
let tile = this.next();
if (!tile) break;