[NAVIGATOR] Remove Weave

custom-2020
Matt A. Tobin 4 years ago committed by Roy Tam
parent e4b0705c69
commit 56b87e1de3
  1. 8
      navigator/base/content/navigator.js
  2. 143
      navigator/base/content/pref/pref-sync.js
  3. 160
      navigator/base/content/pref/pref-sync.xul
  4. 46
      navigator/base/content/sync/aboutSyncTabs-bindings.xml
  5. 11
      navigator/base/content/sync/aboutSyncTabs.css
  6. 295
      navigator/base/content/sync/aboutSyncTabs.js
  7. 67
      navigator/base/content/sync/aboutSyncTabs.xul
  8. 146
      navigator/base/content/sync/syncAddDevice.js
  9. 132
      navigator/base/content/sync/syncAddDevice.xul
  10. 235
      navigator/base/content/sync/syncGenericChange.js
  11. 119
      navigator/base/content/sync/syncGenericChange.xul
  12. 49
      navigator/base/content/sync/syncKey.xhtml
  13. 93
      navigator/base/content/sync/syncNotification.xml
  14. 261
      navigator/base/content/sync/syncQuota.js
  15. 63
      navigator/base/content/sync/syncQuota.xul
  16. 971
      navigator/base/content/sync/syncSetup.js
  17. 486
      navigator/base/content/sync/syncSetup.xul
  18. 456
      navigator/base/content/sync/syncUI.js
  19. 224
      navigator/base/content/sync/syncUtils.js
  20. 6
      navigator/base/content/utilityOverlay.js
  21. 19
      navigator/base/jar.mn
  22. 2
      navigator/components/nsAbout.js
  23. 22
      navigator/locales/en-US/chrome/common/aboutSyncTabs.dtd
  24. 56
      navigator/locales/en-US/chrome/common/pref/pref-sync.dtd
  25. 6
      navigator/locales/en-US/chrome/common/sync/syncBrand.dtd
  26. 37
      navigator/locales/en-US/chrome/common/sync/syncGenericChange.properties
  27. 18
      navigator/locales/en-US/chrome/common/sync/syncKey.dtd
  28. 8
      navigator/locales/en-US/chrome/common/sync/syncQuota.dtd
  29. 42
      navigator/locales/en-US/chrome/common/sync/syncQuota.properties
  30. 116
      navigator/locales/en-US/chrome/common/sync/syncSetup.dtd
  31. 50
      navigator/locales/en-US/chrome/common/sync/syncSetup.properties
  32. 9
      navigator/locales/jar.mn

@ -690,9 +690,6 @@ function Startup()
if (!gPrivate) {
DownloadTaskbarProgress.onBrowserWindowLoad(window);
// initialize the sync UI
gSyncUI.init();
// initialize the session-restore service
setTimeout(InitSessionStoreCallback, 0);
}
@ -1463,11 +1460,6 @@ function BrowserOpenTabFromTabBarMiddleClick(e)
}
}
function BrowserOpenSyncTabs()
{
switchToTabHavingURI("about:sync-tabs", true);
}
/* Show file picker dialog configured for opening a file, and return
* the selected nsIFileURL instance. */
function selectFileToOpen(label, prefRoot)

@ -1,143 +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");
const PAGE_NO_ACCOUNT = 0;
const PAGE_HAS_ACCOUNT = 1;
const PAGE_NEEDS_UPDATE = 2;
var gSyncPane = {
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";
},
topics: [ "weave:service:ready",
"weave:service:login:error",
"weave:service:login:finish",
"weave:service:start-over",
"weave:service:setup-complete",
"weave:service:logout:finish"],
init: function () {
for (var topic of this.topics)
Services.obs.addObserver(this, topic, false);
window.addEventListener("unload", this);
var xps = Components.classes["@mozilla.org/weave/service;1"]
.getService().wrappedJSObject;
if (xps.ready)
this.observe(null, "weave:service:ready", null);
else
xps.ensureLoaded();
},
handleEvent: function (aEvent) {
window.removeEventListener("unload", this);
for (var topic of this.topics)
Services.obs.removeObserver(this, topic);
},
observe: function (aSubject, aTopic, aData) {
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;
let prefutilitiesBundle = document.getElementById("bundle_prefutilities");
let buttonChoice =
Services.prompt.confirmEx(window,
prefutilitiesBundle.getString("syncUnlink.title"),
prefutilitiesBundle.getString("syncUnlink.label"),
flags,
prefutilitiesBundle.getString("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();
},
openSetup: function (resetSync) {
var win = Services.wm.getMostRecentWindow("Weave:AccountSetup");
if (win)
win.focus();
else {
window.openDialog("chrome://communicator/content/sync/syncSetup.xul",
"weaveSetup", "centerscreen,chrome,resizable=no", resetSync);
}
},
openQuotaDialog: function () {
let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
if (win)
win.focus();
else
window.openDialog("chrome://communicator/content/sync/syncQuota.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://communicator/content/sync/syncAddDevice.xul",
"syncAddDevice", "centerscreen,chrome,resizable=no");
},
resetSync: function () {
this.openSetup(true);
}
};

@ -1,160 +0,0 @@
<?xml version="1.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/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://communicator/locale/sync/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://communicator/locale/pref/pref-sync.dtd">
%brandDTD;
%syncBrandDTD;
%syncDTD;
]>
<overlay id="SyncPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<prefpane id="sync_pane"
helpTopic="sync_prefs"
onpaneload="gSyncPane.init();">
<preferences>
<preference id="engine.addons" name="services.sync.engine.addons" type="bool"/>
<preference id="engine.bookmarks" name="services.sync.engine.bookmarks" type="bool"/>
<preference id="engine.history" name="services.sync.engine.history" type="bool"/>
<preference id="engine.passwords" name="services.sync.engine.passwords" type="bool"/>
<preference id="engine.prefs" name="services.sync.engine.prefs" type="bool"/>
<preference id="engine.tabs" name="services.sync.engine.tabs" type="bool"/>
</preferences>
<script type="application/javascript"
src="chrome://communicator/content/pref/pref-sync.js"/>
<script type="application/javascript"
src="chrome://communicator/content/sync/syncUtils.js"/>
<deck id="weavePrefsDeck">
<vbox id="noAccount" align="center">
<spacer flex="1"/>
<description id="syncDesc" flex="1">
&weaveDesc.label;
</description>
<button id="setupButton"
label="&setupButton.label;"
accesskey="&setupButton.accesskey;"
oncommand="gSyncPane.openSetup();"/>
<separator/>
<spacer flex="3"/>
</vbox>
<vbox id="hasAccount">
<groupbox>
<caption label="&accountGroupboxCaption.label;"/>
<hbox align="center">
<label value="&accountName.label;" control="accountName"/>
<textbox id="accountName" flex="1" readonly="true"/>
<button type="menu"
label="&manageAccount.label;"
accesskey="&manageAccount.accesskey;">
<menupopup>
<menuitem label="&viewQuota.label;"
accesskey="&viewQuota.accesskey;"
oncommand="gSyncPane.openQuotaDialog();"/>
<menuseparator/>
<menuitem label="&changePassword.label;"
accesskey="&changePassword.accesskey;"
oncommand="gSyncUtils.changePassword();"/>
<menuitem label="&myRecoveryKey.label;"
accesskey="&myRecoveryKey.accesskey;"
oncommand="gSyncUtils.resetPassphrase();"/>
<menuseparator/>
<menuitem label="&resetSync.label;"
accesskey="&resetSync.accesskey;"
oncommand="gSyncPane.resetSync();"/>
<menuitem label="&unlinkDevice.label;"
accesskey="&unlinkDevice.accesskey;"
oncommand="gSyncPane.startOver(true);"/>
<menuseparator/>
<menuitem label="&addDevice.label;"
accesskey="&addDevice.accesskey;"
oncommand="gSyncPane.openAddDevice();"/>
</menupopup>
</button>
</hbox>
<vbox>
<label value="&syncMy2.label;"/>
<listbox id="syncEnginesList" flex="1">
<listitem type="checkbox"
label="&engine.addons.label;"
accesskey="&engine.addons.accesskey;"
preference="engine.addons"/>
<listitem type="checkbox"
label="&engine.bookmarks.label;"
accesskey="&engine.bookmarks.accesskey;"
preference="engine.bookmarks"/>
<listitem type="checkbox"
label="&engine.history.label;"
accesskey="&engine.history.accesskey;"
preference="engine.history"/>
<listitem type="checkbox"
label="&engine.passwords.label;"
accesskey="&engine.passwords.accesskey;"
preference="engine.passwords"/>
<listitem type="checkbox"
label="&engine.prefs.label;"
accesskey="&engine.prefs.accesskey;"
preference="engine.prefs"/>
<listitem type="checkbox"
label="&engine.tabs.label;"
accesskey="&engine.tabs.accesskey;"
preference="engine.tabs"/>
</listbox>
</vbox>
</groupbox>
<groupbox>
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&syncComputerName.label;"
accesskey="&syncComputerName.accesskey;"
control="syncComputerName"/>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this);"/>
</row>
</rows>
</grid>
</groupbox>
<hbox id="tosPP" pack="center">
<label class="text-link"
onclick="event.stopPropagation(); gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncUtils.openPrivacyPolicy();"
value="&prefs.ppLink.label;"/>
</hbox>
</vbox>
<vbox id="needsUpdate" align="center" pack="center">
<hbox>
<label id="loginError" value=""/>
<button label="&updatePass.label;"
accesskey="&updatePass.accesskey;"
oncommand="gSyncPane.updatePass(); return false;"
id="updatePassButton"/>
<button label="&resetPass.label;"
accesskey="&resetPass.accesskey;"
oncommand="gSyncPane.resetPass(); return false;"
id="resetPassButton"/>
</hbox>
<button label="&unlinkDevice.label;"
accesskey="&unlinkDevice.accesskey;"
oncommand="gSyncPane.startOver(true); return false;"
id="unlinkDeviceButton"/>
</vbox>
</deck>
</prefpane>
</overlay>

@ -1,46 +0,0 @@
<?xml version="1.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/. -->
<bindings id="tabBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="tab-listing" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<content>
<xul:hbox flex="1">
<xul:vbox>
<xul:image class="tabIcon"
xbl:inherits="src=icon"/>
</xul:vbox>
<xul:vbox flex="1">
<xul:label xbl:inherits="value=title,selected"
crop="end" flex="1" class="title"/>
<xul:label xbl:inherits="value=url,selected"
crop="end" flex="1" class="url"/>
</xul:vbox>
</xul:hbox>
</content>
<handlers>
<handler event="dblclick" button="0">
<![CDATA[
RemoteTabViewer.openSelected();
]]>
</handler>
</handlers>
</binding>
<binding id="client-listing" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<content>
<xul:hbox align="center" onfocus="event.target.blur();" onselect="return false;">
<xul:image/>
<xul:label xbl:inherits="value=clientName"
class="clientName"
crop="center" flex="1"/>
</xul:hbox>
</content>
</binding>
</bindings>

@ -1,11 +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/. */
richlistitem[type="tab"] {
-moz-binding: url(chrome://communicator/content/aboutSyncTabs-bindings.xml#tab-listing);
}
richlistitem[type="client"] {
-moz-binding: url(chrome://communicator/content/aboutSyncTabs-bindings.xml#client-listing);
}

@ -1,295 +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/. */
const Cu = Components.utils;
Cu.import("resource://services-sync/main.js");
Cu.import("resource:///modules/PlacesUIUtils.jsm");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
var RemoteTabViewer = {
_tabsList: null,
init: function () {
Services.obs.addObserver(this, "weave:service:login:finish", false);
Services.obs.addObserver(this, "weave:engine:sync:finish", false);
this._tabsList = document.getElementById("tabsList");
this.buildList(true);
},
uninit: function () {
Services.obs.removeObserver(this, "weave:service:login:finish");
Services.obs.removeObserver(this, "weave:engine:sync:finish");
},
buildList: function(force) {
if (!Weave.Service.isLoggedIn || !this._refetchTabs(force))
return;
//XXXzpao We should say something about not being logged in & not having data
// or tell the appropriate condition. (bug 583344)
this._generateTabList();
},
createItem: function(attrs) {
let item = document.createElement("richlistitem");
// Copy the attributes from the argument into the item
for (let attr in attrs)
item.setAttribute(attr, attrs[attr]);
if (attrs["type"] == "tab")
item.label = attrs.title || attrs.url;
return item;
},
filterTabs: function(event) {
let val = event.target.value.toLowerCase();
let numTabs = this._tabsList.getRowCount();
let client = null;
for (let i = 0; i < numTabs; i++) {
let item = this._tabsList.getItemAtIndex(i);
let hide = false; // By default, make sure the item is visible.
switch (item.getAttribute("type")) {
case "tab":
if (item.getAttribute("url").toLowerCase().indexOf(val) == -1 &&
item.getAttribute("title").toLowerCase().indexOf(val) == -1)
hide = true;
else
client = null; // This client should not be hidden.
break;
case "client":
if (client)
client.hidden = true; // Hide the last client, it had no visible tabs.
client = item;
break;
}
item.hidden = hide;
}
if (client)
client.hidden = true; // Hide the last client, it had no visible tabs.
},
openSelected: function() {
let items = this._tabsList.selectedItems;
let urls = [];
for (let i = 0; i < items.length; i++) {
if (items[i].getAttribute("type") == "tab") {
urls.push(items[i].getAttribute("url"));
let index = this._tabsList.getIndexOfItem(items[i]);
this._tabsList.removeItemAt(index);
}
}
if (urls.length) {
getTopWin().getBrowser().loadTabs(urls);
this._tabsList.clearSelection();
}
},
bookmarkSingleTab: function() {
let item = this._tabsList.selectedItems[0];
let uri = Weave.Utils.makeURI(item.getAttribute("url"));
let title = item.getAttribute("title");
PlacesUIUtils.showMinimalAddBookmarkUI(uri, title);
},
bookmarkSelectedTabs: function() {
let items = this._tabsList.selectedItems;
let URIs = [];
let titles = [];
for (let i = 0; i < items.length; i++) {
if (items[i].getAttribute("type") == "tab") {
let uri = Weave.Utils.makeURI(items[i].getAttribute("url"));
if (!uri)
continue;
URIs.push(uri);
titles.push(items[i].getAttribute("title"));
}
}
if (URIs.length)
PlacesUIUtils.showMinimalAddMultiBookmarkUI(URIs, titles);
},
getIcon: function (iconUri, defaultIcon) {
try {
let iconURI = Weave.Utils.makeURI(iconUri);
return PlacesUtils.favicons.getFaviconLinkForIcon(iconURI).spec;
} catch(ex) {
// Do nothing.
}
// Just give the provided default icon or the system's default.
return defaultIcon || PlacesUtils.favicons.defaultFavicon.spec;
},
_generateTabList: function() {
let engine = Weave.Service.engineManager.get("tabs");
let list = this._tabsList;
// clear out existing richlistitems
let count = list.getRowCount();
if (count > 0) {
for (let i = count - 1; i >= 0; i--)
list.removeItemAt(i);
}
let seenURLs = new Set();
let localURLs = engine.getOpenURLs();
for (let [guid, client] in Iterator(engine.getAllClients())) {
let appendClient = true;
client.tabs.forEach(function({title, urlHistory, icon}) {
let url = urlHistory[0];
if (!url || localURLs.has(url) || seenURLs.has(url))
return;
seenURLs.add(url);
if (appendClient) {
let attrs = {
type: "client",
clientName: client.clientName,
class: Weave.Service.clientsEngine.isMobile(client.id) ? "mobile" : "desktop"
};
let clientEnt = this.createItem(attrs);
list.appendChild(clientEnt);
appendClient = false;
clientEnt.disabled = true;
}
let attrs = {
type: "tab",
title: title || url,
url: url,
icon: this.getIcon(icon)
}
let tab = this.createItem(attrs);
list.appendChild(tab);
}, this);
}
},
adjustContextMenu: function(event) {
let mode = "all";
switch (this._tabsList.selectedItems.length) {
case 0:
break;
case 1:
mode = "single"
break;
default:
mode = "multiple";
break;
}
let menu = document.getElementById("tabListContext");
let el = menu.firstChild;
while (el) {
let showFor = el.getAttribute("showFor");
if (showFor)
el.hidden = showFor != mode && showFor != "all";
else // menuseparator
el.hidden = mode == "all";
el = el.nextSibling;
}
},
_refetchTabs: function(force) {
if (!force) {
// Don't bother refetching tabs if we already did so recently
let lastFetch = GetIntPref("services.sync.lastTabFetch", 0);
let now = Math.floor(Date.now() / 1000);
if (now - lastFetch < 30)
return false;
}
// if Clients hasn't synced yet this session, need to sync it as well
if (Weave.Service.clientsEngine.lastSync == 0)
Weave.Service.clientsEngine.sync();
// Force a sync only for the tabs engine
let engine = Weave.Service.engineManager.get("tabs");
engine.lastModified = null;
engine.sync();
Services.prefs.setIntPref("services.sync.lastTabFetch",
Math.floor(Date.now() / 1000));
return true;
},
observe: function(subject, topic, data) {
switch (topic) {
case "weave:service:login:finish":
this.buildList(true);
break;
case "weave:engine:sync:finish":
if (subject == "tabs")
this._generateTabList();
break;
}
},
handleClick: function(event) {
if (event.target.getAttribute("type") == "tab" && event.button == 1) {
let url = event.target.getAttribute("url");
openUILink(url, event);
let index = this._tabsList.getIndexOfItem(event.target);
this._tabsList.removeItemAt(index);
}
}
};
var EventDirector = {
handleEvent: function(event) {
switch (event.type) {
case "click":
RemoteTabViewer.handleClick(event);
break;
case "contextmenu":
RemoteTabViewer.adjustContextMenu(event);
break;
case "command":
switch (event.target.id) {
case "openSingleTab":
case "openSelectedTabs":
RemoteTabViewer.openSelected();
break;
case "bookmarkSingleTab":
RemoteTabViewer.bookmarkSingleTab();
break;
case "bookmarkSelectedTabs":
RemoteTabViewer.bookmarkSelectedTabs();
break;
case "buildList":
RemoteTabViewer.buildList();
break;
case "filterTabs":
RemoteTabViewer.filterTabs(event);
break;
}
break;
}
}
};
window.onload = function() {
RemoteTabViewer.init();
let tabsList = document.getElementById("tabsList");
tabsList.addEventListener("click", EventDirector);
tabsList.addEventListener("contextmenu", EventDirector);
document.getElementById("tabListContext")
.addEventListener("command", EventDirector);
document.getElementById("filterTabs")
.addEventListener("command", EventDirector);
}
window.onunload = function() {
RemoteTabViewer.uninit();
}

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/aboutSyncTabs.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/content/aboutSyncTabs.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % aboutSyncTabsDTD SYSTEM "chrome://communicator/locale/aboutSyncTabs.dtd">
%aboutSyncTabsDTD;
]>
<window id="tabs-display"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&tabs.otherComputers.label;">
<script type="application/javascript;version=1.8" src="chrome://communicator/content/aboutSyncTabs.js"/>
<script type="application/javascript" src="chrome://communicator/content/utilityOverlay.js"/>
<html:head>
<html:link rel="icon" href="chrome://communicator/skin/sync/sync-16.png"/>
</html:head>
<popupset id="contextmenus">
<menupopup id="tabListContext">
<menuitem id="openSingleTab"
label="&tabs.context.openTab.label;"
accesskey="&tabs.context.openTab.accesskey;"
showFor="single"/>
<menuitem id="bookmarkSingleTab"
label="&tabs.context.bookmarkSingleTab.label;"
accesskey="&tabs.context.bookmarkSingleTab.accesskey;"
showFor="single"/>
<menuitem id="openSelectedTabs"
label="&tabs.context.openMultipleTabs.label;"
accesskey="&tabs.context.openMultipleTabs.accesskey;"
showFor="multiple"/>
<menuitem id="bookmarkSelectedTabs"
label="&tabs.context.bookmarkMultipleTabs.label;"
accesskey="&tabs.context.bookmarkMultipleTabs.accesskey;"
showFor="multiple"/>
<menuseparator/>
<menuitem id="buildList"
label="&tabs.context.refreshList.label;"
accesskey="&tabs.context.refreshList.accesskey;"
showFor="all"/>
</menupopup>
</popupset>
<richlistbox id="tabsList"
context="tabListContext"
seltype="multiple"
class="plain"
align="center"
flex="1">
<hbox id="headers" align="center">
<label id="tabsListHeading"
value="&tabs.otherComputers.label;"/>
<spacer flex="1"/>
<textbox id="filterTabs"
type="search"
aria-controls="tabsList"
emptytext="&tabs.searchText.label;"/>
</hbox>
</richlistbox>
</window>

@ -1,146 +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/. */
const Ci = Components.interfaces;
const Cc = Components.classes;
const Cu = Components.utils;
Cu.import("resource://services-sync/main.js");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const PIN_PART_LENGTH = 4;
const ADD_DEVICE_PAGE = 0;
const SYNC_KEY_PAGE = 1;
const DEVICE_CONNECTED_PAGE = 2;
var gSyncAddDevice = {
init: function init() {
this.nextFocusEl = { pin1: this.pin2,
pin2: this.pin3,
pin3: this.wizard.getButton("next") };
this.throbber = document.getElementById("add-device-throbber");
this.errorRow = document.getElementById("errorRow");
},
onPageShow: function onPageShow() {
this.wizard.getButton("back").hidden = true;
switch (this.wizard.pageIndex) {
case ADD_DEVICE_PAGE:
this.onTextBoxInput();
this.wizard.canRewind = false;
this.wizard.getButton("next").hidden = false;
this.pin1.focus();
break;
case SYNC_KEY_PAGE:
this.wizard.canAdvance = false;
this.wizard.canRewind = true;
this.wizard.getButton("back").hidden = false;
this.wizard.getButton("next").hidden = true;
document.getElementById("weavePassphrase").value =
Weave.Utils.hyphenatePassphrase(Weave.Service.identity.syncKey);
break;
case DEVICE_CONNECTED_PAGE:
this.wizard.canAdvance = true;
this.wizard.canRewind = false;
this.wizard.getButton("cancel").hidden = true;
break;
}
},
onWizardAdvance: function onWizardAdvance() {
switch (this.wizard.pageIndex) {
case ADD_DEVICE_PAGE:
this.startTransfer();
return false;
case DEVICE_CONNECTED_PAGE:
window.close();
return false;
}
return true;
},
startTransfer: function startTransfer() {
this.errorRow.hidden = true;
// When onAbort is called, Weave may already be gone.
const JPAKE_ERROR_USERABORT = Weave.JPAKE_ERROR_USERABORT;
let self = this;
let jpakeclient = this._jpakeclient = new Weave.JPAKEClient({
onPaired: function onPaired() {
let credentials = {account: Weave.Service.identity.account,
password: Weave.Service.identity.basicPassword,
synckey: Weave.Service.identity.syncKey,
serverURL: Weave.Service.serverURL};
jpakeclient.sendAndComplete(credentials);
},
onComplete: function onComplete() {
delete self._jpakeclient;
self.wizard.pageIndex = DEVICE_CONNECTED_PAGE;
// Schedule a sync for soonish to fetch the data uploaded by the
// device with which we just paired.
Weave.Service.scheduler.scheduleNextSync(Weave.Service.scheduler.activeInterval);
},
onAbort: function onAbort(error) {
delete self._jpakeclient;
// Aborted by user, ignore.
if (error == JPAKE_ERROR_USERABORT)
return;
self.errorRow.hidden = false;
self.throbber.hidden = true;
self.pin1.value = self.pin2.value = self.pin3.value = "";
self.pin1.disabled = self.pin2.disabled = self.pin3.disabled = false;
self.pin1.focus();
}
});
this.throbber.hidden = false;
this.pin1.disabled = this.pin2.disabled = this.pin3.disabled = true;
this.wizard.canAdvance = false;
let pin = this.pin1.value + this.pin2.value + this.pin3.value;
let expectDelay = false;
jpakeclient.pairWithPIN(pin, expectDelay);
},
onWizardBack: function onWizardBack() {
if (this.wizard.pageIndex != SYNC_KEY_PAGE)
return true;
this.wizard.pageIndex = ADD_DEVICE_PAGE;
return false;
},
onWizardCancel: function onWizardCancel() {
if (this._jpakeclient) {
this._jpakeclient.abort();
delete this._jpakeclient;
}
return true;
},
onTextBoxInput: function onTextBoxInput(textbox) {
this.wizard.canAdvance = (this.pin1.value.length == PIN_PART_LENGTH &&
this.pin2.value.length == PIN_PART_LENGTH &&
this.pin3.value.length == PIN_PART_LENGTH);
if (textbox && textbox.value.length == PIN_PART_LENGTH)
this.nextFocusEl[textbox.id].focus();
},
goToSyncKeyPage: function goToSyncKeyPage() {
this.wizard.pageIndex = SYNC_KEY_PAGE;
}
};
// onWizardAdvance() and onPageShow() are run before init() so we'll set
// these up as lazy getters.
["wizard", "pin1", "pin2", "pin3"].forEach(function (id) {
XPCOMUtils.defineLazyGetter(gSyncAddDevice, id, function() {
return document.getElementById(id);
});
});

@ -1,132 +0,0 @@
<?xml version="1.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/. -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/sync/syncSetup.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/sync/syncCommon.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://communicator/locale/sync/syncBrand.dtd">
<!ENTITY % syncSetupDTD SYSTEM "chrome://communicator/locale/sync/syncSetup.dtd">
%brandDTD;
%syncBrandDTD;
%syncSetupDTD;
]>
<wizard xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
id="wizard"
title="&addDevice.title.label;"
windowtype="Sync:AddDevice"
persist="screenX screenY"
onwizardnext="return gSyncAddDevice.onWizardAdvance();"
onwizardback="return gSyncAddDevice.onWizardBack();"
onwizardcancel="gSyncAddDevice.onWizardCancel();"
onload="gSyncAddDevice.init();">
<script type="application/javascript"
src="chrome://communicator/content/sync/syncAddDevice.js"/>
<script type="application/javascript"
src="chrome://communicator/content/sync/syncUtils.js"/>
<script type="application/javascript"
src="chrome://communicator/content/utilityOverlay.js"/>
<script type="application/javascript"
src="chrome://global/content/printUtils.js"/>
<wizardpage id="addDevicePage"
label="&addDevice.title.label;"
onpageshow="gSyncAddDevice.onPageShow();">
<description>
&addDevice.dialog.description.label;
<label class="text-link"
value="&addDevice.showMeHow.label;"
href="https://services.mozilla.com/sync/help/add-device"/>
</description>
<spacer flex="1"/>
<description>
&addDevice.dialog.enterCode.label;
</description>
<spacer flex="1"/>
<vbox align="center">
<textbox id="pin1"
class="pin"
size="4"
maxlength="4"
oninput="gSyncAddDevice.onTextBoxInput(this);"
onfocus="this.select();"/>
<textbox id="pin2"
class="pin"
size="4"
maxlength="4"
oninput="gSyncAddDevice.onTextBoxInput(this);"
onfocus="this.select();"/>
<textbox id="pin3"
class="pin"
size="4"
maxlength="4"
oninput="gSyncAddDevice.onTextBoxInput(this);"
onfocus="this.select();"/>
</vbox>
<spacer flex="1"/>
<vbox id="add-device-throbber" align="center" hidden="true">
<image/>
</vbox>
<hbox id="errorRow" pack="center" hidden="true">
<image class="statusIcon" status="error"/>
<label class="status"
value="&addDevice.dialog.tryAgain.label;"/>
</hbox>
<spacer flex="3"/>
<label class="text-link"
value="&addDevice.dontHaveDevice.label;"
onclick="gSyncAddDevice.goToSyncKeyPage();"/>
</wizardpage>
<!-- Need a non-empty label here, otherwise we get a default label on Mac -->
<wizardpage id="syncKeyPage"
label=" "
onpageshow="gSyncAddDevice.onPageShow();">
<description>
&addDevice.dialog.recoveryKey.label;
</description>
<spacer/>
<groupbox>
<label value="&recoveryKeyEntry.label;"
accesskey="&recoveryKeyEntry.accesskey;"
control="weavePassphrase"/>
<textbox id="weavePassphrase"
readonly="true"/>
</groupbox>
<groupbox align="center">
<description>&recoveryKeyBackup.description;</description>
<hbox>
<button id="printSyncKeyButton"
label="&button.syncKeyBackup.print.label;"
accesskey="&button.syncKeyBackup.print.accesskey;"
oncommand="gSyncUtils.passphrasePrint('weavePassphrase');"/>
<button id="saveSyncKeyButton"
label="&button.syncKeyBackup.save.label;"
accesskey="&button.syncKeyBackup.save.accesskey;"
oncommand="gSyncUtils.passphraseSave('weavePassphrase');"/>
</hbox>
</groupbox>
</wizardpage>
<wizardpage id="deviceConnectedPage"
label="&addDevice.dialog.connected.label;"
onpageshow="gSyncAddDevice.onPageShow();">
<vbox align="center">
<image id="successPageIcon"/>
</vbox>
<separator/>
<description class="normal">
&addDevice.dialog.successful.label;
</description>
</wizardpage>
</wizard>

@ -1,235 +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/. */
const Ci = Components.interfaces;
const Cc = Components.classes;
Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://gre/modules/Services.jsm");
var Change = {
_dialog: null,
_dialogType: null,
_status: null,
_statusIcon: null,
_firstBox: null,
_secondBox: null,
_passphraseBox: null,
get _currentPasswordInvalid() {
return Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED;
},
get _updatingPassphrase() {
return this._dialogType == "UpdatePassphrase";
},
onLoad: function Change_onLoad() {
/* Load labels */
let introText = document.getElementById("introText");
let warningText = document.getElementById("warningText");
// load some other elements & info from the window
this._dialog = document.getElementById("change-dialog");
this._dialogType = window.arguments[0];
this._duringSetup = window.arguments[1];
this._status = document.getElementById("status");
this._statusIcon = document.getElementById("statusIcon");
this._statusRow = document.getElementById("statusRow");
this._firstBox = document.getElementById("textBox1");
this._secondBox = document.getElementById("textBox2");
this._passphraseBox = document.getElementById("passphraseBox");
this._dialog.getButton("finish").disabled = true;
this._dialog.getButton("back").hidden = true;
this._stringBundle =
Services.strings.createBundle("chrome://communicator/locale/sync/syncGenericChange.properties");
switch (this._dialogType) {
case "UpdatePassphrase":
case "ResetPassphrase":
document.getElementById("textBox1Row").hidden = true;
document.getElementById("textBox2Row").hidden = true;
document.getElementById("passphraseLabel").value
= this._str("new.recoverykey.label");
document.getElementById("passphraseSpacer").hidden = false;
if (this._updatingPassphrase) {
document.getElementById("passphraseHelpBox").hidden = false;
document.title = this._str("new.recoverykey.title");
introText.textContent = this._str("new.recoverykey.introText");
this._dialog.getButton("finish").label
= this._str("new.recoverykey.acceptButton");
}
else {
document.getElementById("generatePassphraseButton").hidden = false;
document.getElementById("passphraseBackupButtons").hidden = false;
this._passphraseBox.readOnly = true;
let pp = Weave.Service.identity.syncKey;
if (Weave.Utils.isPassphrase(pp))
pp = Weave.Utils.hyphenatePassphrase(pp);
this._passphraseBox.value = pp;
this._passphraseBox.focus();
document.title = this._str("change.recoverykey.title");
introText.textContent = this._str("change.recoverykey.introText2");
warningText.textContent = this._str("change.recoverykey.warningText");
this._dialog.getButton("finish").label
= this._str("change.recoverykey.acceptButton");
if (this._duringSetup)
this._dialog.getButton("finish").disabled = false;
}
break;
case "ChangePassword":
document.getElementById("passphraseRow").hidden = true;
let box1label = document.getElementById("textBox1Label");
let box2label = document.getElementById("textBox2Label");
box1label.value = this._str("new.password.label");
if (this._currentPasswordInvalid) {
document.title = this._str("new.password.title");
introText.textContent = this._str("new.password.introText");
this._dialog.getButton("finish").label
= this._str("new.password.acceptButton");
document.getElementById("textBox2Row").hidden = true;
}
else {
document.title = this._str("change.password.title");
box2label.value = this._str("new.password.confirm");
introText.textContent = this._str("change.password3.introText");
warningText.textContent = this._str("change.password.warningText");
this._dialog.getButton("finish").label
= this._str("change.password.acceptButton");
}
break;
}
document.getElementById("change-page")
.setAttribute("label", document.title);
},
_clearStatus: function _clearStatus() {
this._status.textContent = "";
this._statusIcon.removeAttribute("status");
},
_updateStatus: function Change__updateStatus(str, state) {
this._updateStatusWithString(this._str(str), state);
},
_updateStatusWithString: function Change__updateStatusWithString(string, state) {
this._statusRow.hidden = false;
this._status.textContent = string;
this._statusIcon.setAttribute("status", state);
let error = state == "error";
this._dialog.getButton("cancel").disabled = !error;
this._dialog.getButton("finish").disabled = !error;
document.getElementById("printSyncKeyButton").disabled = !error;
document.getElementById("saveSyncKeyButton").disabled = !error;
if (state == "success")
window.setTimeout(window.close, 1500);
},
onDialogAccept: function() {
switch (this._dialogType) {
case "UpdatePassphrase":
case "ResetPassphrase":
return this.doChangePassphrase();
break;
case "ChangePassword":
return this.doChangePassword();
break;
}
},
doGeneratePassphrase: function () {
let passphrase = Weave.Utils.generatePassphrase();
this._passphraseBox.value = Weave.Utils.hyphenatePassphrase(passphrase);
this._clearStatus();
this._dialog.getButton("finish").disabled = false;
},
doChangePassphrase: function Change_doChangePassphrase() {
let pp = Weave.Utils.normalizePassphrase(this._passphraseBox.value);
if (this._updatingPassphrase) {
Weave.Service.identity.syncKey = pp;
if (Weave.Service.login()) {
this._updateStatus("change.recoverykey.success", "success");
Weave.Service.persistLogin();
}
else {
this._updateStatus("new.passphrase.status.incorrect", "error");
}
}
else {
this._updateStatus("change.recoverykey.label", "active");
if (Weave.Service.changePassphrase(pp))
this._updateStatus("change.recoverykey.success", "success");
else
this._updateStatus("change.recoverykey.error", "error");
}
return false;
},
doChangePassword: function Change_doChangePassword() {
if (this._currentPasswordInvalid) {
Weave.Service.identity.basicPassword = this._firstBox.value;
if (Weave.Service.login()) {
this._updateStatus("change.password.status.success", "success");
Weave.Service.persistLogin();
}
else {
this._updateStatus("new.password.status.incorrect", "error");
}
}
else {
this._updateStatus("change.password.status.active", "active");
if (Weave.Service.changePassword(this._firstBox.value))
this._updateStatus("change.password.status.success", "success");
else
this._updateStatus("change.password.status.error", "error");
}
return false;
},
validate: function () {
let valid = false;
let errorString = "";
if (this._dialogType == "ChangePassword") {
if (this._currentPasswordInvalid)
[valid, errorString] = gSyncUtils.validatePassword(this._firstBox);
else
[valid, errorString] = gSyncUtils.validatePassword(this._firstBox, this._secondBox);
}
else {
if (!this._updatingPassphrase)
return;
valid = this._passphraseBox.value != "";
}
if (errorString == "")
this._clearStatus();
else
this._updateStatusWithString(errorString, "error");
this._statusRow.hidden = valid;
this._dialog.getButton("finish").disabled = !valid;
},
_str: function Change__string(str) {
try {
return this._stringBundle.GetStringFromName(str);
} catch (e) {
Components.utils.reportError("Missing string: " + str);
throw e;
}
}
};

@ -1,119 +0,0 @@
<?xml version="1.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/. -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/sync/syncSetup.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/sync/syncCommon.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://communicator/locale/sync/syncBrand.dtd">
<!ENTITY % syncSetupDTD SYSTEM "chrome://communicator/locale/sync/syncSetup.dtd">
%brandDTD;
%syncBrandDTD;
%syncSetupDTD;
]>
<wizard xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
id="change-dialog"
windowtype="Weave:ChangeSomething"
persist="screenX screenY"
onwizardnext="Change.onLoad();"
onwizardfinish="return Change.onDialogAccept();">
<script type="application/javascript"
src="chrome://communicator/content/sync/syncGenericChange.js"/>
<script type="application/javascript"
src="chrome://communicator/content/sync/syncUtils.js"/>
<script type="application/javascript"
src="chrome://global/content/printUtils.js"/>
<wizardpage id="change-page"
label="">
<description id="introText"/>
<separator class="thin"/>
<groupbox>
<grid>
<columns>
<column align="right"/>
<column flex="3"/>
<column flex="1"/>
</columns>
<rows>
<row id="textBox1Row" align="center">
<label id="textBox1Label" control="textBox1"/>
<textbox id="textBox1" type="password" oninput="Change.validate();"/>
<spacer/>
</row>
<row id="textBox2Row" align="center">
<label id="textBox2Label" control="textBox2"/>
<textbox id="textBox2" type="password" oninput="Change.validate();"/>
<spacer/>
</row>
</rows>
</grid>
<vbox id="passphraseRow">
<hbox flex="1">
<label id="passphraseLabel" control="passphraseBox"/>
<spacer flex="1"/>
<label id="generatePassphraseButton"
hidden="true"
value="&recoveryGenerateNewKey.label;"
class="text-link inline-link"
onclick="event.stopPropagation();
Change.doGeneratePassphrase();"/>
</hbox>
<textbox id="passphraseBox"
flex="1"
onfocus="this.select();"
oninput="Change.validate();"/>
</vbox>
<vbox id="feedback" pack="center">
<hbox id="statusRow" align="center">
<image id="statusIcon" class="statusIcon"/>
<label id="status" class="status" value=" "/>
</hbox>
</vbox>
</groupbox>
<separator class="thin"/>
<hbox id="passphraseBackupButtons"
hidden="true"
pack="center">
<button id="printSyncKeyButton"
label="&button.syncKeyBackup.print.label;"
accesskey="&button.syncKeyBackup.print.accesskey;"
oncommand="gSyncUtils.passphrasePrint('passphraseBox');"/>
<button id="saveSyncKeyButton"
label="&button.syncKeyBackup.save.label;"
accesskey="&button.syncKeyBackup.save.accesskey;"
oncommand="gSyncUtils.passphraseSave('passphraseBox');"/>
</hbox>
<vbox id="passphraseHelpBox"
hidden="true">
<description>
&existingRecoveryKey.description;
<label class="text-link"
href="https://services.mozilla.com/sync/help/manual-setup">
&addDevice.showMeHow.label;
</label>
</description>
</vbox>
<spacer id="passphraseSpacer" flex="1" hidden="true"/>
<description id="warningText" class="data"/>
<spacer flex="1"/>
</wizardpage>
</wizard>

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % syncBrandDTD SYSTEM "chrome://communicator/locale/sync/syncBrand.dtd">
%syncBrandDTD;
<!ENTITY % syncKeyDTD SYSTEM "chrome://communicator/locale/sync/syncKey.dtd">
%syncKeyDTD;
]>