forked from mirrors/gecko-dev
Bug 1814931 - Convert services/sync modules to ES modules. r=markh
Differential Revision: https://phabricator.services.mozilla.com/D168836
This commit is contained in:
parent
b8b9107571
commit
6b1d3492e0
52 changed files with 278 additions and 514 deletions
|
|
@ -344,16 +344,16 @@ for (let entry of ignorableWhitelist) {
|
|||
}
|
||||
|
||||
if (!isDevtools) {
|
||||
// services/sync/modules/service.js
|
||||
// services/sync/modules/service.sys.mjs
|
||||
for (let module of [
|
||||
"addons.js",
|
||||
"bookmarks.js",
|
||||
"forms.js",
|
||||
"history.js",
|
||||
"passwords.js",
|
||||
"prefs.js",
|
||||
"tabs.js",
|
||||
"extension-storage.js",
|
||||
"addons.sys.mjs",
|
||||
"bookmarks.sys.mjs",
|
||||
"forms.sys.mjs",
|
||||
"history.sys.mjs",
|
||||
"passwords.sys.mjs",
|
||||
"prefs.sys.mjs",
|
||||
"tabs.sys.mjs",
|
||||
"extension-storage.sys.mjs",
|
||||
]) {
|
||||
whitelist.add("resource://services-sync/engines/" + module);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
||||
|
|
@ -62,10 +61,11 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
* // 4. Trigger loading of Sync.
|
||||
* service.ensureLoaded();
|
||||
*/
|
||||
function WeaveService() {
|
||||
export function WeaveService() {
|
||||
this.wrappedJSObject = this;
|
||||
this.ready = false;
|
||||
}
|
||||
|
||||
WeaveService.prototype = {
|
||||
classID: Components.ID("{74b89fb0-f200-4ae8-a3ec-dd164117f6de}"),
|
||||
|
||||
|
|
@ -144,7 +144,7 @@ WeaveService.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
function AboutWeaveLog() {}
|
||||
export function AboutWeaveLog() {}
|
||||
AboutWeaveLog.prototype = {
|
||||
classID: Components.ID("{d28f8a0b-95da-48f4-b712-caf37097be41}"),
|
||||
|
||||
|
|
@ -177,5 +177,3 @@ AboutWeaveLog.prototype = {
|
|||
return channel;
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["WeaveService", "AboutWeaveLog"];
|
||||
|
|
@ -8,13 +8,13 @@ Classes = [
|
|||
{
|
||||
'cid': '{74b89fb0-f200-4ae8-a3ec-dd164117f6de}',
|
||||
'contract_ids': ['@mozilla.org/weave/service;1'],
|
||||
'jsm': 'resource://services-sync/Weave.jsm',
|
||||
'esModule': 'resource://services-sync/Weave.sys.mjs',
|
||||
'constructor': 'WeaveService',
|
||||
},
|
||||
{
|
||||
'cid': '{d28f8a0b-95da-48f4-b712-caf37097be41}',
|
||||
'contract_ids': ['@mozilla.org/network/protocol/about;1?what=sync-log'],
|
||||
'jsm': 'resource://services-sync/Weave.jsm',
|
||||
'esModule': 'resource://services-sync/Weave.sys.mjs',
|
||||
'constructor': 'AboutWeaveLog',
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,22 +2,13 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"FakeCryptoService",
|
||||
"FakeFilesystemService",
|
||||
"FakeGUIDService",
|
||||
"fakeSHA256HMAC",
|
||||
];
|
||||
|
||||
const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
|
||||
const { RawCryptoWrapper } = ChromeUtils.import(
|
||||
"resource://services-sync/record.js"
|
||||
);
|
||||
const { Utils } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
|
||||
function FakeFilesystemService(contents) {
|
||||
export function FakeFilesystemService(contents) {
|
||||
this.fakeContents = contents;
|
||||
let self = this;
|
||||
|
||||
|
|
@ -62,7 +53,7 @@ function FakeFilesystemService(contents) {
|
|||
};
|
||||
}
|
||||
|
||||
function fakeSHA256HMAC(message) {
|
||||
export function fakeSHA256HMAC(message) {
|
||||
message = message.substr(0, 64);
|
||||
while (message.length < 64) {
|
||||
message += " ";
|
||||
|
|
@ -70,7 +61,7 @@ function fakeSHA256HMAC(message) {
|
|||
return message;
|
||||
}
|
||||
|
||||
function FakeGUIDService() {
|
||||
export function FakeGUIDService() {
|
||||
let latestGUID = 0;
|
||||
|
||||
Utils.makeGUID = function makeGUID() {
|
||||
|
|
@ -84,7 +75,7 @@ function FakeGUIDService() {
|
|||
* Mock implementation of WeaveCrypto. It does not encrypt or
|
||||
* decrypt, merely returning the input verbatim.
|
||||
*/
|
||||
function FakeCryptoService() {
|
||||
export function FakeCryptoService() {
|
||||
this.counter = 0;
|
||||
|
||||
delete Weave.Crypto; // get rid of the getter first
|
||||
|
|
@ -96,6 +87,7 @@ function FakeCryptoService() {
|
|||
return fakeSHA256HMAC(this.ciphertext);
|
||||
};
|
||||
}
|
||||
|
||||
FakeCryptoService.prototype = {
|
||||
async encrypt(clearText, symmetricKey, iv) {
|
||||
return clearText;
|
||||
|
|
@ -2,13 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["initializeIdentityWithTokenServerResponse"];
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
|
||||
const { SyncAuthManager } = ChromeUtils.import(
|
||||
"resource://services-sync/sync_auth.js"
|
||||
|
|
@ -22,7 +17,7 @@ const { configureFxAccountIdentity } = ChromeUtils.import(
|
|||
|
||||
// Create a new sync_auth object and initialize it with a
|
||||
// mocked TokenServerClient which always receives the specified response.
|
||||
var initializeIdentityWithTokenServerResponse = function(response) {
|
||||
export var initializeIdentityWithTokenServerResponse = function(response) {
|
||||
// First create a mock "request" object that well' hack into the token server.
|
||||
// A log for it
|
||||
let requestLog = Log.repository.getLogger("testing.mock-rest");
|
||||
|
|
@ -2,15 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"RotaryEngine",
|
||||
"RotaryRecord",
|
||||
"RotaryStore",
|
||||
"RotaryTracker",
|
||||
];
|
||||
|
||||
const { Store, SyncEngine, LegacyTracker } = ChromeUtils.import(
|
||||
"resource://services-sync/engines.js"
|
||||
);
|
||||
|
|
@ -28,17 +19,19 @@ const { SerializableSet, Utils } = ChromeUtils.import(
|
|||
* Complete with record, store, and tracker implementations.
|
||||
*/
|
||||
|
||||
function RotaryRecord(collection, id) {
|
||||
export function RotaryRecord(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
RotaryRecord.prototype = {};
|
||||
Object.setPrototypeOf(RotaryRecord.prototype, CryptoWrapper.prototype);
|
||||
Utils.deferGetSet(RotaryRecord, "cleartext", ["denomination"]);
|
||||
|
||||
function RotaryStore(name, engine) {
|
||||
export function RotaryStore(name, engine) {
|
||||
Store.call(this, name, engine);
|
||||
this.items = {};
|
||||
}
|
||||
|
||||
RotaryStore.prototype = {
|
||||
async create(record) {
|
||||
this.items[record.id] = record.denomination;
|
||||
|
|
@ -91,18 +84,20 @@ RotaryStore.prototype = {
|
|||
|
||||
Object.setPrototypeOf(RotaryStore.prototype, Store.prototype);
|
||||
|
||||
function RotaryTracker(name, engine) {
|
||||
export function RotaryTracker(name, engine) {
|
||||
LegacyTracker.call(this, name, engine);
|
||||
}
|
||||
|
||||
RotaryTracker.prototype = {};
|
||||
Object.setPrototypeOf(RotaryTracker.prototype, LegacyTracker.prototype);
|
||||
|
||||
function RotaryEngine(service) {
|
||||
export function RotaryEngine(service) {
|
||||
SyncEngine.call(this, "Rotary", service);
|
||||
// Ensure that the engine starts with a clean slate.
|
||||
this.toFetch = new SerializableSet();
|
||||
this.previousFailed = new SerializableSet();
|
||||
}
|
||||
|
||||
RotaryEngine.prototype = {
|
||||
_storeObj: RotaryStore,
|
||||
_trackerObj: RotaryTracker,
|
||||
|
|
@ -2,30 +2,11 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"encryptPayload",
|
||||
"makeIdentityConfig",
|
||||
"makeFxAccountsInternalMock",
|
||||
"configureFxAccountIdentity",
|
||||
"configureIdentity",
|
||||
"SyncTestingInfrastructure",
|
||||
"waitForZeroTimer",
|
||||
"promiseZeroTimer",
|
||||
"promiseNamedTimer",
|
||||
"MockFxaStorageManager",
|
||||
"AccountState", // from a module import
|
||||
"sumHistogram",
|
||||
"syncTestLogging",
|
||||
];
|
||||
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
);
|
||||
const { Assert } = ChromeUtils.importESModule(
|
||||
"resource://testing-common/Assert.sys.mjs"
|
||||
);
|
||||
import { Assert } from "resource://testing-common/Assert.sys.mjs";
|
||||
|
||||
const { initTestLogging } = ChromeUtils.import(
|
||||
"resource://testing-common/services/common/logging.js"
|
||||
);
|
||||
|
|
@ -48,12 +29,12 @@ const { SCOPE_OLD_SYNC, LEGACY_SCOPE_WEBEXT_SYNC } = ChromeUtils.import(
|
|||
);
|
||||
|
||||
// and grab non-exported stuff via a backstage pass.
|
||||
const { AccountState } = ChromeUtils.import(
|
||||
export const { AccountState } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
);
|
||||
|
||||
// A mock "storage manager" for FxAccounts that doesn't actually write anywhere.
|
||||
function MockFxaStorageManager() {}
|
||||
export function MockFxaStorageManager() {}
|
||||
|
||||
MockFxaStorageManager.prototype = {
|
||||
promiseInitialized: Promise.resolve(),
|
||||
|
|
@ -110,7 +91,7 @@ MockFxaStorageManager.prototype = {
|
|||
* we can account for the timer in delayedAutoconnect) and then two event
|
||||
* loop ticks (to account for the CommonUtils.nextTick() in autoConnect).
|
||||
*/
|
||||
function waitForZeroTimer(callback) {
|
||||
export function waitForZeroTimer(callback) {
|
||||
let ticks = 2;
|
||||
function wait() {
|
||||
if (ticks) {
|
||||
|
|
@ -123,13 +104,13 @@ function waitForZeroTimer(callback) {
|
|||
CommonUtils.namedTimer(wait, 150, {}, "timer");
|
||||
}
|
||||
|
||||
var promiseZeroTimer = function() {
|
||||
export var promiseZeroTimer = function() {
|
||||
return new Promise(resolve => {
|
||||
waitForZeroTimer(resolve);
|
||||
});
|
||||
};
|
||||
|
||||
var promiseNamedTimer = function(wait, thisObj, name) {
|
||||
export var promiseNamedTimer = function(wait, thisObj, name) {
|
||||
return new Promise(resolve => {
|
||||
CommonUtils.namedTimer(resolve, wait, thisObj, name);
|
||||
});
|
||||
|
|
@ -139,7 +120,7 @@ var promiseNamedTimer = function(wait, thisObj, name) {
|
|||
// providers. |overrides| can specify overrides for any default values.
|
||||
// |server| is optional, but if specified, will be used to form the cluster
|
||||
// URL for the FxA identity.
|
||||
var makeIdentityConfig = function(overrides) {
|
||||
export var makeIdentityConfig = function(overrides) {
|
||||
// first setup the defaults.
|
||||
let result = {
|
||||
// Username used in both fxaccount and sync identity configs.
|
||||
|
|
@ -197,7 +178,7 @@ var makeIdentityConfig = function(overrides) {
|
|||
return result;
|
||||
};
|
||||
|
||||
var makeFxAccountsInternalMock = function(config) {
|
||||
export var makeFxAccountsInternalMock = function(config) {
|
||||
return {
|
||||
newAccountState(credentials) {
|
||||
// We only expect this to be called with null indicating the (mock)
|
||||
|
|
@ -233,7 +214,7 @@ var makeFxAccountsInternalMock = function(config) {
|
|||
|
||||
// Configure an instance of an FxAccount identity provider with the specified
|
||||
// config (or the default config if not specified).
|
||||
var configureFxAccountIdentity = function(
|
||||
export var configureFxAccountIdentity = function(
|
||||
authService,
|
||||
config = makeIdentityConfig(),
|
||||
fxaInternal = makeFxAccountsInternalMock(config)
|
||||
|
|
@ -279,7 +260,7 @@ var configureFxAccountIdentity = function(
|
|||
authService._account = config.fxaccount.user.email;
|
||||
};
|
||||
|
||||
var configureIdentity = async function(identityOverrides, server) {
|
||||
export var configureIdentity = async function(identityOverrides, server) {
|
||||
let config = makeIdentityConfig(identityOverrides, server);
|
||||
// Must be imported after the identity configuration is set up.
|
||||
let { Service } = ChromeUtils.import("resource://services-sync/service.js");
|
||||
|
|
@ -307,14 +288,14 @@ var configureIdentity = async function(identityOverrides, server) {
|
|||
}
|
||||
};
|
||||
|
||||
function syncTestLogging(level = "Trace") {
|
||||
export function syncTestLogging(level = "Trace") {
|
||||
let logStats = initTestLogging(level);
|
||||
Services.prefs.setStringPref("services.sync.log.logger", level);
|
||||
Services.prefs.setStringPref("services.sync.log.logger.engine", "");
|
||||
return logStats;
|
||||
}
|
||||
|
||||
var SyncTestingInfrastructure = async function(server, username) {
|
||||
export var SyncTestingInfrastructure = async function(server, username) {
|
||||
let config = makeIdentityConfig({ username });
|
||||
await configureIdentity(config, server);
|
||||
return {
|
||||
|
|
@ -328,7 +309,7 @@ var SyncTestingInfrastructure = async function(server, username) {
|
|||
/**
|
||||
* Turn WBO cleartext into fake "encrypted" payload as it goes over the wire.
|
||||
*/
|
||||
function encryptPayload(cleartext) {
|
||||
export function encryptPayload(cleartext) {
|
||||
if (typeof cleartext == "object") {
|
||||
cleartext = JSON.stringify(cleartext);
|
||||
}
|
||||
|
|
@ -340,7 +321,7 @@ function encryptPayload(cleartext) {
|
|||
};
|
||||
}
|
||||
|
||||
var sumHistogram = function(name, options = {}) {
|
||||
export var sumHistogram = function(name, options = {}) {
|
||||
let histogram = options.key
|
||||
? Services.telemetry.getKeyedHistogramById(name)
|
||||
: Services.telemetry.getHistogramById(name);
|
||||
|
|
@ -5,9 +5,7 @@
|
|||
// This module provides a facility for disconnecting Sync and FxA, optionally
|
||||
// sanitizing profile data as part of the process.
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
|
@ -32,9 +30,7 @@ XPCOMUtils.defineLazyGetter(lazy, "FxAccountsCommon", function() {
|
|||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
});
|
||||
|
||||
const EXPORTED_SYMBOLS = ["SyncDisconnectInternal", "SyncDisconnect"];
|
||||
|
||||
const SyncDisconnectInternal = {
|
||||
export const SyncDisconnectInternal = {
|
||||
lockRetryInterval: 1000, // wait 1 seconds before trying for the lock again.
|
||||
lockRetryCount: 120, // Try 120 times (==2 mins) before giving up in disgust.
|
||||
promiseDisconnectFinished: null, // If we are sanitizing, a promise for completion.
|
||||
|
|
@ -235,7 +231,7 @@ const SyncDisconnectInternal = {
|
|||
},
|
||||
};
|
||||
|
||||
const SyncDisconnect = {
|
||||
export const SyncDisconnect = {
|
||||
get promiseDisconnectFinished() {
|
||||
return SyncDisconnectInternal.promiseDisconnectFinished;
|
||||
},
|
||||
|
|
@ -2,20 +2,11 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SyncedTabs"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
|
||||
const { Preferences } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Preferences.sys.mjs"
|
||||
);
|
||||
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
|
@ -261,7 +252,7 @@ Services.obs.addObserver(SyncedTabsInternal, "weave:service:start-over");
|
|||
Services.prefs.addObserver("services.sync.engine.tabs", SyncedTabsInternal);
|
||||
|
||||
// The public interface.
|
||||
var SyncedTabs = {
|
||||
export var SyncedTabs = {
|
||||
// A mock-point for tests.
|
||||
_internal: SyncedTabsInternal,
|
||||
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @typedef {Object} UIState
|
||||
* @property {string} status The Sync/FxA status, see STATUS_* constants.
|
||||
|
|
@ -14,8 +12,6 @@
|
|||
* @property {boolean} [syncing] Whether or not we are currently syncing.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["UIState"];
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineModuleGetter(
|
||||
lazy,
|
||||
|
|
@ -234,9 +230,8 @@ const UIStateInternal = {
|
|||
},
|
||||
};
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(UIStateInternal, "fxAccounts", () => {
|
||||
return ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
|
|
@ -247,7 +242,7 @@ for (let topic of TOPICS) {
|
|||
Services.obs.addObserver(UIStateInternal, topic);
|
||||
}
|
||||
|
||||
var UIState = {
|
||||
export var UIState = {
|
||||
_internal: UIStateInternal,
|
||||
|
||||
ON_UPDATE,
|
||||
|
|
@ -15,11 +15,8 @@
|
|||
* hopefully ported.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Svc, Utils } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
const { AddonManager } = ChromeUtils.import(
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
|
|
@ -27,18 +24,11 @@ const { AddonManager } = ChromeUtils.import(
|
|||
|
||||
const DEFAULT_STATE_FILE = "addonsreconciler";
|
||||
|
||||
var CHANGE_INSTALLED = 1;
|
||||
var CHANGE_UNINSTALLED = 2;
|
||||
var CHANGE_ENABLED = 3;
|
||||
var CHANGE_DISABLED = 4;
|
||||
export var CHANGE_INSTALLED = 1;
|
||||
export var CHANGE_UNINSTALLED = 2;
|
||||
export var CHANGE_ENABLED = 3;
|
||||
export var CHANGE_DISABLED = 4;
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"AddonsReconciler",
|
||||
"CHANGE_INSTALLED",
|
||||
"CHANGE_UNINSTALLED",
|
||||
"CHANGE_ENABLED",
|
||||
"CHANGE_DISABLED",
|
||||
];
|
||||
/**
|
||||
* Maintains state of add-ons.
|
||||
*
|
||||
|
|
@ -96,13 +86,14 @@ var EXPORTED_SYMBOLS = [
|
|||
* events will occur immediately. However, we still see disabling events and
|
||||
* heed them like they were normal. In the end, the state is proper.
|
||||
*/
|
||||
function AddonsReconciler(queueCaller) {
|
||||
export function AddonsReconciler(queueCaller) {
|
||||
this._log = Log.repository.getLogger("Sync.AddonsReconciler");
|
||||
this._log.manageLevelFromPref("services.sync.log.logger.addonsreconciler");
|
||||
this.queueCaller = queueCaller;
|
||||
|
||||
Svc.Obs.add("xpcom-shutdown", this.stopListening, this);
|
||||
}
|
||||
|
||||
AddonsReconciler.prototype = {
|
||||
/** Flag indicating whether we are listening to AddonManager events. */
|
||||
_listening: false,
|
||||
|
|
@ -2,13 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AddonUtils"];
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Svc } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
|
||||
const lazy = {};
|
||||
|
|
@ -398,4 +393,4 @@ AddonUtilsInternal.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
const AddonUtils = new AddonUtilsInternal();
|
||||
export const AddonUtils = new AddonUtilsInternal();
|
||||
|
|
@ -28,8 +28,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["BridgeWrapperXPCOM", "BridgedEngine", "LogAdapter"];
|
||||
|
||||
/**
|
||||
* A stub store that converts between raw decrypted incoming records and
|
||||
* envelopes. Since the interface we need is so minimal, this class doesn't
|
||||
|
|
@ -153,7 +151,7 @@ class InterruptedError extends Error {
|
|||
* Adapts a `Log.sys.mjs` logger to a `mozIServicesLogSink`. This class is copied
|
||||
* from `SyncedBookmarksMirror.jsm`.
|
||||
*/
|
||||
class LogAdapter {
|
||||
export class LogAdapter {
|
||||
constructor(log) {
|
||||
this.log = log;
|
||||
}
|
||||
|
|
@ -194,7 +192,7 @@ class LogAdapter {
|
|||
|
||||
// This converts the XPCOM-defined, callback-based mozIBridgedSyncEngine to
|
||||
// a promise-based implementation.
|
||||
class BridgeWrapperXPCOM {
|
||||
export class BridgeWrapperXPCOM {
|
||||
constructor(component) {
|
||||
this.comp = component;
|
||||
}
|
||||
|
|
@ -312,7 +310,7 @@ class BridgeWrapperXPCOM {
|
|||
* tracker is fine, because the shape of the `Tracker` interface may not make
|
||||
* sense for all engines.
|
||||
*/
|
||||
function BridgedEngine(name, service) {
|
||||
export function BridgedEngine(name, service) {
|
||||
SyncEngine.call(this, name, service);
|
||||
}
|
||||
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
|
@ -12,9 +10,7 @@ ChromeUtils.defineModuleGetter(
|
|||
"resource://services-common/async.js"
|
||||
);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["CollectionValidator", "CollectionProblemData"];
|
||||
|
||||
class CollectionProblemData {
|
||||
export class CollectionProblemData {
|
||||
constructor() {
|
||||
this.missingIDs = 0;
|
||||
this.clientDuplicates = [];
|
||||
|
|
@ -47,7 +43,7 @@ class CollectionProblemData {
|
|||
}
|
||||
}
|
||||
|
||||
class CollectionValidator {
|
||||
export class CollectionValidator {
|
||||
// Construct a generic collection validator. This is intended to be called by
|
||||
// subclasses.
|
||||
// - name: Name of the engine
|
||||
|
|
@ -7,13 +7,8 @@
|
|||
// attempt to cure, or may decide she is overworked and underpaid.
|
||||
// Or something - naming is hard :)
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Doctor"];
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { Observers } = ChromeUtils.import(
|
||||
"resource://services-common/observers.js"
|
||||
|
|
@ -25,7 +20,7 @@ const { Svc } = ChromeUtils.import("resource://services-sync/util.js");
|
|||
|
||||
const log = Log.repository.getLogger("Sync.Doctor");
|
||||
|
||||
var Doctor = {
|
||||
export var Doctor = {
|
||||
async consult(recentlySyncedEngines) {
|
||||
if (!Services.telemetry.canRecordBase) {
|
||||
log.info("Skipping consultation: telemetry reporting is disabled");
|
||||
|
|
@ -2,24 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"EngineManager",
|
||||
"SyncEngine",
|
||||
"Tracker",
|
||||
"LegacyTracker",
|
||||
"Store",
|
||||
"Changeset",
|
||||
];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
import { JSONFile } from "resource://gre/modules/JSONFile.sys.mjs";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { JSONFile } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/JSONFile.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { Observers } = ChromeUtils.import(
|
||||
"resource://services-common/observers.js"
|
||||
|
|
@ -62,7 +49,7 @@ function ensureDirectory(path) {
|
|||
* bookmarks, bridged engines, addresses, and credit cards) or only upload a
|
||||
* single record (tabs and preferences) should subclass `Tracker`.
|
||||
*/
|
||||
function Tracker(name, engine) {
|
||||
export function Tracker(name, engine) {
|
||||
if (!engine) {
|
||||
throw new Error("Tracker must be associated with an Engine instance.");
|
||||
}
|
||||
|
|
@ -206,7 +193,7 @@ Tracker.prototype = {
|
|||
* consistency issues due to missed notifications, interrupted syncs, and the
|
||||
* tracker's view of what changed diverging from the data store's.
|
||||
*/
|
||||
function LegacyTracker(name, engine) {
|
||||
export function LegacyTracker(name, engine) {
|
||||
Tracker.call(this, name, engine);
|
||||
|
||||
this._ignored = [];
|
||||
|
|
@ -353,7 +340,7 @@ Object.setPrototypeOf(LegacyTracker.prototype, Tracker.prototype);
|
|||
* and/or applyIncoming function on top of the basic APIs.
|
||||
*/
|
||||
|
||||
function Store(name, engine) {
|
||||
export function Store(name, engine) {
|
||||
if (!engine) {
|
||||
throw new Error("Store must be associated with an Engine instance.");
|
||||
}
|
||||
|
|
@ -368,6 +355,7 @@ function Store(name, engine) {
|
|||
return Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
});
|
||||
}
|
||||
|
||||
Store.prototype = {
|
||||
/**
|
||||
* Apply multiple incoming records against the store.
|
||||
|
|
@ -541,7 +529,7 @@ Store.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
function EngineManager(service) {
|
||||
export function EngineManager(service) {
|
||||
this.service = service;
|
||||
|
||||
this._engines = {};
|
||||
|
|
@ -558,6 +546,7 @@ function EngineManager(service) {
|
|||
.getLogger(`Sync.Engine`)
|
||||
.manageLevelFromPref("services.sync.log.logger.engine");
|
||||
}
|
||||
|
||||
EngineManager.prototype = {
|
||||
get(name) {
|
||||
// Return an array of engines if we have an array of names
|
||||
|
|
@ -753,7 +742,7 @@ EngineManager.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
function SyncEngine(name, service) {
|
||||
export function SyncEngine(name, service) {
|
||||
if (!service) {
|
||||
throw new Error("SyncEngine must be associated with a Service instance.");
|
||||
}
|
||||
|
|
@ -2171,7 +2160,7 @@ SyncEngine.prototype = {
|
|||
* only records timestamps, though engines can extend this to store additional
|
||||
* data for each entry.
|
||||
*/
|
||||
class Changeset {
|
||||
export class Changeset {
|
||||
// Creates an empty changeset.
|
||||
constructor() {
|
||||
this.changes = {};
|
||||
|
|
@ -34,11 +34,9 @@
|
|||
*
|
||||
* See the documentation in all.js for the behavior of these prefs.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const { Preferences } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Preferences.sys.mjs"
|
||||
);
|
||||
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
|
||||
|
||||
const { AddonUtils } = ChromeUtils.import(
|
||||
"resource://services-sync/addonutils.js"
|
||||
);
|
||||
|
|
@ -72,8 +70,6 @@ ChromeUtils.defineModuleGetter(
|
|||
"resource://gre/modules/addons/AddonRepository.jsm"
|
||||
);
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AddonsEngine", "AddonValidator"];
|
||||
|
||||
// 7 days in milliseconds.
|
||||
const PRUNE_ADDON_CHANGES_THRESHOLD = 60 * 60 * 24 * 7 * 1000;
|
||||
|
||||
|
|
@ -131,11 +127,12 @@ Utils.deferGetSet(AddonRecord, "cleartext", [
|
|||
* The engine instance overrides a handful of functions on the base class. The
|
||||
* rationale for each is documented by that function.
|
||||
*/
|
||||
function AddonsEngine(service) {
|
||||
export function AddonsEngine(service) {
|
||||
SyncEngine.call(this, "Addons", service);
|
||||
|
||||
this._reconciler = new AddonsReconciler(this._tracker.asyncObserver);
|
||||
}
|
||||
|
||||
AddonsEngine.prototype = {
|
||||
_storeObj: AddonsStore,
|
||||
_trackerObj: AddonsTracker,
|
||||
|
|
@ -782,7 +779,7 @@ AddonsTracker.prototype = {
|
|||
|
||||
Object.setPrototypeOf(AddonsTracker.prototype, LegacyTracker.prototype);
|
||||
|
||||
class AddonValidator extends CollectionValidator {
|
||||
export class AddonValidator extends CollectionValidator {
|
||||
constructor(engine = null) {
|
||||
super("addons", "id", ["addonID", "enabled", "applicationID", "source"]);
|
||||
this.engine = engine;
|
||||
|
|
@ -2,19 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"BookmarksEngine",
|
||||
"PlacesItem",
|
||||
"Bookmark",
|
||||
"BookmarkFolder",
|
||||
"BookmarkQuery",
|
||||
"Livemark",
|
||||
"BookmarkSeparator",
|
||||
];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { SCORE_INCREMENT_XLARGE } = ChromeUtils.import(
|
||||
"resource://services-sync/constants.js"
|
||||
|
|
@ -100,10 +89,11 @@ function getTypeObject(type) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function PlacesItem(collection, id, type) {
|
||||
export function PlacesItem(collection, id, type) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
this.type = type || "item";
|
||||
}
|
||||
|
||||
PlacesItem.prototype = {
|
||||
async decrypt(keyBundle) {
|
||||
// Do the normal CryptoWrapper decrypt, but change types before returning
|
||||
|
|
@ -166,9 +156,10 @@ Utils.deferGetSet(PlacesItem, "cleartext", [
|
|||
"dateAdded",
|
||||
]);
|
||||
|
||||
function Bookmark(collection, id, type) {
|
||||
export function Bookmark(collection, id, type) {
|
||||
PlacesItem.call(this, collection, id, type || "bookmark");
|
||||
}
|
||||
|
||||
Bookmark.prototype = {
|
||||
_logName: "Sync.Record.Bookmark",
|
||||
|
||||
|
|
@ -202,9 +193,10 @@ Utils.deferGetSet(Bookmark, "cleartext", [
|
|||
"keyword",
|
||||
]);
|
||||
|
||||
function BookmarkQuery(collection, id) {
|
||||
export function BookmarkQuery(collection, id) {
|
||||
Bookmark.call(this, collection, id, "query");
|
||||
}
|
||||
|
||||
BookmarkQuery.prototype = {
|
||||
_logName: "Sync.Record.BookmarkQuery",
|
||||
|
||||
|
|
@ -226,9 +218,10 @@ Object.setPrototypeOf(BookmarkQuery.prototype, Bookmark.prototype);
|
|||
|
||||
Utils.deferGetSet(BookmarkQuery, "cleartext", ["folderName", "queryId"]);
|
||||
|
||||
function BookmarkFolder(collection, id, type) {
|
||||
export function BookmarkFolder(collection, id, type) {
|
||||
PlacesItem.call(this, collection, id, type || "folder");
|
||||
}
|
||||
|
||||
BookmarkFolder.prototype = {
|
||||
_logName: "Sync.Record.Folder",
|
||||
|
||||
|
|
@ -255,9 +248,10 @@ Utils.deferGetSet(BookmarkFolder, "cleartext", [
|
|||
"children",
|
||||
]);
|
||||
|
||||
function Livemark(collection, id) {
|
||||
export function Livemark(collection, id) {
|
||||
BookmarkFolder.call(this, collection, id, "livemark");
|
||||
}
|
||||
|
||||
Livemark.prototype = {
|
||||
_logName: "Sync.Record.Livemark",
|
||||
|
||||
|
|
@ -281,9 +275,10 @@ Object.setPrototypeOf(Livemark.prototype, BookmarkFolder.prototype);
|
|||
|
||||
Utils.deferGetSet(Livemark, "cleartext", ["siteUri", "feedUri"]);
|
||||
|
||||
function BookmarkSeparator(collection, id) {
|
||||
export function BookmarkSeparator(collection, id) {
|
||||
PlacesItem.call(this, collection, id, "separator");
|
||||
}
|
||||
|
||||
BookmarkSeparator.prototype = {
|
||||
_logName: "Sync.Record.Separator",
|
||||
|
||||
|
|
@ -303,9 +298,10 @@ Utils.deferGetSet(BookmarkSeparator, "cleartext", "pos");
|
|||
* handles reconciliation, so we stub out `_reconcile`, and wait to pull changes
|
||||
* until we're ready to upload.
|
||||
*/
|
||||
function BookmarksEngine(service) {
|
||||
export function BookmarksEngine(service) {
|
||||
SyncEngine.call(this, "Bookmarks", service);
|
||||
}
|
||||
|
||||
BookmarksEngine.prototype = {
|
||||
_recordObj: PlacesItem,
|
||||
_trackerObj: BookmarksTracker,
|
||||
|
|
@ -20,8 +20,6 @@
|
|||
* commands.json, update it, and write it back out.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ClientEngine", "ClientsRec"];
|
||||
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const {
|
||||
DEVICE_TYPE_DESKTOP,
|
||||
|
|
@ -38,9 +36,7 @@ const { CryptoWrapper } = ChromeUtils.import(
|
|||
const { Resource } = ChromeUtils.import("resource://services-sync/resource.js");
|
||||
const { Svc, Utils } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
|
@ -83,9 +79,10 @@ function hasDupeCommand(commands, action) {
|
|||
);
|
||||
}
|
||||
|
||||
function ClientsRec(collection, id) {
|
||||
export function ClientsRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
ClientsRec.prototype = {
|
||||
_logName: "Sync.Record.Clients",
|
||||
ttl: CLIENTS_TTL,
|
||||
|
|
@ -106,13 +103,14 @@ Utils.deferGetSet(ClientsRec, "cleartext", [
|
|||
"fxaDeviceId",
|
||||
]);
|
||||
|
||||
function ClientEngine(service) {
|
||||
export function ClientEngine(service) {
|
||||
SyncEngine.call(this, "Clients", service);
|
||||
|
||||
this.fxAccounts = lazy.fxAccounts;
|
||||
this.addClientCommandQueue = Async.asyncQueueCaller(this._log);
|
||||
Utils.defineLazyIDProperty(this, "localID", "services.sync.client.GUID");
|
||||
}
|
||||
|
||||
ClientEngine.prototype = {
|
||||
_storeObj: ClientStore,
|
||||
_recordObj: ClientsRec,
|
||||
|
|
@ -2,17 +2,9 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"ExtensionStorageEngineKinto",
|
||||
"ExtensionStorageEngineBridge",
|
||||
];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { BridgedEngine, BridgeWrapperXPCOM } = ChromeUtils.import(
|
||||
const { BridgedEngine, BridgeWrapperXPCOM, LogAdapter } = ChromeUtils.import(
|
||||
"resource://services-sync/bridged_engine.js"
|
||||
);
|
||||
const { SyncEngine } = ChromeUtils.import(
|
||||
|
|
@ -23,7 +15,6 @@ const { Tracker } = ChromeUtils.import("resource://services-sync/engines.js");
|
|||
const lazy = {};
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
LogAdapter: "resource://services-sync/bridged_engine.js",
|
||||
extensionStorageSync: "resource://gre/modules/ExtensionStorageSync.jsm",
|
||||
extensionStorageSyncKinto:
|
||||
"resource://gre/modules/ExtensionStorageSyncKinto.jsm",
|
||||
|
|
@ -72,7 +63,7 @@ function setEngineEnabled(enabled) {
|
|||
}
|
||||
|
||||
// A "bridged engine" to our webext-storage component.
|
||||
function ExtensionStorageEngineBridge(service) {
|
||||
export function ExtensionStorageEngineBridge(service) {
|
||||
this.component = lazy.StorageSyncService.getInterface(
|
||||
Ci.mozIBridgedSyncEngine
|
||||
);
|
||||
|
|
@ -83,7 +74,7 @@ function ExtensionStorageEngineBridge(service) {
|
|||
Ci.mozIAppServicesLogger
|
||||
);
|
||||
let logger_target = "app-services:webext_storage:sync";
|
||||
app_services_logger.register(logger_target, new lazy.LogAdapter(this._log));
|
||||
app_services_logger.register(logger_target, new LogAdapter(this._log));
|
||||
}
|
||||
|
||||
ExtensionStorageEngineBridge.prototype = {
|
||||
|
|
@ -205,7 +196,7 @@ Object.setPrototypeOf(
|
|||
* for syncing that we do not need to integrate in the Firefox Sync
|
||||
* framework, so this is something of a stub.
|
||||
*/
|
||||
function ExtensionStorageEngineKinto(service) {
|
||||
export function ExtensionStorageEngineKinto(service) {
|
||||
SyncEngine.call(this, "Extension-Storage", service);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
|
|
@ -214,6 +205,7 @@ function ExtensionStorageEngineKinto(service) {
|
|||
0
|
||||
);
|
||||
}
|
||||
|
||||
ExtensionStorageEngineKinto.prototype = {
|
||||
_trackerObj: ExtensionStorageTracker,
|
||||
// we don't need these since we implement our own sync logic
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["FormEngine", "FormRec", "FormValidator"];
|
||||
|
||||
const { Store, SyncEngine, LegacyTracker } = ChromeUtils.import(
|
||||
"resource://services-sync/engines.js"
|
||||
);
|
||||
|
|
@ -18,9 +16,8 @@ const { CollectionProblemData, CollectionValidator } = ChromeUtils.import(
|
|||
"resource://services-sync/collection_validator.js"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
FormHistory: "resource://gre/modules/FormHistory.sys.mjs",
|
||||
|
|
@ -28,9 +25,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
|
||||
const FORMS_TTL = 3 * 365 * 24 * 60 * 60; // Three years in seconds.
|
||||
|
||||
function FormRec(collection, id) {
|
||||
export function FormRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
FormRec.prototype = {
|
||||
_logName: "Sync.Record.Form",
|
||||
ttl: FORMS_TTL,
|
||||
|
|
@ -87,9 +85,10 @@ var FormWrapper = {
|
|||
},
|
||||
};
|
||||
|
||||
function FormEngine(service) {
|
||||
export function FormEngine(service) {
|
||||
SyncEngine.call(this, "Forms", service);
|
||||
}
|
||||
|
||||
FormEngine.prototype = {
|
||||
_storeObj: FormStore,
|
||||
_trackerObj: FormTracker,
|
||||
|
|
@ -244,7 +243,7 @@ class FormsProblemData extends CollectionProblemData {
|
|||
}
|
||||
}
|
||||
|
||||
class FormValidator extends CollectionValidator {
|
||||
export class FormValidator extends CollectionValidator {
|
||||
constructor() {
|
||||
super("forms", "id", ["name", "value"]);
|
||||
this.ignoresMissingClients = true;
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["HistoryEngine", "HistoryRec"];
|
||||
|
||||
const HISTORY_TTL = 5184000; // 60 days in milliseconds
|
||||
const THIRTY_DAYS_IN_MS = 2592000000; // 30 days in milliseconds
|
||||
|
||||
|
|
@ -32,9 +30,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||
});
|
||||
|
||||
function HistoryRec(collection, id) {
|
||||
export function HistoryRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
HistoryRec.prototype = {
|
||||
_logName: "Sync.Record.History",
|
||||
ttl: HISTORY_TTL,
|
||||
|
|
@ -43,9 +42,10 @@ Object.setPrototypeOf(HistoryRec.prototype, CryptoWrapper.prototype);
|
|||
|
||||
Utils.deferGetSet(HistoryRec, "cleartext", ["histUri", "title", "visits"]);
|
||||
|
||||
function HistoryEngine(service) {
|
||||
export function HistoryEngine(service) {
|
||||
SyncEngine.call(this, "History", service);
|
||||
}
|
||||
|
||||
HistoryEngine.prototype = {
|
||||
_recordObj: HistoryRec,
|
||||
_storeObj: HistoryStore,
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["PasswordEngine", "LoginRec", "PasswordValidator"];
|
||||
|
||||
const { Collection, CryptoWrapper } = ChromeUtils.import(
|
||||
"resource://services-sync/record.js"
|
||||
);
|
||||
|
|
@ -50,9 +48,10 @@ function isSyncableChange(oldLogin, newLogin) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function LoginRec(collection, id) {
|
||||
export function LoginRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
LoginRec.prototype = {
|
||||
_logName: "Sync.Record.Login",
|
||||
|
||||
|
|
@ -78,9 +77,10 @@ Utils.deferGetSet(LoginRec, "cleartext", [
|
|||
"timePasswordChanged",
|
||||
]);
|
||||
|
||||
function PasswordEngine(service) {
|
||||
export function PasswordEngine(service) {
|
||||
SyncEngine.call(this, "Passwords", service);
|
||||
}
|
||||
|
||||
PasswordEngine.prototype = {
|
||||
_storeObj: PasswordStore,
|
||||
_trackerObj: PasswordTracker,
|
||||
|
|
@ -460,7 +460,7 @@ PasswordTracker.prototype = {
|
|||
};
|
||||
Object.setPrototypeOf(PasswordTracker.prototype, LegacyTracker.prototype);
|
||||
|
||||
class PasswordValidator extends CollectionValidator {
|
||||
export class PasswordValidator extends CollectionValidator {
|
||||
constructor() {
|
||||
super("passwords", "id", [
|
||||
"hostname",
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["PrefsEngine", "PrefRec", "getPrefsGUIDForTest"];
|
||||
|
||||
// Prefs which start with this prefix are our "control" prefs - they indicate
|
||||
// which preferences should be synced.
|
||||
const PREF_SYNC_PREFS_PREFIX = "services.sync.prefs.sync.";
|
||||
|
|
@ -27,12 +25,9 @@ const PREF_SYNC_PREFS_PREFIX = "services.sync.prefs.sync.";
|
|||
// this special control pref at the same time they flip the default.
|
||||
const PREF_SYNC_SEEN_PREFIX = "services.sync.prefs.sync-seen.";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Preferences } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Preferences.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
|
||||
|
||||
const { Store, SyncEngine, Tracker } = ChromeUtils.import(
|
||||
"resource://services-sync/engines.js"
|
||||
);
|
||||
|
|
@ -104,9 +99,10 @@ function isAllowedPrefName(prefName) {
|
|||
}
|
||||
}
|
||||
|
||||
function PrefRec(collection, id) {
|
||||
export function PrefRec(collection, id) {
|
||||
CryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
PrefRec.prototype = {
|
||||
_logName: "Sync.Record.Pref",
|
||||
};
|
||||
|
|
@ -114,9 +110,10 @@ Object.setPrototypeOf(PrefRec.prototype, CryptoWrapper.prototype);
|
|||
|
||||
Utils.deferGetSet(PrefRec, "cleartext", ["value"]);
|
||||
|
||||
function PrefsEngine(service) {
|
||||
export function PrefsEngine(service) {
|
||||
SyncEngine.call(this, "Prefs", service);
|
||||
}
|
||||
|
||||
PrefsEngine.prototype = {
|
||||
_storeObj: PrefStore,
|
||||
_trackerObj: PrefTracker,
|
||||
|
|
@ -471,6 +468,6 @@ PrefTracker.prototype = {
|
|||
};
|
||||
Object.setPrototypeOf(PrefTracker.prototype, Tracker.prototype);
|
||||
|
||||
function getPrefsGUIDForTest() {
|
||||
export function getPrefsGUIDForTest() {
|
||||
return lazy.PREFS_GUID;
|
||||
}
|
||||
|
|
@ -2,13 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabEngine", "TabProvider"];
|
||||
|
||||
const STORAGE_VERSION = 1; // This needs to be kept in-sync with the rust storage version
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { SyncEngine, Tracker } = ChromeUtils.import(
|
||||
"resource://services-sync/engines.js"
|
||||
);
|
||||
|
|
@ -62,7 +59,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
);
|
||||
|
||||
// A "bridged engine" to our tabs component.
|
||||
function TabEngine(service) {
|
||||
export function TabEngine(service) {
|
||||
BridgedEngine.call(this, "Tabs", service);
|
||||
}
|
||||
|
||||
|
|
@ -350,7 +347,7 @@ TabEngine.prototype = {
|
|||
};
|
||||
Object.setPrototypeOf(TabEngine.prototype, BridgedEngine.prototype);
|
||||
|
||||
const TabProvider = {
|
||||
export const TabProvider = {
|
||||
getWindowEnumerator() {
|
||||
return Services.wm.getEnumerator("navigator:browser");
|
||||
},
|
||||
|
|
@ -2,16 +2,11 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["BulkKeyBundle"];
|
||||
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
|
||||
|
||||
/**
|
||||
|
|
@ -107,7 +102,7 @@ KeyBundle.prototype = {
|
|||
*
|
||||
* This is just a KeyBundle with a collection attached.
|
||||
*/
|
||||
function BulkKeyBundle(collection) {
|
||||
export function BulkKeyBundle(collection) {
|
||||
let log = Log.repository.getLogger("Sync.BulkKeyBundle");
|
||||
log.info("BulkKeyBundle being created for " + collection);
|
||||
KeyBundle.call(this);
|
||||
|
|
@ -2,13 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Weave"];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
|
||||
var Weave = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
export var Weave = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(Weave, {
|
||||
Service: "resource://services-sync/service.js",
|
||||
|
|
@ -2,14 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["ErrorHandler", "SyncScheduler"];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const {
|
||||
CREDENTIALS_CHANGED,
|
||||
ENGINE_APPLY_FAIL,
|
||||
|
|
@ -84,10 +80,11 @@ function getThrottledIntervalPreference(prefName) {
|
|||
return Math.max(Svc.Prefs.get(prefName), 60) * 1000;
|
||||
}
|
||||
|
||||
function SyncScheduler(service) {
|
||||
export function SyncScheduler(service) {
|
||||
this.service = service;
|
||||
this.init();
|
||||
}
|
||||
|
||||
SyncScheduler.prototype = {
|
||||
_log: Log.repository.getLogger("Sync.SyncScheduler"),
|
||||
|
||||
|
|
@ -824,10 +821,11 @@ SyncScheduler.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
function ErrorHandler(service) {
|
||||
export function ErrorHandler(service) {
|
||||
this.service = service;
|
||||
this.init();
|
||||
}
|
||||
|
||||
ErrorHandler.prototype = {
|
||||
init() {
|
||||
Svc.Obs.add("weave:engine:sync:applied", this);
|
||||
|
|
@ -2,23 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"WBORecord",
|
||||
"RecordManager",
|
||||
"RawCryptoWrapper",
|
||||
"CryptoWrapper",
|
||||
"CollectionKeyManager",
|
||||
"Collection",
|
||||
// Exported for tests.
|
||||
"PostQueue",
|
||||
];
|
||||
|
||||
const CRYPTO_COLLECTION = "crypto";
|
||||
const KEYS_WBO = "keys";
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const {
|
||||
DEFAULT_DOWNLOAD_BATCH_SIZE,
|
||||
DEFAULT_KEYBUNDLE_NAME,
|
||||
|
|
@ -47,12 +35,13 @@ const { CryptoUtils } = ChromeUtils.import(
|
|||
* @param {String} collection The collection name for this BSO.
|
||||
* @param {String} id The ID of this BSO.
|
||||
*/
|
||||
function WBORecord(collection, id) {
|
||||
export function WBORecord(collection, id) {
|
||||
this.data = {};
|
||||
this.payload = {};
|
||||
this.collection = collection; // Optional.
|
||||
this.id = id; // Optional.
|
||||
}
|
||||
|
||||
WBORecord.prototype = {
|
||||
_logName: "Sync.Record.WBO",
|
||||
|
||||
|
|
@ -165,7 +154,7 @@ Utils.deferGetSet(WBORecord, "data", [
|
|||
* @param {String} collection The collection name for this BSO.
|
||||
* @param {String} id The ID of this BSO.
|
||||
*/
|
||||
function RawCryptoWrapper(collection, id) {
|
||||
export function RawCryptoWrapper(collection, id) {
|
||||
// Setting properties before calling the superclass constructor isn't allowed
|
||||
// in new-style classes (`class MyRecord extends RawCryptoWrapper`), but
|
||||
// allowed with plain functions. This is also why `defaultCleartext` is a
|
||||
|
|
@ -174,6 +163,7 @@ function RawCryptoWrapper(collection, id) {
|
|||
WBORecord.call(this, collection, id);
|
||||
this.ciphertext = null;
|
||||
}
|
||||
|
||||
RawCryptoWrapper.prototype = {
|
||||
_logName: "Sync.Record.RawCryptoWrapper",
|
||||
|
||||
|
|
@ -291,9 +281,10 @@ Utils.deferGetSet(RawCryptoWrapper, "payload", ["ciphertext", "IV", "hmac"]);
|
|||
* @param {String} collection The collection name for this BSO.
|
||||
* @param {String} id The ID of this BSO.
|
||||
*/
|
||||
function CryptoWrapper(collection, id) {
|
||||
export function CryptoWrapper(collection, id) {
|
||||
RawCryptoWrapper.call(this, collection, id);
|
||||
}
|
||||
|
||||
CryptoWrapper.prototype = {
|
||||
_logName: "Sync.Record.CryptoWrapper",
|
||||
|
||||
|
|
@ -372,12 +363,13 @@ Utils.deferGetSet(CryptoWrapper, "cleartext", "deleted");
|
|||
/**
|
||||
* An interface and caching layer for records.
|
||||
*/
|
||||
function RecordManager(service) {
|
||||
export function RecordManager(service) {
|
||||
this.service = service;
|
||||
|
||||
this._log = Log.repository.getLogger(this._logName);
|
||||
this._records = {};
|
||||
}
|
||||
|
||||
RecordManager.prototype = {
|
||||
_recordType: CryptoWrapper,
|
||||
_logName: "Sync.RecordManager",
|
||||
|
|
@ -443,7 +435,7 @@ RecordManager.prototype = {
|
|||
* You can update this thing simply by giving it /info/collections. It'll
|
||||
* use the last modified time to bring itself up to date.
|
||||
*/
|
||||
function CollectionKeyManager(lastModified, default_, collections) {
|
||||
export function CollectionKeyManager(lastModified, default_, collections) {
|
||||
this.lastModified = lastModified || 0;
|
||||
this._default = default_ || null;
|
||||
this._collections = collections || {};
|
||||
|
|
@ -753,7 +745,7 @@ CollectionKeyManager.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
function Collection(uri, recordObj, service) {
|
||||
export function Collection(uri, recordObj, service) {
|
||||
if (!service) {
|
||||
throw new Error("Collection constructor requires a service.");
|
||||
}
|
||||
|
|
@ -780,6 +772,7 @@ function Collection(uri, recordObj, service) {
|
|||
// opaque value and not (necessarily) a number.
|
||||
this._offset = null;
|
||||
}
|
||||
|
||||
Collection.prototype = {
|
||||
_logName: "Sync.Collection",
|
||||
|
||||
|
|
@ -1114,7 +1107,7 @@ class LimitTracker {
|
|||
In most cases we expect there to be exactly 1 batch consisting of possibly
|
||||
multiple POSTs.
|
||||
*/
|
||||
function PostQueue(poster, timestamp, serverConfig, log, postCallback) {
|
||||
export function PostQueue(poster, timestamp, serverConfig, log, postCallback) {
|
||||
// The "post" function we should use when it comes time to do the post.
|
||||
this.poster = poster;
|
||||
this.log = log;
|
||||
|
|
@ -2,14 +2,10 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Resource"];
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Observers } = ChromeUtils.import(
|
||||
"resource://services-common/observers.js"
|
||||
);
|
||||
|
|
@ -17,9 +13,8 @@ const { CommonUtils } = ChromeUtils.import(
|
|||
"resource://services-common/utils.js"
|
||||
);
|
||||
const { Utils } = ChromeUtils.import("resource://services-sync/util.js");
|
||||
const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Timer.sys.mjs"
|
||||
);
|
||||
import { setTimeout, clearTimeout } from "resource://gre/modules/Timer.sys.mjs";
|
||||
|
||||
/* global AbortController */
|
||||
|
||||
/*
|
||||
|
|
@ -36,12 +31,13 @@ const { setTimeout, clearTimeout } = ChromeUtils.importESModule(
|
|||
* post(data, callback)
|
||||
* delete(callback)
|
||||
*/
|
||||
function Resource(uri) {
|
||||
export function Resource(uri) {
|
||||
this._log = Log.repository.getLogger(this._logName);
|
||||
this._log.manageLevelFromPref("services.sync.log.logger.network.resources");
|
||||
this.uri = uri;
|
||||
this._headers = {};
|
||||
}
|
||||
|
||||
// (static) Caches the latest server timestamp (X-Weave-Timestamp header).
|
||||
Resource.serverTime = null;
|
||||
|
||||
|
|
@ -2,20 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Service"];
|
||||
|
||||
const CRYPTO_COLLECTION = "crypto";
|
||||
const KEYS_WBO = "keys";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/AppConstants.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
|
|
@ -1637,7 +1630,7 @@ Sync11Service.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
var Service = new Sync11Service();
|
||||
export var Service = new Sync11Service();
|
||||
Service.promiseInitialized = new Promise(resolve => {
|
||||
Service.onStartup().then(resolve);
|
||||
});
|
||||
|
|
@ -7,13 +7,8 @@
|
|||
* in conjunction with EngineManager.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["DeclinedEngines"];
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
);
|
||||
|
|
@ -21,12 +16,13 @@ const { Observers } = ChromeUtils.import(
|
|||
"resource://services-common/observers.js"
|
||||
);
|
||||
|
||||
var DeclinedEngines = function(service) {
|
||||
export var DeclinedEngines = function(service) {
|
||||
this._log = Log.repository.getLogger("Sync.Declined");
|
||||
this._log.manageLevelFromPref("services.sync.log.logger.declined");
|
||||
|
||||
this.service = service;
|
||||
};
|
||||
|
||||
DeclinedEngines.prototype = {
|
||||
updateDeclined(meta, engineManager = this.service.engineManager) {
|
||||
let enabled = new Set(engineManager.getEnabled().map(e => e.name));
|
||||
|
|
@ -6,11 +6,8 @@
|
|||
* This file contains code for synchronizing engines.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["EngineSynchronizer"];
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const {
|
||||
ABORT_SYNC_COMMAND,
|
||||
LOGIN_FAILED_NETWORK_ERROR,
|
||||
|
|
@ -35,7 +32,7 @@ ChromeUtils.defineModuleGetter(
|
|||
*
|
||||
* This was originally split out of service.js. The API needs lots of love.
|
||||
*/
|
||||
function EngineSynchronizer(service) {
|
||||
export function EngineSynchronizer(service) {
|
||||
this._log = Log.repository.getLogger("Sync.Synchronizer");
|
||||
this._log.manageLevelFromPref("services.sync.log.logger.synchronizer");
|
||||
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Status"];
|
||||
|
||||
const {
|
||||
CLIENT_NOT_CONFIGURED,
|
||||
ENGINE_SUCCEEDED,
|
||||
|
|
@ -16,14 +14,13 @@ const {
|
|||
SYNC_FAILED_PARTIAL,
|
||||
SYNC_SUCCEEDED,
|
||||
} = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const { SyncAuthManager } = ChromeUtils.import(
|
||||
"resource://services-sync/sync_auth.js"
|
||||
);
|
||||
|
||||
var Status = {
|
||||
export var Status = {
|
||||
_log: Log.repository.getLogger("Sync.Status"),
|
||||
__authManager: null,
|
||||
ready: false,
|
||||
|
|
@ -2,16 +2,9 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SyncAuthManager", "AuthenticationError"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { Async } = ChromeUtils.import("resource://services-common/async.js");
|
||||
const { TokenServerClient } = ChromeUtils.import(
|
||||
"resource://services-common/tokenserverclient.js"
|
||||
|
|
@ -84,7 +77,7 @@ const OBSERVER_TOPICS = [
|
|||
some other error object (which should do the right thing when toString() is
|
||||
called on it)
|
||||
*/
|
||||
function AuthenticationError(details, source) {
|
||||
export function AuthenticationError(details, source) {
|
||||
this.details = details;
|
||||
this.source = source;
|
||||
}
|
||||
|
|
@ -101,7 +94,7 @@ AuthenticationError.prototype = {
|
|||
// credentials in order to access it.
|
||||
//
|
||||
|
||||
function SyncAuthManager() {
|
||||
export function SyncAuthManager() {
|
||||
// NOTE: _fxaService and _tokenServerClient are replaced with mocks by
|
||||
// the test suite.
|
||||
this._fxaService = lazy.fxAccounts;
|
||||
|
|
@ -2,14 +2,6 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"ErrorSanitizer", // for testing.
|
||||
"SyncRecord",
|
||||
"SyncTelemetry",
|
||||
];
|
||||
|
||||
// Support for Sync-and-FxA-related telemetry, which is submitted in a special-purpose
|
||||
// telemetry ping called the "sync ping", documented here:
|
||||
//
|
||||
|
|
@ -20,12 +12,9 @@ var EXPORTED_SYMBOLS = [
|
|||
// for ensuring that we can delete those pings upon user request, by plumbing its
|
||||
// identifiers into the "deletion-request" ping.
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
|
@ -168,7 +157,7 @@ function normalizeExtraTelemetryFields(extra) {
|
|||
// generate different messages for the same underlying error.
|
||||
// * [TODO] Normalize errors so environmental factors don't influence message.
|
||||
// For example, timestamps or GUIDs should be replaced with something static.
|
||||
class ErrorSanitizer {
|
||||
export class ErrorSanitizer {
|
||||
// Things we normalize - this isn't exhaustive, but covers the common error messages we see.
|
||||
// Eg:
|
||||
// > Win error 112 during operation write on file [profileDir]\weave\addonsreconciler.json (Espacio en disco insuficiente. )
|
||||
|
|
@ -457,7 +446,7 @@ class EngineRecord {
|
|||
|
||||
// The record of a single "sync" - typically many of these are submitted in
|
||||
// a single ping (ie, as a 'syncs' array)
|
||||
class SyncRecord {
|
||||
export class SyncRecord {
|
||||
constructor(allowedEngines, why) {
|
||||
this.allowedEngines = allowedEngines;
|
||||
// Our failure reason. This property only exists in the generated ping if an
|
||||
|
|
@ -1239,4 +1228,4 @@ class SyncTelemetryImpl {
|
|||
}
|
||||
}
|
||||
|
||||
var SyncTelemetry = new SyncTelemetryImpl(ENGINES);
|
||||
export var SyncTelemetry = new SyncTelemetryImpl(ENGINES);
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Utils", "Svc", "SerializableSet"];
|
||||
|
||||
const { Observers } = ChromeUtils.import(
|
||||
"resource://services-common/observers.js"
|
||||
);
|
||||
|
|
@ -21,12 +19,9 @@ const {
|
|||
SYNC_KEY_ENCODED_LENGTH,
|
||||
WEAVE_VERSION,
|
||||
} = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
const { Preferences } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Preferences.sys.mjs"
|
||||
);
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { Preferences } from "resource://gre/modules/Preferences.sys.mjs";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
const FxAccountsCommon = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
|
|
@ -66,7 +61,7 @@ class HMACMismatch extends Error {
|
|||
/*
|
||||
* Utility functions
|
||||
*/
|
||||
var Utils = {
|
||||
export var Utils = {
|
||||
// Aliases from CryptoUtils.
|
||||
generateRandomBytesLegacy: CryptoUtils.generateRandomBytesLegacy,
|
||||
computeHTTPMACSHA1: CryptoUtils.computeHTTPMACSHA1,
|
||||
|
|
@ -761,7 +756,7 @@ var Utils = {
|
|||
/**
|
||||
* A subclass of Set that serializes as an Array when passed to JSON.stringify.
|
||||
*/
|
||||
class SerializableSet extends Set {
|
||||
export class SerializableSet extends Set {
|
||||
toJSON() {
|
||||
return Array.from(this);
|
||||
}
|
||||
|
|
@ -780,7 +775,8 @@ XPCOMUtils.defineLazyGetter(Utils, "utf8Encoder", () => new TextEncoder());
|
|||
/*
|
||||
* Commonly-used services
|
||||
*/
|
||||
var Svc = {};
|
||||
export var Svc = {};
|
||||
|
||||
Svc.Prefs = new Preferences(PREFS_BRANCH);
|
||||
Svc.Obs = Observers;
|
||||
|
||||
|
|
@ -16,48 +16,48 @@ EXTRA_COMPONENTS += [
|
|||
]
|
||||
|
||||
EXTRA_JS_MODULES["services-sync"] += [
|
||||
"modules/addonsreconciler.js",
|
||||
"modules/addonutils.js",
|
||||
"modules/bridged_engine.js",
|
||||
"modules/collection_validator.js",
|
||||
"modules/addonsreconciler.sys.mjs",
|
||||
"modules/addonutils.sys.mjs",
|
||||
"modules/bridged_engine.sys.mjs",
|
||||
"modules/collection_validator.sys.mjs",
|
||||
"modules/constants.js",
|
||||
"modules/doctor.js",
|
||||
"modules/engines.js",
|
||||
"modules/keys.js",
|
||||
"modules/main.js",
|
||||
"modules/policies.js",
|
||||
"modules/record.js",
|
||||
"modules/resource.js",
|
||||
"modules/service.js",
|
||||
"modules/status.js",
|
||||
"modules/sync_auth.js",
|
||||
"modules/SyncDisconnect.jsm",
|
||||
"modules/SyncedTabs.jsm",
|
||||
"modules/telemetry.js",
|
||||
"modules/UIState.jsm",
|
||||
"modules/util.js",
|
||||
"Weave.jsm",
|
||||
"modules/doctor.sys.mjs",
|
||||
"modules/engines.sys.mjs",
|
||||
"modules/keys.sys.mjs",
|
||||
"modules/main.sys.mjs",
|
||||
"modules/policies.sys.mjs",
|
||||
"modules/record.sys.mjs",
|
||||
"modules/resource.sys.mjs",
|
||||
"modules/service.sys.mjs",
|
||||
"modules/status.sys.mjs",
|
||||
"modules/sync_auth.sys.mjs",
|
||||
"modules/SyncDisconnect.sys.mjs",
|
||||
"modules/SyncedTabs.sys.mjs",
|
||||
"modules/telemetry.sys.mjs",
|
||||
"modules/UIState.sys.mjs",
|
||||
"modules/util.sys.mjs",
|
||||
"Weave.sys.mjs",
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES["services-sync"].engines += [
|
||||
"modules/engines/addons.js",
|
||||
"modules/engines/clients.js",
|
||||
"modules/engines/extension-storage.js",
|
||||
"modules/engines/passwords.js",
|
||||
"modules/engines/prefs.js",
|
||||
"modules/engines/addons.sys.mjs",
|
||||
"modules/engines/clients.sys.mjs",
|
||||
"modules/engines/extension-storage.sys.mjs",
|
||||
"modules/engines/passwords.sys.mjs",
|
||||
"modules/engines/prefs.sys.mjs",
|
||||
]
|
||||
|
||||
if not CONFIG["MOZ_THUNDERBIRD"]:
|
||||
EXTRA_JS_MODULES["services-sync"].engines += [
|
||||
"modules/engines/bookmarks.js",
|
||||
"modules/engines/forms.js",
|
||||
"modules/engines/history.js",
|
||||
"modules/engines/tabs.js",
|
||||
"modules/engines/bookmarks.sys.mjs",
|
||||
"modules/engines/forms.sys.mjs",
|
||||
"modules/engines/history.sys.mjs",
|
||||
"modules/engines/tabs.sys.mjs",
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES["services-sync"].stages += [
|
||||
"modules/stages/declined.js",
|
||||
"modules/stages/enginesync.js",
|
||||
"modules/stages/declined.sys.mjs",
|
||||
"modules/stages/enginesync.sys.mjs",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
|
|
@ -65,10 +65,10 @@ XPCOM_MANIFESTS += [
|
|||
]
|
||||
|
||||
TESTING_JS_MODULES.services.sync += [
|
||||
"modules-testing/fakeservices.js",
|
||||
"modules-testing/fxa_utils.js",
|
||||
"modules-testing/rotaryengine.js",
|
||||
"modules-testing/utils.js",
|
||||
"modules-testing/fakeservices.sys.mjs",
|
||||
"modules-testing/fxa_utils.sys.mjs",
|
||||
"modules-testing/rotaryengine.sys.mjs",
|
||||
"modules-testing/utils.sys.mjs",
|
||||
]
|
||||
|
||||
SPHINX_TREES["/services/sync"] = "docs"
|
||||
|
|
|
|||
|
|
@ -2,16 +2,9 @@
|
|||
* 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/. */
|
||||
|
||||
"use strict";
|
||||
import { Log } from "resource://gre/modules/Log.sys.mjs";
|
||||
import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Authentication"];
|
||||
|
||||
const { Log } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Log.sys.mjs"
|
||||
);
|
||||
const { clearTimeout, setTimeout } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Timer.sys.mjs"
|
||||
);
|
||||
const { getFxAccountsSingleton } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
);
|
||||
|
|
@ -27,7 +20,7 @@ const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
|||
/**
|
||||
* Helper object for Firefox Accounts authentication
|
||||
*/
|
||||
var Authentication = {
|
||||
export var Authentication = {
|
||||
/**
|
||||
* Check if an user has been logged in
|
||||
*/
|
||||
|
|
@ -7,11 +7,7 @@
|
|||
Only the following listed symbols will exposed on import, and only when
|
||||
and where imported. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Logger"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const lazy = {};
|
||||
|
||||
|
|
@ -19,7 +15,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
|
||||
});
|
||||
|
||||
var Logger = {
|
||||
export var Logger = {
|
||||
_foStream: null,
|
||||
_converter: null,
|
||||
_potentialError: null,
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
/* 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/. */
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Addon", "STATE_ENABLED", "STATE_DISABLED"];
|
||||
|
||||
const { AddonManager } = ChromeUtils.import(
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
|
|
@ -13,10 +10,10 @@ const { AddonUtils } = ChromeUtils.import(
|
|||
);
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
const STATE_ENABLED = 1;
|
||||
const STATE_DISABLED = 2;
|
||||
export const STATE_ENABLED = 1;
|
||||
export const STATE_DISABLED = 2;
|
||||
|
||||
function Addon(TPS, id) {
|
||||
export function Addon(TPS, id) {
|
||||
this.TPS = TPS;
|
||||
this.id = id;
|
||||
}
|
||||
|
|
@ -7,11 +7,8 @@
|
|||
// It used to have a test before it was moved:
|
||||
// https://searchfox.org/mozilla-central/rev/b1a5802e0f73bfd6d2096e5fefc2b47831a50b2d/services/sync/tests/unit/test_bookmark_validator.js
|
||||
|
||||
"use strict";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
);
|
||||
|
|
@ -30,8 +27,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
PlacesUtils: "resource://gre/modules/PlacesUtils.sys.mjs",
|
||||
});
|
||||
|
||||
var EXPORTED_SYMBOLS = ["BookmarkValidator", "BookmarkProblemData"];
|
||||
|
||||
const QUERY_PROTOCOL = "place:";
|
||||
|
||||
function areURLsEqual(a, b) {
|
||||
|
|
@ -133,7 +128,7 @@ const BOOKMARK_VALIDATOR_VERSION = 1;
|
|||
* - structuralDifferences: As above, but contains the items where the differences were
|
||||
* structural, that is, they contained childGUIDs or parentid
|
||||
*/
|
||||
class BookmarkProblemData {
|
||||
export class BookmarkProblemData {
|
||||
constructor() {
|
||||
this.rootOnServer = false;
|
||||
this.missingIDs = 0;
|
||||
|
|
@ -660,7 +655,7 @@ class ServerRecordInspection {
|
|||
}
|
||||
}
|
||||
|
||||
class BookmarkValidator {
|
||||
export class BookmarkValidator {
|
||||
constructor() {
|
||||
this.yieldState = lazy.Async.yieldState();
|
||||
}
|
||||
|
|
@ -7,26 +7,14 @@
|
|||
* listed symbols will exposed on import, and only when and where imported.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"PlacesItem",
|
||||
"Bookmark",
|
||||
"Separator",
|
||||
"BookmarkFolder",
|
||||
"DumpBookmarks",
|
||||
];
|
||||
import { PlacesBackups } from "resource://gre/modules/PlacesBackups.sys.mjs";
|
||||
|
||||
import { PlacesSyncUtils } from "resource://gre/modules/PlacesSyncUtils.sys.mjs";
|
||||
import { PlacesUtils } from "resource://gre/modules/PlacesUtils.sys.mjs";
|
||||
|
||||
const { PlacesBackups } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PlacesBackups.sys.mjs"
|
||||
);
|
||||
const { PlacesSyncUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PlacesSyncUtils.sys.mjs"
|
||||
);
|
||||
const { PlacesUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PlacesUtils.sys.mjs"
|
||||
);
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
async function DumpBookmarks() {
|
||||
export async function DumpBookmarks() {
|
||||
let [bookmarks] = await PlacesBackups.getBookmarksTree();
|
||||
Logger.logInfo(
|
||||
"Dumping Bookmarks...\n" + JSON.stringify(bookmarks, undefined, 2) + "\n\n"
|
||||
|
|
@ -66,7 +54,7 @@ function PlacesItemProps(props) {
|
|||
/**
|
||||
* PlacesItem object. Base class for places items.
|
||||
*/
|
||||
function PlacesItem(props) {
|
||||
export function PlacesItem(props) {
|
||||
this.props = new PlacesItemProps(props);
|
||||
if (this.props.location == null) {
|
||||
this.props.location = "menu";
|
||||
|
|
@ -411,7 +399,7 @@ PlacesItem.prototype = {
|
|||
/**
|
||||
* Bookmark class constructor. Initializes instance properties.
|
||||
*/
|
||||
function Bookmark(props) {
|
||||
export function Bookmark(props) {
|
||||
PlacesItem.call(this, props);
|
||||
if (this.props.title == null) {
|
||||
this.props.title = this.props.uri;
|
||||
|
|
@ -618,7 +606,7 @@ extend(Bookmark, PlacesItem);
|
|||
/**
|
||||
* BookmarkFolder class constructor. Initializes instance properties.
|
||||
*/
|
||||
function BookmarkFolder(props) {
|
||||
export function BookmarkFolder(props) {
|
||||
PlacesItem.call(this, props);
|
||||
this.props.type = "folder";
|
||||
}
|
||||
|
|
@ -720,7 +708,7 @@ extend(BookmarkFolder, PlacesItem);
|
|||
/**
|
||||
* Separator class constructor. Initializes instance properties.
|
||||
*/
|
||||
function Separator(props) {
|
||||
export function Separator(props) {
|
||||
PlacesItem.call(this, props);
|
||||
this.props.type = "separator";
|
||||
}
|
||||
|
|
@ -7,13 +7,6 @@
|
|||
* listed symbols will exposed on import, and only when and where imported.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"Address",
|
||||
"CreditCard",
|
||||
"DumpAddresses",
|
||||
"DumpCreditCards",
|
||||
];
|
||||
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
const lazy = {};
|
||||
|
|
@ -97,13 +90,13 @@ const ADDRESS_FIELDS = [
|
|||
"email",
|
||||
];
|
||||
|
||||
class Address extends FormAutofillBase {
|
||||
export class Address extends FormAutofillBase {
|
||||
constructor(props) {
|
||||
super(props, "addresses", ADDRESS_FIELDS);
|
||||
}
|
||||
}
|
||||
|
||||
async function DumpAddresses() {
|
||||
export async function DumpAddresses() {
|
||||
await DumpStorage("addresses");
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +107,7 @@ const CREDIT_CARD_FIELDS = [
|
|||
"cc-exp-year",
|
||||
];
|
||||
|
||||
class CreditCard extends FormAutofillBase {
|
||||
export class CreditCard extends FormAutofillBase {
|
||||
constructor(props) {
|
||||
super(props, "creditCards", CREDIT_CARD_FIELDS);
|
||||
}
|
||||
|
|
@ -135,6 +128,6 @@ class CreditCard extends FormAutofillBase {
|
|||
}
|
||||
}
|
||||
|
||||
async function DumpCreditCards() {
|
||||
export async function DumpCreditCards() {
|
||||
await DumpStorage("creditCards");
|
||||
}
|
||||
|
|
@ -7,13 +7,9 @@
|
|||
listed symbols will exposed on import, and only when and where imported.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["FormData"];
|
||||
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
const { FormHistory } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/FormHistory.sys.mjs"
|
||||
);
|
||||
import { FormHistory } from "resource://gre/modules/FormHistory.sys.mjs";
|
||||
|
||||
/**
|
||||
* FormDB
|
||||
|
|
@ -102,7 +98,7 @@ var FormDB = {
|
|||
*
|
||||
* Initializes instance properties.
|
||||
*/
|
||||
function FormData(props, msSinceEpoch) {
|
||||
export function FormData(props, msSinceEpoch) {
|
||||
this.fieldname = null;
|
||||
this.value = null;
|
||||
this.date = 0;
|
||||
|
|
@ -7,17 +7,13 @@
|
|||
* listed symbols will exposed on import, and only when and where imported.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["HistoryEntry", "DumpHistory"];
|
||||
import { PlacesUtils } from "resource://gre/modules/PlacesUtils.sys.mjs";
|
||||
|
||||
import { PlacesSyncUtils } from "resource://gre/modules/PlacesSyncUtils.sys.mjs";
|
||||
|
||||
const { PlacesUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PlacesUtils.sys.mjs"
|
||||
);
|
||||
const { PlacesSyncUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/PlacesSyncUtils.sys.mjs"
|
||||
);
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
var DumpHistory = async function TPS_History__DumpHistory() {
|
||||
export var DumpHistory = async function TPS_History__DumpHistory() {
|
||||
let query = PlacesUtils.history.getNewQuery();
|
||||
let options = PlacesUtils.history.getNewQueryOptions();
|
||||
let root = PlacesUtils.history.executeQuery(query, options).root;
|
||||
|
|
@ -46,7 +42,7 @@ var DumpHistory = async function TPS_History__DumpHistory() {
|
|||
*
|
||||
* Contains methods for manipulating browser history entries.
|
||||
*/
|
||||
var HistoryEntry = {
|
||||
export var HistoryEntry = {
|
||||
/**
|
||||
* Add
|
||||
*
|
||||
|
|
@ -7,8 +7,6 @@
|
|||
* listed symbols will exposed on import, and only when and where imported.
|
||||
*/
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Password", "DumpPasswords"];
|
||||
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
var nsLoginInfo = new Components.Constructor(
|
||||
|
|
@ -17,7 +15,7 @@ var nsLoginInfo = new Components.Constructor(
|
|||
"init"
|
||||
);
|
||||
|
||||
var DumpPasswords = function TPS__Passwords__DumpPasswords() {
|
||||
export var DumpPasswords = function TPS__Passwords__DumpPasswords() {
|
||||
let logins = Services.logins.getAllLogins();
|
||||
Logger.logInfo("\ndumping password list\n", true);
|
||||
for (var i = 0; i < logins.length; i++) {
|
||||
|
|
@ -65,7 +63,7 @@ function PasswordProps(props) {
|
|||
/**
|
||||
* Password class constructor. Initializes instance properties.
|
||||
*/
|
||||
function Password(props) {
|
||||
export function Password(props) {
|
||||
this.props = new PasswordProps(props);
|
||||
if ("changes" in props) {
|
||||
this.updateProps = new PasswordProps(props);
|
||||
|
|
@ -7,8 +7,6 @@
|
|||
Only the following listed symbols will exposed on import, and only when
|
||||
and where imported. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["Preference"];
|
||||
|
||||
const WEAVE_PREF_PREFIX = "services.sync.prefs.sync.";
|
||||
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
|
@ -18,7 +16,7 @@ const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
|||
*
|
||||
* Initializes instance properties.
|
||||
*/
|
||||
function Preference(props) {
|
||||
export function Preference(props) {
|
||||
Logger.AssertTrue(
|
||||
"name" in props && "value" in props,
|
||||
"Preference must have both name and value"
|
||||
|
|
@ -7,8 +7,6 @@
|
|||
Only the following listed symbols will exposed on import, and only when
|
||||
and where imported. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["BrowserTabs"];
|
||||
|
||||
const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
|
||||
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
|
||||
|
||||
|
|
@ -27,7 +25,7 @@ Services.mm.loadFrameScript(
|
|||
true
|
||||
);
|
||||
|
||||
var BrowserTabs = {
|
||||
export var BrowserTabs = {
|
||||
/**
|
||||
* Add
|
||||
*
|
||||
|
|
@ -1,16 +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/. */
|
||||
"use strict";
|
||||
|
||||
/* This is a JavaScript module (JSM) to be imported via
|
||||
ChromeUtils.import() and acts as a singleton.
|
||||
Only the following listed symbols will exposed on import, and only when
|
||||
and where imported. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["BrowserWindows"];
|
||||
|
||||
var BrowserWindows = {
|
||||
export var BrowserWindows = {
|
||||
/**
|
||||
* Add
|
||||
*
|
||||
|
|
@ -7,8 +7,6 @@
|
|||
From mozilla/toolkit/content
|
||||
These files did not have a license
|
||||
*/
|
||||
var EXPORTED_SYMBOLS = ["goQuitApplication"];
|
||||
|
||||
function canQuitApplication() {
|
||||
try {
|
||||
var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(
|
||||
|
|
@ -25,7 +23,7 @@ function canQuitApplication() {
|
|||
return true;
|
||||
}
|
||||
|
||||
function goQuitApplication() {
|
||||
export function goQuitApplication() {
|
||||
if (!canQuitApplication()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -302,7 +302,6 @@ avoid-blacklist-and-whitelist:
|
|||
- services/automation/ServicesAutomation.jsm
|
||||
- services/fxaccounts/FxAccountsCommon.js
|
||||
- services/fxaccounts/FxAccounts.jsm
|
||||
- services/sync/modules/engines/addons.js
|
||||
- taskcluster/ci/docker-image/kind.yml
|
||||
- taskcluster/gecko_taskgraph/actions/create_interactive.py
|
||||
- taskcluster/gecko_taskgraph/target_tasks.py
|
||||
|
|
|
|||
Loading…
Reference in a new issue