--- a/browser/components/migration/tests/unit/test_Chrome_passwords.js
+++ b/browser/components/migration/tests/unit/test_Chrome_passwords.js
@@ -89,17 +89,17 @@ function promiseSetPassword(login) {
stmt.params.rowid = login.id;
stmt.executeAsync({
handleError(aError) {
reject("Error with the query: " + aError.message);
},
handleCompletion(aReason) {
- if (aReason === Ci.mozIStorageStatementCallback.REASON_FINISHED){
+ if (aReason === Ci.mozIStorageStatementCallback.REASON_FINISHED) {
resolve();
} else {
reject("Query has failed: " + aReason);
}
},
});
stmt.finalize();
});
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -8,17 +8,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
// We need to cache this before test runs...
var cachedLeftPaneFolderIdGetter;
var getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function") {
cachedLeftPaneFolderIdGetter = getter;
}
// ...And restore it when test ends.
-registerCleanupFunction(function(){
+registerCleanupFunction(function() {
let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function") {
PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
}
});
function openLibrary(callback, aLeftPaneRoot) {
let library = window.openDialog("chrome://browser/content/places/places.xul",
--- a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
+++ b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
@@ -17,17 +17,17 @@ const ACTION_METHODS = [
"onClearFilter",
"onFilterFocus",
"onFilterBlur",
];
add_task(function* testInitUninit() {
let store = new SyncedTabsListStore();
let ViewMock = sinon.stub();
- let view = {render(){}, destroy(){}};
+ let view = {render() {}, destroy() {}};
ViewMock.returns(view);
sinon.spy(view, 'render');
sinon.spy(view, 'destroy');
sinon.spy(store, "on");
sinon.stub(store, "getData");
--- a/browser/components/uitour/test/browser_UITour_heartbeat.js
+++ b/browser/components/uitour/test/browser_UITour_heartbeat.js
@@ -154,17 +154,17 @@ function promiseWaitExpectedNotification
});
}
function validateTimestamp(eventName, timestamp) {
info("'" + eventName + "' notification received (timestamp " + timestamp.toString() + ").");
ok(Number.isFinite(timestamp), "Timestamp must be a number.");
}
-add_task(function* test_setup(){
+add_task(function* test_setup() {
yield setup_UITourTest();
requestLongerTimeout(2);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("browser.uitour.surveyDuration");
});
});
/**
--- a/browser/components/uitour/test/browser_no_tabs.js
+++ b/browser/components/uitour/test/browser_no_tabs.js
@@ -45,17 +45,17 @@ function destroyHiddenBrowser(aFrame, aB
// Take care of the frame holding our invisible browser.
aFrame.destroy();
}
/**
* Test that UITour works when called when no tabs are available (e.g., when using windowless
* browsers).
*/
-add_task(function* test_windowless_UITour(){
+add_task(function* test_windowless_UITour() {
// Get the URL for the test page.
let pageURL = getRootDirectory(gTestPath) + "uitour.html";
// Allow the URL to use the UITour.
info("Adding UITour permission to the test page.");
let pageURI = Services.io.newURI(pageURL, null, null);
Services.perms.add(pageURI, "uitour", Services.perms.ALLOW_ACTION);
--- a/browser/extensions/pocket/content/panels/js/saved.js
+++ b/browser/extensions/pocket/content/panels/js/saved.js
@@ -586,17 +586,17 @@ PKT_SAVED.prototype = {
myself.overlay.showStateSaved(resp);
});
}
}
$(function()
{
- if(!window.thePKT_SAVED){
+ if(!window.thePKT_SAVED) {
var thePKT_SAVED = new PKT_SAVED();
window.thePKT_SAVED = thePKT_SAVED;
thePKT_SAVED.init();
}
// send an async message to get string data
thePKT_SAVED.sendMessage("initL10N", {}, function(resp) {
window.pocketStrings = resp.strings;
--- a/browser/extensions/pocket/content/panels/js/signup.js
+++ b/browser/extensions/pocket/content/panels/js/signup.js
@@ -162,17 +162,17 @@ PKT_SIGNUP.prototype = {
// tell back end we're ready
thePKT_SIGNUP.sendMessage("show");
}
}
$(function()
{
- if(!window.thePKT_SIGNUP){
+ if(!window.thePKT_SIGNUP) {
var thePKT_SIGNUP = new PKT_SIGNUP();
window.thePKT_SIGNUP = thePKT_SIGNUP;
thePKT_SIGNUP.init();
}
// send an async message to get string data
thePKT_SIGNUP.sendMessage("initL10N", {}, function(resp) {
window.pocketStrings = resp.strings;
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ b/browser/extensions/pocket/content/pktApi.jsm
@@ -85,17 +85,17 @@ var pktApi = (function() {
for (var key in arguments[i]) {
if (arguments[i].hasOwnProperty(key))
out[key] = arguments[i][key];
}
}
return out;
}
- var parseJSON = function(jsonString){
+ var parseJSON = function(jsonString) {
try {
var o = JSON.parse(jsonString);
// Handle non-exception-throwing cases:
// Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
// but... JSON.parse(null) returns 'null', and typeof null === "object",
// so we must check for that, too.
if (o && typeof o === "object" && o !== null) {
@@ -256,17 +256,17 @@ var pktApi = (function() {
var data = options.data || {};
data.locale_lang = Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(Ci.nsIXULChromeRegistry).
getSelectedLocale("browser");
data.consumer_key = oAuthConsumerKey;
var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
request.open("POST", url, true);
- request.onreadystatechange = function(e){
+ request.onreadystatechange = function(e) {
if (request.readyState == 4) {
if (request.status === 200) {
// There could still be an error if the response is no valid json
// or does not have status = 1
var response = parseJSON(request.response);
if (options.success && response && response.status == 1) {
options.success(response, request);
return;
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
@@ -90,17 +90,17 @@ this.TestRunner = {
// Don't let the caret blink since it causes false positives for image diffs
Services.prefs.setIntPref("ui.caretBlinkTime", -1);
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let selectedBrowser = browserWindow.gBrowser.selectedBrowser;
yield BrowserTestUtils.loadURI(selectedBrowser, HOME_PAGE);
yield BrowserTestUtils.browserLoaded(selectedBrowser);
- for (let i = 0; i < this.combos.length; i++){
+ for (let i = 0; i < this.combos.length; i++) {
this.currentComboIndex = i;
yield this._performCombo(this.combos.item(this.currentComboIndex));
}
log.info("Done: Completed " + this.completedCombos + " out of " +
this.combos.length + " configurations.");
this.cleanup();
}),
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
@@ -37,17 +37,17 @@ this.Preferences = {
let configName = primary.replace(/^pane/, "prefs") + (advanced ? "-" + advanced : "");
this.configurations[configName] = {};
this.configurations[configName].applyConfig = prefHelper.bind(null, primary, advanced);
}
},
configurations: {
"panePrivacy-DNTDialog": {
- applyConfig: Task.async(function*(){
+ applyConfig: Task.async(function*() {
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
yield prefHelper("panePrivacy", null);
yield ContentTask.spawn(browserWindow.gBrowser.selectedBrowser, null, function* () {
content.document.getElementById("doNotTrackSettings").click();
});
}),
},
--- a/toolkit/.eslintrc
+++ b/toolkit/.eslintrc
@@ -162,17 +162,17 @@
// No using with
"no-with": 2,
// Always require semicolon at end of statement
// "semi": [2, "always"],
// Require space before blocks
- // "space-before-blocks": 2,
+ "space-before-blocks": 2,
// Never use spaces before function parentheses
// "space-before-function-paren": [2, { "anonymous": "always", "named": "never" }],
// No space padding in parentheses
// "space-in-parens": [2, "never"],
// Require spaces around operators
--- a/toolkit/components/addoncompat/RemoteAddonsChild.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsChild.jsm
@@ -539,17 +539,17 @@ var RemoteAddonsChild = {
Cu.reportError(e);
}
}
},
init: function(global) {
if (!this._ready) {
- if (!Services.cpmm.initialProcessData.remoteAddonsParentInitted){
+ if (!Services.cpmm.initialProcessData.remoteAddonsParentInitted) {
return null;
}
this.makeReady();
this._ready = true;
}
global.sendAsyncMessage("Addons:RegisterGlobal", {}, {global: global});
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
@@ -35,17 +35,17 @@ function test_portal_not_found() {
prepare: function prepare() {
do_check_eq(++step, 1);
gCaptivePortalDetector.finishPreparation(kInterfaceName);
},
complete: function complete(success) {
do_check_eq(++step, 2);
do_check_true(success);
do_check_eq(attempt, 1);
- gServer.stop(function(){dump('server stop\n'); do_test_finished(); });
+ gServer.stop(function() {dump('server stop\n'); do_test_finished(); });
}
};
gCaptivePortalDetector.checkCaptivePortal(kInterfaceName, callback);
}
function run_test() {
run_captivedetect_test(xhr_handler, fakeUIResponse, test_portal_not_found);
--- a/toolkit/components/contentprefs/nsContentPrefService.js
+++ b/toolkit/components/contentprefs/nsContentPrefService.js
@@ -223,17 +223,17 @@ ContentPrefService.prototype = {
Cr.NS_ERROR_ILLEGAL_VALUE);
var group = this._parseGroupParam(aGroup);
if (aContext && aContext.usePrivateBrowsing) {
if (this._privModeStorage.has(group, aName)) {
let value = this._privModeStorage.get(group, aName);
if (aCallback) {
- this._scheduleCallback(function(){aCallback.onResult(value);});
+ this._scheduleCallback(function() {aCallback.onResult(value);});
return undefined;
}
return value;
}
// if we don't have a pref specific to this private mode browsing
// session, to try to get one from normal mode
}
@@ -592,17 +592,17 @@ ContentPrefService.prototype = {
tm.mainThread.dispatch(func, Ci.nsIThread.DISPATCH_NORMAL);
},
_selectPref: function ContentPrefService__selectPref(aGroup, aSetting, aCallback) {
let value = undefined;
if (this._cache.has(aGroup, aSetting)) {
value = this._cache.get(aGroup, aSetting);
if (aCallback) {
- this._scheduleCallback(function(){aCallback.onResult(value);});
+ this._scheduleCallback(function() {aCallback.onResult(value);});
return undefined;
}
return value;
}
try {
this._stmtSelectPref.params.group = aGroup;
this._stmtSelectPref.params.setting = aSetting;
@@ -642,17 +642,17 @@ ContentPrefService.prototype = {
return this.__stmtSelectGlobalPref;
},
_selectGlobalPref: function ContentPrefService__selectGlobalPref(aName, aCallback) {
let value = undefined;
if (this._cache.has(null, aName)) {
value = this._cache.get(null, aName);
if (aCallback) {
- this._scheduleCallback(function(){aCallback.onResult(value);});
+ this._scheduleCallback(function() {aCallback.onResult(value);});
return undefined;
}
return value;
}
try {
this._stmtSelectGlobalPref.params.name = aName;
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -2701,17 +2701,17 @@ function run_variadic_tests(library) {
do_check_throws(function() {
ctypes.FunctionType(ctypes.winapi_abi, ctypes.bool,
[ctypes.bool, "..."]);
}, Error);
}
do_check_throws(function() {
// No variadic closure callbacks allowed.
- sum_va_type(function(){});
+ sum_va_type(function() {});
}, Error);
let count_true_va = library.declare("test_sum_va_cdecl", ctypes.default_abi, ctypes.uint8_t,
ctypes.uint8_t, "...");
do_check_eq(count_true_va(8,
ctypes.bool(false),
ctypes.bool(false),
ctypes.bool(false),
--- a/toolkit/components/exthelper/extApplication.js
+++ b/toolkit/components/exthelper/extApplication.js
@@ -100,17 +100,17 @@ Events.prototype = {
}
this._listeners = this._listeners.filter(hasFilter);
},
dispatch: function evts_dispatch(aEvent, aEventItem) {
var eventItem = new EventItem(aEvent, aEventItem);
- this._listeners.forEach(function(key){
+ this._listeners.forEach(function(key) {
if (key.event == aEvent) {
key.listener.handleEvent ?
key.listener.handleEvent(eventItem) :
key.listener(eventItem);
}
});
return !eventItem._cancel;
--- a/toolkit/components/feeds/test/head.js
+++ b/toolkit/components/feeds/test/head.js
@@ -65,16 +65,16 @@ function iterateDir(dir, recurse, callba
iterateDir(entry, recurse, callback);
}
} else {
callback(entry);
}
}
}
-function isIID(a, iid){
+function isIID(a, iid) {
try {
a.QueryInterface(iid);
return true;
} catch(e) { }
return false;
}
--- a/toolkit/components/microformats/microformat-shiv.js
+++ b/toolkit/components/microformats/microformat-shiv.js
@@ -38,17 +38,17 @@ var Microformats; // jshint ignore:line
// create objects incase the v1 map modules don't load
modules.maps = (modules.maps)? modules.maps : {};
modules.rels = (modules.rels)? modules.rels : {};
modules.Parser.prototype = {
- init: function(){
+ init: function() {
this.rootNode = null;
this.document = null;
this.options = {
'baseUrl': '',
'filters': [],
'textFormat': 'whitespacetrimmed',
'dateFormat': 'auto', // html5 for testing
'overlappingVersions': false,
@@ -73,51 +73,51 @@ var Microformats; // jshint ignore:line
rels;
this.init();
options = (options)? options : {};
this.mergeOptions(options);
this.getDOMContext( options );
// if we do not have any context create error
- if(!this.rootNode || !this.document){
+ if(!this.rootNode || !this.document) {
this.errors.push(this.noContentErr);
}else{
// only parse h-* microformats if we need to
// this is added to speed up parsing
- if(this.hasMicroformats(this.rootNode, options)){
+ if(this.hasMicroformats(this.rootNode, options)) {
this.prepareDOM( options );
- if(this.options.filters.length > 0){
+ if(this.options.filters.length > 0) {
// parse flat list of items
var newRootNode = this.findFilterNodes(this.rootNode, this.options.filters);
data = this.walkRoot(newRootNode);
}else{
// parse whole document from root
data = this.walkRoot(this.rootNode);
}
out.items = data;
// don't clear-up DOM if it was cloned
- if(modules.domUtils.canCloneDocument(this.document) === false){
+ if(modules.domUtils.canCloneDocument(this.document) === false) {
this.clearUpDom(this.rootNode);
}
}
// find any rels
- if(this.findRels){
+ if(this.findRels) {
rels = this.findRels(this.rootNode);
out.rels = rels.rels;
out['rel-urls'] = rels['rel-urls'];
}
}
- if(this.errors.length > 0){
+ if(this.errors.length > 0) {
return this.formatError();
}
return out;
},
/**
* parse to get parent microformat of passed node
@@ -125,17 +125,17 @@ var Microformats; // jshint ignore:line
* @param {DOM Node} node
* @param {Object} options
* @return {Object}
*/
getParent: function(node, options) {
this.init();
options = (options)? options : {};
- if(node){
+ if(node) {
return this.getParentTreeWalk(node, options);
}
this.errors.push(this.noContentErr);
return this.formatError();
},
/**
@@ -151,40 +151,40 @@ var Microformats; // jshint ignore:line
x,
i;
this.init();
options = (options)? options : {};
this.getDOMContext( options );
// if we do not have any context create error
- if(!this.rootNode || !this.document){
+ if(!this.rootNode || !this.document) {
return {'errors': [this.noContentErr]};
}
items = this.findRootNodes( this.rootNode, true );
i = items.length;
while(i--) {
classItems = modules.domUtils.getAttributeList(items[i], 'class');
x = classItems.length;
while(x--) {
// find v2 names
- if(modules.utils.startWith( classItems[x], 'h-' )){
+ if(modules.utils.startWith( classItems[x], 'h-' )) {
this.appendCount(classItems[x], 1, out);
}
// find v1 names
for(var key in modules.maps) {
// dont double count if v1 and v2 roots are present
if(modules.maps[key].root === classItems[x] && classItems.indexOf(key) === -1) {
this.appendCount(key, 1, out);
}
}
}
}
var relCount = this.countRels( this.rootNode );
- if(relCount > 0){
+ if(relCount > 0) {
out.rels = relCount;
}
return out;
},
/**
@@ -193,29 +193,29 @@ var Microformats; // jshint ignore:line
* @param {DOM Node} node
* @param {Objecte} options
* @return {Boolean}
*/
isMicroformat: function( node, options ) {
var classes,
i;
- if(!node){
+ if(!node) {
return false;
}
// if documemt gets topmost node
node = modules.domUtils.getTopMostNode( node );
// look for h-* microformats
classes = this.getUfClassNames(node);
- if(options && options.filters && modules.utils.isArray(options.filters)){
+ if(options && options.filters && modules.utils.isArray(options.filters)) {
i = options.filters.length;
while(i--) {
- if(classes.root.indexOf(options.filters[i]) > -1){
+ if(classes.root.indexOf(options.filters[i]) > -1) {
return true;
}
}
return false;
}
return (classes.root.length > 0);
},
@@ -226,46 +226,46 @@ var Microformats; // jshint ignore:line
* @param {DOM Node} node
* @param {Objecte} options
* @return {Boolean}
*/
hasMicroformats: function( node, options ) {
var items,
i;
- if(!node){
+ if(!node) {
return false;
}
// if browser based documemt get topmost node
node = modules.domUtils.getTopMostNode( node );
// returns all microformat roots
items = this.findRootNodes( node, true );
- if(options && options.filters && modules.utils.isArray(options.filters)){
+ if(options && options.filters && modules.utils.isArray(options.filters)) {
i = items.length;
while(i--) {
- if( this.isMicroformat( items[i], options ) ){
+ if( this.isMicroformat( items[i], options ) ) {
return true;
}
}
return false;
}
return (items.length > 0);
},
/**
* add a new v1 mapping object to parser
*
* @param {Array} maps
*/
- add: function( maps ){
- maps.forEach(function(map){
- if(map && map.root && map.name && map.properties){
+ add: function( maps ) {
+ maps.forEach(function(map) {
+ if(map && map.root && map.name && map.properties) {
modules.maps[map.name] = JSON.parse(JSON.stringify(map));
}
});
},
/**
* internal parse to get parent microformats by walking up the tree
@@ -275,17 +275,17 @@ var Microformats; // jshint ignore:line
* @param {Int} recursive
* @return {Object}
*/
getParentTreeWalk: function (node, options, recursive) {
options = (options)? options : {};
// recursive calls
if (recursive === undefined) {
- if (node.parentNode && node.nodeName !== 'HTML'){
+ if (node.parentNode && node.nodeName !== 'HTML') {
return this.getParentTreeWalk(node.parentNode, options, true);
}
return this.formatEmpty();
}
if (node !== null && node !== undefined && node.parentNode) {
if (this.isMicroformat( node, options )) {
// if we have a match return microformat
options.node = node;
@@ -298,30 +298,30 @@ var Microformats; // jshint ignore:line
/**
* configures what are the base DOM objects for parsing
*
* @param {Object} options
*/
- getDOMContext: function( options ){
+ getDOMContext: function( options ) {
var nodes = modules.domUtils.getDOMContext( options );
this.rootNode = nodes.rootNode;
this.document = nodes.document;
},
/**
* prepares DOM before the parse begins
*
* @param {Object} options
* @return {Boolean}
*/
- prepareDOM: function( options ){
+ prepareDOM: function( options ) {
var baseTag,
href;
// use current document to define baseUrl, try/catch needed for IE10+ error
try {
if (!options.baseUrl && this.document && this.document.location) {
this.options.baseUrl = this.document.location.href;
}
@@ -329,100 +329,100 @@ var Microformats; // jshint ignore:line
// there is no alt action
}
// find base tag to set baseUrl
baseTag = modules.domUtils.querySelector(this.document,'base');
if(baseTag) {
href = modules.domUtils.getAttribute(baseTag, 'href');
- if(href){
+ if(href) {
this.options.baseUrl = href;
}
}
// get path to rootNode
// then clone document
// then reset the rootNode to its cloned version in a new document
var path,
newDocument,
newRootNode;
path = modules.domUtils.getNodePath(this.rootNode);
newDocument = modules.domUtils.cloneDocument(this.document);
newRootNode = modules.domUtils.getNodeByPath(newDocument, path);
// check results as early IE fails
- if(newDocument && newRootNode){
+ if(newDocument && newRootNode) {
this.document = newDocument;
this.rootNode = newRootNode;
}
// add includes
- if(this.addIncludes){
+ if(this.addIncludes) {
this.addIncludes( this.document );
}
return (this.rootNode && this.document);
},
/**
* returns an empty structure with errors
*
* @return {Object}
*/
- formatError: function(){
+ formatError: function() {
var out = this.formatEmpty();
out.errors = this.errors;
return out;
},
/**
* returns an empty structure
*
* @return {Object}
*/
- formatEmpty: function(){
+ formatEmpty: function() {
return {
'items': [],
'rels': {},
'rel-urls': {}
};
},
// find microformats of a given type and return node structures
findFilterNodes: function(rootNode, filters) {
- if(modules.utils.isString(filters)){
+ if(modules.utils.isString(filters)) {
filters = [filters];
}
var newRootNode = modules.domUtils.createNode('div'),
items = this.findRootNodes(rootNode, true),
i = 0,
x = 0,
y = 0;
// add v1 names
y = filters.length;
while (y--) {
- if(this.getMapping(filters[y])){
+ if(this.getMapping(filters[y])) {
var v1Name = this.getMapping(filters[y]).root;
filters.push(v1Name);
}
}
- if(items){
+ if(items) {
i = items.length;
while(x < i) {
// append matching nodes into newRootNode
y = filters.length;
while (y--) {
- if(modules.domUtils.hasAttributeValue(items[x], 'class', filters[y])){
+ if(modules.domUtils.hasAttributeValue(items[x], 'class', filters[y])) {
var clone = modules.domUtils.clone(items[x]);
modules.domUtils.appendChild(newRootNode, clone);
break;
}
}
x++;
}
}
@@ -433,18 +433,18 @@ var Microformats; // jshint ignore:line
/**
* appends data to output object for count
*
* @param {string} name
* @param {Int} count
* @param {Object}
*/
- appendCount: function(name, count, out){
- if(out[name]){
+ appendCount: function(name, count, out) {
+ if(out[name]) {
out[name] = out[name] + count;
}else{
out[name] = count;
}
},
/**
@@ -533,40 +533,40 @@ var Microformats; // jshint ignore:line
/**
* starts the tree walk to find microformats
*
* @param {DOM Node} node
* @return {Array}
*/
- walkRoot: function(node){
+ walkRoot: function(node) {
var context = this,
children = [],
child,
classes,
items = [],
out = [];
classes = this.getUfClassNames(node);
// if it is a root microformat node
- if(classes && classes.root.length > 0){
+ if(classes && classes.root.length > 0) {
items = this.walkTree(node);
- if(items.length > 0){
+ if(items.length > 0) {
out = out.concat(items);
}
}else{
// check if there are children and one of the children has a root microformat
children = modules.domUtils.getChildren( node );
- if(children && children.length > 0 && this.findRootNodes(node, true).length > -1){
+ if(children && children.length > 0 && this.findRootNodes(node, true).length > -1) {
for (var i = 0; i < children.length; i++) {
child = children[i];
items = context.walkRoot(child);
- if(items.length > 0){
+ if(items.length > 0) {
out = out.concat(items);
}
}
}
}
return out;
},
@@ -580,24 +580,24 @@ var Microformats; // jshint ignore:line
walkTree: function(node) {
var classes,
out = [],
obj,
itemRootID;
// loop roots found on one element
classes = this.getUfClassNames(node);
- if(classes && classes.root.length && classes.root.length > 0){
+ if(classes && classes.root.length && classes.root.length > 0) {
this.rootID++;
itemRootID = this.rootID;
obj = this.createUfObject(classes.root, classes.typeVersion);
this.walkChildren(node, obj, classes.root, itemRootID, classes);
- if(this.impliedRules){
+ if(this.impliedRules) {
this.impliedRules(node, obj, classes);
}
out.push( this.cleanUfObject(obj) );
}
return out;
},
@@ -644,18 +644,18 @@ var Microformats; // jshint ignore:line
classes.typeVersion,
modules.text.parse(this.document, child, context.options.textFormat)
);
// add the microformat as an array of properties
propertyName = context.removePropPrefix(classes.properties[0][0]);
// modifies value with "implied value rule"
- if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1){
- if(context.impliedValueRule){
+ if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1) {
+ if(context.impliedValueRule) {
out = context.impliedValueRule(out, parentClasses.properties[0][0], classes.properties[0][0], value);
}
}
if(out.properties[propertyName]) {
out.properties[propertyName].push(rootItem);
} else {
out.properties[propertyName] = [rootItem];
@@ -668,17 +668,17 @@ var Microformats; // jshint ignore:line
x = 0;
i = rootItem.type.length;
itemRootID = context.rootID;
while(x < i) {
context.walkChildren(child, rootItem, rootItem.type, itemRootID, classes);
x++;
}
- if(this.impliedRules){
+ if(this.impliedRules) {
context.impliedRules(child, rootItem, classes);
}
this.cleanUfObject(rootItem);
}
// a property which is NOT a microformat and has not been used for a given root element
if(classes.root.length === 0 && classes.properties.length > 0) {
@@ -687,26 +687,26 @@ var Microformats; // jshint ignore:line
i = classes.properties.length;
while(x < i) {
value = context.getValue(child, classes.properties[x][0], out);
propertyName = context.removePropPrefix(classes.properties[x][0]);
propertyVersion = classes.properties[x][1];
// modifies value with "implied value rule"
- if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1){
- if(context.impliedValueRule){
+ if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1) {
+ if(context.impliedValueRule) {
out = context.impliedValueRule(out, parentClasses.properties[0][0], classes.properties[x][0], value);
}
}
// if we have not added this value into a property with the same name already
if(!context.hasRootID(child, rootID, propertyName)) {
// check the root and property is the same version or if overlapping versions are allowed
- if( context.isAllowedPropertyVersion( out.typeVersion, propertyVersion ) ){
+ if( context.isAllowedPropertyVersion( out.typeVersion, propertyVersion ) ) {
// add the property as an array of properties
if(out.properties[propertyName]) {
out.properties[propertyName].push(value);
} else {
out.properties[propertyName] = [value];
}
// add rootid to node so we can track its use
context.appendRootID(child, rootID, propertyName);
@@ -730,34 +730,34 @@ var Microformats; // jshint ignore:line
// create object with type, property and value
rootItem = context.createUfObject(
classes.root,
classes.typeVersion,
modules.text.parse(this.document, child, context.options.textFormat)
);
// add the microformat as an array of properties
- if(!out.children){
+ if(!out.children) {
out.children = [];
}
if(!context.hasRootID(child, rootID, 'child-root')) {
out.children.push( rootItem );
context.appendRootID(child, rootID, 'child-root');
context.rootID++;
}
x = 0;
i = rootItem.type.length;
itemRootID = context.rootID;
while(x < i) {
context.walkChildren(child, rootItem, rootItem.type, itemRootID, classes);
x++;
}
- if(this.impliedRules){
+ if(this.impliedRules) {
context.impliedRules(child, rootItem, classes);
}
context.cleanUfObject( rootItem );
}
@@ -970,19 +970,19 @@ var Microformats; // jshint ignore:line
/**
* appends a new rootid to a given node
*
* @param {DOM Node} node
* @param {String} id
* @param {String} propertyName
*/
appendRootID: function(node, id, propertyName) {
- if(this.hasRootID(node, id, propertyName) === false){
+ if(this.hasRootID(node, id, propertyName) === false) {
var rootids = [];
- if(modules.domUtils.hasAttribute(node,'rootids')){
+ if(modules.domUtils.hasAttribute(node,'rootids')) {
rootids = modules.domUtils.getAttributeList(node,'rootids');
}
rootids.push('id' + id + '-' + propertyName);
modules.domUtils.setAttribute(node, 'rootids', rootids.join(' '));
}
},
@@ -991,17 +991,17 @@ var Microformats; // jshint ignore:line
*
* @param {DOM Node} node
* @param {String} id
* @param {String} propertyName
* @return {Boolean}
*/
hasRootID: function(node, id, propertyName) {
var rootids = [];
- if(!modules.domUtils.hasAttribute(node,'rootids')){
+ if(!modules.domUtils.hasAttribute(node,'rootids')) {
return false;
}
rootids = modules.domUtils.getAttributeList(node, 'rootids');
return (rootids.indexOf('id' + id + '-' + propertyName) > -1);
},
@@ -1088,19 +1088,19 @@ var Microformats; // jshint ignore:line
/**
* finds out whether a node has h-* class v1 and v2
*
* @param {DOM Node} node
* @return {Boolean}
*/
- hasHClass: function(node){
+ hasHClass: function(node) {
var classes = this.getUfClassNames(node);
- if(classes.root && classes.root.length > 0){
+ if(classes.root && classes.root.length > 0) {
return true;
}
return false;
},
/**
* get both the root and property class names from a node
@@ -1126,31 +1126,31 @@ var Microformats; // jshint ignore:line
map,
prop,
propName,
v2Name,
impiedRel,
ufName;
// don't get classes from excluded list of tags
- if(modules.domUtils.hasTagName(node, this.excludeTags) === false){
+ if(modules.domUtils.hasTagName(node, this.excludeTags) === false) {
// find classes for node
classNames = modules.domUtils.getAttribute(node, 'class');
if(classNames) {
items = classNames.split(' ');
x = 0;
i = items.length;
while(x < i) {
item = modules.utils.trim(items[x]);
// test for root prefix - v2
if(modules.utils.startWith(item, context.rootPrefix)) {
- if(out.root.indexOf(item) === -1){
+ if(out.root.indexOf(item) === -1) {
out.root.push(item);
}
out.typeVersion = 'v2';
}
// test for property prefix - v2
z = context.propertyPrefixes.length;
while(z--) {
@@ -1165,27 +1165,27 @@ var Microformats; // jshint ignore:line
// only add a root once
if(modules.maps[key].root === item && out.root.indexOf(key) === -1) {
// if root map has subTree set to true
// test to see if we should create a property or root
if(modules.maps[key].subTree) {
out.properties.push(['p-' + modules.maps[key].root, 'v1']);
} else {
out.root.push(key);
- if(!out.typeVersion){
+ if(!out.typeVersion) {
out.typeVersion = 'v1';
}
}
}
}
}
// test for mapped property classnames v1
- if(ufNameArr){
+ if(ufNameArr) {
for (var a = 0; a < ufNameArr.length; a++) {
ufName = ufNameArr[a];
// get mapped property v1 microformat
map = context.getMapping(ufName);
if(map) {
for(key in map.properties) {
if (map.properties.hasOwnProperty(key)) {
@@ -1228,17 +1228,17 @@ var Microformats; // jshint ignore:line
x++;
}
}
}
// finds any alt rel=* mappings for a given node/microformat
- if(ufNameArr && this.findRelImpied){
+ if(ufNameArr && this.findRelImpied) {
for (var b = 0; b < ufNameArr.length; b++) {
ufName = ufNameArr[b];
impiedRel = this.findRelImpied(node, ufName);
if(impiedRel && out.properties.indexOf(impiedRel) === -1) {
out.properties.push([impiedRel, 'v1']);
}
}
}
@@ -1290,18 +1290,18 @@ var Microformats; // jshint ignore:line
/**
* whether a property is the right microformats version for its root type
*
* @param {String} typeVersion
* @param {String} propertyVersion
* @return {Boolean}
*/
- isAllowedPropertyVersion: function(typeVersion, propertyVersion){
- if(this.options.overlappingVersions === true){
+ isAllowedPropertyVersion: function(typeVersion, propertyVersion) {
+ if(this.options.overlappingVersions === true) {
return true;
}
return (typeVersion === propertyVersion);
},
/**
* creates a blank microformats object
@@ -1371,33 +1371,33 @@ var Microformats; // jshint ignore:line
/**
* expands all relative URLs to absolute ones where it can
*
* @param {DOM Node} node
* @param {String} attrName
* @param {String} baseUrl
*/
- expandURLs: function(node, attrName, baseUrl){
+ expandURLs: function(node, attrName, baseUrl) {
var i,
nodes,
attr;
nodes = modules.domUtils.getNodesByAttribute(node, attrName);
i = nodes.length;
while (i--) {
try{
// the url parser can blow up if the format is not right
attr = modules.domUtils.getAttribute(nodes[i], attrName);
if(attr && attr !== '' && baseUrl !== '' && attr.indexOf('://') === -1) {
//attr = urlParser.resolve(baseUrl, attr);
attr = modules.url.resolve(attr, baseUrl);
modules.domUtils.setAttribute(nodes[i], attrName, attr);
}
- }catch(err){
+ }catch(err) {
// do nothing - convert only the urls we can, leave the rest as they are
}
}
},
/**
@@ -1415,80 +1415,80 @@ var Microformats; // jshint ignore:line
},
/**
* removes all rootid attributes
*
* @param {DOM Node} rootNode
*/
- removeRootIds: function(rootNode){
+ removeRootIds: function(rootNode) {
var arr,
i;
arr = modules.domUtils.getNodesByAttribute(rootNode, 'rootids');
i = arr.length;
while(i--) {
modules.domUtils.removeAttribute(arr[i],'rootids');
}
},
/**
* removes all changes made to the DOM
*
* @param {DOM Node} rootNode
*/
- clearUpDom: function(rootNode){
- if(this.removeIncludes){
+ clearUpDom: function(rootNode) {
+ if(this.removeIncludes) {
this.removeIncludes(rootNode);
}
this.removeRootIds(rootNode);
}
};
modules.Parser.prototype.constructor = modules.Parser;
// check parser module is loaded
- if(modules.Parser){
+ if(modules.Parser) {
/**
* applies "implied rules" microformat output structure i.e. feed-title, name, photo, url and date
*
* @param {DOM Node} node
* @param {Object} uf (microformat output structure)
* @param {Object} parentClasses (classes structure)
* @param {Boolean} impliedPropertiesByVersion
* @return {Object}
*/
modules.Parser.prototype.impliedRules = function(node, uf, parentClasses) {
var typeVersion = (uf.typeVersion)? uf.typeVersion: 'v2';
// TEMP: override to allow v1 implied properties while spec changes
- if(this.options.impliedPropertiesByVersion === false){
+ if(this.options.impliedPropertiesByVersion === false) {
typeVersion = 'v2';
}
if(node && uf && uf.properties) {
uf = this.impliedBackwardComp( node, uf, parentClasses );
- if(typeVersion === 'v2'){
+ if(typeVersion === 'v2') {
uf = this.impliedhFeedTitle( uf );
uf = this.impliedName( node, uf );
uf = this.impliedPhoto( node, uf );
uf = this.impliedUrl( node, uf );
}
uf = this.impliedValue( node, uf, parentClasses );
uf = this.impliedDate( uf );
// TEMP: flagged while spec changes are put forward
- if(this.options.parseLatLonGeo === true){
+ if(this.options.parseLatLonGeo === true) {
uf = this.impliedGeo( uf );
}
}
return uf;
};
@@ -1521,17 +1521,17 @@ var Microformats; // jshint ignore:line
value = this.getImpliedProperty(node, ['img', 'area', 'abbr'], this.getNameAttr);
var textFormat = this.options.textFormat;
// if no value for tags/properties use text
if(!value) {
name = [modules.text.parse(this.document, node, textFormat)];
}else{
name = [modules.text.parseText(this.document, value, textFormat)];
}
- if(name && name[0] !== ''){
+ if(name && name[0] !== '') {
uf.properties.name = name;
}
}
return uf;
};
@@ -1632,25 +1632,25 @@ var Microformats; // jshint ignore:line
// i.e. img.h-card
var value = getAttrFunction(node),
descendant,
child;
if(!value) {
// i.e. .h-card>img:only-of-type:not(.h-card)
descendant = modules.domUtils.getSingleDescendantOfType( node, tagList);
- if(descendant && this.hasHClass(descendant) === false){
+ if(descendant && this.hasHClass(descendant) === false) {
value = getAttrFunction(descendant);
}
- if(node.children.length > 0 ){
+ if(node.children.length > 0 ) {
// i.e. .h-card>:only-child>img:only-of-type:not(.h-card)
child = modules.domUtils.getSingleDescendant(node);
- if(child && this.hasHClass(child) === false){
+ if(child && this.hasHClass(child) === false) {
descendant = modules.domUtils.getSingleDescendantOfType(child, tagList);
- if(descendant && this.hasHClass(descendant) === false){
+ if(descendant && this.hasHClass(descendant) === false) {
value = getAttrFunction(descendant);
}
}
}
}
return value;
};
@@ -1689,17 +1689,17 @@ var Microformats; // jshint ignore:line
/**
* get an implied photo value from a node
*
* @param {DOM Node} node
* @return {String || null}
*/
modules.Parser.prototype.getURLAttr = function(node) {
var value = null;
- if(modules.domUtils.hasAttributeValue(node, 'class', 'include') === false){
+ if(modules.domUtils.hasAttributeValue(node, 'class', 'include') === false) {
value = modules.domUtils.getAttrValFromTagList(node, ['a'], 'href');
if(!value) {
value = modules.domUtils.getAttrValFromTagList(node, ['area'], 'href');
}
}
return value;
@@ -1708,34 +1708,34 @@ var Microformats; // jshint ignore:line
/**
*
*
* @param {DOM Node} node
* @param {Object} uf
* @return {Object}
*/
- modules.Parser.prototype.impliedValue = function(node, uf, parentClasses){
+ modules.Parser.prototype.impliedValue = function(node, uf, parentClasses) {
// intersection of implied name and implied value rules
if(uf.properties.name) {
- if(uf.value && parentClasses.root.length > 0 && parentClasses.properties.length === 1){
+ if(uf.value && parentClasses.root.length > 0 && parentClasses.properties.length === 1) {
uf = this.getAltValue(uf, parentClasses.properties[0][0], 'p-name', uf.properties.name[0]);
}
}
// intersection of implied URL and implied value rules
if(uf.properties.url) {
- if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1){
+ if(parentClasses && parentClasses.root.length === 1 && parentClasses.properties.length === 1) {
uf = this.getAltValue(uf, parentClasses.properties[0][0], 'u-url', uf.properties.url[0]);
}
}
// apply alt value
- if(uf.altValue !== null){
+ if(uf.altValue !== null) {
uf.value = uf.altValue.value;
}
delete uf.altValue;
return uf;
};
@@ -1744,102 +1744,102 @@ var Microformats; // jshint ignore:line
* get alt value based on rules about parent property prefix
*
* @param {Object} uf
* @param {String} parentPropertyName
* @param {String} propertyName
* @param {String} value
* @return {Object}
*/
- modules.Parser.prototype.getAltValue = function(uf, parentPropertyName, propertyName, value){
- if(uf.value && !uf.altValue){
+ modules.Parser.prototype.getAltValue = function(uf, parentPropertyName, propertyName, value) {
+ if(uf.value && !uf.altValue) {
// first p-name of the h-* child
- if(modules.utils.startWith(parentPropertyName,'p-') && propertyName === 'p-name'){
+ if(modules.utils.startWith(parentPropertyName,'p-') && propertyName === 'p-name') {
uf.altValue = {name: propertyName, value: value};
}
// if it's an e-* property element
- if(modules.utils.startWith(parentPropertyName,'e-') && modules.utils.startWith(propertyName,'e-')){
+ if(modules.utils.startWith(parentPropertyName,'e-') && modules.utils.startWith(propertyName,'e-')) {
uf.altValue = {name: propertyName, value: value};
}
// if it's an u-* property element
- if(modules.utils.startWith(parentPropertyName,'u-') && propertyName === 'u-url'){
+ if(modules.utils.startWith(parentPropertyName,'u-') && propertyName === 'u-url') {
uf.altValue = {name: propertyName, value: value};
}
}
return uf;
};
/**
* if a h-feed does not have a title use the title tag of a page
*
* @param {Object} uf
* @return {Object}
*/
- modules.Parser.prototype.impliedhFeedTitle = function( uf ){
- if(uf.type && uf.type.indexOf('h-feed') > -1){
+ modules.Parser.prototype.impliedhFeedTitle = function( uf ) {
+ if(uf.type && uf.type.indexOf('h-feed') > -1) {
// has no name property
- if(uf.properties.name === undefined || uf.properties.name[0] === '' ){
+ if(uf.properties.name === undefined || uf.properties.name[0] === '' ) {
// use the text from the title tag
var title = modules.domUtils.querySelector(this.document, 'title');
- if(title){
+ if(title) {
uf.properties.name = [modules.domUtils.textContent(title)];
}
}
}
return uf;
};
/**
* implied Geo from pattern <abbr class="p-geo" title="37.386013;-122.082932">
*
* @param {Object} uf
* @return {Object}
*/
- modules.Parser.prototype.impliedGeo = function( uf ){
+ modules.Parser.prototype.impliedGeo = function( uf ) {
var geoPair,
parts,
longitude,
latitude,
valid = true;
- if(uf.type && uf.type.indexOf('h-geo') > -1){
+ if(uf.type && uf.type.indexOf('h-geo') > -1) {
// has no latitude or longitude property
- if(uf.properties.latitude === undefined || uf.properties.longitude === undefined ){
+ if(uf.properties.latitude === undefined || uf.properties.longitude === undefined ) {
geoPair = (uf.properties.name)? uf.properties.name[0] : null;
geoPair = (!geoPair && uf.properties.value)? uf.properties.value : geoPair;
- if(geoPair){
+ if(geoPair) {
// allow for the use of a ';' as in microformats and also ',' as in Geo URL
geoPair = geoPair.replace(';',',');
// has sep char
- if(geoPair.indexOf(',') > -1 ){
+ if(geoPair.indexOf(',') > -1 ) {
parts = geoPair.split(',');
// only correct if we have two or more parts
- if(parts.length > 1){
+ if(parts.length > 1) {
// latitude no value outside the range -90 or 90
latitude = parseFloat( parts[0] );
- if(modules.utils.isNumber(latitude) && latitude > 90 || latitude < -90){
+ if(modules.utils.isNumber(latitude) && latitude > 90 || latitude < -90) {
valid = false;
}
// longitude no value outside the range -180 to 180
longitude = parseFloat( parts[1] );
- if(modules.utils.isNumber(longitude) && longitude > 180 || longitude < -180){
+ if(modules.utils.isNumber(longitude) && longitude > 180 || longitude < -180) {
valid = false;
}
- if(valid){
+ if(valid) {
uf.properties.latitude = [latitude];
uf.properties.longitude = [longitude];
}
}
}
}
}
@@ -1849,41 +1849,41 @@ var Microformats; // jshint ignore:line
/**
* if a backwards compat built structure has no properties add name through this.impliedName
*
* @param {Object} uf
* @return {Object}
*/
- modules.Parser.prototype.impliedBackwardComp = function(node, uf, parentClasses){
+ modules.Parser.prototype.impliedBackwardComp = function(node, uf, parentClasses) {
// look for pattern in parent classes like "p-geo h-geo"
// these are structures built from backwards compat parsing of geo
if(parentClasses.root.length === 1 && parentClasses.properties.length === 1) {
if(parentClasses.root[0].replace('h-','') === this.removePropPrefix(parentClasses.properties[0][0])) {
// if microformat has no properties apply the impliedName rule to get value from containing node
// this will get value from html such as <abbr class="geo" title="30.267991;-97.739568">Brighton</abbr>
- if( modules.utils.hasProperties(uf.properties) === false ){
+ if( modules.utils.hasProperties(uf.properties) === false ) {
uf = this.impliedName( node, uf );
}
}
}
return uf;
};
}
// check parser module is loaded
- if(modules.Parser){
+ if(modules.Parser) {
/**
* appends clones of include Nodes into the DOM structure
*
* @param {DOM node} rootNode
*/
modules.Parser.prototype.addIncludes = function(rootNode) {
@@ -1950,17 +1950,17 @@ var Microformats; // jshint ignore:line
/**
* appends a clone of an include into another Node using Id
*
* @param {DOM node} rootNode
* @param {Stringe} id
*/
- modules.Parser.prototype.apppendInclude = function(node, id){
+ modules.Parser.prototype.apppendInclude = function(node, id) {
var include,
clone;
id = modules.utils.trim(id.replace('#', ''));
include = modules.domUtils.getElementById(this.document, id);
if(include) {
clone = modules.domUtils.clone(include);
this.markIncludeChildren(clone);
@@ -1992,34 +1992,34 @@ var Microformats; // jshint ignore:line
};
/**
* removes all appended include clones from DOM
*
* @param {DOM node} rootNode
*/
- modules.Parser.prototype.removeIncludes = function(rootNode){
+ modules.Parser.prototype.removeIncludes = function(rootNode) {
var arr,
i;
// remove all the items that were added as includes
arr = modules.domUtils.getNodesByAttribute(rootNode, 'data-include');
i = arr.length;
while(i--) {
modules.domUtils.removeChild(rootNode,arr[i]);
}
};
}
// check parser module is loaded
- if(modules.Parser){
+ if(modules.Parser) {
/**
* finds rel=* structures
*
* @param {DOM node} rootNode
* @return {Object}
*/
modules.Parser.prototype.findRels = function(rootNode) {
@@ -2064,38 +2064,38 @@ var Microformats; // jshint ignore:line
if(!out.rels[item]) {
out.rels[item] = [];
}
if(typeof this.options.baseUrl === 'string' && typeof value === 'string') {
var resolved = modules.url.resolve(value, this.options.baseUrl);
// do not add duplicate rels - based on resolved URLs
- if(out.rels[item].indexOf(resolved) === -1){
+ if(out.rels[item].indexOf(resolved) === -1) {
out.rels[item].push( resolved );
}
}
z++;
}
var url = null;
- if(modules.domUtils.hasAttribute(arr[x], 'href')){
+ if(modules.domUtils.hasAttribute(arr[x], 'href')) {
url = modules.domUtils.getAttribute(arr[x], 'href');
- if(url){
+ if(url) {
url = modules.url.resolve(url, this.options.baseUrl );
}
}
// add to rel-urls
var relUrl = this.getRelProperties(arr[x]);
relUrl.rels = items;
// // do not add duplicate rel-urls - based on resolved URLs
- if(url && out['rel-urls'][url] === undefined){
+ if(url && out['rel-urls'][url] === undefined) {
out['rel-urls'][url] = relUrl;
}
}
x++;
}
return out;
@@ -2103,32 +2103,32 @@ var Microformats; // jshint ignore:line
/**
* gets the properties of a rel=*
*
* @param {DOM node} node
* @return {Object}
*/
- modules.Parser.prototype.getRelProperties = function(node){
+ modules.Parser.prototype.getRelProperties = function(node) {
var obj = {};
- if(modules.domUtils.hasAttribute(node, 'media')){
+ if(modules.domUtils.hasAttribute(node, 'media')) {
obj.media = modules.domUtils.getAttribute(node, 'media');
}
- if(modules.domUtils.hasAttribute(node, 'type')){
+ if(modules.domUtils.hasAttribute(node, 'type')) {
obj.type = modules.domUtils.getAttribute(node, 'type');
}
- if(modules.domUtils.hasAttribute(node, 'hreflang')){
+ if(modules.domUtils.hasAttribute(node, 'hreflang')) {
obj.hreflang = modules.domUtils.getAttribute(node, 'hreflang');
}
- if(modules.domUtils.hasAttribute(node, 'title')){
+ if(modules.domUtils.hasAttribute(node, 'title')) {
obj.title = modules.domUtils.getAttribute(node, 'title');
}
- if(modules.utils.trim(this.getPValue(node, false)) !== ''){
+ if(modules.utils.trim(this.getPValue(node, false)) !== '') {
obj.text = this.getPValue(node, false);
}
return obj;
};
/**
@@ -2183,17 +2183,17 @@ var Microformats; // jshint ignore:line
/**
* returns the number of rel=* microformats
*
* @param {DOM node} node
* @return {Int}
*/
modules.Parser.prototype.countRels = function(node) {
- if(node){
+ if(node) {
return modules.domUtils.getNodesByAttribute(node, 'rel').length;
}
return 0;
};
}
@@ -2258,63 +2258,63 @@ var Microformats; // jshint ignore:line
/**
* removes spaces at front and back of text
*
* @param {String} text
* @return {String}
*/
trim: function( text ) {
- if(text && this.isString(text)){
+ if(text && this.isString(text)) {
return (text.trim())? text.trim() : text.replace(/^\s+|\s+$/g, '');
}
return '';
},
/**
* replaces a character in text
*
* @param {String} text
* @param {Int} index
* @param {String} character
* @return {String}
*/
replaceCharAt: function( text, index, character ) {
- if(text && text.length > index){
+ if(text && text.length > index) {
return text.substr(0, index) + character + text.substr(index+character.length);
}
return text;
},
/**
* removes whitespace, tabs and returns from start and end of text
*
* @param {String} text
* @return {String}
*/
- trimWhitespace: function( text ){
- if(text && text.length){
+ trimWhitespace: function( text ) {
+ if(text && text.length) {
var i = text.length,
x = 0;
// turn all whitespace chars at end into spaces
while (i--) {
- if(this.isOnlyWhiteSpace(text[i])){
+ if(this.isOnlyWhiteSpace(text[i])) {
text = this.replaceCharAt( text, i, ' ' );
}else{
break;
}
}
// turn all whitespace chars at start into spaces
i = text.length;
while (x < i) {
- if(this.isOnlyWhiteSpace(text[x])){
+ if(this.isOnlyWhiteSpace(text[x])) {
text = this.replaceCharAt( text, i, ' ' );
}else{
break;
}
x++;
}
}
return this.trim(text);
@@ -2322,28 +2322,28 @@ var Microformats; // jshint ignore:line
/**
* does text only contain whitespace characters
*
* @param {String} text
* @return {Boolean}
*/
- isOnlyWhiteSpace: function( text ){
+ isOnlyWhiteSpace: function( text ) {
return !(/[^\t\n\r ]/.test( text ));
},
/**
* removes whitespace from text (leaves a single space)
*
* @param {String} text
* @return {Sring}
*/
- collapseWhiteSpace: function( text ){
+ collapseWhiteSpace: function( text ) {
return text.replace(/[\t\n\r ]+/g, ' ');
},
/**
* does an object have any of its own properties
*
* @param {Object} obj
@@ -2412,110 +2412,110 @@ var Microformats; // jshint ignore:line
/**
* configures what are the base DOM objects for parsing
*
* @param {Object} options
* @return {DOM Node} node
*/
- getDOMContext: function( options ){
+ getDOMContext: function( options ) {
// if a node is passed
- if(options.node){
+ if(options.node) {
this.rootNode = options.node;
}
// if a html string is passed
- if(options.html){
+ if(options.html) {
//var domParser = new DOMParser();
var domParser = this.getDOMParser();
this.rootNode = domParser.parseFromString( options.html, 'text/html' );
}
// find top level document from rootnode
- if(this.rootNode !== null){
- if(this.rootNode.nodeType === 9){
+ if(this.rootNode !== null) {
+ if(this.rootNode.nodeType === 9) {
this.document = this.rootNode;
this.rootNode = modules.domUtils.querySelector(this.rootNode, 'html');
}else{
// if it's DOM node get parent DOM Document
this.document = modules.domUtils.ownerDocument(this.rootNode);
}
}
// use global document object
- if(!this.rootNode && document){
+ if(!this.rootNode && document) {
this.rootNode = modules.domUtils.querySelector(document, 'html');
this.document = document;
}
- if(this.rootNode && this.document){
+ if(this.rootNode && this.document) {
return {document: this.document, rootNode: this.rootNode};
}
return {document: null, rootNode: null};
},
/**
* gets the first DOM node
*
* @param {Dom Document}
* @return {DOM Node} node
*/
- getTopMostNode: function( node ){
+ getTopMostNode: function( node ) {
//var doc = this.ownerDocument(node);
//if(doc && doc.nodeType && doc.nodeType === 9 && doc.documentElement){
// return doc.documentElement;
//}
return node;
},
/**
* abstracts DOM ownerDocument
*
* @param {DOM Node} node
* @return {Dom Document}
*/
- ownerDocument: function(node){
+ ownerDocument: function(node) {
return node.ownerDocument;
},
/**
* abstracts DOM textContent
*
* @param {DOM Node} node
* @return {String}
*/
- textContent: function(node){
- if(node.textContent){
+ textContent: function(node) {
+ if(node.textContent) {
return node.textContent;
- }else if(node.innerText){
+ }else if(node.innerText) {
return node.innerText;
}
return '';
},
/**
* abstracts DOM innerHTML
*
* @param {DOM Node} node
* @return {String}
*/
- innerHTML: function(node){
+ innerHTML: function(node) {
return node.innerHTML;
},
/**
* abstracts DOM hasAttribute
*
* @param {DOM Node} node
@@ -2554,17 +2554,17 @@ var Microformats; // jshint ignore:line
/**
* abstracts DOM setAttribute
*
* @param {DOM Node} node
* @param {String} attributeName
* @param {String} attributeValue
*/
- setAttribute: function(node, attributeName, attributeValue){
+ setAttribute: function(node, attributeName, attributeValue) {
node.setAttribute(attributeName, attributeValue);
},
/**
* abstracts DOM removeAttribute
*
* @param {DOM Node} node
@@ -2686,78 +2686,78 @@ var Microformats; // jshint ignore:line
/**
* get node if it has no siblings. CSS equivalent is :only-child
*
* @param {DOM Node} rootNode
* @param {Array} tagNames
* @return {DOM Node || null}
*/
- getSingleDescendant: function(node){
+ getSingleDescendant: function(node) {
return this.getDescendant( node, null, false );
},
/**
* get node if it has no siblings of the same type. CSS equivalent is :only-of-type
*
* @param {DOM Node} rootNode
* @param {Array} tagNames
* @return {DOM Node || null}
*/
- getSingleDescendantOfType: function(node, tagNames){
+ getSingleDescendantOfType: function(node, tagNames) {
return this.getDescendant( node, tagNames, true );
},
/**
* get child node limited by presence of siblings - either CSS :only-of-type or :only-child
*
* @param {DOM Node} rootNode
* @param {Array} tagNames
* @return {DOM Node || null}
*/
- getDescendant: function( node, tagNames, onlyOfType ){
+ getDescendant: function( node, tagNames, onlyOfType ) {
var i = node.children.length,
countAll = 0,
countOfType = 0,
child,
out = null;
while(i--) {
child = node.children[i];
if(child.nodeType === 1) {
- if(tagNames){
+ if(tagNames) {
// count just only-of-type
- if(this.hasTagName(child, tagNames)){
+ if(this.hasTagName(child, tagNames)) {
out = child;
countOfType++;
}
}else{
// count all elements
out = child;
countAll++;
}
}
}
- if(onlyOfType === true){
+ if(onlyOfType === true) {
return (countOfType === 1)? out : null;
}
return (countAll === 1)? out : null;
},
/**
* is a node one of a list of tags
*
* @param {DOM Node} rootNode
* @param {Array} tagNames
* @return {Boolean}
*/
- hasTagName: function(node, tagNames){
+ hasTagName: function(node, tagNames) {
var i = tagNames.length;
while(i--) {
if(node.tagName.toLowerCase() === tagNames[i]) {
return true;
}
}
return false;
},
@@ -2765,28 +2765,28 @@ var Microformats; // jshint ignore:line
/**
* abstracts DOM appendChild
*
* @param {DOM Node} node
* @param {DOM Node} childNode
* @return {DOM Node}
*/
- appendChild: function(node, childNode){
+ appendChild: function(node, childNode) {
return node.appendChild(childNode);
},
/**
* abstracts DOM removeChild
*
* @param {DOM Node} childNode
* @return {DOM Node || null}
*/
- removeChild: function(childNode){
+ removeChild: function(childNode) {
if (childNode.parentNode) {
return childNode.parentNode.removeChild(childNode);
}
return null;
},
/**
@@ -2803,31 +2803,31 @@ var Microformats; // jshint ignore:line
/**
* gets the text of a node
*
* @param {DOM Node} node
* @return {String}
*/
- getElementText: function( node ){
- if(node && node.data){
+ getElementText: function( node ) {
+ if(node && node.data) {
return node.data;
}
return '';
},
/**
* gets the attributes of a node - ordered by sequence in html
*
* @param {DOM Node} node
* @return {Array}
*/
- getOrderedAttributes: function( node ){
+ getOrderedAttributes: function( node ) {
var nodeStr = node.outerHTML,
attrs = [];
for (var i = 0; i < node.attributes.length; i++) {
var attr = node.attributes[i];
attr.indexNum = nodeStr.indexOf(attr.name);
attrs.push( attr );
@@ -2838,64 +2838,64 @@ var Microformats; // jshint ignore:line
/**
* decodes html entities in given text
*
* @param {DOM Document} doc
* @param String} text
* @return {String}
*/
- decodeEntities: function( doc, text ){
+ decodeEntities: function( doc, text ) {
//return text;
return doc.createTextNode( text ).nodeValue;
},
/**
* clones a DOM document
*
* @param {DOM Document} document
* @return {DOM Document}
*/
- cloneDocument: function( document ){
+ cloneDocument: function( document ) {
var newNode,
newDocument = null;
- if( this.canCloneDocument( document )){
+ if( this.canCloneDocument( document )) {
newDocument = document.implementation.createHTMLDocument('');
newNode = newDocument.importNode( document.documentElement, true );
newDocument.replaceChild(newNode, newDocument.querySelector('html'));
}
return (newNode && newNode.nodeType && newNode.nodeType === 1)? newDocument : document;
},
/**
* can environment clone a DOM document
*
* @param {DOM Document} document
* @return {Boolean}
*/
- canCloneDocument: function( document ){
+ canCloneDocument: function( document ) {
return (document && document.importNode && document.implementation && document.implementation.createHTMLDocument);
},
/**
* get the child index of a node. Used to create a node path
*
* @param {DOM Node} node
* @return {Int}
*/
getChildIndex: function (node) {
var parent = node.parentNode,
i = -1,
child;
- while (parent && (child = parent.childNodes[++i])){
- if (child === node){
+ while (parent && (child = parent.childNodes[++i])) {
+ if (child === node) {
return i;
}
}
return -1;
},
/**
@@ -2904,18 +2904,18 @@ var Microformats; // jshint ignore:line
* @param {DOM Node} node
* @return {Array}
*/
getNodePath: function (node) {
var parent = node.parentNode,
path = [],
index = this.getChildIndex(node);
- if(parent && (path = this.getNodePath(parent))){
- if(index > -1){
+ if(parent && (path = this.getNodePath(parent))) {
+ if(index > -1) {
path.push(index);
}
}
return path;
},
/**
@@ -2924,70 +2924,70 @@ var Microformats; // jshint ignore:line
* @param {DOM document} document
* @param {Array} path
* @return {DOM Node}
*/
getNodeByPath: function (document, path) {
var node = document.documentElement,
i = 0,
index;
- while ((index = path[++i]) > -1){
+ while ((index = path[++i]) > -1) {
node = node.childNodes[index];
}
return node;
},
/**
* get an array/nodeList of child nodes
*
* @param {DOM node} node
* @return {Array}
*/
- getChildren: function( node ){
+ getChildren: function( node ) {
return node.children;
},
/**
* create a node
*
* @param {String} tagName
* @return {DOM node}
*/
- createNode: function( tagName ){
+ createNode: function( tagName ) {
return this.document.createElement(tagName);
},
/**
* create a node with text content
*
* @param {String} tagName
* @param {String} text
* @return {DOM node}
*/
- createNodeWithText: function( tagName, text ){
+ createNodeWithText: function( tagName, text ) {
var node = this.document.createElement(tagName);
node.innerHTML = text;
return node;
}
};
modules.url = {
/**
* creates DOM objects needed to resolve URLs
*/
- init: function(){
+ init: function() {
//this._domParser = new DOMParser();
this._domParser = modules.domUtils.getDOMParser();
// do not use a head tag it does not work with IE9
this._html = '<base id="base" href=""></base><a id="link" href=""></a>';
this._nodes = this._domParser.parseFromString( this._html, 'text/html' );
this._baseNode = modules.domUtils.getElementById(this._nodes,'base');
this._linkNode = modules.domUtils.getElementById(this._nodes,'link');
},
@@ -2997,41 +2997,41 @@ var Microformats; // jshint ignore:line
* resolves url to absolute version using baseUrl
*
* @param {String} url
* @param {String} baseUrl
* @return {String}
*/
resolve: function(url, baseUrl) {
// use modern URL web API where we can
- if(modules.utils.isString(url) && modules.utils.isString(baseUrl) && url.indexOf('://') === -1){
+ if(modules.utils.isString(url) && modules.utils.isString(baseUrl) && url.indexOf('://') === -1) {
// this try catch is required as IE has an URL object but no constuctor support
// http://glennjones.net/articles/the-problem-with-window-url
try {
var resolved = new URL(url, baseUrl).toString();
// deal with early Webkit not throwing an error - for Safari
- if(resolved === '[object URL]'){
+ if(resolved === '[object URL]') {
resolved = URI.resolve(baseUrl, url);
}
return resolved;
- }catch(e){
+ }catch(e) {
// otherwise fallback to DOM
- if(this._domParser === undefined){
+ if(this._domParser === undefined) {
this.init();
}
// do not use setAttribute it does not work with IE9
this._baseNode.href = baseUrl;
this._linkNode.href = url;
// dont use getAttribute as it returns orginal value not resolved
return this._linkNode.href;
}
}else{
- if(modules.utils.isString(url)){
+ if(modules.utils.isString(url)) {
return url;
}
return '';
}
},
};
@@ -3059,65 +3059,65 @@ var Microformats; // jshint ignore:line
modules.ISODate.prototype = {
/**
* clear all states
*
*/
- clear: function(){
+ clear: function() {
this.clearDate();
this.clearTime();
this.clearTimeZone();
this.setAutoProfileState();
},
/**
* clear date states
*
*/
- clearDate: function(){
+ clearDate: function() {
this.dY = -1;
this.dM = -1;
this.dD = -1;
this.dDDD = -1;
},
/**
* clear time states
*
*/
- clearTime: function(){
+ clearTime: function() {
this.tH = -1;
this.tM = -1;
this.tS = -1;
this.tD = -1;
},
/**
* clear timezone states
*
*/
- clearTimeZone: function(){
+ clearTimeZone: function() {
this.tzH = -1;
this.tzM = -1;
this.tzPN = '+';
this.z = false;
},
/**
* resets the auto profile state
*
*/
- setAutoProfileState: function(){
+ setAutoProfileState: function() {
this.autoProfile = {
sep: 'T',
dsep: '-',
tsep: ':',
tzsep: ':',
tzZulu: 'Z'
};
},
@@ -3135,17 +3135,17 @@ var Microformats; // jshint ignore:line
var parts = [],
tzArray = [],
position = 0,
datePart = '',
timePart = '',
timeZonePart = '';
- if(format){
+ if(format) {
this.format = format;
}
// discover date time separtor for auto profile
// Set to 'T' by default
if(dateString.indexOf('t') > -1) {
@@ -3298,17 +3298,17 @@ var Microformats; // jshint ignore:line
* @param {String} timeString
* @param {String} format
* @return {String}
*/
parseTimeZone: function( timeString, format ) {
this.clearTimeZone();
var parts = [];
- if(timeString.toLowerCase() === 'z'){
+ if(timeString.toLowerCase() === 'z') {
this.z = true;
// set case for z
this.autoProfile.tzZulu = (timeString === 'z')? 'z' : 'Z';
}else{
// discover timezone separtor for auto profile // default is ':'
if(timeString.indexOf(':') === -1) {
this.autoProfile.tzsep = '';
@@ -3337,17 +3337,17 @@ var Microformats; // jshint ignore:line
* returns ISO date/time string in W3C Note, RFC 3339, HTML5, or auto profile
*
* @param {String} format
* @return {String}
*/
toString: function( format ) {
var output = '';
- if(format){
+ if(format) {
this.format = format;
}
this.setFormatSep();
if(this.dY > -1) {
output = this.dY;
if(this.dM > 0 && this.dM < 13) {
output += this.dsep + this.dM;
@@ -3374,44 +3374,44 @@ var Microformats; // jshint ignore:line
* in W3C Note, RFC 3339, HTML5, or auto profile
*
* @param {String} format
* @return {String}
*/
toTimeString: function( format ) {
var out = '';
- if(format){
+ if(format) {
this.format = format;
}
this.setFormatSep();
// time can only be created with a full date
if(this.tH) {
if(this.tH > -1 && this.tH < 25) {
out += this.tH;
- if(this.tM > -1 && this.tM < 61){
+ if(this.tM > -1 && this.tM < 61) {
out += this.tsep + this.tM;
- if(this.tS > -1 && this.tS < 61){
+ if(this.tS > -1 && this.tS < 61) {
out += this.tsep + this.tS;
- if(this.tD > -1){
+ if(this.tD > -1) {
out += '.' + this.tD;
}
}
}
// time zone offset
if(this.z) {
out += this.tzZulu;
} else {
if(this.tzH && this.tzH > -1 && this.tzH < 25) {
out += this.tzPN + this.tzH;
- if(this.tzM > -1 && this.tzM < 61){
+ if(this.tzM > -1 && this.tzM < 61) {
out += this.tzsep + this.tzM;
}
}
}
}
}
return out;
},
@@ -3538,35 +3538,35 @@ var Microformats; // jshint ignore:line
/**
* simple test of whether ISO date string is a duration i.e. PY17M or PW12
*
* @param {String} text
* @return {Boolean}
*/
isDuration: function( text ) {
- if(modules.utils.isString( text )){
+ if(modules.utils.isString( text )) {
text = text.toLowerCase();
- if(modules.utils.startWith(text, 'p') ){
+ if(modules.utils.startWith(text, 'p') ) {
return true;
}
}
return false;
},
/**
* is text a time or timezone
* i.e. HH-MM-SS or z+-HH-MM-SS 08:43 | 15:23:00:0567 | 10:34pm | 10:34 p.m. | +01:00:00 | -02:00 | z15:00 | 0843
*
* @param {String} text
* @return {Boolean}
*/
isTime: function( text ) {
- if(modules.utils.isString(text)){
+ if(modules.utils.isString(text)) {
text = text.toLowerCase();
text = modules.utils.trim( text );
// start with timezone char
if( text.match(':') && ( modules.utils.startWith(text, 'z') || modules.utils.startWith(text, '-') || modules.utils.startWith(text, '+') )) {
return true;
}
// has ante meridiem or post meridiem
if( text.match(/^[0-9]/) &&
@@ -3574,18 +3574,18 @@ var Microformats; // jshint ignore:line
return true;
}
// contains time delimiter but not datetime delimiter
if( text.match(':') && !text.match(/t|\s/) ) {
return true;
}
// if it's a number of 2, 4 or 6 chars
- if(modules.utils.isNumber(text)){
- if(text.length === 2 || text.length === 4 || text.length === 6){
+ if(modules.utils.isNumber(text)) {
+ if(text.length === 2 || text.length === 4 || text.length === 6) {
return true;
}
}
}
return false;
},
@@ -3654,17 +3654,17 @@ var Microformats; // jshint ignore:line
isotime.parseTime(this.parseAmPmTime(time), format);
if(isodate.hasFullDate() && isotime.hasTime()) {
isodate.tH = isotime.tH;
isodate.tM = isotime.tM;
isodate.tS = isotime.tS;
isodate.tD = isotime.tD;
return isodate;
}
- if(isodate.hasFullDate()){
+ if(isodate.hasFullDate()) {
return isodate;
}
return new modules.ISODate();
},
/**
* concatenate an array of date and time text fragments to create an ISODate object
@@ -3682,61 +3682,61 @@ var Microformats; // jshint ignore:line
// if the fragment already contains a full date just return it once
if(arr[0].toUpperCase().match('T')) {
return new modules.ISODate(arr[0], format);
}
for(i = 0; i < arr.length; i++) {
value = arr[i];
// date pattern
- if( value.charAt(4) === '-' && out.hasFullDate() === false ){
+ if( value.charAt(4) === '-' && out.hasFullDate() === false ) {
out.parseDate(value);
}
// time pattern
if( (value.indexOf(':') > -1 || modules.utils.isNumber( this.parseAmPmTime(value) )) && out.hasTime() === false ) {
// split time and timezone
var items = this.splitTimeAndZone(value);
value = items[0];
// parse any use of am/pm
value = this.parseAmPmTime(value);
out.parseTime(value);
// parse any timezone
- if(items.length > 1){
+ if(items.length > 1) {
out.parseTimeZone(items[1], format);
}
}
// timezone pattern
if(value.charAt(0) === '-' || value.charAt(0) === '+' || value.toUpperCase() === 'Z') {
- if( out.hasTimeZone() === false ){
+ if( out.hasTimeZone() === false ) {
out.parseTimeZone(value);
}
}
}
return out;
},
/**
* parses text by splitting it into an array of time and timezone strings
*
* @param {String} text
* @return {Array} Modules.ISODate
*/
- splitTimeAndZone: function ( text ){
+ splitTimeAndZone: function ( text ) {
var out = [text],
chars = ['-','+','z','Z'],
i = chars.length;
while (i--) {
- if(text.indexOf(chars[i]) > -1){
+ if(text.indexOf(chars[i]) > -1) {
out[0] = text.slice( 0, text.indexOf(chars[i]) );
out.push( text.slice( text.indexOf(chars[i]) ) );
break;
}
}
return out;
}
@@ -3761,54 +3761,54 @@ var Microformats; // jshint ignore:line
/**
* parses the text from the DOM Node
*
* @param {DOM Node} node
* @param {String} textFormat
* @return {String}
*/
- parse: function(doc, node, textFormat){
+ parse: function(doc, node, textFormat) {
var out;
this.textFormat = (textFormat)? textFormat : this.textFormat;
- if(this.textFormat === 'normalised'){
+ if(this.textFormat === 'normalised') {
out = this.walkTreeForText( node );
- if(out !== undefined){
+ if(out !== undefined) {
return this.normalise( doc, out );
}
return '';
}
return this.formatText( doc, modules.domUtils.textContent(node), this.textFormat );
},
/**
* parses the text from a html string
*
* @param {DOM Document} doc
* @param {String} text
* @param {String} textFormat
* @return {String}
*/
- parseText: function( doc, text, textFormat ){
+ parseText: function( doc, text, textFormat ) {
var node = modules.domUtils.createNodeWithText( 'div', text );
return this.parse( doc, node, textFormat );
},
/**
* parses the text from a html string - only for whitespace or whitespacetrimmed formats
*
* @param {String} text
* @param {String} textFormat
* @return {String}
*/
- formatText: function( doc, text, textFormat ){
+ formatText: function( doc, text, textFormat ) {
this.textFormat = (textFormat)? textFormat : this.textFormat;
- if(text){
+ if(text) {
var out = '',
regex = /(<([^>]+)>)/ig;
out = text.replace(regex, '');
if(this.textFormat === 'whitespacetrimmed') {
out = modules.utils.trimWhitespace( out );
}
@@ -3820,17 +3820,17 @@ var Microformats; // jshint ignore:line
/**
* normalises whitespace in given text
*
* @param {String} text
* @return {String}
*/
- normalise: function( doc, text ){
+ normalise: function( doc, text ) {
text = text.replace( / /g, ' ') ; // exchanges html entity for space into space char
text = modules.utils.collapseWhiteSpace( text ); // removes linefeeds, tabs and addtional spaces
text = modules.domUtils.decodeEntities( doc, text ); // decode HTML entities
text = text.replace( '–', '-' ); // correct dash decoding
return modules.utils.trim( text );
},
@@ -3839,37 +3839,37 @@ var Microformats; // jshint ignore:line
*
* @param {DOM Node} node
* @return {String}
*/
walkTreeForText: function( node ) {
var out = '',
j = 0;
- if(node.tagName && this.excludeTags.indexOf( node.tagName.toLowerCase() ) > -1){
+ if(node.tagName && this.excludeTags.indexOf( node.tagName.toLowerCase() ) > -1) {
return out;
}
// if node is a text node get its text
- if(node.nodeType && node.nodeType === 3){
+ if(node.nodeType && node.nodeType === 3) {
out += modules.domUtils.getElementText( node );
}
// get the text of the child nodes
- if(node.childNodes && node.childNodes.length > 0){
+ if(node.childNodes && node.childNodes.length > 0) {
for (j = 0; j < node.childNodes.length; j++) {
var text = this.walkTreeForText( node.childNodes[j] );
- if(text !== undefined){
+ if(text !== undefined) {
out += text;
}
}
}
// if it's a block level tag add an additional space at the end
- if(node.tagName && this.blockLevelTags.indexOf( node.tagName.toLowerCase() ) !== -1){
+ if(node.tagName && this.blockLevelTags.indexOf( node.tagName.toLowerCase() ) !== -1) {
out += ' ';
}
return (out === '')? undefined : out ;
}
};
@@ -3881,25 +3881,25 @@ var Microformats; // jshint ignore:line
/**
* parse the html string from DOM Node
*
* @param {DOM Node} node
* @return {String}
*/
- parse: function( node ){
+ parse: function( node ) {
var out = '',
j = 0;
// we do not want the outer container
- if(node.childNodes && node.childNodes.length > 0){
+ if(node.childNodes && node.childNodes.length > 0) {
for (j = 0; j < node.childNodes.length; j++) {
var text = this.walkTreeForHtml( node.childNodes[j] );
- if(text !== undefined){
+ if(text !== undefined) {
out += text;
}
}
}
return out;
},
@@ -3911,50 +3911,50 @@ var Microformats; // jshint ignore:line
* @param {DOM Node} node
* @return {String}
*/
walkTreeForHtml: function( node ) {
var out = '',
j = 0;
// if node is a text node get its text
- if(node.nodeType && node.nodeType === 3){
+ if(node.nodeType && node.nodeType === 3) {
out += modules.domUtils.getElementText( node );
}
// exclude text which has been added with include pattern -
- if(node.nodeType && node.nodeType === 1 && modules.domUtils.hasAttribute(node, 'data-include') === false){
+ if(node.nodeType && node.nodeType === 1 && modules.domUtils.hasAttribute(node, 'data-include') === false) {
// begin tag
out += '<' + node.tagName.toLowerCase();
// add attributes
var attrs = modules.domUtils.getOrderedAttributes(node);
for (j = 0; j < attrs.length; j++) {
out += ' ' + attrs[j].name + '=' + '"' + attrs[j].value + '"';
}
- if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) === -1){
+ if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) === -1) {
out += '>';
}
// get the text of the child nodes
- if(node.childNodes && node.childNodes.length > 0){
+ if(node.childNodes && node.childNodes.length > 0) {
for (j = 0; j < node.childNodes.length; j++) {
var text = this.walkTreeForHtml( node.childNodes[j] );
- if(text !== undefined){
+ if(text !== undefined) {
out += text;
}
}
}
// end tag
- if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) > -1){
+ if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) > -1) {
out += ' />';
}else{
out += '</' + node.tagName.toLowerCase() + '>';
}
}
return (out === '')? undefined : out;
}
@@ -4465,54 +4465,54 @@ var Microformats; // jshint ignore:line
var External = {
version: modules.version,
livingStandard: modules.livingStandard
};
- External.get = function(options){
+ External.get = function(options) {
var parser = new modules.Parser();
addV1(parser, options);
return parser.get( options );
};
- External.getParent = function(node, options){
+ External.getParent = function(node, options) {
var parser = new modules.Parser();
addV1(parser, options);
return parser.getParent( node, options );
};
- External.count = function(options){
+ External.count = function(options) {
var parser = new modules.Parser();
addV1(parser, options);
return parser.count( options );
};
- External.isMicroformat = function( node, options ){
+ External.isMicroformat = function( node, options ) {
var parser = new modules.Parser();
addV1(parser, options);
return parser.isMicroformat( node, options );
};
- External.hasMicroformats = function( node, options ){
+ External.hasMicroformats = function( node, options ) {
var parser = new modules.Parser();
addV1(parser, options);
return parser.hasMicroformats( node, options );
};
- function addV1(parser, options){
- if(options && options.maps){
- if(Array.isArray(options.maps)){
+ function addV1(parser, options) {
+ if(options && options.maps) {
+ if(Array.isArray(options.maps)) {
parser.add(options.maps);
}else{
parser.add([options.maps]);
}
}
}
--- a/toolkit/components/microformats/update/update.js
+++ b/toolkit/components/microformats/update/update.js
@@ -38,25 +38,25 @@ var repo = 'glennjones/microformat-shiv'
['/test/interface-tests','/test/interface-tests'],
['/test/module-tests','/test/module-tests'],
['/test/standards-tests','/test/standards-tests'],
['/test/static','/test/static']
];
-getLastBuildState( repo, function( err, buildState){
- if(buildState){
+getLastBuildState( repo, function( err, buildState) {
+ if(buildState) {
console.log('last build state:', buildState);
- if(buildState === 'passed'){
+ if(buildState === 'passed') {
console.log('downloading git repo', repo);
- getLastCommitDate( repo, function( err, date){
- if(date){
+ getLastCommitDate( repo, function( err, date) {
+ if(date) {
console.log( 'last commit:', new Date(date).toString() );
}
});
updateFromRepo();
}else{
console.log('not updating because of build state is failing please contact Glenn Jones glennjones@gmail.com');
}
@@ -66,21 +66,21 @@ getLastBuildState( repo, function( err,
}
});
/**
* updates from directories and files from repo
*
*/
-function updateFromRepo(){
- download(repo, tempDir, function(err, data){
+function updateFromRepo() {
+ download(repo, tempDir, function(err, data) {
// the err and data from download-github-repo give false negatives
- if( fs.existsSync( tempDir ) ){
+ if( fs.existsSync( tempDir ) ) {
var version = getRepoVersion();
removeCurrentFiles( pathList, deployDirResolved );
addNewFiles( pathList, deployDirResolved );
fs.removeSync(tempDir);
// changes files for firefox
replaceInFile('/test/module-tests/index.html', /..\/..\/lib\//g, '../lib/' );
@@ -97,76 +97,76 @@ function updateFromRepo(){
/**
* removes old version of delpoyed directories and files
*
* @param {Array} pathList
* @param {String} deployDirResolved
*/
-function removeCurrentFiles( pathList, deployDirResolved ){
- pathList.forEach( function( path ){
+function removeCurrentFiles( pathList, deployDirResolved ) {
+ pathList.forEach( function( path ) {
console.log('removed:', deployDirResolved + path[1]);
fs.removeSync(deployDirResolved + path[1]);
});
}
/**
* copies over required directories and files into deployed path
*
* @param {Array} pathList
* @param {String} deployDirResolved
*/
-function addNewFiles( pathList, deployDirResolved ){
- pathList.forEach( function( path ){
+function addNewFiles( pathList, deployDirResolved ) {
+ pathList.forEach( function( path ) {
console.log('added:', deployDirResolved + path[1]);
fs.copySync(tempDir + path[0], deployDirResolved + path[1]);
});
}
/**
* gets the repo version number
*
* @return {String}
*/
-function getRepoVersion(){
+function getRepoVersion() {
var pack = fs.readFileSync(path.resolve(tempDir,'package.json'), {encoding: 'utf8'});
- if(pack){
+ if(pack) {
pack = JSON.parse(pack)
- if(pack && pack.version){
+ if(pack && pack.version) {
return pack.version;
}
}
return '';
}
/**
* get the last commit date from github repo
*
* @param {String} repo
* @param {Function} callback
*/
-function getLastCommitDate( repo, callback ){
+function getLastCommitDate( repo, callback ) {
var options = {
url: 'https://api.github.com/repos/' + repo + '/commits?per_page=1',
headers: {
'User-Agent': 'request'
}
};
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
var date = null,
json = JSON.parse(body);
- if(json && json.length && json[0].commit && json[0].commit.author ){
+ if(json && json.length && json[0].commit && json[0].commit.author ) {
date = json[0].commit.author.date;
}
callback(null, date);
}else{
console.log(error, response, body);
callback('fail to get last commit date', null);
}
});
@@ -174,31 +174,31 @@ function getLastCommitDate( repo, callba
/**
* get the last build state from travis-ci
*
* @param {String} repo
* @param {Function} callback
*/
-function getLastBuildState( repo, callback ){
+function getLastBuildState( repo, callback ) {
var options = {
url: 'https://api.travis-ci.org/repos/' + repo,
headers: {
'User-Agent': 'request',
'Accept': 'application/vnd.travis-ci.2+json'
}
};
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
var buildState = null,
json = JSON.parse(body);
- if(json && json.repo && json.repo.last_build_state ){
+ if(json && json.repo && json.repo.last_build_state ) {
buildState = json.repo.last_build_state;
}
callback(null, buildState);
}else{
console.log(error, response, body);
callback('fail to get last build state', null);
}
});
@@ -206,61 +206,61 @@ function getLastBuildState( repo, callba
/**
* adds exported symbol to microformat-shiv.js file
*
* @param {String} path
* @param {String} content
*/
-function addExportedSymbol( path ){
- if(path === '/microformat-shiv.js'){
+function addExportedSymbol( path ) {
+ if(path === '/microformat-shiv.js') {
fs.appendFileSync(deployDirResolved + '/microformat-shiv.js', '\r\n' + exportedSymbol + '\r\n');
console.log('appended exported symbol to microformat-shiv.js');
}
}
/**
* adds exported symbol to microformat-shiv.js file
*
* @param {String} path
* @param {String} content
*/
-function replaceInFile( path, findStr, replaceStr ){
- readFile(deployDirResolved + path, function(err, fileStr){
- if(fileStr){
+function replaceInFile( path, findStr, replaceStr ) {
+ readFile(deployDirResolved + path, function(err, fileStr) {
+ if(fileStr) {
fileStr = fileStr.replace(findStr, replaceStr)
writeFile(deployDirResolved + path, fileStr);
console.log('replaced ' + findStr + ' with ' + replaceStr + ' in ' + path);
}else{
console.log('error replaced strings in ' + path);
}
})
}
/**
* write a file
*
* @param {String} path
* @param {String} content
*/
-function writeFile(path, content){
+function writeFile(path, content) {
fs.writeFile(path, content, 'utf8', function(err) {
if(err) {
console.log(err);
} else {
console.log('The file: ' + path + ' was saved');
}
});
}
/**
* read a file
*
* @param {String} path
* @param {Function} callback
*/
-function readFile(path, callback){
+function readFile(path, callback) {
fs.readFile(path, 'utf8', callback);
}
--- a/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContextMenu.jsm
@@ -44,17 +44,17 @@ var LoginManagerContextMenu = {
let fragment = browser.ownerDocument.createDocumentFragment();
let duplicateUsernames = this._findDuplicates(foundLogins);
for (let login of foundLogins) {
let item = fragment.ownerDocument.createElement("menuitem");
let username = login.username;
// If login is empty or duplicated we want to append a modification date to it.
- if (!username || duplicateUsernames.has(username)){
+ if (!username || duplicateUsernames.has(username)) {
if (!username) {
username = this._getLocalizedString("noUsername");
}
let meta = login.QueryInterface(Ci.nsILoginMetaInfo);
let time = this.dateAndTimeFormatter.format(new Date(meta.timePasswordChanged));
username = this._getLocalizedString("loginHostAge", [username, time]);
}
item.setAttribute("label", username);
--- a/toolkit/components/passwordmgr/content/passwordManagerExceptions.js
+++ b/toolkit/components/passwordmgr/content/passwordManagerExceptions.js
@@ -10,33 +10,33 @@ function RejectsStartup() {
LoadRejects();
let treecols = document.getElementsByTagName("treecols")[0];
treecols.addEventListener("click", HandleTreeColumnClick.bind(null, RejectColumnSort));
}
var rejectsTreeView = {
rowCount : 0,
- setTree : function(tree){},
+ setTree : function(tree) {},
getImageSrc : function(row, column) {},
getProgressMode : function(row, column) {},
getCellValue : function(row, column) {},
- getCellText : function(row, column){
+ getCellText : function(row, column) {
var rv="";
if (column.id=="rejectCol") {
rv = rejects[row].host;
}
return rv;
},
isSeparator : function(index) {return false;},
isSorted: function() { return false; },
isContainer : function(index) {return false;},
cycleHeader : function(column) {},
- getRowProperties : function(row){ return ""; },
- getColumnProperties : function(column){ return ""; },
+ getRowProperties : function(row) { return ""; },
+ getColumnProperties : function(column) { return ""; },
getCellProperties : function(row, column) {
if (column.element.getAttribute("id") == "rejectCol")
return "ltr";
return "";
}
};
--- a/toolkit/components/passwordmgr/test/browser/browser_context_menu.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_context_menu.js
@@ -253,17 +253,17 @@ function* openPasswordContextMenu(browse
let popupShownPromise = BrowserTestUtils.waitForEvent(popupHeader, "popupshown");
EventUtils.synthesizeMouseAtCenter(popupHeader, {});
yield popupShownPromise;
}
/**
* Verify that only the expected form fields are filled.
*/
-function* assertContextMenuFill(form, usernameField, passwordField, unchangedFields, loginIndex){
+function* assertContextMenuFill(form, usernameField, passwordField, unchangedFields, loginIndex) {
let popupMenu = document.getElementById("fill-login-popup");
// Store the value of fields that should remain unchanged.
if (unchangedFields.length) {
for (let field of unchangedFields) {
field.setAttribute("original-value", field.value);
}
}
--- a/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
+++ b/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
@@ -22,17 +22,17 @@ function startAutocomplete() {
userField.focus();
doKey("down");
setTimeout(submitForm, 100);
}
function submitForm() {
doKey("down");
doKey("return");
- setTimeout(function(){ form.submit(); }, 100);
+ setTimeout(function() { form.submit(); }, 100);
}
var form = document.getElementById("form");
var userField = document.getElementById("user");
window.addEventListener('message', () => { startAutocomplete(); });
</script>
--- a/toolkit/components/places/tests/bookmarks/test_1017502-bookmarks_foreign_count.js
+++ b/toolkit/components/places/tests/bookmarks/test_1017502-bookmarks_foreign_count.js
@@ -68,17 +68,17 @@ add_task(function* maintenance_foreign_c
// Adjust the foreign_count for the added entry to an incorrect value
let deferred = Promise.defer();
let stmt = DBConn().createAsyncStatement(
`UPDATE moz_places SET foreign_count = 10 WHERE url_hash = hash(:t_url)
AND url = :t_url `);
stmt.params.t_url = T_URI.spec;
stmt.executeAsync({
- handleCompletion: function(){
+ handleCompletion: function() {
deferred.resolve();
}
});
stmt.finalize();
yield deferred.promise;
Assert.equal((yield getForeignCountForURL(conn, T_URI)), 10);
// Run maintenance
@@ -87,17 +87,17 @@ add_task(function* maintenance_foreign_c
promiseTopicObserved("places-maintenance-finished");
PlacesDBUtils.maintenanceOnIdle();
yield promiseMaintenanceFinished;
// Check if the foreign_count has been adjusted to the correct value
Assert.equal((yield getForeignCountForURL(conn, T_URI)), 0);
});
-add_task(function* add_remove_tags_test(){
+add_task(function* add_remove_tags_test() {
let conn = yield PlacesUtils.promiseDBConnection();
yield PlacesTestUtils.addVisits(T_URI);
Assert.equal((yield getForeignCountForURL(conn, T_URI)), 0);
// Check foreign count incremented by 1 for a single tag
PlacesUtils.tagging.tagURI(T_URI, ["test tag"]);
Assert.equal((yield getForeignCountForURL(conn, T_URI)), 1);
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
@@ -384,17 +384,17 @@ add_task(function* reorder_notification(
parentGuid: PlacesUtils.bookmarks.unfiledGuid
},
{ type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
url: "http://example3.com/",
parentGuid: PlacesUtils.bookmarks.unfiledGuid
},
];
let sorted = [];
- for (let bm of bookmarks){
+ for (let bm of bookmarks) {
sorted.push(yield PlacesUtils.bookmarks.insert(bm));
}
// Randomly reorder the array.
sorted.sort(() => 0.5 - Math.random());
let observer = expectNotifications();
yield PlacesUtils.bookmarks.reorder(PlacesUtils.bookmarks.unfiledGuid,
--- a/toolkit/components/places/tests/browser/browser_bug248970.js
+++ b/toolkit/components/places/tests/browser/browser_bug248970.js
@@ -129,17 +129,17 @@ function* checkHistoryItems() {
/**
* Function attempts to check if Bookmark-A has been visited
* during private browsing mode, function should return false
*
* @returns false if the accessCount has not changed
* true if the accessCount has changed
*/
-function isBookmarkAltered(){
+function isBookmarkAltered() {
let options = PlacesUtils.history.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
options.maxResults = 1; // should only expect a new bookmark
let query = PlacesUtils.history.getNewQuery();
query.setFolders([PlacesUtils.bookmarks.bookmarksMenuFolder], 1);
let root = PlacesUtils.history.executeQuery(query, options).root;
--- a/toolkit/components/places/tests/expiration/test_annos_expire_policy.js
+++ b/toolkit/components/places/tests/expiration/test_annos_expire_policy.js
@@ -40,17 +40,17 @@ function add_old_anno(aIdentifier, aName
// Item annotation.
as.setItemAnnotation(aIdentifier, aName, aValue, 0, aExpirePolicy);
// Update dateAdded for the last added annotation.
sql = "UPDATE moz_items_annos SET dateAdded = :expire_date, lastModified = :last_modified " +
"WHERE id = (SELECT id FROM moz_items_annos " +
"WHERE item_id = :id " +
"ORDER BY dateAdded DESC LIMIT 1)";
}
- else if (aIdentifier instanceof Ci.nsIURI){
+ else if (aIdentifier instanceof Ci.nsIURI) {
// Page annotation.
as.setPageAnnotation(aIdentifier, aName, aValue, 0, aExpirePolicy);
// Update dateAdded for the last added annotation.
sql = "UPDATE moz_annos SET dateAdded = :expire_date, lastModified = :last_modified " +
"WHERE id = (SELECT a.id FROM moz_annos a " +
"LEFT JOIN moz_places h on h.id = a.place_id " +
"WHERE h.url_hash = hash(:id) AND h.url = :id " +
"ORDER BY a.dateAdded DESC LIMIT 1)";
--- a/toolkit/components/places/tests/expiration/test_clearHistory.js
+++ b/toolkit/components/places/tests/expiration/test_clearHistory.js
@@ -41,17 +41,17 @@ function add_old_anno(aIdentifier, aName
"WHERE id = ( " +
"SELECT a.id FROM moz_items_annos a " +
"JOIN moz_anno_attributes n ON n.id = a.anno_attribute_id " +
"WHERE a.item_id = :id " +
"AND n.name = :anno_name " +
"ORDER BY a.dateAdded DESC LIMIT 1 " +
")";
}
- else if (aIdentifier instanceof Ci.nsIURI){
+ else if (aIdentifier instanceof Ci.nsIURI) {
// Page annotation.
as.setPageAnnotation(aIdentifier, aName, aValue, 0, aExpirePolicy);
// Update dateAdded for the last added annotation.
sql = "UPDATE moz_annos SET dateAdded = :expire_date, lastModified = :last_modified " +
"WHERE id = ( " +
"SELECT a.id FROM moz_annos a " +
"JOIN moz_anno_attributes n ON n.id = a.anno_attribute_id " +
"JOIN moz_places h on h.id = a.place_id " +
--- a/toolkit/components/places/tests/queries/test_415716.js
+++ b/toolkit/components/places/tests/queries/test_415716.js
@@ -1,15 +1,15 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et: */
/* 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/. */
-function modHistoryTypes(val){
+function modHistoryTypes(val) {
switch(val % 8) {
case 0:
case 1:
return TRANSITION_LINK;
case 2:
return TRANSITION_TYPED;
case 3:
return TRANSITION_BOOKMARK;
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -707,17 +707,17 @@ AboutReader.prototype = {
} else {
img.onload = function() {
setImageMargins(img);
}
}
}
},
- _maybeSetTextDirection: function Read_maybeSetTextDirection(article){
+ _maybeSetTextDirection: function Read_maybeSetTextDirection(article) {
if(!article.dir)
return;
//Set "dir" attribute on content
this._contentElement.setAttribute("dir", article.dir);
this._headerElement.setAttribute("dir", article.dir);
},
--- a/toolkit/components/satchel/AutoCompleteE10S.jsm
+++ b/toolkit/components/satchel/AutoCompleteE10S.jsm
@@ -28,17 +28,17 @@ var AutoCompleteE10SView = {
// nsITreeView
selection: null,
get rowCount() { return this.treeData.length; },
setTree: function(treeBox) { this.treeBox = treeBox; },
getCellText: function(idx, column) { return this.treeData[idx] },
isContainer: function(idx) { return false; },
- getCellValue: function(idx, column){ return false },
+ getCellValue: function(idx, column) { return false },
isContainerOpen: function(idx) { return false; },
isContainerEmpty: function(idx) { return false; },
isSeparator: function(idx) { return false; },
isSorted: function() { return false; },
isEditable: function(idx, column) { return false; },
canDrop: function(idx, orientation, dt) { return false; },
getLevel: function(idx) { return 0; },
getParentIndex: function(idx) { return -1; },
@@ -59,17 +59,17 @@ var AutoCompleteE10SView = {
get matchCount() {
return this.rowCount;
},
handleEnter: function(aIsPopupSelection) {
AutoCompleteE10S.handleEnter(aIsPopupSelection);
},
- stopSearch: function(){},
+ stopSearch: function() {},
// Internal JS-only API
clearResults: function() {
this.treeData = [];
this.properties = [];
},
addResult: function(text, properties) {
--- a/toolkit/components/satchel/formSubmitListener.js
+++ b/toolkit/components/satchel/formSubmitListener.js
@@ -1,13 +1,13 @@
/* 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/. */
-(function(){
+(function() {
var Cc = Components.classes;
var Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
--- a/toolkit/components/startup/tests/browser/beforeunload.html
+++ b/toolkit/components/startup/tests/browser/beforeunload.html
@@ -1,10 +1,10 @@
<html>
<script>
- window.onbeforeunload = function(event){
+ window.onbeforeunload = function(event) {
event.returnValue = 'Test beforeunload handler';
}
</script>
<body>
Test page
</body>
</html>
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -209,17 +209,17 @@ var processInfo = {
_GetCurrentProcess: null,
getCounters: function() {
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
if (isWindows)
return this.getCounters_Windows();
return null;
},
getCounters_Windows: function() {
- if (!this._initialized){
+ if (!this._initialized) {
Cu.import("resource://gre/modules/ctypes.jsm");
this._IO_COUNTERS = new ctypes.StructType("IO_COUNTERS", [
{'readOps': ctypes.unsigned_long_long},
{'writeOps': ctypes.unsigned_long_long},
{'otherOps': ctypes.unsigned_long_long},
{'readBytes': ctypes.unsigned_long_long},
{'writeBytes': ctypes.unsigned_long_long},
{'otherBytes': ctypes.unsigned_long_long} ]);
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
@@ -422,17 +422,17 @@ add_task(function* test_changePingAfterS
const pingId = yield pingPromise;
// Make sure our changes didn't affect the submitted payload.
let archivedCopy = yield TelemetryArchive.promiseArchivedPingById(pingId);
Assert.equal(archivedCopy.payload.canary, "test",
"The payload must not be changed after being submitted.");
});
-add_task(function* test_telemetryEnabledUnexpectedValue(){
+add_task(function* test_telemetryEnabledUnexpectedValue() {
// Remove the default value for toolkit.telemetry.enabled from the default prefs.
// Otherwise, we wouldn't be able to set the pref to a string.
let defaultPrefBranch = Services.prefs.getDefaultBranch(null);
defaultPrefBranch.deleteBranch(PREF_ENABLED);
// Set the preferences controlling the Telemetry status to a string.
Preferences.set(PREF_ENABLED, "false");
// Check that Telemetry is not enabled.
@@ -451,17 +451,17 @@ add_task(function* test_telemetryEnabled
// Also check that the false works as well.
Preferences.set(PREF_ENABLED, false);
yield TelemetryController.testReset();
Assert.equal(Telemetry.canRecordExtended, false,
"False must disable Telemetry recording.");
});
-add_task(function* test_telemetryCleanFHRDatabase(){
+add_task(function* test_telemetryCleanFHRDatabase() {
const FHR_DBNAME_PREF = "datareporting.healthreport.dbName";
const CUSTOM_DB_NAME = "unlikely.to.be.used.sqlite";
const DEFAULT_DB_NAME = "healthreport.sqlite";
// Check that we're able to remove a FHR DB with a custom name.
const CUSTOM_DB_PATHS = [
OS.Path.join(OS.Constants.Path.profileDir, CUSTOM_DB_NAME),
OS.Path.join(OS.Constants.Path.profileDir, CUSTOM_DB_NAME + "-wal"),
@@ -499,12 +499,12 @@ add_task(function* test_telemetryCleanFH
// Trigger the cleanup and check that the files were removed.
yield TelemetryStorage.removeFHRDatabase();
for (let dbFilePath of DEFAULT_DB_PATHS) {
Assert.ok(!(yield OS.File.exists(dbFilePath)), "The DB must not be on the disk anymore: " + dbFilePath);
}
});
-add_task(function* stopServer(){
+add_task(function* stopServer() {
yield PingServer.stop();
do_test_finished();
});
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -582,17 +582,17 @@ function checkSystemSection(data) {
let features = gfxInfo.getFeatures();
Assert.equal(features.compositor, gfxData.features.compositor);
Assert.equal(features.opengl, gfxData.features.opengl);
Assert.equal(features.webgl, gfxData.features.webgl);
}
catch (e) {}
}
-function checkActiveAddon(data){
+function checkActiveAddon(data) {
let signedState = mozinfo.addon_signing ? "number" : "undefined";
// system add-ons have an undefined signState
if (data.isSystem)
signedState = "undefined";
const EXPECTED_ADDON_FIELDS_TYPES = {
blocklisted: "boolean",
name: "string",
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -1856,12 +1856,12 @@ add_task(function* test_userIdleAndSched
Assert.ok(receivedPingRequest, "Telemetry must send one daily ping.");
const receivedPing = decodeRequestPayload(receivedPingRequest);
checkPingFormat(receivedPing, PING_TYPE_MAIN, true, true);
Assert.equal(receivedPing.payload.info.reason, REASON_DAILY);
yield TelemetryController.testShutdown();
});
-add_task(function* stopServer(){
+add_task(function* stopServer() {
yield PingServer.stop();
do_test_finished();
});
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -93,17 +93,17 @@ const BackgroundPageThumbs = {
* @return {Promise} A Promise that resolves when this task completes
*/
captureIfMissing: Task.async(function* (url, options={}) {
// The fileExistsForURL call is an optimization, potentially but unlikely
// incorrect, and no big deal when it is. After the capture is done, we
// atomically test whether the file exists before writing it.
let exists = yield PageThumbsStorage.fileExistsForURL(url);
if (exists) {
- if(options.onDone){
+ if(options.onDone) {
options.onDone(url);
}
return url;
}
let thumbPromise = new Promise((resolve, reject) => {
function observe(subject, topic, data) { // jshint ignore:line
if (data === url) {
switch(topic) {
--- a/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
+++ b/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
@@ -81,17 +81,17 @@ function checkOldStore() {
checkArrays(['ordinal'], getAttributes(aboutURI, 'lockCol'));
checkArrays(['ordinal', 'sortDirection'], getAttributes(aboutURI, 'prefCol'));
checkValue(aboutURI, "prefCol", "ordinal", "1");
checkValue(aboutURI, "prefCol", "sortDirection", "ascending");
checkValue(aboutURI, "lockCol", "ordinal", "3");
}
-add_task(function* testImport(){
+add_task(function* testImport() {
let src = "localstore.rdf";
let dst = OS.Path.join(OS.Constants.Path.profileDir, src);
yield OS.File.copy(src, dst);
// Importing relies on XULStore not yet being loaded before this point.
XULStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
checkOldStore();
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -944,42 +944,42 @@ function safeModeRestart() {
if (!cancelQuit.data) {
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
}
}
/**
* Set up event listeners for buttons.
*/
-function setupEventListeners(){
+function setupEventListeners() {
$("show-update-history-button").addEventListener("click", function (event) {
var prompter = Cc["@mozilla.org/updates/update-prompt;1"].createInstance(Ci.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
});
- $("reset-box-button").addEventListener("click", function (event){
+ $("reset-box-button").addEventListener("click", function (event) {
ResetProfile.openConfirmationDialog(window);
});
- $("copy-raw-data-to-clipboard").addEventListener("click", function (event){
+ $("copy-raw-data-to-clipboard").addEventListener("click", function (event) {
copyRawDataToClipboard(this);
});
- $("copy-to-clipboard").addEventListener("click", function (event){
+ $("copy-to-clipboard").addEventListener("click", function (event) {
copyContentsToClipboard();
});
- $("profile-dir-button").addEventListener("click", function (event){
+ $("profile-dir-button").addEventListener("click", function (event) {
openProfileDirectory();
});
$("restart-in-safe-mode-button").addEventListener("click", function (event) {
if (Services.obs.enumerateObservers("restart-in-safe-mode").hasMoreElements()) {
Services.obs.notifyObservers(null, "restart-in-safe-mode", "");
}
else {
safeModeRestart();
}
});
- $("verify-place-integrity-button").addEventListener("click", function (event){
+ $("verify-place-integrity-button").addEventListener("click", function (event) {
PlacesDBUtils.checkAndFixDatabase(function(aLog) {
let msg = aLog.join("\n");
$("verify-place-result").style.display = "block";
$("verify-place-result").classList.remove("no-copy");
$("verify-place-result").textContent = msg;
});
});
}
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -708,17 +708,17 @@ var EnvironmentData = {
this.renderKeyValueObject(addons.activeExperiment, addonSection, "activeExperiment");
this.renderAddonsObject(addons.activeGMPlugins, addonSection, "activeGMPlugins");
this.renderPersona(addons, addonSection, "persona");
let hasAddonData = Object.keys(ping.environment.addons).length > 0;
this.createSubsection("addons", hasAddonData, addonSection, dataDiv);
},
- appendRow: function(table, id, value){
+ appendRow: function(table, id, value) {
let row = document.createElement("tr");
this.appendColumn(row, "td", id);
this.appendColumn(row, "td", value);
table.appendChild(row);
},
/**
* Helper function for appending a column to the data table.
*
@@ -1204,17 +1204,17 @@ var Histogram = {
let textData = this.renderValues(outerDiv, hgram, options);
// The 'Copy' button contains the textual data, copied to clipboard on click
let copyButton = document.createElement("button");
copyButton.className = "copy-node";
copyButton.appendChild(document.createTextNode(this.hgramCopyCaption));
copyButton.histogramText = aName + EOL + stats + EOL + EOL + textData;
- copyButton.addEventListener("click", function(){
+ copyButton.addEventListener("click", function() {
Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper)
.copyString(this.histogramText);
});
outerDiv.appendChild(copyButton);
aParent.appendChild(outerDiv);
return outerDiv;
},
--- a/toolkit/content/tests/browser/browser_findbar.js
+++ b/toolkit/content/tests/browser/browser_findbar.js
@@ -237,17 +237,17 @@ function promiseFindFinished(searchText,
return deferred.promise;
}
/**
* A promise-like wrapper for the waitForFocus helper.
*/
function promiseFocus() {
return new Promise((resolve) => {
- waitForFocus(function(){
+ waitForFocus(function() {
resolve();
}, content);
});
}
function promiseRemotenessChange(tab, shouldBeRemote) {
return new Promise((resolve) => {
let browser = gBrowser.getBrowserForTab(tab);
--- a/toolkit/content/tests/widgets/videocontrols_direction_test.js
+++ b/toolkit/content/tests/widgets/videocontrols_direction_test.js
@@ -81,10 +81,10 @@ function runTest(index) {
var refCanvas = new RemoteCanvas(currentTest.ref, "ref-" + index);
refCanvas.load(testCallback);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.requestCompleteLog();
window.addEventListener("load", function() {
- SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function(){ runTest(0); });
+ SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function() { runTest(0); });
}, true);
--- a/toolkit/content/widgets/preferences.xml
+++ b/toolkit/content/widgets/preferences.xml
@@ -1062,17 +1062,17 @@
return win;
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="dialogaccept">
<![CDATA[
- if (!this._fireEvent("beforeaccept", this)){
+ if (!this._fireEvent("beforeaccept", this)) {
return false;
}
var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager);
if (this.type == "child" && window.opener &&
secMan.isSystemPrincipal(window.opener.document.nodePrincipal)) {
let psvc = Components.classes["@mozilla.org/preferences-service;1"]
--- a/toolkit/identity/IdentityUtils.jsm
+++ b/toolkit/identity/IdentityUtils.jsm
@@ -60,17 +60,17 @@ this.checkRenamed = function checkRename
this.getRandomId = function getRandomId() {
return uuidgen.generateUUID().toString();
};
/*
* copy source object into target, excluding private properties
* (those whose names begin with an underscore)
*/
-this.objectCopy = function objectCopy(source, target){
+this.objectCopy = function objectCopy(source, target) {
let desc;
Object.getOwnPropertyNames(source).forEach(function(name) {
if (name[0] !== '_') {
desc = Object.getOwnPropertyDescriptor(source, name);
Object.defineProperty(target, name, desc);
}
});
};
--- a/toolkit/modules/ClientID.jsm
+++ b/toolkit/modules/ClientID.jsm
@@ -202,17 +202,17 @@ var ClientIDImpl = {
/**
* Sets the client id to the given value and updates the value cached in
* preferences only if the given id is a valid.
*
* @param {String} id A string containing the client ID.
* @return {Boolean} True when the client ID has valid format, or False
* otherwise.
*/
- updateClientID: function (id){
+ updateClientID: function (id) {
if (!isValidClientID(id)) {
this._log.error("updateClientID - invalid client ID", id);
return false;
}
this._clientID = id;
Preferences.set(PREF_CACHED_CLIENTID, this._clientID);
return true;
--- a/toolkit/modules/tests/browser/browser_PromiseMessage.js
+++ b/toolkit/modules/tests/browser/browser_PromiseMessage.js
@@ -10,17 +10,17 @@ const url = "http://example.org/tests/do
/**
* Test basic API error conditions
*/
add_task(function* () {
yield BrowserTestUtils.withNewTab({gBrowser, url}, testPromiseMessageAPI)
});
-function* testPromiseMessageAPI(aBrowser){
+function* testPromiseMessageAPI(aBrowser) {
// Reusing an existing message.
const msgKey = "DOM:WebManifest:hasManifestLink";
const mm = aBrowser.messageManager;
const id = "this should not change";
const foo = "neitherShouldThis";
const data = {id, foo};
// This just returns false, and it doesn't matter for this test.
--- a/toolkit/modules/tests/xpcshell/test_FileUtils.js
+++ b/toolkit/modules/tests/xpcshell/test_FileUtils.js
@@ -159,17 +159,17 @@ var closeFileOutputStream = function(aKi
// We can write data to the stream just fine while it's open.
let data = "testClose";
fos.write(data, data.length);
// But once we close it, we can't anymore.
if (aKind == "atomic") {
FileUtils.closeAtomicFileOutputStream(fos);
- } else if (aKind == "safe"){
+ } else if (aKind == "safe") {
FileUtils.closeSafeFileOutputStream(fos);
}
do_check_throws(function () {
fos.write(data, data.length);
}, Components.results.NS_BASE_STREAM_CLOSED);
run_next_test();
};
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -1735,17 +1735,17 @@ var AddonDatabase = {
return this.Writer.flush();
},
/**
* Asynchronously retrieve all add-ons from the database
* @return: Promise{Map}
* Resolves when the add-ons are retrieved from the database
*/
- retrieveStoredData: function(){
+ retrieveStoredData: function() {
return this.openConnection().then(db => db.addons);
},
/**
* Asynchronously repopulates the database so it only contains the
* specified add-ons
*
* @param aAddons
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -7200,22 +7200,22 @@ AddonWrapper.prototype = {
if (this.hasResource("icon.png")) {
icons[32] = icons[48] = this.getResourceURI("icon.png").spec;
}
if (this.hasResource("icon64.png")) {
icons[64] = this.getResourceURI("icon64.png").spec;
}
}
- if(this.isActive && addon.iconURL){
+ if(this.isActive && addon.iconURL) {
icons[32] = addon.iconURL;
icons[48] = addon.iconURL;
}
- if(this.isActive && addon.icon64URL){
+ if(this.isActive && addon.icon64URL) {
icons[64] = addon.icon64URL;
}
Object.freeze(icons);
return icons;
},
get screenshots() {
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -871,17 +871,17 @@ Blocklist.prototype = {
return;
} catch (e) {
LOG("Blocklist::_preloadBlocklist: Failed to load XML file " + e)
}
LOG("Blocklist::_preloadBlocklist: no XML File found");
}),
- _preloadBlocklistFile: Task.async(function*(path){
+ _preloadBlocklistFile: Task.async(function*(path) {
if (this._addonEntries) {
// The file has been already loaded.
return;
}
if (!gBlocklistEnabled) {
LOG("Blocklist::_preloadBlocklistFile: blocklist is disabled");
return;
--- a/toolkit/mozapps/extensions/test/browser/browser_bug523784.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug523784.js
@@ -77,17 +77,17 @@ function bug523784_test2(win) {
if (aTopic != "domwindowopened")
return;
Services.ww.unregisterNotification(windowObserver);
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, false);
- executeSoon(function(){
+ executeSoon(function() {
let moreInfoLink = win.document.getElementById("moreInfo");
let cancelButton = win.document.documentElement.getButton("cancel");
is(moreInfoLink.getAttribute("href"),
Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL"),
"More Info link should link to the general blocklist page.");
cancelButton.doCommand();
executeSoon(finish);
})
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js
@@ -206,17 +206,17 @@ function load_blocklist(file) {
function check_addon_state(addon) {
return addon.userDisabled + "," + addon.softDisabled + "," + addon.appDisabled;
}
function check_plugin_state(plugin) {
return plugin.disabled + "," + plugin.blocklisted;
}
-function create_blocklistURL(blockID){
+function create_blocklistURL(blockID) {
let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL);
url = url.replace(/%blockID%/g, blockID);
return url;
}
// Performs the initial setup
function run_test() {
// Setup for test
--- a/toolkit/mozapps/extensions/test/xpcshell/test_e10s_restartless.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_e10s_restartless.js
@@ -276,17 +276,17 @@ add_task(function*() {
addon2 = yield promiseAddonByID(ID2);
addon2.uninstall();
restartManager();
});
// Check that the rollout policy sets work as expected
-add_task(function*(){
+add_task(function*() {
gAppInfo.browserTabsRemoteAutostart = true;
Services.prefs.setBoolPref("extensions.e10sBlocksEnabling", true);
Services.prefs.setCharPref("extensions.e10s.rollout.policy", "xpcshell-test");
// Both 'bootstrap1' and 'bootstrap2' addons are listed in the allowed policy
// set, so they should install and start normally.
yield check_normal();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_strictcompat.js
@@ -178,17 +178,17 @@ function check_test_1() {
do_check_false(a1.hasResource("foo.bar"));
let uri = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, uri + "install.rdf");
do_check_eq(a1.iconURL, uri + "icon.png");
do_check_eq(a1.icon64URL, uri + "icon64.png");
a1.uninstall();
- do_execute_soon(function(){run_test_2(a1)});
+ do_execute_soon(function() {run_test_2(a1)});
});
});
}));
});
}
// Tests that an install from a url downloads.
function run_test_2(aAddon) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -620,17 +620,17 @@ add_task(function*() {
BootstrapMonitor.checkAddonNotInstalled(ID);
BootstrapMonitor.checkAddonNotStarted(ID);
yield promiseRestartManager();
});
// Installing a temporary add-on over a non-restartless add-on should fail.
-add_task(function*(){
+add_task(function*() {
yield promiseInstallAllFiles([do_get_addon("test_install1")], true);
let non_restartless_ID = "addon1@tests.mozilla.org";
BootstrapMonitor.checkAddonNotInstalled(non_restartless_ID);
BootstrapMonitor.checkAddonNotStarted(non_restartless_ID);
restartManager();
--- a/toolkit/mozapps/handling/content/dialog.js
+++ b/toolkit/mozapps/handling/content/dialog.js
@@ -132,17 +132,17 @@ var dialog = {
// it, and users won't have such records for URLs they don't visit,
// and users won't visit the handler's URL template, they'll only
// visit URLs derived from that template (i.e. with %s in the template
// replaced by the URL of the content being handled).
elm.setAttribute("image", uri.prePath + "/favicon.ico");
}
elm.setAttribute("description", uri.prePath);
}
- else if (app instanceof Ci.nsIDBusHandlerApp){
+ else if (app instanceof Ci.nsIDBusHandlerApp) {
elm.setAttribute("description", app.method);
}
else
throw "unknown handler type";
items.insertBefore(elm, this._itemChoose);
if (preferredHandler && app == preferredHandler)
this.selectedItem = elm;
--- a/toolkit/mozapps/installer/precompile_cache.js
+++ b/toolkit/mozapps/installer/precompile_cache.js
@@ -53,17 +53,17 @@ function get_modules_under(uri) {
let jarReader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci.nsIZipReader);
let file = jar.JARFile.QueryInterface(Ci.nsIFileURL);
jarReader.open(file.file);
let entries = jar_entries(jarReader, "components/*.js")
.concat(jar_entries(jarReader, "modules/*.js"))
.concat(jar_entries(jarReader, "modules/*.jsm"));
jarReader.close();
return entries;
- } else if (uri instanceof Ci.nsIFileURL){
+ } else if (uri instanceof Ci.nsIFileURL) {
let file = uri.QueryInterface(Ci.nsIFileURL);
return dir_entries(file.file, "components", ".js")
.concat(dir_entries(file.file, "modules", ".js"))
.concat(dir_entries(file.file, "modules", ".jsm"));
}
throw new Error("Expected a nsIJARURI or nsIFileURL");
}
--- a/toolkit/mozapps/preferences/changemp.js
+++ b/toolkit/mozapps/preferences/changemp.js
@@ -222,16 +222,16 @@ function checkPasswords()
// was called with the intention to change the password.
// The token currently uses an empty password.
// We will not allow changing the password from empty to empty.
ok.setAttribute("disabled","true");
return;
}
}
- if (pw1 == pw2){
+ if (pw1 == pw2) {
ok.setAttribute("disabled","false");
} else
{
ok.setAttribute("disabled","true");
}
}
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -464,18 +464,18 @@ var gUpdates = {
}
}
// Provide the ability to test the billboard html
var billboardTestURL = getPref("getCharPref", PREF_APP_UPDATE_BILLBOARD_TEST_URL, null);
if (billboardTestURL) {
var updatesFoundBillboardPage = document.getElementById("updatesfoundbillboard");
updatesFoundBillboardPage.setAttribute("next", "dummy");
- gUpdatesFoundBillboardPage.onExtra1 = function(){ gUpdates.wiz.cancel(); };
- gUpdatesFoundBillboardPage.onExtra2 = function(){ gUpdates.wiz.cancel(); };
+ gUpdatesFoundBillboardPage.onExtra1 = function() { gUpdates.wiz.cancel(); };
+ gUpdatesFoundBillboardPage.onExtra2 = function() { gUpdates.wiz.cancel(); };
this.onWizardNext = function() { gUpdates.wiz.cancel(); };
this.update = { billboardURL : billboardTestURL,
brandName : this.brandName,
displayVersion : "Billboard Test 1.0",
showNeverForVersion : true,
type : "major" };
aCallback(updatesFoundBillboardPage.id);
}
@@ -1319,17 +1319,17 @@ var gErrorExtraPage = {
if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS))
Services.prefs.clearUserPref(PREF_APP_UPDATE_BACKGROUNDERRORS);
if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_HAS_UPDATE) {
document.getElementById("errorCertAttrHasUpdateLabel").hidden = false;
secHistogram.add(CoI.nsISecurityUITelemetry.WARNING_INSECURE_UPDATE);
}
else {
- if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE){
+ if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE) {
document.getElementById("errorCertCheckNoUpdateLabel").hidden = false;
secHistogram.add(CoI.nsISecurityUITelemetry.WARNING_NO_SECURE_UPDATE);
}
else
document.getElementById("genericBackgroundErrorLabel").hidden = false;
var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_URL_MANUAL);
var errorLinkLabel = document.getElementById("errorExtraLinkLabel");
errorLinkLabel.value = manualURL;
--- a/toolkit/mozapps/update/nsUpdateServiceStub.js
+++ b/toolkit/mozapps/update/nsUpdateServiceStub.js
@@ -32,14 +32,14 @@ function UpdateServiceStub() {
if (statusFile.exists()) {
let aus = Cc["@mozilla.org/updates/update-service;1"].
getService(Ci.nsIApplicationUpdateService).
QueryInterface(Ci.nsIObserver);
aus.observe(null, "post-update-processing", "");
}
}
UpdateServiceStub.prototype = {
- observe: function(){},
+ observe: function() {},
classID: Components.ID("{e43b0010-04ba-4da6-b523-1f92580bc150}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdateServiceStub]);