mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 524916 - remove any/all code/images/strings that we aren't using anymore
Remove unused sync engines (cookies, extensions, input, microformats, plugins, themes).
This commit is contained in:
parent
b4be46694e
commit
b4233752d2
@ -1,308 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Bookmarks Sync.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Jono DiCarlo <jdicarlo@mozilla.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const EXPORTED_SYMBOLS = ['CookieEngine', 'CookieTracker', 'CookieStore'];
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://weave/log4moz.js");
|
||||
Cu.import("resource://weave/engines.js");
|
||||
Cu.import("resource://weave/stores.js");
|
||||
Cu.import("resource://weave/trackers.js");
|
||||
|
||||
function CookieEngine(pbeId) {
|
||||
this._init(pbeId);
|
||||
}
|
||||
CookieEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
get name() { return "cookies"; },
|
||||
get _displayName() { return "Cookies"; },
|
||||
get logName() { return "CookieEngine"; },
|
||||
get serverPrefix() { return "user-data/cookies/"; },
|
||||
|
||||
__store: null,
|
||||
get _store() {
|
||||
if (!this.__store)
|
||||
this.__store = new CookieStore();
|
||||
return this.__store;
|
||||
},
|
||||
|
||||
__tracker: null,
|
||||
get _tracker() {
|
||||
if (!this.__tracker)
|
||||
this.__tracker = new CookieTracker();
|
||||
return this.__tracker;
|
||||
}
|
||||
};
|
||||
|
||||
function CookieStore( cookieManagerStub ) {
|
||||
// XXX disabled for now..
|
||||
return;
|
||||
/* If no argument is passed in, this store will query/write to the real
|
||||
Mozilla cookie manager component. This is the normal way to use this
|
||||
class in production code. But for unit-testing purposes, you can pass
|
||||
in a stub object that will be used in place of the cookieManager. */
|
||||
this._init();
|
||||
this._cookieManagerStub = cookieManagerStub;
|
||||
}
|
||||
CookieStore.prototype = {
|
||||
__proto__: Store.prototype,
|
||||
_logName: "CookieStore",
|
||||
_lookup: null,
|
||||
|
||||
// Documentation of the nsICookie interface says:
|
||||
// name ACString The name of the cookie. Read only.
|
||||
// value ACString The cookie value. Read only.
|
||||
// isDomain boolean True if the cookie is a domain cookie, false otherwise. Read only.
|
||||
// host AUTF8String The host (possibly fully qualified) of the cookie. Read only.
|
||||
// path AUTF8String The path pertaining to the cookie. Read only.
|
||||
// isSecure boolean True if the cookie was transmitted over ssl, false otherwise. Read only.
|
||||
// expires PRUint64 Expiration time (local timezone) expressed as number of seconds since Jan 1, 1970. Read only.
|
||||
// status nsCookieStatus Holds the P3P status of cookie. Read only.
|
||||
// policy nsCookiePolicy Holds the site's compact policy value. Read only.
|
||||
// nsICookie2 deprecates expires, status, and policy, and adds:
|
||||
//rawHost AUTF8String The host (possibly fully qualified) of the cookie without a leading dot to represent if it is a domain cookie. Read only.
|
||||
//isSession boolean True if the cookie is a session cookie. Read only.
|
||||
//expiry PRInt64 the actual expiry time of the cookie (where 0 does not represent a session cookie). Read only.
|
||||
//isHttpOnly boolean True if the cookie is an http only cookie. Read only.
|
||||
|
||||
__cookieManager: null,
|
||||
get _cookieManager() {
|
||||
if ( this._cookieManagerStub != undefined ) {
|
||||
return this._cookieManagerStub;
|
||||
}
|
||||
// otherwise, use the real one
|
||||
if (!this.__cookieManager)
|
||||
this.__cookieManager = Cc["@mozilla.org/cookiemanager;1"].
|
||||
getService(Ci.nsICookieManager2);
|
||||
// need the 2nd revision of the ICookieManager interface
|
||||
// because it supports add() and the 1st one doesn't.
|
||||
return this.__cookieManager;
|
||||
},
|
||||
|
||||
_createCommand: function CookieStore__createCommand(command) {
|
||||
/* we got a command to create a cookie in the local browser
|
||||
in order to sync with the server. */
|
||||
|
||||
this._log.debug("CookieStore got create command for: " + command.GUID);
|
||||
|
||||
// this assumes command.data fits the nsICookie2 interface
|
||||
if ( !command.data.isSession ) {
|
||||
// Add only persistent cookies ( not session cookies )
|
||||
this._cookieManager.add( command.data.host,
|
||||
command.data.path,
|
||||
command.data.name,
|
||||
command.data.value,
|
||||
command.data.isSecure,
|
||||
command.data.isHttpOnly,
|
||||
command.data.isSession,
|
||||
command.data.expiry );
|
||||
}
|
||||
},
|
||||
|
||||
_removeCommand: function CookieStore__removeCommand(command) {
|
||||
/* we got a command to remove a cookie from the local browser
|
||||
in order to sync with the server.
|
||||
command.data appears to be equivalent to what wrap() puts in
|
||||
the JSON dictionary. */
|
||||
|
||||
if (!(command.GUID in this._lookup)) {
|
||||
this._log.warn("Warning! Remove command for unknown item: " + command.GUID);
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.debug("CookieStore got remove command for: " + command.GUID);
|
||||
|
||||
/* I think it goes like this, according to
|
||||
http://developer.mozilla.org/en/docs/nsICookieManager
|
||||
the last argument is "always block cookies from this domain?"
|
||||
and the answer is "no". */
|
||||
this._cookieManager.remove(this._lookup[command.GUID].host,
|
||||
this._lookup[command.GUID].name,
|
||||
this._lookup[command.GUID].path,
|
||||
false);
|
||||
},
|
||||
|
||||
_editCommand: function CookieStore__editCommand(command) {
|
||||
/* we got a command to change a cookie in the local browser
|
||||
in order to sync with the server. */
|
||||
|
||||
if (!(command.GUID in this._lookup)) {
|
||||
this._log.warn("Warning! Edit command for unknown item: " + command.GUID);
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.debug("CookieStore got edit command for: " + command.GUID);
|
||||
|
||||
/* Look up the cookie that matches the one in the command: */
|
||||
var iter = this._cookieManager.enumerator;
|
||||
var matchingCookie = null;
|
||||
while (iter.hasMoreElements()){
|
||||
let cookie = iter.getNext();
|
||||
if (cookie.QueryInterface( Ci.nsICookie2 ) ){
|
||||
// see if host:path:name of cookie matches GUID given in command
|
||||
let key = cookie.host + ":" + cookie.path + ":" + cookie.name;
|
||||
if (key == command.GUID) {
|
||||
matchingCookie = cookie;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Update values in the cookie:
|
||||
for (var key in command.data) {
|
||||
// Whatever values command.data has, use them
|
||||
matchingCookie[ key ] = command.data[ key ];
|
||||
}
|
||||
// Remove the old incorrect cookie from the manager:
|
||||
this._cookieManager.remove( matchingCookie.host,
|
||||
matchingCookie.name,
|
||||
matchingCookie.path,
|
||||
false );
|
||||
|
||||
// Re-add the new updated cookie:
|
||||
if ( !command.data.isSession ) {
|
||||
/* ignore single-session cookies, add only persistent cookies. */
|
||||
this._cookieManager.add( matchingCookie.host,
|
||||
matchingCookie.path,
|
||||
matchingCookie.name,
|
||||
matchingCookie.value,
|
||||
matchingCookie.isSecure,
|
||||
matchingCookie.isHttpOnly,
|
||||
matchingCookie.isSession,
|
||||
matchingCookie.expiry );
|
||||
}
|
||||
|
||||
// Also, there's an exception raised because
|
||||
// this._data[comand.GUID] is undefined
|
||||
},
|
||||
|
||||
wrap: function CookieStore_wrap() {
|
||||
/* Return contents of this store, as JSON.
|
||||
A dictionary of cookies where the keys are GUIDs and the
|
||||
values are sub-dictionaries containing all cookie fields. */
|
||||
let items = {};
|
||||
var iter = this._cookieManager.enumerator;
|
||||
while (iter.hasMoreElements()) {
|
||||
var cookie = iter.getNext();
|
||||
if (cookie.QueryInterface( Ci.nsICookie2 )) {
|
||||
// String used to identify cookies is
|
||||
// host:path:name
|
||||
if ( cookie.isSession ) {
|
||||
/* Skip session-only cookies, sync only persistent cookies. */
|
||||
continue;
|
||||
}
|
||||
|
||||
let key = cookie.host + ":" + cookie.path + ":" + cookie.name;
|
||||
items[ key ] = { parentid: '',
|
||||
name: cookie.name,
|
||||
value: cookie.value,
|
||||
isDomain: cookie.isDomain,
|
||||
host: cookie.host,
|
||||
path: cookie.path,
|
||||
isSecure: cookie.isSecure,
|
||||
// nsICookie2 values:
|
||||
rawHost: cookie.rawHost,
|
||||
isSession: cookie.isSession,
|
||||
expiry: cookie.expiry,
|
||||
isHttpOnly: cookie.isHttpOnly };
|
||||
|
||||
/* See http://developer.mozilla.org/en/docs/nsICookie
|
||||
Note: not syncing "expires", "status", or "policy"
|
||||
since they're deprecated. */
|
||||
|
||||
}
|
||||
}
|
||||
this._lookup = items;
|
||||
return items;
|
||||
},
|
||||
|
||||
wipe: function CookieStore_wipe() {
|
||||
/* Remove everything from the store. Return nothing.
|
||||
TODO are the semantics of this just wiping out an internal
|
||||
buffer, or am I supposed to wipe out all cookies from
|
||||
the browser itself for reals? */
|
||||
this._cookieManager.removeAll();
|
||||
},
|
||||
|
||||
_resetGUIDs: function CookieStore__resetGUIDs() {
|
||||
/* called in the case where remote/local sync GUIDs do not
|
||||
match. We do need to override this, but since we're deriving
|
||||
GUIDs from the cookie data itself and not generating them,
|
||||
there's basically no way they can get "out of sync" so there's
|
||||
nothing to do here. */
|
||||
}
|
||||
};
|
||||
|
||||
function CookieTracker() {
|
||||
// XXX disabled for now..
|
||||
return;
|
||||
this._init();
|
||||
}
|
||||
CookieTracker.prototype = {
|
||||
__proto__: Tracker.prototype,
|
||||
_logName: "CookieTracker",
|
||||
|
||||
_init: function CT__init() {
|
||||
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||
this.score = 0;
|
||||
/* cookieService can't register observers, but what we CAN do is
|
||||
register a general observer with the global observerService
|
||||
to watch for the 'cookie-changed' message. */
|
||||
let observerService = Cc["@mozilla.org/observer-service;1"].
|
||||
getService(Ci.nsIObserverService);
|
||||
observerService.addObserver( this, 'cookie-changed', false );
|
||||
},
|
||||
|
||||
// implement observe method to satisfy nsIObserver interface
|
||||
observe: function ( aSubject, aTopic, aData ) {
|
||||
/* This gets called when any cookie is added, changed, or removed.
|
||||
aData will contain a string "added", "changed", etc. to tell us which,
|
||||
but for now we can treat them all the same. aSubject is the new
|
||||
cookie object itself. */
|
||||
var newCookie = aSubject.QueryInterface( Ci.nsICookie2 );
|
||||
if ( newCookie ) {
|
||||
if ( !newCookie.isSession ) {
|
||||
/* Any modification to a persistent cookie is worth
|
||||
10 points out of 100. Ignore session cookies. */
|
||||
this.score += 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************** BEGIN LICENSE BLOCK *****************************
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Weave Extension Engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009 the Initial
|
||||
* Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Edward Lee <edilee@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of either
|
||||
* the GNU General Public License Version 2 or later (the "GPL"), or the GNU
|
||||
* Lesser General Public License Version 2.1 or later (the "LGPL"), in which case
|
||||
* the provisions of the GPL or the LGPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only under the terms of
|
||||
* either the GPL or the LGPL, and not to allow others to use your version of
|
||||
* this file under the terms of the MPL, indicate your decision by deleting the
|
||||
* provisions above and replace them with the notice and other provisions
|
||||
* required by the GPL or the LGPL. If you do not delete the provisions above, a
|
||||
* recipient may use your version of this file under the terms of any one of the
|
||||
* MPL, the GPL or the LGPL.
|
||||
*
|
||||
****************************** END LICENSE BLOCK ******************************/
|
||||
|
||||
const EXPORTED_SYMBOLS = ["ExtensionEngine"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://weave/engines.js");
|
||||
|
||||
function ExtensionEngine() {
|
||||
this._init();
|
||||
}
|
||||
ExtensionEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
_displayName: "Extensions",
|
||||
description: "",
|
||||
logName: "Extensions",
|
||||
name: "extensions",
|
||||
};
|
@ -1,273 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Bookmarks Sync.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Anant Narayanan <anant@kix.in>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const EXPORTED_SYMBOLS = ['InputEngine'];
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://weave/log4moz.js");
|
||||
Cu.import("resource://weave/util.js");
|
||||
Cu.import("resource://weave/engines.js");
|
||||
Cu.import("resource://weave/stores.js");
|
||||
Cu.import("resource://weave/trackers.js");
|
||||
|
||||
function InputEngine(pbeId) {
|
||||
this._init(pbeId);
|
||||
}
|
||||
InputEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
get name() { return "input"; },
|
||||
get _displayName() { return "Input History (Location Bar)"; },
|
||||
get logName() { return "InputEngine"; },
|
||||
get serverPrefix() { return "user-data/input/"; },
|
||||
|
||||
__store: null,
|
||||
get _store() {
|
||||
if (!this.__store)
|
||||
this.__store = new InputStore();
|
||||
return this.__store;
|
||||
},
|
||||
|
||||
__tracker: null,
|
||||
get _tracker() {
|
||||
if (!this.__tracker)
|
||||
this.__tracker = new InputTracker();
|
||||
return this.__tracker;
|
||||
}
|
||||
};
|
||||
|
||||
function InputStore() {
|
||||
// XXX disabled for now..
|
||||
return;
|
||||
this._init();
|
||||
}
|
||||
InputStore.prototype = {
|
||||
__proto__: Store.prototype,
|
||||
_logName: "InputStore",
|
||||
_lookup: null,
|
||||
|
||||
__placeDB: null,
|
||||
get _placeDB() {
|
||||
if (!this.__placeDB) {
|
||||
let file = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
get("ProfD", Ci.nsIFile);
|
||||
file.append("places.sqlite");
|
||||
let stor = Cc["@mozilla.org/storage/service;1"].
|
||||
getService(Ci.mozIStorageService);
|
||||
this.__histDB = stor.openDatabase(file);
|
||||
}
|
||||
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);
|
||||
if (pidStmnt.executeStep())
|
||||
return pidStmnt.getInt32(0);
|
||||
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();
|
||||
}
|
||||
},
|
||||
|
||||
_removeCommand: function InputStore__removeCommand(command) {
|
||||
this._log.info("InputStore got removeCommand: " + command);
|
||||
|
||||
if (!(command.GUID in this._lookup)) {
|
||||
this._log.warn("Invalid GUID found, ignoring remove request.");
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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();
|
||||
},
|
||||
|
||||
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);
|
||||
let cnt = stmnt.getInt32(2);
|
||||
|
||||
let idStmnt = this._placeDB.createStatement("SELECT url FROM moz_places WHERE id = ?1");
|
||||
idStmnt.bindInt32Parameter(0, pid);
|
||||
if (idStmnt.executeStep()) {
|
||||
let key = idStmnt.getUTF8String(0);
|
||||
this._lookup[key] = { 'input': inp, 'count': cnt };
|
||||
}
|
||||
}
|
||||
|
||||
return this._lookup;
|
||||
},
|
||||
|
||||
wipe: function InputStore_wipe() {
|
||||
var stmnt = this._placeDB.createStatement("DELETE FROM moz_inputhistory");
|
||||
stmnt.execute();
|
||||
},
|
||||
|
||||
_resetGUIDs: function InputStore__resetGUIDs() {
|
||||
// Not needed.
|
||||
}
|
||||
};
|
||||
|
||||
function InputTracker() {
|
||||
// XXX disabled for now..
|
||||
return;
|
||||
this._init();
|
||||
}
|
||||
InputTracker.prototype = {
|
||||
__proto__: Tracker.prototype,
|
||||
_logName: "InputTracker",
|
||||
|
||||
__placeDB: null,
|
||||
get _placeDB() {
|
||||
if (!this.__placeDB) {
|
||||
let file = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).
|
||||
get("ProfD", Ci.nsIFile);
|
||||
file.append("places.sqlite");
|
||||
let stor = Cc["@mozilla.org/storage/service;1"].
|
||||
getService(Ci.mozIStorageService);
|
||||
this.__histDB = stor.openDatabase(file);
|
||||
}
|
||||
return this.__histDB;
|
||||
},
|
||||
|
||||
/*
|
||||
* To calculate scores, we just count the changes in
|
||||
* the database since the last time we were asked.
|
||||
*
|
||||
* Each change is worth 5 points.
|
||||
*/
|
||||
_rowCount: 0,
|
||||
get score() {
|
||||
var stmnt = this._placeDB.createStatement("SELECT COUNT(place_id) FROM moz_inputhistory");
|
||||
stmnt.executeStep();
|
||||
var count = stmnt.getInt32(0);
|
||||
stmnt.reset();
|
||||
|
||||
this._score = Math.abs(this._rowCount - count) * 5;
|
||||
|
||||
if (this._score >= 100)
|
||||
return 100;
|
||||
else
|
||||
return this._score;
|
||||
},
|
||||
|
||||
resetScore: function InputTracker_resetScore() {
|
||||
var stmnt = this._placeDB.createStatement("SELECT COUNT(place_id) FROM moz_inputhistory");
|
||||
stmnt.executeStep();
|
||||
this._rowCount = stmnt.getInt32(0);
|
||||
stmnt.reset();
|
||||
this._score = 0;
|
||||
},
|
||||
|
||||
_init: function InputTracker__init() {
|
||||
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||
this._score = 0;
|
||||
|
||||
var stmnt = this._placeDB.createStatement("SELECT COUNT(place_id) FROM moz_inputhistory");
|
||||
stmnt.executeStep();
|
||||
this._rowCount = stmnt.getInt32(0);
|
||||
stmnt.reset();
|
||||
}
|
||||
};
|
@ -1,51 +0,0 @@
|
||||
/***************************** BEGIN LICENSE BLOCK *****************************
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Weave MicroFormat Engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009 the Initial
|
||||
* Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Edward Lee <edilee@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of either
|
||||
* the GNU General Public License Version 2 or later (the "GPL"), or the GNU
|
||||
* Lesser General Public License Version 2.1 or later (the "LGPL"), in which case
|
||||
* the provisions of the GPL or the LGPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only under the terms of
|
||||
* either the GPL or the LGPL, and not to allow others to use your version of
|
||||
* this file under the terms of the MPL, indicate your decision by deleting the
|
||||
* provisions above and replace them with the notice and other provisions
|
||||
* required by the GPL or the LGPL. If you do not delete the provisions above, a
|
||||
* recipient may use your version of this file under the terms of any one of the
|
||||
* MPL, the GPL or the LGPL.
|
||||
*
|
||||
****************************** END LICENSE BLOCK ******************************/
|
||||
|
||||
const EXPORTED_SYMBOLS = ["MicroFormatEngine"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://weave/engines.js");
|
||||
|
||||
function MicroFormatEngine() {
|
||||
this._init();
|
||||
}
|
||||
MicroFormatEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
_displayName: "MicroFormats",
|
||||
description: "",
|
||||
logName: "MicroFormats",
|
||||
name: "microformats",
|
||||
};
|
@ -1,51 +0,0 @@
|
||||
/***************************** BEGIN LICENSE BLOCK *****************************
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Weave Plugin Engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009 the Initial
|
||||
* Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Edward Lee <edilee@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of either
|
||||
* the GNU General Public License Version 2 or later (the "GPL"), or the GNU
|
||||
* Lesser General Public License Version 2.1 or later (the "LGPL"), in which case
|
||||
* the provisions of the GPL or the LGPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only under the terms of
|
||||
* either the GPL or the LGPL, and not to allow others to use your version of
|
||||
* this file under the terms of the MPL, indicate your decision by deleting the
|
||||
* provisions above and replace them with the notice and other provisions
|
||||
* required by the GPL or the LGPL. If you do not delete the provisions above, a
|
||||
* recipient may use your version of this file under the terms of any one of the
|
||||
* MPL, the GPL or the LGPL.
|
||||
*
|
||||
****************************** END LICENSE BLOCK ******************************/
|
||||
|
||||
const EXPORTED_SYMBOLS = ["PluginEngine"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://weave/engines.js");
|
||||
|
||||
function PluginEngine() {
|
||||
this._init();
|
||||
}
|
||||
PluginEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
_displayName: "Plugins",
|
||||
description: "",
|
||||
logName: "Plugins",
|
||||
name: "plugins",
|
||||
};
|
@ -1,51 +0,0 @@
|
||||
/***************************** BEGIN LICENSE BLOCK *****************************
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Weave Theme Engine.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009 the Initial
|
||||
* Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Edward Lee <edilee@mozilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of either
|
||||
* the GNU General Public License Version 2 or later (the "GPL"), or the GNU
|
||||
* Lesser General Public License Version 2.1 or later (the "LGPL"), in which case
|
||||
* the provisions of the GPL or the LGPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only under the terms of
|
||||
* either the GPL or the LGPL, and not to allow others to use your version of
|
||||
* this file under the terms of the MPL, indicate your decision by deleting the
|
||||
* provisions above and replace them with the notice and other provisions
|
||||
* required by the GPL or the LGPL. If you do not delete the provisions above, a
|
||||
* recipient may use your version of this file under the terms of any one of the
|
||||
* MPL, the GPL or the LGPL.
|
||||
*
|
||||
****************************** END LICENSE BLOCK ******************************/
|
||||
|
||||
const EXPORTED_SYMBOLS = ["ThemeEngine"];
|
||||
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://weave/engines.js");
|
||||
|
||||
function ThemeEngine() {
|
||||
this._init();
|
||||
}
|
||||
ThemeEngine.prototype = {
|
||||
get enabled() null, // XXX force disabled in-case the pref was somehow set
|
||||
__proto__: SyncEngine.prototype,
|
||||
|
||||
_displayName: "Themes",
|
||||
description: "",
|
||||
logName: "Themes",
|
||||
name: "themes",
|
||||
};
|
@ -79,17 +79,11 @@ Cu.import("resource://weave/engines.js", Weave);
|
||||
|
||||
Cu.import("resource://weave/engines/bookmarks.js", Weave);
|
||||
Cu.import("resource://weave/engines/clientData.js", Weave);
|
||||
Cu.import("resource://weave/engines/cookies.js", Weave);
|
||||
Cu.import("resource://weave/engines/extensions.js", Weave);
|
||||
Cu.import("resource://weave/engines/forms.js", Weave);
|
||||
Cu.import("resource://weave/engines/history.js", Weave);
|
||||
Cu.import("resource://weave/engines/input.js", Weave);
|
||||
Cu.import("resource://weave/engines/prefs.js", Weave);
|
||||
Cu.import("resource://weave/engines/microformats.js", Weave);
|
||||
Cu.import("resource://weave/engines/passwords.js", Weave);
|
||||
Cu.import("resource://weave/engines/plugins.js", Weave);
|
||||
Cu.import("resource://weave/engines/tabs.js", Weave);
|
||||
Cu.import("resource://weave/engines/themes.js", Weave);
|
||||
|
||||
Utils.lazy(Weave, 'Service', WeaveSvc);
|
||||
|
||||
@ -371,7 +365,7 @@ WeaveSvc.prototype = {
|
||||
break;
|
||||
|
||||
case THUNDERBIRD_ID:
|
||||
engines = ["Cookie", "Password"];
|
||||
engines = ["Password"];
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,8 @@ pref("extensions.weave.autoconnect", true);
|
||||
pref("extensions.weave.syncOnQuit.enabled", true);
|
||||
|
||||
pref("extensions.weave.engine.bookmarks", true);
|
||||
//pref("extensions.weave.engine.cookies", false);
|
||||
pref("extensions.weave.engine.forms", true);
|
||||
pref("extensions.weave.engine.history", true);
|
||||
//pref("extensions.weave.engine.input", false);
|
||||
pref("extensions.weave.engine.passwords", true);
|
||||
pref("extensions.weave.engine.prefs", true);
|
||||
pref("extensions.weave.engine.tabs", true);
|
||||
|
Loading…
Reference in New Issue
Block a user