Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1326511 - Enable brace-style and no-multi-spaces eslint rules for…
Browse files Browse the repository at this point in the history
… toolkit. r=MattN

MozReview-Commit-ID: FuVu8skcqOe
  • Loading branch information
msujaws committed Dec 31, 2016
1 parent b6bddab commit 5525d2d
Show file tree
Hide file tree
Showing 752 changed files with 4,950 additions and 8,982 deletions.
9 changes: 3 additions & 6 deletions browser/base/content/aboutDialog-appUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function onUnload(aEvent) {
}


function appUpdater()
{
function appUpdater() {
XPCOMUtils.defineLazyServiceGetter(this, "aus",
"@mozilla.org/updates/update-service;1",
"nsIApplicationUpdateService");
Expand Down Expand Up @@ -142,8 +141,7 @@ appUpdater.prototype =
get updateEnabled() {
try {
return Services.prefs.getBoolPref("app.update.enabled");
}
catch (e) { }
} catch (e) { }
return true; // Firefox default is true
},

Expand All @@ -157,8 +155,7 @@ appUpdater.prototype =
get updateAuto() {
try {
return Services.prefs.getBoolPref("app.update.auto");
}
catch (e) { }
} catch (e) { }
return true; // Firefox default is true
},

Expand Down
9 changes: 3 additions & 6 deletions browser/base/content/aboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");

function init(aEvent)
{
function init(aEvent) {
if (aEvent.target != document)
return;

Expand All @@ -29,14 +28,12 @@ function init(aEvent)
var distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.style.display = "block";
}
catch (ex) {
} catch (ex) {
// Pref is unset
Components.utils.reportError(ex);
}
}
}
catch (e) {
} catch (e) {
// Pref is unset
}

Expand Down
27 changes: 9 additions & 18 deletions browser/base/content/aboutNetError.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,23 @@
// Set to true on init if the error code is nssBadCert.
let gIsCertError;

function getErrorCode()
{
function getErrorCode() {
return searchParams.get("e");
}

function getCSSClass()
{
function getCSSClass() {
return searchParams.get("s");
}

function getDescription()
{
function getDescription() {
return searchParams.get("d");
}

function isCaptive() {
return searchParams.get("captive") == "true";
}

function retryThis(buttonEl)
{
function retryThis(buttonEl) {
// Note: The application may wish to handle switching off "offline mode"
// before this event handler runs, but using a capturing event handler.

Expand Down Expand Up @@ -179,8 +175,7 @@
}
}

function initPage()
{
function initPage() {
var err = getErrorCode();
gIsCertError = (err == "nssBadCert");
// Only worry about captive portals if this is a cert error.
Expand All @@ -193,8 +188,7 @@
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
var errDesc = document.getElementById("ed_" + err);
if (!errTitle || !errDesc)
{
if (!errTitle || !errDesc) {
errTitle = document.getElementById("et_generic");
errDesc = document.getElementById("ed_generic");
}
Expand All @@ -205,8 +199,7 @@
if (sd) {
if (gIsCertError) {
sd.innerHTML = errDesc.innerHTML;
}
else {
} else {
sd.textContent = getDescription();
}
}
Expand All @@ -222,8 +215,7 @@
document.body.className = "neterror";

var ld = document.getElementById("errorLongDesc");
if (ld)
{
if (ld) {
ld.innerHTML = errDesc.innerHTML;
}

Expand Down Expand Up @@ -335,8 +327,7 @@
addDomainErrorLinks();
}

function initPageCaptivePortal()
{
function initPageCaptivePortal() {
document.body.className = "captiveportal";
document.title = document.getElementById("captivePortalPageTitle").textContent;

Expand Down
3 changes: 1 addition & 2 deletions browser/base/content/aboutRobots.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@

<script type="application/javascript"><![CDATA[
var buttonClicked = false;
function robotButton()
{
function robotButton() {
var button = document.getElementById('errorTryAgain');
if (buttonClicked) {
button.style.visibility = "hidden";
Expand Down
3 changes: 1 addition & 2 deletions browser/base/content/abouthealthreport/abouthealth.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ var healthReportWrapper = {
enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
};
healthReportWrapper.injectData("prefs", prefsObj);
}
catch (ex) {
} catch (ex) {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PREFS_FAILED);
}
},
Expand Down
21 changes: 7 additions & 14 deletions browser/base/content/abouthome/aboutHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ var gSnippetsMapCallbacks = [];
* @note Snippets should never directly manage the underlying storage, since
* it may change inadvertently.
*/
function ensureSnippetsMapThen(aCallback)
{
function ensureSnippetsMapThen(aCallback) {
if (gSnippetsMap) {
aCallback(gSnippetsMap);
return;
Expand Down Expand Up @@ -210,16 +209,14 @@ function ensureSnippetsMapThen(aCallback)
}
}

function onSearchSubmit(aEvent)
{
function onSearchSubmit(aEvent) {
gContentSearchController.search(aEvent);
}


var gContentSearchController;

function setupSearch()
{
function setupSearch() {
// Set submit button label for when CSS background are disabled (e.g.
// high contrast mode).
document.getElementById("searchSubmit").value =
Expand All @@ -244,8 +241,7 @@ function setupSearch()
/**
* Inform the test harness that we're done loading the page.
*/
function loadCompleted()
{
function loadCompleted() {
var event = new CustomEvent("AboutHomeLoadSnippetsCompleted", {bubbles:true});
document.dispatchEvent(event);
}
Expand All @@ -254,8 +250,7 @@ function loadCompleted()
* Update the local snippets from the remote storage, then show them through
* showSnippets.
*/
function loadSnippets()
{
function loadSnippets() {
if (!gSnippetsMap)
throw new Error("Snippets map has not properly been initialized");

Expand Down Expand Up @@ -312,8 +307,7 @@ function loadSnippets()
* a "too much recursion" exception.
*/
var _snippetsShown = false;
function showSnippets()
{
function showSnippets() {
let snippetsElt = document.getElementById("snippets");

// Show about:rights notification, if needed.
Expand Down Expand Up @@ -363,8 +357,7 @@ function showSnippets()
/**
* Clear snippets element contents and show default snippets.
*/
function showDefaultSnippets()
{
function showDefaultSnippets() {
// Clear eventual contents...
let snippetsElt = document.getElementById("snippets");
snippetsElt.innerHTML = "";
Expand Down
15 changes: 5 additions & 10 deletions browser/base/content/blockedSite.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.

function getErrorCode()
{
function getErrorCode() {
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
}

function getURL()
{
function getURL() {
var url = document.documentURI;
var match = url.match(/&u=([^&]+)&/);

Expand All @@ -61,8 +59,7 @@
* Check whether this warning page should be overridable or whether
* the "ignore warning" button should be hidden.
*/
function getOverride()
{
function getOverride() {
var url = document.documentURI;
var match = url.match(/&o=1&/);
return !!match;
Expand All @@ -72,17 +69,15 @@
* Attempt to get the hostname via document.location. Fail back
* to getURL so that we always return something meaningful.
*/
function getHostString()
{
function getHostString() {
try {
return document.location.hostname;
} catch (e) {
return getURL();
}
}

function initPage()
{
function initPage() {
var error = "";
switch (getErrorCode()) {
case "malwareBlocked" :
Expand Down
24 changes: 8 additions & 16 deletions browser/base/content/browser-addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ function removeNotificationOnEnd(notification, installs) {
}

const gXPInstallObserver = {
_findChildShell(aDocShell, aSoughtShell)
{
_findChildShell(aDocShell, aSoughtShell) {
if (aDocShell == aSoughtShell)
return aDocShell;

Expand All @@ -45,8 +44,7 @@ const gXPInstallObserver = {
return null;
},

_getBrowser(aDocShell)
{
_getBrowser(aDocShell) {
for (let browser of gBrowser.browsers) {
if (this._findChildShell(browser.docShell, aDocShell))
return browser;
Expand Down Expand Up @@ -163,14 +161,12 @@ const gXPInstallObserver = {
messageString = gNavigatorBundle.getString("addonConfirmInstallUnsigned.message");
notification.setAttribute("warning", "true");
options.learnMoreURL += "unsigned-addons";
}
else if (unsigned.length == 0) {
} else if (unsigned.length == 0) {
// All add-ons are verified or don't need to be verified
messageString = gNavigatorBundle.getString("addonConfirmInstall.message");
notification.removeAttribute("warning");
options.learnMoreURL += "find-and-install-add-ons";
}
else {
} else {
// Some of the add-ons are unverified, the list of names will indicate
// which
messageString = gNavigatorBundle.getString("addonConfirmInstallSomeUnsigned.message");
Expand Down Expand Up @@ -217,8 +213,7 @@ const gXPInstallObserver = {
.add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL);
},

observe(aSubject, aTopic, aData)
{
observe(aSubject, aTopic, aData) {
var brandBundle = document.getElementById("bundle_brand");
var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
var browser = installInfo.browser;
Expand Down Expand Up @@ -247,8 +242,7 @@ const gXPInstallObserver = {
if (gPrefService.prefIsLocked("xpinstall.enabled")) {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
buttons = [];
}
else {
} else {
messageString = gNavigatorBundle.getString("xpinstallDisabledMessage");

action = {
Expand Down Expand Up @@ -442,8 +436,7 @@ const gXPInstallObserver = {
accessKey: gNavigatorBundle.getString("addonInstallRestartIgnoreButton.accesskey"),
callback: () => {},
}];
}
else {
} else {
messageString = gNavigatorBundle.getString("addonsInstalled");
action = null;
}
Expand Down Expand Up @@ -683,8 +676,7 @@ var LightWeightThemeWebInstaller = {
let uri;
try {
uri = makeURI(srcURIString);
}
catch (e) {
} catch (e) {
// makeURI fails if srcURIString is a nonsense URI
return false;
}
Expand Down
3 changes: 1 addition & 2 deletions browser/base/content/browser-feeds.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ var FeedHandler = {
let feeds = gBrowser.selectedBrowser.feeds;
try {
openUILink(href, event, { ignoreAlt: true });
}
finally {
} finally {
// We might default to a livebookmarks modal dialog,
// so reset that if the user happens to click it again
gBrowser.selectedBrowser.feeds = feeds;
Expand Down
Loading

0 comments on commit 5525d2d

Please sign in to comment.