summaryrefslogtreecommitdiffstats
path: root/application/basilisk/components/preferences/in-content/sync.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-12-16 13:57:01 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-12-16 13:57:01 -0500
commit06494f307850c576868831bd28a61464eab1f359 (patch)
treef281f5c46c3e0b73c7eabe22f02622dc013b0c35 /application/basilisk/components/preferences/in-content/sync.js
parente7d4713e0765c79feddf2384d343d10595fa5cb3 (diff)
downloadUXP-06494f307850c576868831bd28a61464eab1f359.tar
UXP-06494f307850c576868831bd28a61464eab1f359.tar.gz
UXP-06494f307850c576868831bd28a61464eab1f359.tar.lz
UXP-06494f307850c576868831bd28a61464eab1f359.tar.xz
UXP-06494f307850c576868831bd28a61464eab1f359.zip
Remove Basilisk from the Unified XUL Platform repository
Development will proceed at https://github.com/MoonchildProductions/Basilisk
Diffstat (limited to 'application/basilisk/components/preferences/in-content/sync.js')
-rw-r--r--application/basilisk/components/preferences/in-content/sync.js193
1 files changed, 0 insertions, 193 deletions
diff --git a/application/basilisk/components/preferences/in-content/sync.js b/application/basilisk/components/preferences/in-content/sync.js
deleted file mode 100644
index 917b5f123..000000000
--- a/application/basilisk/components/preferences/in-content/sync.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://services-sync/main.js");
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-const PAGE_NO_ACCOUNT = 0;
-const PAGE_HAS_ACCOUNT = 1;
-const PAGE_NEEDS_UPDATE = 2;
-
-var gSyncPane = {
- _stringBundle: null,
- prefArray: ["engine.bookmarks", "engine.passwords", "engine.prefs",
- "engine.tabs", "engine.history"],
-
- get page() {
- return document.getElementById("weavePrefsDeck").selectedIndex;
- },
-
- set page(val) {
- document.getElementById("weavePrefsDeck").selectedIndex = val;
- },
-
- get _usingCustomServer() {
- return Weave.Svc.Prefs.isSet("serverURL");
- },
-
- needsUpdate: function () {
- this.page = PAGE_NEEDS_UPDATE;
- let label = document.getElementById("loginError");
- label.value = Weave.Utils.getErrorString(Weave.Status.login);
- label.className = "error";
- },
-
- init: function () {
- // If the Service hasn't finished initializing, wait for it.
- let xps = Components.classes["@mozilla.org/weave/service;1"]
- .getService(Components.interfaces.nsISupports)
- .wrappedJSObject;
-
- if (xps.ready) {
- this._init();
- return;
- }
-
- let onUnload = function () {
- window.removeEventListener("unload", onUnload, false);
- try {
- Services.obs.removeObserver(onReady, "weave:service:ready");
- } catch (e) {}
- };
-
- let onReady = function () {
- Services.obs.removeObserver(onReady, "weave:service:ready");
- window.removeEventListener("unload", onUnload, false);
- this._init();
- }.bind(this);
-
- Services.obs.addObserver(onReady, "weave:service:ready", false);
- window.addEventListener("unload", onUnload, false);
-
- xps.ensureLoaded();
- },
-
- _init: function () {
- let topics = ["weave:service:login:error",
- "weave:service:login:finish",
- "weave:service:start-over",
- "weave:service:setup-complete",
- "weave:service:logout:finish"];
-
- // Add the observers now and remove them on unload
- //XXXzpao This should use Services.obs.* but Weave's Obs does nice handling
- // of `this`. Fix in a followup. (bug 583347)
- topics.forEach(function (topic) {
- Weave.Svc.Obs.add(topic, this.updateWeavePrefs, this);
- }, this);
- window.addEventListener("unload", function() {
- topics.forEach(function (topic) {
- Weave.Svc.Obs.remove(topic, this.updateWeavePrefs, this);
- }, gSyncPane);
- }, false);
-
- this._stringBundle =
- Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
- this.updateWeavePrefs();
- document.getElementById("weavePrefsDeck").setAttribute("hidden", "");
- },
-
- updateWeavePrefs: function () {
- if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED ||
- Weave.Svc.Prefs.get("firstSync", "") == "notReady") {
- this.page = PAGE_NO_ACCOUNT;
- } else if (Weave.Status.login == Weave.LOGIN_FAILED_INVALID_PASSPHRASE ||
- Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
- this.needsUpdate();
- } else {
- this.page = PAGE_HAS_ACCOUNT;
- document.getElementById("accountName").value = Weave.Service.identity.account;
- document.getElementById("syncComputerName").value = Weave.Service.clientsEngine.localName;
- document.getElementById("tosPP").hidden = this._usingCustomServer;
- }
- },
-
- startOver: function (showDialog) {
- if (showDialog) {
- let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
- Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
- Services.prompt.BUTTON_POS_1_DEFAULT;
- let buttonChoice =
- Services.prompt.confirmEx(window,
- this._stringBundle.GetStringFromName("syncUnlink.title"),
- this._stringBundle.GetStringFromName("syncUnlink.label"),
- flags,
- this._stringBundle.GetStringFromName("syncUnlinkConfirm.label"),
- null, null, null, {});
-
- // If the user selects cancel, just bail
- if (buttonChoice == 1) {
- return;
- }
- }
-
- Weave.Service.startOver();
- this.updateWeavePrefs();
- },
-
- updatePass: function () {
- if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
- gSyncUtils.changePassword();
- } else {
- gSyncUtils.updatePassphrase();
- }
- },
-
- resetPass: function () {
- if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) {
- gSyncUtils.resetPassword();
- } else {
- gSyncUtils.resetPassphrase();
- }
- },
-
- /**
- * Invoke the Sync setup wizard.
- *
- * @param wizardType
- * Indicates type of wizard to launch:
- * null -- regular set up wizard
- * "pair" -- pair a device first
- * "reset" -- reset sync
- */
- openSetup: function (wizardType) {
- let win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
- if (win) {
- win.focus();
- } else {
- window.openDialog("chrome://browser/content/sync/setup.xul",
- "weaveSetup", "centerscreen,chrome,resizable=no",
- wizardType);
- }
- },
-
- openQuotaDialog: function () {
- let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
- if (win) {
- win.focus();
- } else {
- window.openDialog("chrome://browser/content/sync/quota.xul", "",
- "centerscreen,chrome,dialog,modal");
- }
- },
-
- openAddDevice: function () {
- if (!Weave.Utils.ensureMPUnlocked()) {
- return;
- }
-
- let win = Services.wm.getMostRecentWindow("Sync:AddDevice");
- if (win) {
- win.focus();
- } else {
- window.openDialog("chrome://browser/content/sync/addDevice.xul",
- "syncAddDevice", "centerscreen,chrome,resizable=no");
- }
- },
-
- resetSync: function () {
- this.openSetup("reset");
- },
-};
-