зеркало из https://github.com/mozilla/gecko-dev.git
Remove trailing whitespace from the codebase.
This commit is contained in:
Родитель
691f609c50
Коммит
c0765fefde
|
@ -161,12 +161,12 @@ Engine.prototype = {
|
|||
this.__tracker = new this._trackerObj();
|
||||
return this.__tracker;
|
||||
},
|
||||
|
||||
|
||||
get displayName() {
|
||||
try {
|
||||
return Str.engines.get(this.name);
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
return this._displayName;
|
||||
},
|
||||
|
||||
|
|
|
@ -391,7 +391,7 @@ BookmarksStore.prototype = {
|
|||
Svc.Bookmark.moveItem(orphan, parentId, insertPos);
|
||||
Svc.Annos.removeItemAnnotation(orphan, PARENT_ANNO);
|
||||
});
|
||||
|
||||
|
||||
// Fix up the ordering of the now-parented items
|
||||
orphans.forEach(this._attachFollowers, this);
|
||||
},
|
||||
|
|
|
@ -100,7 +100,7 @@ FormStore.prototype = {
|
|||
let stor = Cc["@mozilla.org/storage/service;1"].
|
||||
getService(Ci.mozIStorageService);
|
||||
let formDB = stor.openDatabase(file);
|
||||
|
||||
|
||||
this.__defineGetter__("_formDB", function() formDB);
|
||||
return formDB;
|
||||
},
|
||||
|
@ -111,7 +111,7 @@ FormStore.prototype = {
|
|||
this.__defineGetter__("_formHistory", function() formHistory);
|
||||
return formHistory;
|
||||
},
|
||||
|
||||
|
||||
get _formStatement() {
|
||||
// This is essentially:
|
||||
// SELECT * FROM moz_formhistory ORDER BY 1.0 * (lastUsed - minLast) /
|
||||
|
@ -124,21 +124,21 @@ FormStore.prototype = {
|
|||
timesUsed / (SELECT timesUsed FROM moz_formhistory ORDER BY timesUsed DESC LIMIT 1) \
|
||||
DESC LIMIT 200"
|
||||
);
|
||||
|
||||
|
||||
this.__defineGetter__("_formStatement", function() stmnt);
|
||||
return stmnt;
|
||||
},
|
||||
|
||||
|
||||
cacheFormItems: function FormStore_cacheFormItems() {
|
||||
this._log.trace("Caching all form items");
|
||||
this._formItems = this.getAllIDs();
|
||||
},
|
||||
|
||||
|
||||
clearFormCache: function FormStore_clearFormCache() {
|
||||
this._log.trace("Clearing form cache");
|
||||
this._formItems = null;
|
||||
},
|
||||
|
||||
|
||||
getAllIDs: function FormStore_getAllIDs() {
|
||||
let items = {};
|
||||
let stmnt = this._formStatement;
|
||||
|
@ -154,19 +154,19 @@ FormStore.prototype = {
|
|||
|
||||
return items;
|
||||
},
|
||||
|
||||
|
||||
changeItemID: function FormStore_changeItemID(oldID, newID) {
|
||||
this._log.warn("FormStore IDs are data-dependent, cannot change!");
|
||||
},
|
||||
|
||||
|
||||
itemExists: function FormStore_itemExists(id) {
|
||||
return (id in this._formItems);
|
||||
},
|
||||
|
||||
|
||||
createRecord: function FormStore_createRecord(guid, cryptoMetaURL) {
|
||||
let record = new FormRec();
|
||||
record.id = guid;
|
||||
|
||||
|
||||
if (guid in this._formItems) {
|
||||
let item = this._formItems[guid];
|
||||
record.encryption = cryptoMetaURL;
|
||||
|
@ -175,10 +175,10 @@ FormStore.prototype = {
|
|||
} else {
|
||||
record.deleted = true;
|
||||
}
|
||||
|
||||
|
||||
return record;
|
||||
},
|
||||
|
||||
|
||||
create: function FormStore_create(record) {
|
||||
this._log.debug("Adding form record for " + record.name);
|
||||
this._formHistory.addEntry(record.name, record.value);
|
||||
|
@ -186,20 +186,20 @@ FormStore.prototype = {
|
|||
|
||||
remove: function FormStore_remove(record) {
|
||||
this._log.trace("Removing form record: " + record.id);
|
||||
|
||||
|
||||
if (record.id in this._formItems) {
|
||||
let item = this._formItems[record.id];
|
||||
this._formHistory.removeEntry(item.name, item.value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this._log.trace("Invalid GUID found, ignoring remove request.");
|
||||
},
|
||||
|
||||
update: function FormStore_update(record) {
|
||||
this._log.warn("Ignoring form record update request!");
|
||||
},
|
||||
|
||||
|
||||
wipe: function FormStore_wipe() {
|
||||
this._formHistory.removeAllEntries();
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ FormTracker.prototype = {
|
|||
name: "forms",
|
||||
_logName: "FormTracker",
|
||||
file: "form",
|
||||
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver]),
|
||||
|
||||
|
||||
__observerService: null,
|
||||
get _observerService() {
|
||||
if (!this.__observerService)
|
||||
|
@ -223,13 +223,13 @@ FormTracker.prototype = {
|
|||
getService(Ci.nsIObserverService);
|
||||
return this.__observerService;
|
||||
},
|
||||
|
||||
|
||||
_init: function FormTracker__init() {
|
||||
this.__proto__.__proto__._init.call(this);
|
||||
this._log.trace("FormTracker initializing!");
|
||||
this._observerService.addObserver(this, "earlyformsubmit", false);
|
||||
},
|
||||
|
||||
|
||||
/* 10 points per form element */
|
||||
notify: function FormTracker_notify(formElement, aWindow, actionURI) {
|
||||
if (this.ignoreAll)
|
||||
|
|
|
@ -96,7 +96,7 @@ InputStore.prototype = {
|
|||
}
|
||||
return this.__histDB;
|
||||
},
|
||||
|
||||
|
||||
_getIDfromURI: function InputStore__getIDfromURI(uri) {
|
||||
let pidStmnt = this._placeDB.createStatement("SELECT id FROM moz_places WHERE url = ?1");
|
||||
pidStmnt.bindUTF8StringParameter(0, uri);
|
||||
|
@ -105,31 +105,31 @@ InputStore.prototype = {
|
|||
else
|
||||
return null;
|
||||
},
|
||||
|
||||
|
||||
_getInputHistory: function InputStore__getInputHistory(id) {
|
||||
let ipStmnt = this._placeDB.createStatement("SELECT input, use_count FROM moz_inputhistory WHERE place_id = ?1");
|
||||
ipStmnt.bindInt32Parameter(0, id);
|
||||
|
||||
|
||||
let input = [];
|
||||
while (ipStmnt.executeStep()) {
|
||||
let ip = ipStmnt.getUTF8String(0);
|
||||
let cnt = ipStmnt.getInt32(1);
|
||||
input[input.length] = {'input': ip, 'count': cnt};
|
||||
}
|
||||
|
||||
|
||||
return input;
|
||||
},
|
||||
|
||||
_createCommand: function InputStore__createCommand(command) {
|
||||
this._log.info("InputStore got createCommand: " + command);
|
||||
|
||||
|
||||
let placeID = this._getIDfromURI(command.GUID);
|
||||
if (placeID) {
|
||||
let createStmnt = this._placeDB.createStatement("INSERT INTO moz_inputhistory (?1, ?2, ?3)");
|
||||
createStmnt.bindInt32Parameter(0, placeID);
|
||||
createStmnt.bindUTF8StringParameter(1, command.data.input);
|
||||
createStmnt.bindInt32Parameter(2, command.data.count);
|
||||
|
||||
|
||||
createStmnt.execute();
|
||||
}
|
||||
},
|
||||
|
@ -144,17 +144,17 @@ InputStore.prototype = {
|
|||
|
||||
let placeID = this._getIDfromURI(command.GUID);
|
||||
let remStmnt = this._placeDB.createStatement("DELETE FROM moz_inputhistory WHERE place_id = ?1 AND input = ?2");
|
||||
|
||||
|
||||
remStmnt.bindInt32Parameter(0, placeID);
|
||||
remStmnt.bindUTF8StringParameter(1, command.data.input);
|
||||
remStmnt.execute();
|
||||
|
||||
|
||||
delete this._lookup[command.GUID];
|
||||
},
|
||||
|
||||
_editCommand: function InputStore__editCommand(command) {
|
||||
this._log.info("InputStore got editCommand: " + command);
|
||||
|
||||
|
||||
if (!(command.GUID in this._lookup)) {
|
||||
this._log.warn("Invalid GUID found, ignoring remove request.");
|
||||
return;
|
||||
|
@ -162,19 +162,19 @@ InputStore.prototype = {
|
|||
|
||||
let placeID = this._getIDfromURI(command.GUID);
|
||||
let editStmnt = this._placeDB.createStatement("UPDATE moz_inputhistory SET input = ?1, use_count = ?2 WHERE place_id = ?3");
|
||||
|
||||
|
||||
if ('input' in command.data) {
|
||||
editStmnt.bindUTF8StringParameter(0, command.data.input);
|
||||
} else {
|
||||
editStmnt.bindUTF8StringParameter(0, this._lookup[command.GUID].input);
|
||||
}
|
||||
|
||||
|
||||
if ('count' in command.data) {
|
||||
editStmnt.bindInt32Parameter(1, command.data.count);
|
||||
} else {
|
||||
editStmnt.bindInt32Parameter(1, this._lookup[command.GUID].count);
|
||||
}
|
||||
|
||||
|
||||
editStmnt.bindInt32Parameter(2, placeID);
|
||||
editStmnt.execute();
|
||||
},
|
||||
|
@ -182,7 +182,7 @@ InputStore.prototype = {
|
|||
wrap: function InputStore_wrap() {
|
||||
this._lookup = {};
|
||||
let stmnt = this._placeDB.createStatement("SELECT * FROM moz_inputhistory");
|
||||
|
||||
|
||||
while (stmnt.executeStep()) {
|
||||
let pid = stmnt.getInt32(0);
|
||||
let inp = stmnt.getUTF8String(1);
|
||||
|
@ -232,7 +232,7 @@ InputTracker.prototype = {
|
|||
return this.__histDB;
|
||||
},
|
||||
|
||||
/*
|
||||
/*
|
||||
* To calculate scores, we just count the changes in
|
||||
* the database since the last time we were asked.
|
||||
*
|
||||
|
|
|
@ -109,7 +109,7 @@ PasswordStore.prototype = {
|
|||
let prop = Cc["@mozilla.org/hash-property-bag;1"].
|
||||
createInstance(Ci.nsIWritablePropertyBag2);
|
||||
prop.setPropertyAsAUTF8String("guid", id);
|
||||
|
||||
|
||||
let logins = Svc.Login.searchLogins({}, prop);
|
||||
if (logins.length > 0) {
|
||||
this._log.trace(logins.length + " items matching " + id + " found.");
|
||||
|
@ -119,7 +119,7 @@ PasswordStore.prototype = {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
getAllIDs: function PasswordStore__getAllIDs() {
|
||||
let items = {};
|
||||
let logins = Svc.Login.getAllLogins({});
|
||||
|
@ -162,7 +162,7 @@ PasswordStore.prototype = {
|
|||
let record = new LoginRec();
|
||||
let login = this._getLoginFromGUID(guid);
|
||||
|
||||
record.id = guid;
|
||||
record.id = guid;
|
||||
if (login) {
|
||||
record.encryption = cryptoMetaURL;
|
||||
record.hostname = login.hostname;
|
||||
|
@ -185,7 +185,7 @@ PasswordStore.prototype = {
|
|||
|
||||
remove: function PasswordStore__remove(record) {
|
||||
this._log.trace("Removing login " + record.id);
|
||||
|
||||
|
||||
let loginItem = this._getLoginFromGUID(record.id);
|
||||
if (!loginItem) {
|
||||
this._log.trace("Asked to remove record that doesn't exist, ignoring");
|
||||
|
|
|
@ -88,20 +88,20 @@ PrefStore.prototype = {
|
|||
getService(Ci.nsIPrefService);
|
||||
let syncPrefs = service.getBranch(WEAVE_SYNC_PREFS).getChildList("", {}).
|
||||
map(function(elem) { return elem.substr(1); });
|
||||
|
||||
|
||||
this.__defineGetter__("_syncPrefs", function() syncPrefs);
|
||||
return syncPrefs;
|
||||
},
|
||||
|
||||
|
||||
_getAllPrefs: function PrefStore__getAllPrefs() {
|
||||
let values = [];
|
||||
let toSync = this._syncPrefs;
|
||||
|
||||
|
||||
let pref;
|
||||
for (let i = 0; i < toSync.length; i++) {
|
||||
if (!this._prefs.getBoolPref(WEAVE_SYNC_PREFS + "." + toSync[i]))
|
||||
continue;
|
||||
|
||||
|
||||
pref = {};
|
||||
pref["name"] = toSync[i];
|
||||
|
||||
|
@ -124,10 +124,10 @@ PrefStore.prototype = {
|
|||
if ("value" in pref)
|
||||
values[values.length] = pref;
|
||||
}
|
||||
|
||||
|
||||
return values;
|
||||
},
|
||||
|
||||
|
||||
_setAllPrefs: function PrefStore__setAllPrefs(values) {
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
switch (values[i]["type"]) {
|
||||
|
@ -145,36 +145,36 @@ PrefStore.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getAllIDs: function PrefStore_getAllIDs() {
|
||||
/* We store all prefs in just one WBO, with just one GUID */
|
||||
let allprefs = {};
|
||||
allprefs[WEAVE_PREFS_GUID] = this._getAllPrefs();
|
||||
return allprefs;
|
||||
},
|
||||
|
||||
|
||||
changeItemID: function PrefStore_changeItemID(oldID, newID) {
|
||||
this._log.trace("PrefStore GUID is constant!");
|
||||
},
|
||||
|
||||
|
||||
itemExists: function FormStore_itemExists(id) {
|
||||
return (id === WEAVE_PREFS_GUID);
|
||||
},
|
||||
|
||||
|
||||
createRecord: function FormStore_createRecord(guid, cryptoMetaURL) {
|
||||
let record = new PrefRec();
|
||||
record.id = guid;
|
||||
|
||||
|
||||
if (guid == WEAVE_PREFS_GUID) {
|
||||
record.encryption = cryptoMetaURL;
|
||||
record.value = this._getAllPrefs();
|
||||
} else {
|
||||
record.deleted = true;
|
||||
}
|
||||
|
||||
|
||||
return record;
|
||||
},
|
||||
|
||||
|
||||
create: function PrefStore_create(record) {
|
||||
this._log.trace("Ignoring create request");
|
||||
},
|
||||
|
@ -187,7 +187,7 @@ PrefStore.prototype = {
|
|||
this._log.trace("Received pref updates, applying...");
|
||||
this._setAllPrefs(record.value);
|
||||
},
|
||||
|
||||
|
||||
wipe: function PrefStore_wipe() {
|
||||
this._log.trace("Ignoring wipe request");
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ PrefTracker.prototype = {
|
|||
name: "prefs",
|
||||
_logName: "PrefTracker",
|
||||
file: "prefs",
|
||||
|
||||
|
||||
get _prefs() {
|
||||
let prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch2);
|
||||
|
@ -215,21 +215,21 @@ PrefTracker.prototype = {
|
|||
getService(Ci.nsIPrefService);
|
||||
let syncPrefs = service.getBranch(WEAVE_SYNC_PREFS).getChildList("", {}).
|
||||
map(function(elem) { return elem.substr(1); });
|
||||
|
||||
|
||||
this.__defineGetter__("_syncPrefs", function() syncPrefs);
|
||||
return syncPrefs;
|
||||
},
|
||||
|
||||
|
||||
_init: function PrefTracker__init() {
|
||||
this.__proto__.__proto__._init.call(this);
|
||||
this._prefs.addObserver("", this, false);
|
||||
this._prefs.addObserver("", this, false);
|
||||
},
|
||||
|
||||
|
||||
/* 25 points per pref change */
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic != "nsPref:changed")
|
||||
return;
|
||||
|
||||
|
||||
if (this._syncPrefs.indexOf(aData) != -1) {
|
||||
this.score += 1;
|
||||
this.addChangedID(WEAVE_PREFS_GUID);
|
||||
|
|
|
@ -265,7 +265,7 @@ Preferences.prototype = {
|
|||
else
|
||||
this._reset(prefName);
|
||||
},
|
||||
|
||||
|
||||
_reset: function(prefName) {
|
||||
try {
|
||||
this._prefSvc.clearUserPref(prefName);
|
||||
|
|
|
@ -146,12 +146,12 @@ Resource.prototype = {
|
|||
// Always validate the cache:
|
||||
channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
|
||||
|
||||
|
||||
// Setup a callback to handle bad HTTPS certificates.
|
||||
channel.notificationCallbacks = new badCertListener();
|
||||
|
||||
|
||||
// Avoid calling the authorizer more than once
|
||||
let headers = this.headers;
|
||||
let headers = this.headers;
|
||||
for (let key in headers) {
|
||||
if (key == 'Authorization')
|
||||
this._log.trace("HTTP Header " + key + ": ***** (suppressed)");
|
||||
|
@ -167,7 +167,7 @@ Resource.prototype = {
|
|||
// ** {{{ Resource._request }}} **
|
||||
//
|
||||
// Perform a particular HTTP request on the resource. This method
|
||||
// is never called directly, but is used by the high-level
|
||||
// is never called directly, but is used by the high-level
|
||||
// {{{get}}}, {{{put}}}, {{{post}}} and {{delete}} methods.
|
||||
_request: function Res__request(action, data) {
|
||||
let iter = 0;
|
||||
|
@ -176,7 +176,7 @@ Resource.prototype = {
|
|||
if ("undefined" != typeof(data))
|
||||
this._data = data;
|
||||
|
||||
// PUT and POST are trreated differently because
|
||||
// PUT and POST are trreated differently because
|
||||
// they have payload data.
|
||||
if ("PUT" == action || "POST" == action) {
|
||||
// Convert non-string bodies into JSON
|
||||
|
@ -304,7 +304,7 @@ Resource.prototype = {
|
|||
};
|
||||
|
||||
// = ChannelListener =
|
||||
//
|
||||
//
|
||||
// This object implements the {{{nsIStreamListener}}} interface
|
||||
// and is called as the network operation proceeds.
|
||||
function ChannelListener(onComplete, onProgress, logger) {
|
||||
|
|
|
@ -141,7 +141,7 @@ WeaveSvc.prototype = {
|
|||
// Only do work if it's actually changing
|
||||
if (value == this.serverURL)
|
||||
return;
|
||||
|
||||
|
||||
// A new server most likely uses a different cluster, so clear that
|
||||
Svc.Prefs.set("serverURL", value);
|
||||
Svc.Prefs.reset("clusterURL");
|
||||
|
@ -507,7 +507,7 @@ WeaveSvc.prototype = {
|
|||
_verifyLogin: function _verifyLogin()
|
||||
this._notify("verify-login", "", function() {
|
||||
// Make sure we have a cluster to verify against
|
||||
// this is a little weird, if we don't get a node we pretend
|
||||
// this is a little weird, if we don't get a node we pretend
|
||||
// to succeed, since that probably means we just don't have storage
|
||||
if (this.clusterURL == "" && !this._setCluster()) {
|
||||
Status.sync = NO_SYNC_NODE_FOUND;
|
||||
|
@ -1017,7 +1017,7 @@ WeaveSvc.prototype = {
|
|||
if (this.nextSync != 0)
|
||||
interval = this.nextSync - Date.now();
|
||||
// Use the bigger of default sync interval and backoff
|
||||
else
|
||||
else
|
||||
interval = Math.max(this.syncInterval, Status.backoffInterval);
|
||||
}
|
||||
|
||||
|
@ -1075,7 +1075,7 @@ WeaveSvc.prototype = {
|
|||
break;
|
||||
default:
|
||||
this._scheduleNextSync();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ Cu.import("resource://weave/ext/Observers.js");
|
|||
/*
|
||||
* Trackers are associated with a single engine and deal with
|
||||
* listening for changes to their particular data type.
|
||||
*
|
||||
*
|
||||
* There are two things they keep track of:
|
||||
* 1) A score, indicating how urgently the engine wants to sync
|
||||
* 2) A list of IDs for all the changed items that need to be synced
|
||||
|
@ -83,7 +83,7 @@ Tracker.prototype = {
|
|||
* -1: Do not sync unless the user specifically requests it (almost disabled)
|
||||
* 0: Nothing has changed
|
||||
* 100: Please sync me ASAP!
|
||||
*
|
||||
*
|
||||
* Setting it to other values should (but doesn't currently) throw an exception
|
||||
*/
|
||||
get score() {
|
||||
|
|
|
@ -728,7 +728,7 @@ let Utils = {
|
|||
try {
|
||||
return Str.errors.get(error, args || null);
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
// basically returns "Unknown Error"
|
||||
return Str.errors.get("error.reason.unknown");
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче