Bug 1311343 - Enable eslint of browser/components/feeds/; r?standard8
MozReview-Commit-ID: 6c4nzNeeurk
--- a/.eslintignore
+++ b/.eslintignore
@@ -59,17 +59,16 @@ b2g/locales/en-US/b2g-l10n.js
browser/app/**
browser/base/content/browser-social.js
browser/base/content/nsContextMenu.js
browser/base/content/sanitizeDialog.js
browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
browser/base/content/newtab/**
browser/components/downloads/**
-browser/components/feeds/**
browser/components/privatebrowsing/**
browser/components/sessionstore/**
browser/components/tabview/**
browser/components/translation/**
# generated files in cld2
browser/components/translation/cld2/cld-worker.js
browser/extensions/pdfjs/**
# generated or library files in pocket
--- a/browser/components/feeds/FeedConverter.js
+++ b/browser/components/feeds/FeedConverter.js
@@ -1,9 +1,9 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/debug.js");
Components.utils.import("resource://gre/modules/Services.jsm");
@@ -222,17 +222,17 @@ FeedConverter.prototype = {
case "client":
case "default":
try {
let title = feed.title ? feed.title.plainText() : "";
let desc = feed.subtitle ? feed.subtitle.plainText() : "";
let feedReader = safeGetCharPref(getPrefActionForType(feedType), "bookmarks");
feedService.addToClientReader(result.uri.spec, title, desc, feed.type, feedReader);
return;
- } catch(ex) { /* fallback to preview mode */ }
+ } catch (ex) { /* fallback to preview mode */ }
}
}
}
let ios =
Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
let chromeChannel;
--- a/browser/components/feeds/FeedWriter.js
+++ b/browser/components/feeds/FeedWriter.js
@@ -606,17 +606,17 @@ FeedWriter.prototype = {
_setAlwaysUseCheckedState(feedType) {
let checkbox = this._document.getElementById("alwaysUse");
if (checkbox) {
let alwaysUse = false;
try {
if (Services.prefs.getCharPref(getPrefActionForType(feedType)) != "ask")
alwaysUse = true;
}
- catch(ex) { }
+ catch (ex) { }
this._setCheckboxCheckedState(checkbox, alwaysUse);
}
},
_setSubscribeUsingLabel() {
let stringLabel = "subscribeFeedUsing";
switch (this._getFeedType()) {
case Ci.nsIFeed.TYPE_VIDEO:
@@ -944,17 +944,17 @@ FeedWriter.prototype = {
prefs.addObserver(PREF_AUDIO_SELECTED_READER, this, false);
prefs.addObserver(PREF_AUDIO_SELECTED_WEB, this, false);
prefs.addObserver(PREF_AUDIO_SELECTED_APP, this, false);
this._mm.addMessageListener("FeedWriter:SetApplicationLauncherMenuItem", this);
},
receiveMessage(msg) {
- switch(msg.name) {
+ switch (msg.name) {
case "FeedWriter:SetApplicationLauncherMenuItem":
let menuItem = null;
if (msg.data.type == "DefaultAppMenuItem") {
menuItem = this._defaultHandlerMenuItem;
} else {
// Most likely SelectedAppMenuItem
menuItem = this._selectedAppMenuItem;
--- a/browser/components/feeds/WebContentConverter.js
+++ b/browser/components/feeds/WebContentConverter.js
@@ -915,17 +915,17 @@ WebContentConverterRegistrarContent.prot
}).filter(child => !!child)
.sort();
// now register them
for (num of nums) {
let branch = ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + num + ".");
try {
this._registerContentHandlerHavingBranch(branch);
- } catch(ex) {
+ } catch (ex) {
// do nothing, the next branch might have values
}
}
},
_typeIsRegistered(contentType, uri) {
return this._contentTypes[contentType]
.some(e => e.uri == uri);
--- a/browser/components/feeds/content/subscribe.js
+++ b/browser/components/feeds/content/subscribe.js
@@ -3,17 +3,17 @@
* 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 SubscribeHandler = {
/**
* The nsIFeedWriter object that produces the UI
*/
_feedWriter: null,
-
+
init: function SH_init() {
this._feedWriter = new BrowserFeedWriter();
},
writeContent: function SH_writeContent() {
this._feedWriter.writeContent();
},
--- a/browser/components/feeds/test/test_bug436801.html
+++ b/browser/components/feeds/test/test_bug436801.html
@@ -81,29 +81,29 @@ function checkNode(node, schema) {
var text = schema.shift();
is(node.data, text, "Text should match");
return;
}
// type == Node.ELEMENT_NODE
var tag = schema.shift();
is(node.localName, tag, "Element should have expected tag");
while (schema.length) {
- var val = schema.shift();
+ let val = schema.shift();
if (Array.isArray(val))
var childSchema = val;
else
var attrSchema = val;
}
if (attrSchema) {
var nsTable = {
xml: "http://www.w3.org/XML/1998/namespace",
};
for (var name in attrSchema) {
var [ns, nsName] = name.split(":");
- var val = nsName ? node.getAttributeNS(nsTable[ns], nsName) :
+ let val = nsName ? node.getAttributeNS(nsTable[ns], nsName) :
node.getAttribute(name);
is(val, attrSchema[name], "Attribute " + name + " should match");
}
}
if (childSchema) {
var numChildren = node.childNodes.length;
is(childSchema.length, numChildren,
"Element should have expected number of children");
--- a/browser/components/feeds/test/test_registerHandler.html
+++ b/browser/components/feeds/test/test_registerHandler.html
@@ -23,17 +23,17 @@ https://bugzilla.mozilla.org/show_bug.cg
function testRegisterHandler(aIsProtocol, aTxt, aUri, aTitle)
{
try {
if (aIsProtocol)
navigator.registerProtocolHandler(aTxt, aUri, aTitle);
else
navigator.registerContentHandler(aTxt, aUri, aTitle);
}
- catch(e) {
+ catch (e) {
return false;
}
return true;
}
ok(navigator.registerProtocolHandler, "navigator.registerProtocolHandler should be defined");
ok(navigator.registerContentHandler, "navigator.registerContentHandler should be defined");
@@ -56,20 +56,20 @@ https://bugzilla.mozilla.org/show_bug.cg
// restriction to http(s) for the uri of the handler (bug 401343)
// https should work (http already tested in the generic case)
is(testRegisterHandler(true, "foo", "https://mochi.test:8888/%s", "Foo handler"), true, "registering a foo protocol handler with https scheme should work");
is(testRegisterHandler(false, "application/rss+xml", "https://mochi.test:8888/%s", "Foo handler"), true, "registering a foo content handler with https scheme should work");
// ftp should not work
is(testRegisterHandler(true, "foo", "ftp://mochi.test:8888/%s", "Foo handler"), false, "registering a foo protocol handler with ftp scheme should not work");
is(testRegisterHandler(false, "application/rss+xml", "ftp://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with ftp scheme should not work");
- // chrome should not work
+ // chrome should not work
is(testRegisterHandler(true, "foo", "chrome://mochi.test:8888/%s", "Foo handler"), false, "registering a foo protocol handler with chrome scheme should not work");
is(testRegisterHandler(false, "application/rss+xml", "chrome://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with chrome scheme should not work");
- // foo should not work
+ // foo should not work
is(testRegisterHandler(true, "foo", "foo://mochi.test:8888/%s", "Foo handler"), false, "registering a foo protocol handler with foo scheme should not work");
is(testRegisterHandler(false, "application/rss+xml", "foo://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with foo scheme should not work");
// for security reasons, protocol handlers should never be registered for some schemes (chrome, vbscript, ...) (bug 402788)
is(testRegisterHandler(true, "chrome", "http://mochi.test:8888/%s", "chrome handler"), false, "registering a chrome protocol handler should not work");
is(testRegisterHandler(true, "vbscript", "http://mochi.test:8888/%s", "vbscript handler"), false, "registering a vbscript protocol handler should not work");
is(testRegisterHandler(true, "javascript", "http://mochi.test:8888/%s", "javascript handler"), false, "registering a javascript protocol handler should not work");
is(testRegisterHandler(true, "moz-icon", "http://mochi.test:8888/%s", "moz-icon handler"), false, "registering a moz-icon protocol handler should not work");