--- a/.eslintignore
+++ b/.eslintignore
@@ -46,17 +46,16 @@ mailnews/test/*
# mailnews/extensions exclusions
mailnews/extensions/*
!mailnews/extensions/newsblog
# mail exclusions
mail/app/**
mail/base/**
mail/branding/**
-mail/components/activity/**
mail/components/cloudfile/**
mail/components/compose/**
mail/components/im/**
mail/components/newmailaccount/**
mail/components/search/**
mail/config/**
mail/extensions/**
mail/installer/**
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -1,14 +1,14 @@
/**
* 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/. */
-ChromeUtils.import("resource:///modules/activity/activityModules.js");
+ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
ChromeUtils.import("resource:///modules/errUtils.js");
ChromeUtils.import("resource:///modules/folderUtils.jsm");
ChromeUtils.import("resource:///modules/IOUtils.js");
ChromeUtils.import("resource:///modules/jsTreeSelection.js");
ChromeUtils.import("resource:///modules/MailConsts.js");
ChromeUtils.import("resource:///modules/mailInstrumentation.js");
ChromeUtils.import("resource:///modules/mailnewsMigrator.js");
ChromeUtils.import("resource:///modules/MailServices.jsm");
--- a/mail/base/test/unit/test_alertHook.js
+++ b/mail/base/test/unit/test_alertHook.js
@@ -1,14 +1,14 @@
/* 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/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/activity/alertHook.js");
+ChromeUtils.import("resource:///modules/activity/alertHook.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
ChromeUtils.import("resource://testing-common/mailnews/MockFactory.js");
alertHook.init();
// Replace the alerts service with our own. This will let us check if we're
// prompting or not.
var gAlertShown = false;
--- a/mail/components/activity/content/activity.js
+++ b/mail/components/activity/content/activity.js
@@ -1,183 +1,165 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* 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/. */
-////////////////////////////////////////////////////////////////////////////////
-//// Globals
-
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
+const activityManager = Cc["@mozilla.org/activity-manager;1"].getService(Ci.nsIActivityManager);
-var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
- "nsIActivityProcess", "init");
-var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
- "nsIActivityEvent", "init");
-var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
- "nsIActivityWarning", "init");
var ACTIVITY_LIMIT = 250;
-var activityObject =
-{
-
+var activityObject = {
_activityMgrListener: null,
_activitiesView: null,
_activityLogger: Log4Moz.getConfiguredLogger("activitymgr"),
_ignoreNotifications: false,
_groupCache: new Map(),
- selectAll: function() {
+ selectAll() {
this._activitiesView.selectAll();
},
- //////////////////////////////////////////////////////////////////////////////
- //// An object to monitor nsActivityManager operations. This class acts as
- //// binding layer between nsActivityManager and nsActivityManagerUI objects.
+ // An object to monitor nsActivityManager operations. This class acts as
+ // binding layer between nsActivityManager and nsActivityManagerUI objects.
/**
* Note: The prototype for this function is set at the bottom of this file.
*/
- ActivityMgrListener: function() {},
+ ActivityMgrListener() {},
- //////////////////////////////////////////////////////////////////////////////
- //// Utility Functions for Activity binding management
+ // Utility Functions for Activity binding management
/**
* Creates the proper binding for the given activity
*/
- createActivityBinding: function(aActivity) {
+ createActivityBinding(aActivity) {
let bindingName = aActivity.bindingName;
let binding = document.createElement(bindingName);
if (binding)
- binding.setAttribute('actID', aActivity.id);
+ binding.setAttribute("actID", aActivity.id);
return binding;
},
/**
* Returns the activity group binding that matches the context_type
* and context of the given activity, if any.
*/
- getActivityGroupBindingByContext: function(aContextType, aContextObj) {
+ getActivityGroupBindingByContext(aContextType, aContextObj) {
return this._groupCache.get(aContextType + ":" + aContextObj);
},
/**
* Inserts the given binding into the correct position on the
* activity manager window.
*/
- placeActivityBinding: function(aBinding) {
+ placeActivityBinding(aBinding) {
if (aBinding.isGroup || aBinding.isProcess)
this._activitiesView.insertBefore(aBinding,
this._activitiesView.firstChild);
else {
let next = this._activitiesView.firstChild;
while (next && (next.isWarning || next.isProcess || next.isGroup))
next = next.nextSibling;
if (next)
this._activitiesView.insertBefore(aBinding, next);
else
this._activitiesView.appendChild(aBinding);
}
if (aBinding.isGroup)
this._groupCache.set(aBinding.contextType + ":" + aBinding.contextObj,
aBinding);
while (this._activitiesView.childNodes.length > ACTIVITY_LIMIT)
- this.removeActivityBinding(this._activitiesView.lastChild.getAttribute('actID'));
+ this.removeActivityBinding(this._activitiesView.lastChild.getAttribute("actID"));
},
/**
* Adds a new binding to activity manager window for the
* given activity. It is called by ActivityMgrListener when
* a new activity is added into the activity manager's internal
* list.
*/
- addActivityBinding: function(aID, aActivity) {
+ addActivityBinding(aID, aActivity) {
try {
- this._activityLogger.info("Adding ActivityBinding: " + aID + ", " +
- aActivity)
+ this._activityLogger.info(`Adding ActivityBinding: ${aID}, ${aActivity}`);
// get |groupingStyle| of the activity. Grouping style determines
// whether we show the activity standalone or grouped by context in
// the activity manager window.
let isGroupByContext = (aActivity.groupingStyle ==
Ci.nsIActivity
.GROUPING_STYLE_BYCONTEXT);
// find out if an activity group has already been created for this context
let group = null;
if (isGroupByContext) {
group = this.getActivityGroupBindingByContext(aActivity.contextType,
aActivity.contextObj);
// create a group if it's not already created.
if (!group) {
group = document.createElement("activity-group");
- this._activityLogger.info("created group element")
+ this._activityLogger.info("created group element");
// Set the context type and object of the newly created group
group.contextType = aActivity.contextType;
group.contextObj = aActivity.contextObj;
group.contextDisplayText = aActivity.contextDisplayText;
// add group into the list
this.placeActivityBinding(group);
}
}
// create the appropriate binding for the activity
let actBinding = this.createActivityBinding(aActivity);
- this._activityLogger.info("created activity binding")
+ this._activityLogger.info("created activity binding");
if (group) {
// get the inner list element of the group
let groupView = document.getAnonymousElementByAttribute(group, "anonid",
"activityGroupView");
groupView.appendChild(actBinding);
- }
- else {
+ } else {
this.placeActivityBinding(actBinding);
}
} catch (e) {
this._activityLogger.error("addActivityBinding: " + e);
- throw(e);
+ throw e;
}
},
/**
* Removes the activity binding from the activity manager window.
* It is called by ActivityMgrListener when the activity in question
* is removed from the activity manager's internal list.
*/
- removeActivityBinding: function(aID) {
+ removeActivityBinding(aID) {
// Note: document.getAnonymousNodes(_activitiesView); didn't work
this._activityLogger.info("removing Activity ID: " + aID);
let activities = this._activitiesView.childNodes;
for (let i = 0; i < activities.length; i++) {
let item = activities[i];
if (!item) {
- this._activityLogger.debug("returning as empty")
+ this._activityLogger.debug("returning as empty");
return;
}
if (!item.isGroup) {
- this._activityLogger.debug("is not a group, ")
- if (item.getAttribute('actID') == aID) {
+ this._activityLogger.debug("is not a group, ");
+ if (item.getAttribute("actID") == aID) {
// since XBL dtors are not working properly when we remove the
// element, we have to explicitly remove the binding from
// activities' listeners list. See bug 230086 for details.
item.detachFromActivity();
item.remove();
break;
}
- }
- else {
- let actbinding = document.getAnonymousElementByAttribute(item, 'actID',
- aID);
+ } else {
+ let actbinding = document.getAnonymousElementByAttribute(item, "actID", aID);
if (actbinding) {
let groupView = document.getAnonymousElementByAttribute(item,
"anonid", "activityGroupView");
// since XBL dtors are not working properly when we remove the
// element, we have to explicitly remove the binding from
// activities' listeners list. See bug 230086 for details.
actbinding.detachFromActivity();
actbinding.remove();
@@ -190,134 +172,123 @@ var activityObject =
}
break;
}
}
}
},
- //////////////////////////////////////////////////////////////////////////////
- //// Startup, Shutdown
+ // -----------------
+ // Startup, Shutdown
- startup: function() {
+ startup() {
try {
this._activitiesView = document.getElementById("activityView");
- let activityManager = Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager);
let activities = activityManager.getActivities({});
for (let iActivity = Math.max(0, activities.length - ACTIVITY_LIMIT);
iActivity < activities.length; iActivity++) {
let activity = activities[iActivity];
this.addActivityBinding(activity.id, activity);
}
// start listening changes in the activity manager's
// internal list
this._activityMgrListener = new this.ActivityMgrListener();
activityManager.addListener(this._activityMgrListener);
} catch (e) {
- this._activityLogger.error("Exception: " + e )
+ this._activityLogger.error("Exception: " + e);
}
},
- rebuild: function() {
- let activityManager = Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager);
+ rebuild() {
let activities = activityManager.getActivities({});
for (let activity of activities)
this.addActivityBinding(activity.id, activity);
},
- shutdown: function() {
- let activityManager = Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager);
+ shutdown() {
activityManager.removeListener(this._activityMgrListener);
},
- //////////////////////////////////////////////////////////////////////////////
- //// Utility Functions
+ // -----------------
+ // Utility Functions
/**
* Remove all activities not in-progress from the activity list.
*/
- clearActivityList: function() {
+ clearActivityList() {
this._activityLogger.debug("clearActivityList");
this._ignoreNotifications = true;
// If/when we implement search, we'll want to remove just the items
// that are on the search display, however for now, we'll just clear up
// everything.
- Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager)
- .cleanUp();
+ activityManager.cleanUp();
// since XBL dtors are not working properly when we remove the element,
// we have to explicitly remove the binding from activities' listeners
// list. See bug 230086 for details.
let activities = this._activitiesView.childNodes;
for (let i = activities.length - 1; i >= 0; i--) {
let item = activities[i];
- if (!item.isGroup)
+ if (!item.isGroup) {
item.detachFromActivity();
- else {
- let actbinding = document.getAnonymousElementByAttribute(item,
- 'actID', '*');
+ } else {
+ let actbinding = document.getAnonymousElementByAttribute(item, "actID", "*");
while (actbinding) {
actbinding.detachFromActivity();
actbinding.remove();
- actbinding = document.getAnonymousElementByAttribute(item,
- 'actID', '*');
+ actbinding = document.getAnonymousElementByAttribute(item, "actID", "*");
}
}
}
let empty = this._activitiesView.cloneNode(false);
this._activitiesView.parentNode.replaceChild(empty, this._activitiesView);
this._activitiesView = empty;
this._groupCache.clear();
this.rebuild();
this._ignoreNotifications = false;
this._activitiesView.focus();
},
- processKeyEvent: function(event) {
+ processKeyEvent(event) {
switch (event.keyCode) {
case event.DOM_VK_RIGHT:
- if (event.target.tagName == 'richlistbox') {
+ if (event.target.tagName == "richlistbox") {
let richlistbox = event.target.selectedItem.processes;
- if (richlistbox.tagName == 'xul:richlistbox') {
+ if (richlistbox.tagName == "xul:richlistbox") {
richlistbox.focus();
richlistbox.selectItem(richlistbox.getItemAtIndex(0));
}
}
break;
case event.DOM_VK_LEFT:
- if (event.target.tagName == 'activity-group') {
+ if (event.target.tagName == "activity-group") {
var parent = event.target.parentNode;
- if (parent.tagName == 'richlistbox') {
+ if (parent.tagName == "richlistbox") {
event.target.processes.clearSelection();
parent.selectItem(event.target);
parent.focus();
}
}
break;
}
},
};
activityObject.ActivityMgrListener.prototype = {
- onAddedActivity: function(aID, aActivity) {
- activityObject._activityLogger.info("added activity: " + aID + " " +
- aActivity)
+ onAddedActivity(aID, aActivity) {
+ activityObject._activityLogger.info(`added activity: ${aID} ${aActivity}`);
if (!activityObject._ignoreNotifications)
activityObject.addActivityBinding(aID, aActivity);
},
- onRemovedActivity: function(aID) {
+ onRemovedActivity(aID) {
if (!activityObject._ignoreNotifications)
activityObject.removeActivityBinding(aID);
- }
+ },
};
--- a/mail/components/activity/content/activity.xml
+++ b/mail/components/activity/content/activity.xml
@@ -17,17 +17,17 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="activity-group"
extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation>
<constructor>
<![CDATA[
- this.setAttribute('contextDisplayText', this.contextDisplayText);
+ this.setAttribute("contextDisplayText", this.contextDisplayText);
]]>
</constructor>
<field name="contextType">
""
</field>
<field name="contextObj">
null
</field>
@@ -38,17 +38,17 @@
<getter>
<![CDATA[
return this._contextDisplayText;
]]>
</getter>
<setter>
<![CDATA[
this._contextDisplayText = val;
- document.getAnonymousElementByAttribute(this, "anonid", "contextlbl").setAttribute("value", val)
+ document.getAnonymousElementByAttribute(this, "anonid", "contextlbl").setAttribute("value", val);
]]>
</setter>
</property>
<property name="isGroup">
<getter>
<![CDATA[
return true;
]]>
@@ -60,22 +60,19 @@
return document.getAnonymousElementByAttribute(this, "anonid",
"activityGroupView");
]]>
</getter>
</property>
<method name="retry">
<body>
<![CDATA[
- let activityManager = Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager);
-
- let processes = activityManager
- .getProcessesByContext(this.contextType,
- this.contextObj, {});
+ /* globals activityManager */
+ let processes = activityManager.getProcessesByContext(this.contextType,
+ this.contextObj, {});
for (let process of processes) {
if (process.retryHandler)
process.retryHandler.retry(process);
}
]]>
</body>
</method>
</implementation>
@@ -101,27 +98,26 @@
</xul:vbox>
</content>
</binding>
<binding id="activity-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
<implementation implements="nsIActivityListener">
<constructor>
<![CDATA[
+ /* globals activityManager */
ChromeUtils.import("resource:///modules/templateUtils.js", this);
try {
- ChromeUtils.import("resource:///modules/gloda/log4moz.js");
- let activityManager = Cc["@mozilla.org/activity-manager;1"]
- .getService(Ci.nsIActivityManager);
+ const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
// fetch the activity and set the base attributes
- let actID = this.getAttribute('actID');
+ let actID = this.getAttribute("actID");
this._activity = activityManager.getActivity(actID);
this._activity.addListener(this);
- this.setAttribute('iconclass', this._activity.iconClass);
+ this.setAttribute("iconclass", this._activity.iconClass);
this.log = Log4Moz.getConfiguredLogger("activity-base");
this.text = {
paused: "paused2",
canceled: "canceled",
failed: "failed",
waitingforinput: "waitingForInput",
waitingforretry: "waitingForRetry",
@@ -173,21 +169,21 @@
return this._activity && (this._activity instanceof
Ci.nsIActivityWarning);
]]>
</getter>
</property>
<property name="isOrphan">
<getter>
<![CDATA[
+ /* globals activityManager */
try {
- let activity = activityManager.getActivity(this._activity.id);
- return false;
- }
- catch(e) {
+ activityManager.getActivity(this._activity.id);
+ return false;
+ } catch (e) {
// happens when the given activity is already removed form
// the activity manager. Returning true indicates that the
// XBL doesn't have any associated activity - orphan.
}
return true;
]]>
</getter>
</property>
@@ -217,27 +213,28 @@
]]>
</getter>
</property>
<method name="setVisibility">
<parameter name="anonid"/>
<parameter name="visible"/>
<body>
<![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid",
- anonid).setAttribute('hidden', !visible);
+ document.getAnonymousElementByAttribute(this, "anonid", anonid)
+ .setAttribute("hidden", !visible);
]]>
</body>
</method>
<method name="formatTimeTip">
<parameter name="time"/>
<body>
<![CDATA[
+ ChromeUtils.import("resource://gre/modules/Services.jsm");
const dateTimeFormatter = new Services.intl.DateTimeFormat(undefined, {
- dateStyle: "long", timeStyle: "short"
+ dateStyle: "long", timeStyle: "short",
});
// Get the end time to display
let end = new Date(parseInt(time));
// Set the tooltip to be the full date and time
return dateTimeFormatter.format(end);
]]>
@@ -260,100 +257,96 @@
this.displayText = this._activity.displayText;
// make sure that binding reflects the latest state of the process
this.onStateChanged(this._activity.state,
Ci.nsIActivityProcess.STATE_NOTSTARTED);
this.onProgressChanged(this._activity,
this._activity.lastStatusText,
this._activity.workUnitComplete,
this._activity.totalWorkUnits);
- }
- catch(e) {
+ } catch (e) {
this.log.error("Exception constructing activity-process: " + e);
- throw(e)
+ throw e;
}
]]>
</constructor>
<property name="displayText">
<getter>
<![CDATA[
- return this.getAttribute('displayText');
+ return this.getAttribute("displayText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('displayText', val);
+ this.setAttribute("displayText", val);
]]>
</setter>
</property>
<property name="statusText">
<getter>
<![CDATA[
- return this.getAttribute('statusText');
+ return this.getAttribute("statusText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('statusText', val);
+ this.setAttribute("statusText", val);
]]>
</setter>
</property>
<property name="inProgress">
<getter>
<![CDATA[
return (this._activity.state ==
Ci.nsIActivityProcess.STATE_INPROGRESS);
]]>
</getter>
</property>
<property name="isRemovable">
<getter>
<![CDATA[
return this._activity.state == Ci.nsIActivityProcess.STATE_COMPLETED ||
- this._activity.state == Ci.nsIActivityProcess.STATE_CANCELED
+ this._activity.state == Ci.nsIActivityProcess.STATE_CANCELED;
]]>
</getter>
</property>
<property name="canCancel">
<getter>
<![CDATA[
try {
return (this._activity.cancelHandler != null);
- }
- catch(e) {
+ } catch (e) {
// In normal conditions, we shouldn't endup here. This can only
// happen if the XBL is orphan - associated activity has been
// deleted but XBL stays alive.
}
return false;
]]>
</getter>
</property>
<property name="canPause">
<getter>
<![CDATA[
try {
return (this._activity.pauseHandler != null);
- }
- catch(e) {
+ } catch (e) {
// In normal conditions, we shouldn't endup here. This can only
// happen if the XBL is orphan - associated activity has been
// deleted but XBL stays alive.
}
return false;
]]>
</getter>
</property>
<property name="canRetry">
<getter>
<![CDATA[
try {
return (this._activity.retryHandler != null);
- }
- catch(e) {
+ } catch (e) {
// In normal conditions, we shouldn't endup here. This can only
// happen if the XBL is orphan - associated activity has been
// deleted but XBL stays alive.
}
return false;
]]>
</getter>
</property>
@@ -368,17 +361,17 @@
let hideCancelBut = true;
let hideRetryBut = true;
let hidePauseBut = true;
let hideResumeBut = true;
let hideProgressMeter = false;
let displayText = this.displayText;
let statusText = this.statusText;
- switch(this._activity.state) {
+ switch (this._activity.state) {
case Ci.nsIActivityProcess.STATE_INPROGRESS:
hideCancelBut = !this.canCancel;
hidePauseBut = !this.canPause;
// status text is empty
statusText = "";
break;
case Ci.nsIActivityProcess.STATE_COMPLETED:
// all buttons and progress meter are hidden
@@ -440,22 +433,21 @@
<body>
<![CDATA[
let element =
document.getAnonymousElementByAttribute(this, "anonid",
"progressmeter");
if (aTotalWorkUnits == 0) {
element.setAttribute("mode", "undetermined");
element.setAttribute("value", 0);
- }
- else {
+ } else {
let _percentComplete = 100.0 * aWorkUnitsComplete /
aTotalWorkUnits;
element.setAttribute("mode", "determined");
- element.setAttribute('value', _percentComplete);
+ element.setAttribute("value", _percentComplete);
}
this.statusText = aStatusText;
]]>
</body>
</method>
<method name="onHandlerChanged">
<parameter name="aActivity"/>
<body>
@@ -467,18 +459,17 @@
let hideResumeBut = !this.canPause ||
this._activity.state == Ci.nsIActivityProcess.STATE_PAUSED;
this.setVisibility("button_cancel", !hideCancelBut);
this.setVisibility("button_retry", !hideRetryBut);
if (hidePauseBut) {
this.setVisibility("button_pause", !hidePauseBut);
this.setVisibility("button_resume", !hideResumeBut);
- }
- else {
+ } else {
this.setVisibility("button_pause", this.paused);
this.setVisibility("button_resume", !this.paused);
}
]]>
</body>
</method>
<property name="paused">
<getter>
@@ -558,68 +549,66 @@
// We deliberately propagate the exceptions to the caller.
this._activity.QueryInterface(Ci.nsIActivityEvent);
try {
this.displayText = this._activity.displayText;
this.statusText = this._activity.statusText;
this.completionTime = this._activity.completionTime;
this.setVisibility("button_undo", this._activity.undoHandler);
- }
- catch(e) {
+ } catch (e) {
this.log.error("Exception constructing activity-event: " + e);
- throw(e)
+ throw e;
}
]]>
</constructor>
<property name="displayText">
<getter>
<![CDATA[
- return this.getAttribute('displayText');
+ return this.getAttribute("displayText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('displayText', val);
+ this.setAttribute("displayText", val);
]]>
</setter>
</property>
<property name="statusText">
<getter>
<![CDATA[
- return this.getAttribute('statusText');
+ return this.getAttribute("statusText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('statusText', val);
+ this.setAttribute("statusText", val);
]]>
</setter>
</property>
<property name="completionTime">
<getter>
<![CDATA[
- return this.getAttribute('completionTime');
+ return this.getAttribute("completionTime");
]]>
</getter>
<setter>
<![CDATA[
this.setAttribute("completionTime",
this.makeFriendlyDateAgo(new Date(parseInt(val))));
this.setAttribute("completionTimeTip", this.formatTimeTip(val));
]]>
</setter>
</property>
<property name="canUndo">
<getter>
<![CDATA[
try {
return (this._activity.undoHandler != null);
- }
- catch(e) {
+ } catch (e) {
// In normal conditions, we shouldn't endup here. This can only
// happen if the XBL is orphan - associated activity has been
// deleted but XBL stays alive.
}
return false;
]]>
</getter>
</property>
@@ -669,67 +658,65 @@
// We deliberately propagate the exceptions to the caller.
this._activity.QueryInterface(Ci.nsIActivityWarning);
try {
this.displayText = this._activity.displayText;
this.dateTime = this._activity.time;
this.recoveryTipText = this._activity.recoveryTipText;
this.setVisibility("button_recover", this._activity.recoveryHandler);
- }
- catch(e) {
+ } catch (e) {
this.log.error("Exception constructing activity-warning: " + e);
- throw(e)
+ throw e;
}
]]>
</constructor>
<property name="displayText">
<getter>
<![CDATA[
- return this.getAttribute('displayText');
+ return this.getAttribute("displayText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('displayText', val);
+ this.setAttribute("displayText", val);
]]>
</setter>
</property>
<property name="recoveryTipText">
<getter>
<![CDATA[
- return this.getAttribute('recoveryTipText');
+ return this.getAttribute("recoveryTipText");
]]>
</getter>
<setter>
<![CDATA[
- this.setAttribute('recoveryTipText', val);
+ this.setAttribute("recoveryTipText", val);
]]>
</setter>
</property>
<property name="dateTime">
<getter>
<![CDATA[
- return this.getAttribute('dateTime');
+ return this.getAttribute("dateTime");
]]>
</getter>
<setter>
<![CDATA[
this.setAttribute("dateTime",
this.makeFriendlyDateAgo(new Date(parseInt(val))));
]]>
</setter>
</property>
<property name="canRecover">
<getter>
<![CDATA[
try {
return (this._activity.recoveryHandler != null);
- }
- catch(e) {
+ } catch (e) {
// In normal conditions, we shouldn't endup here. This can only
// happen if the XBL is orphan - associated activity has been
// deleted but XBL stays alive.
}
return false;
]]>
</getter>
</property>
rename from mail/components/activity/modules/activityModules.js
rename to mail/components/activity/modules/activityModules.jsm
--- a/mail/components/activity/modules/activityModules.js
+++ b/mail/components/activity/modules/activityModules.jsm
@@ -3,20 +3,20 @@
* 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/. */
// This module is designed to be a central place to initialise activity related
// modules.
this.EXPORTED_SYMBOLS = [];
-ChromeUtils.import("resource:///modules/activity/sendLater.js");
+const { sendLaterModule } = ChromeUtils.import("resource:///modules/activity/sendLater.jsm", null);
sendLaterModule.init();
-ChromeUtils.import("resource:///modules/activity/moveCopy.js");
+const { moveCopyModule } = ChromeUtils.import("resource:///modules/activity/moveCopy.jsm", null);
moveCopyModule.init();
-ChromeUtils.import("resource:///modules/activity/glodaIndexer.js");
+const { glodaIndexerActivity } = ChromeUtils.import("resource:///modules/activity/glodaIndexer.jsm", null);
glodaIndexerActivity.init();
-ChromeUtils.import("resource:///modules/activity/autosync.js");
+const { autosyncModule } = ChromeUtils.import("resource:///modules/activity/autosync.jsm", null);
autosyncModule.init();
-ChromeUtils.import("resource:///modules/activity/alertHook.js");
+ChromeUtils.import("resource:///modules/activity/alertHook.jsm");
alertHook.init();
-ChromeUtils.import("resource:///modules/activity/pop3Download.js");
+const { pop3DownloadModule } = ChromeUtils.import("resource:///modules/activity/pop3Download.jsm", null);
pop3DownloadModule.init();
rename from mail/components/activity/modules/alertHook.js
rename to mail/components/activity/modules/alertHook.jsm
--- a/mail/components/activity/modules/alertHook.js
+++ b/mail/components/activity/modules/alertHook.jsm
@@ -1,26 +1,24 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
-this.EXPORTED_SYMBOLS = ['alertHook'];
+this.EXPORTED_SYMBOLS = ["alertHook"];
var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
"nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
// This module provides a link between the send later service and the activity
// manager.
-var alertHook =
-{
+var alertHook = {
get activityMgr() {
delete this.activityMgr;
return this.activityMgr = Cc["@mozilla.org/activity-manager;1"]
.getService(Ci.nsIActivityManager);
},
get alertService() {
delete this.alertService;
@@ -32,60 +30,57 @@ var alertHook =
delete this.brandShortName;
return this.brandShortName = Services.strings
.createBundle("chrome://branding/locale/brand.properties")
.GetStringFromName("brandShortName");
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgUserFeedbackListener]),
- onAlert: function (aMessage, aUrl) {
+ onAlert(aMessage, aUrl) {
// Create a new warning.
let warning = new nsActWarning(aMessage, this.activityMgr, "");
if (aUrl && aUrl.server && aUrl.server.prettyName) {
warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT;
warning.contextType = "incomingServer";
warning.contextDisplayText = aUrl.server.prettyName;
warning.contextObj = aUrl.server;
+ } else {
+ warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
}
- else
- warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
this.activityMgr.addActivity(warning);
// If we have a message window in the url, then show a warning prompt,
// just like the modal code used to. Otherwise, don't.
try {
if (!aUrl || !aUrl.msgWindow)
return true;
- }
- // nsIMsgMailNewsUrl.msgWindow will throw on a null pointer, so that's
- // what we're handling here.
- catch (ex) {
+ } catch (ex) {
+ // nsIMsgMailNewsUrl.msgWindow will throw on a null pointer, so that's
+ // what we're handling here.
if (ex instanceof Ci.nsIException &&
ex.result == Cr.NS_ERROR_INVALID_POINTER) {
return true;
- } else {
- throw ex;
}
+ throw ex;
}
try {
this.alertService
.showAlertNotification("chrome://branding/content/icon48.png",
this.brandShortName, aMessage);
- }
- catch (ex) {
+ } catch (ex) {
// XXX On Linux, if libnotify isn't supported, showAlertNotification
// can throw an error, so fall-back to the old method of modal dialogs.
return false;
}
return true;
},
- init: function() {
+ init() {
// We shouldn't need to remove the listener as we're not being held by
// anyone except by the send later instance.
MailServices.mailSession.addUserFeedbackListener(this);
- }
+ },
};
rename from mail/components/activity/modules/autosync.js
rename to mail/components/activity/modules/autosync.jsm
--- a/mail/components/activity/modules/autosync.js
+++ b/mail/components/activity/modules/autosync.jsm
@@ -1,43 +1,39 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
-this.EXPORTED_SYMBOLS = ['autosyncModule'];
+this.EXPORTED_SYMBOLS = ["autosyncModule"];
var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
"nsIActivityProcess", "init");
var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
"nsIActivityEvent", "init");
-var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
- "nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
var nsIAutoSyncMgrListener = Ci.nsIAutoSyncMgrListener;
/**
* This code aims to mediate between the auto-sync code and the activity mgr.
*
* Not every auto-sync activity is directly mapped to a process or event.
* To prevent a possible event overflow, Auto-Sync monitor generates one
* sync'd event per account when after all its _pending_ folders are sync'd,
* rather than generating one event per folder sync.
*/
var autosyncModule =
{
- _inQFolderList : [],
- _running : false,
+ _inQFolderList: [],
+ _running: false,
_syncInfoPerFolder: new Map(),
_syncInfoPerServer: new Map(),
_lastMessage: new Map(),
get log() {
delete this.log;
return this.log = Log4Moz.getConfiguredLogger("autosyncActivities");
},
@@ -55,50 +51,50 @@ var autosyncModule =
},
get bundle() {
delete this.bundle;
return this.bundle = Services.strings
.createBundle("chrome://messenger/locale/activity.properties");
},
- getString: function(stringName) {
+ getString(stringName) {
try {
- return this.bundle.GetStringFromName(stringName)
+ return this.bundle.GetStringFromName(stringName);
} catch (e) {
this.log.error("error trying to get a string called: " + stringName);
- throw(e);
+ throw e;
}
},
- createSyncMailProcess : function(folder) {
+ createSyncMailProcess(folder) {
try {
// create an activity process for this folder
let msg = this.bundle.formatStringFromName("autosyncProcessDisplayText",
- [folder.prettyName], 1)
+ [folder.prettyName], 1);
let process = new nsActProcess(msg, this.autoSyncManager);
// we want to use default auto-sync icon
process.iconClass = "syncMail";
process.addSubject(folder);
// group processes under folder's imap account
process.contextType = "account";
process.contextDisplayText = this.bundle.formatStringFromName("autosyncContextDisplayText",
- [folder.server.prettyName], 1)
+ [folder.server.prettyName], 1);
process.contextObj = folder.server;
return process;
} catch (e) {
this.log.error("createSyncMailProcess: " + e);
- throw(e);
+ throw e;
}
},
- createSyncMailEvent : function(syncItem) {
+ createSyncMailEvent(syncItem) {
try {
// extract the relevant parts
let process = syncItem.activity;
let folder = syncItem.syncFolder;
// create an activity event
let msg = this.bundle.formatStringFromName("autosyncEventDisplayText",
@@ -115,122 +111,118 @@ var autosyncModule =
let event = new nsActEvent(msg, this.autoSyncManager, statusMsg,
this._syncInfoPerServer.get(folder.server).startTime,
Date.now()); // completion time
// since auto-sync events do not have undo option by nature,
// setting these values are informational only.
event.contextType = process.contextType;
event.contextDisplayText = this.bundle.formatStringFromName("autosyncContextDisplayText",
- [folder.server.prettyName], 1)
+ [folder.server.prettyName], 1);
event.contextObj = process.contextObj;
event.iconClass = "syncMail";
// transfer all subjects.
// same as above, not mandatory
let subjects = process.getSubjects({});
for (let subject of subjects)
event.addSubject(subject);
return event;
} catch (e) {
this.log.error("createSyncMailEvent: " + e);
- throw(e);
+ throw e;
}
},
- onStateChanged : function(running) {
+ onStateChanged(running) {
try {
this._running = running;
this.log.info("OnStatusChanged: " + (running ? "running" : "sleeping") + "\n");
} catch (e) {
this.log.error("onStateChanged: " + e);
- throw(e);
+ throw e;
}
},
- onFolderAddedIntoQ : function(queue, folder) {
+ onFolderAddedIntoQ(queue, folder) {
try {
if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
this._inQFolderList.push(folder);
this.log.info("Auto_Sync OnFolderAddedIntoQ [" + this._inQFolderList.length + "] " +
folder.prettyName + " of " + folder.server.prettyName);
// create an activity process for this folder
let process = this.createSyncMailProcess(folder);
// create a sync object to keep track of the process of this folder
let imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
let syncItem = { syncFolder: folder,
activity: process,
percentComplete: 0,
totalDownloaded: 0,
- pendingMsgCount: imapFolder.autoSyncStateObj.pendingMessageCount
+ pendingMsgCount: imapFolder.autoSyncStateObj.pendingMessageCount,
};
// if this is the first folder of this server in the queue, then set the sync start time
// for activity event
if (!this._syncInfoPerServer.has(folder.server)) {
this._syncInfoPerServer.set(folder.server, { startTime: Date.now(),
- totalDownloads: 0
+ totalDownloads: 0,
});
}
// associate the sync object with the folder in question
// use folder.URI as key
this._syncInfoPerFolder.set(folder.URI, syncItem);
}
} catch (e) {
this.log.error("onFolderAddedIntoQ: " + e);
- throw(e);
+ throw e;
}
},
- onFolderRemovedFromQ : function(queue, folder) {
+ onFolderRemovedFromQ(queue, folder) {
try {
if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
let i = this._inQFolderList.indexOf(folder);
if (i > -1)
this._inQFolderList.splice(i, 1);
this.log.info("OnFolderRemovedFromQ [" + this._inQFolderList.length + "] " +
folder.prettyName + " of " + folder.server.prettyName + "\n");
let syncItem = this._syncInfoPerFolder.get(folder.URI);
let process = syncItem.activity;
let canceled = false;
- if (process instanceof Ci.nsIActivityProcess)
- {
+ if (process instanceof Ci.nsIActivityProcess) {
canceled = (process.state == Ci.nsIActivityProcess.STATE_CANCELED);
process.state = Ci.nsIActivityProcess.STATE_COMPLETED;
try {
this.activityMgr.removeActivity(process.id);
- }
- catch(e) {
+ } catch (e) {
// It is OK to end up here; If the folder is queued and the
// message get manually downloaded by the user, we might get
// a folder removed notification even before a download
// started for this folder. This behavior stems from the fact
// that we add activities into the activity manager in
// onDownloadStarted notification rather than onFolderAddedIntoQ.
// This is an expected side effect.
}
// remove the folder/syncItem association from the table
this._syncInfoPerFolder.delete(folder.URI);
}
// if this is the last folder of this server in the queue
// create a sync event and clean the sync start time
let found = false;
- for (let value of this._syncInfoPerFolder.values())
- {
- if (value.syncFolder.server == folder.server)
- {
+ for (let value of this._syncInfoPerFolder.values()) {
+ if (value.syncFolder.server == folder.server) {
found = true;
break;
}
}
this.log.info("Auto_Sync OnFolderRemovedFromQ Last folder of the server: " + !found);
if (!found) {
// create an sync event for the completed process if it's not canceled
if (!canceled) {
@@ -241,20 +233,20 @@ var autosyncModule =
this._lastMessage.set(key, this.activityMgr
.addActivity(this.createSyncMailEvent(syncItem)));
}
this._syncInfoPerServer.delete(folder.server);
}
}
} catch (e) {
this.log.error("onFolderRemovedFromQ: " + e);
- throw(e);
+ throw e;
}
},
- onDownloadStarted : function(folder, numOfMessages, totalPending) {
+ onDownloadStarted(folder, numOfMessages, totalPending) {
try {
if (folder instanceof Ci.nsIMsgFolder) {
this.log.info("OnDownloadStarted (" + numOfMessages + "/" + totalPending + "): " +
folder.prettyName + " of " + folder.server.prettyName + "\n");
let syncItem = this._syncInfoPerFolder.get(folder.URI);
let process = syncItem.activity;
@@ -269,17 +261,17 @@ var autosyncModule =
if (!this.activityMgr.containsActivity(process.id)) {
this.log.info("Auto_Sync OnDownloadStarted: No process, adding a new process");
this.activityMgr.addActivity(process);
}
syncItem.totalDownloaded += numOfMessages;
process.state = Ci.nsIActivityProcess.STATE_INPROGRESS;
- let percent = (syncItem.totalDownloaded/syncItem.pendingMsgCount)*100;
+ let percent = (syncItem.totalDownloaded / syncItem.pendingMsgCount) * 100;
if (percent > syncItem.percentComplete)
syncItem.percentComplete = percent;
let msg = this.bundle.formatStringFromName("autosyncProcessProgress2",
[syncItem.totalDownloaded,
syncItem.pendingMsgCount,
folder.prettyName,
folder.server.prettyName], 4);
@@ -288,55 +280,55 @@ var autosyncModule =
let serverInfo = this._syncInfoPerServer.get(syncItem.syncFolder.server);
serverInfo.totalDownloads += numOfMessages;
this._syncInfoPerServer.set(syncItem.syncFolder.server, serverInfo);
}
}
} catch (e) {
this.log.error("onDownloadStarted: " + e);
- throw(e);
+ throw e;
}
},
- onDownloadCompleted : function(folder) {
+ onDownloadCompleted(folder) {
try {
if (folder instanceof Ci.nsIMsgFolder) {
this.log.info("OnDownloadCompleted: " + folder.prettyName + " of " +
folder.server.prettyName);
let process = this._syncInfoPerFolder.get(folder.URI).activity;
if (process instanceof Ci.nsIActivityProcess &&
!this._running) {
this.log.info("OnDownloadCompleted: Auto-Sync Manager is paused, pausing the process");
process.state = Ci.nsIActivityProcess.STATE_PAUSED;
}
}
} catch (e) {
this.log.error("onDownloadCompleted: " + e);
- throw(e);
+ throw e;
}
},
- onDownloadError : function(folder) {
+ onDownloadError(folder) {
if (folder instanceof Ci.nsIMsgFolder) {
this.log.error("OnDownloadError: " + folder.prettyName + " of " +
folder.server.prettyName + "\n");
}
},
- onDiscoveryQProcessed : function (folder, numOfHdrsProcessed, leftToProcess) {
+ onDiscoveryQProcessed(folder, numOfHdrsProcessed, leftToProcess) {
this.log.info("onDiscoveryQProcessed: Processed " + numOfHdrsProcessed + "/" +
- (leftToProcess+numOfHdrsProcessed) + " of " + folder.prettyName + "\n");
+ (leftToProcess + numOfHdrsProcessed) + " of " + folder.prettyName + "\n");
},
- onAutoSyncInitiated : function (folder) {
+ onAutoSyncInitiated(folder) {
this.log.info("onAutoSyncInitiated: " + folder.prettyName + " of " +
folder.server.prettyName + " has been updated.\n");
},
- init: function() {
+ init() {
// XXX when do we need to remove ourselves?
- this.log.info('initing');
+ this.log.info("initing");
Cc["@mozilla.org/imap/autosyncmgr;1"]
.getService(Ci.nsIAutoSyncManager).addListener(this);
},
-}
+};
rename from mail/components/activity/modules/glodaIndexer.js
rename to mail/components/activity/modules/glodaIndexer.jsm
--- a/mail/components/activity/modules/glodaIndexer.js
+++ b/mail/components/activity/modules/glodaIndexer.jsm
@@ -4,25 +4,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
this.EXPORTED_SYMBOLS = ["glodaIndexerActivity"];
var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
"nsIActivityProcess", "init");
var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
"nsIActivityEvent", "init");
-var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
- "nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
-ChromeUtils.import("resource:///modules/gloda/public.js");
-ChromeUtils.import("resource:///modules/gloda/indexer.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
+const { Gloda } = ChromeUtils.import("resource:///modules/gloda/public.js", null);
+const { GlodaIndexer } = ChromeUtils.import("resource:///modules/gloda/indexer.js", null);
/**
* Gloda message indexer feedback.
*/
var glodaIndexerActivity =
{
get log() {
delete this.log;
@@ -36,33 +33,32 @@ var glodaIndexerActivity =
},
get bundle() {
delete this.bundle;
return this.bundle = Services.strings
.createBundle("chrome://messenger/locale/activity.properties");
},
- getString: function(stringName) {
+ getString(stringName) {
try {
return this.bundle.GetStringFromName(stringName);
} catch (e) {
this.log.error("error trying to get a string called: " + stringName);
- throw(e);
+ throw e;
}
},
- init: function() {
+ init() {
// Register a listener with the Gloda indexer that receives notifications
// about Gloda indexing status. We wrap the listener in this function so we
// can set |this| to the GlodaIndexerActivity object inside the listener.
- function listenerWrapper(...aArgs)
- {
+ function listenerWrapper(...aArgs) {
glodaIndexerActivity.listener(...aArgs);
- };
+ }
GlodaIndexer.addListener(listenerWrapper);
},
/**
* Information about the current job. An object with these properties:
*
* folder {String}
* the name of the folder being processed by the job
@@ -74,30 +70,25 @@ var glodaIndexerActivity =
* the time at which we were first notified about the job
* totalItemNum {Number}
* the total number of messages being indexed in the job
* jobType {String}
* The IndexinbJob jobType (ex: "folder", "folderCompact")
*/
currentJob: null,
- listener: function(aStatus, aFolder, aJobNumber, aItemNumber,
- aTotalItemNum, aJobType)
- {
+ listener(aStatus, aFolder, aJobNumber, aItemNumber, aTotalItemNum, aJobType) {
this.log.debug("Gloda Indexer Folder/Status: " + aFolder + "/" + aStatus);
this.log.debug("Gloda Indexer Job: " + aJobNumber);
this.log.debug("Gloda Indexer Item: " + aItemNumber + "/" + aTotalItemNum);
- if (aStatus == Gloda.kIndexerIdle)
- {
+ if (aStatus == Gloda.kIndexerIdle) {
if (this.currentJob)
this.onJobCompleted();
- }
- else
- {
+ } else {
// If the job numbers have changed, the indexer has finished the job
// we were previously tracking, so convert the corresponding process
// into an event and start a new process to track the new job.
if (this.currentJob && aJobNumber != this.currentJob.jobNumber)
this.onJobCompleted();
// If we aren't tracking a job, either this is the first time we've been
// called or the last job we were tracking was completed. Either way,
@@ -106,54 +97,53 @@ var glodaIndexerActivity =
this.onJobBegun(aFolder, aJobNumber, aTotalItemNum, aJobType);
// If there is only one item, don't bother creating a progress item.
if (aTotalItemNum != 1)
this.onJobProgress(aFolder, aItemNumber, aTotalItemNum);
}
},
- onJobBegun: function(aFolder, aJobNumber, aTotalItemNum, aJobType) {
+ onJobBegun(aFolder, aJobNumber, aTotalItemNum, aJobType) {
let displayText =
aFolder ? this.getString("indexingFolder").replace("#1", aFolder)
: this.getString("indexing");
let process = new nsActProcess(displayText, Gloda);
process.iconClass = "indexMail";
process.contextType = "account";
process.contextObj = aFolder;
process.addSubject(aFolder);
this.currentJob = {
folder: aFolder,
jobNumber: aJobNumber,
- process: process,
+ process,
startTime: new Date(),
totalItemNum: aTotalItemNum,
jobType: aJobType,
};
this.activityMgr.addActivity(process);
},
- onJobProgress: function(aFolder, aItemNumber, aTotalItemNum) {
+ onJobProgress(aFolder, aItemNumber, aTotalItemNum) {
this.currentJob.process.state = Ci.nsIActivityProcess.STATE_INPROGRESS;
// The total number of items being processed in the job can change, as can
// the folder being processed, since we sometimes get notified about a job
// before it has determined these things, so we update them here.
this.currentJob.folder = aFolder;
this.currentJob.totalItemNum = aTotalItemNum;
let statusText;
if (aTotalItemNum == null) {
statusText = aFolder ? this.getString("indexingFolderStatusVague")
.replace("#1", aFolder)
: this.getString("indexingStatusVague");
- }
- else {
+ } else {
let percentComplete =
aTotalItemNum == 0 ? 100 : parseInt(aItemNumber / aTotalItemNum * 100);
// Note: we must replace the folder name placeholder last; otherwise,
// if the name happens to contain another one of the placeholders, we'll
// hork the name when replacing it.
statusText = this.getString(aFolder ? "indexingFolderStatusExact"
: "indexingStatusExact");
statusText = PluralForm.get(aTotalItemNum, statusText)
@@ -161,17 +151,17 @@ var glodaIndexerActivity =
.replace("#2", aTotalItemNum)
.replace("#3", percentComplete)
.replace("#4", aFolder);
}
this.currentJob.process.setProgress(statusText, aItemNumber, aTotalItemNum);
},
- onJobCompleted: function() {
+ onJobCompleted() {
this.currentJob.process.state = Ci.nsIActivityProcess.STATE_COMPLETED;
this.activityMgr.removeActivity(this.currentJob.process.id);
// this.currentJob.totalItemNum might still be null at this point
// if we were first notified about the job before the indexer determined
// the number of messages to index and then it didn't find any to index.
let totalItemNum = this.currentJob.totalItemNum || 0;
@@ -189,17 +179,17 @@ var glodaIndexerActivity =
// if the name happens to contain another one of the placeholders, we'll
// hork the name when replacing it.
let displayText = PluralForm.get(totalItemNum,
this.getString("indexedFolder"))
.replace("#1", totalItemNum)
.replace("#2", this.currentJob.folder);
let endTime = new Date();
- let secondsElapsed = parseInt((endTime - this.currentJob.startTime)/1000);
+ let secondsElapsed = parseInt((endTime - this.currentJob.startTime) / 1000);
let statusText = PluralForm.get(secondsElapsed,
this.getString("indexedFolderStatus"))
.replace("#1", secondsElapsed);
let event = new nsActEvent(displayText,
Gloda,
statusText,
@@ -213,11 +203,11 @@ var glodaIndexerActivity =
let subjects = this.currentJob.process.getSubjects({});
for (let subject of subjects)
event.addSubject(subject);
this.activityMgr.addActivity(event);
}
this.currentJob = null;
- }
+ },
};
rename from mail/components/activity/modules/moveCopy.js
rename to mail/components/activity/modules/moveCopy.jsm
--- a/mail/components/activity/modules/moveCopy.js
+++ b/mail/components/activity/modules/moveCopy.jsm
@@ -1,28 +1,23 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
-this.EXPORTED_SYMBOLS = ['moveCopyModule'];
+this.EXPORTED_SYMBOLS = ["moveCopyModule"];
-var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
- "nsIActivityProcess", "init");
var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
"nsIActivityEvent", "init");
-var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
- "nsIActivityWarning", "init");
var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
// This module provides a link between the move/copy code and the activity
// manager.
var moveCopyModule =
{
lastMessage: {},
lastFolder: {},
@@ -38,164 +33,156 @@ var moveCopyModule =
},
get bundle() {
delete this.bundle;
return this.bundle = Services.strings
.createBundle("chrome://messenger/locale/activity.properties");
},
- getString: function(stringName) {
+ getString(stringName) {
try {
- return this.bundle.GetStringFromName(stringName)
+ return this.bundle.GetStringFromName(stringName);
} catch (e) {
this.log.error("error trying to get a string called: " + stringName);
- throw(e);
+ throw e;
}
},
- msgAdded : function(aMsg) {
+ msgAdded(aMsg) {
},
- msgsDeleted : function(aMsgList) {
+ msgsDeleted(aMsgList) {
this.log.info("in msgsDeleted");
let count = aMsgList.length;
if (count <= 0)
return;
let displayCount = count;
// get the folder of the deleted messages
let folder = aMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
- let activities = this.activityMgr.getActivities({})
+ let activities = this.activityMgr.getActivities({});
if (activities.length > 0 &&
- activities[activities.length-1].id == this.lastMessage.id &&
+ activities[activities.length - 1].id == this.lastMessage.id &&
this.lastMessage.type == "deleteMail" &&
- this.lastMessage.folder == folder.prettyName)
- {
+ this.lastMessage.folder == folder.prettyName) {
displayCount += this.lastMessage.count;
this.activityMgr.removeActivity(this.lastMessage.id);
}
this.lastMessage = {};
let displayText = PluralForm.get(displayCount, this.getString("deletedMessages2"));
- displayText = displayText.replace("#1", displayCount)
+ displayText = displayText.replace("#1", displayCount);
this.lastMessage.count = displayCount;
- displayText = displayText.replace("#2", folder.prettyName)
+ displayText = displayText.replace("#2", folder.prettyName);
this.lastMessage.folder = folder.prettyName;
let statusText = folder.server.prettyName;
// create an activity event
let event = new nsActEvent(displayText,
folder,
statusText,
Date.now(), // start time
Date.now()); // completion time
event.iconClass = "deleteMail";
this.lastMessage.type = event.iconClass;
- for (let i = 0; i < count; i++)
- {
+ for (let i = 0; i < count; i++) {
let msgHdr = aMsgList.queryElementAt(i, Ci.nsIMsgDBHdr);
event.addSubject(msgHdr.messageId);
}
this.lastMessage.id = this.activityMgr.addActivity(event);
},
- msgsMoveCopyCompleted : function(aMove, aSrcMsgList, aDestFolder) {
+ msgsMoveCopyCompleted(aMove, aSrcMsgList, aDestFolder) {
try {
this.log.info("in msgsMoveCopyCompleted");
let count = aSrcMsgList.length;
if (count <= 0)
return;
// get the folder of the moved/copied messages
let folder = aSrcMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
this.log.info("got folder");
let displayCount = count;
let activities = this.activityMgr.getActivities({});
if (activities.length > 0 &&
- activities[activities.length-1].id == this.lastMessage.id &&
+ activities[activities.length - 1].id == this.lastMessage.id &&
this.lastMessage.type == (aMove ? "moveMail" : "copyMail") &&
this.lastMessage.sourceFolder == folder.prettyName &&
- this.lastMessage.destFolder == aDestFolder.prettyName)
- {
+ this.lastMessage.destFolder == aDestFolder.prettyName) {
displayCount += this.lastMessage.count;
this.activityMgr.removeActivity(this.lastMessage.id);
}
- let statusText = '';
- if (folder.server != aDestFolder.server)
- {
+ let statusText = "";
+ if (folder.server != aDestFolder.server) {
statusText = this.getString("fromServerToServer");
statusText = statusText.replace("#1", folder.server.prettyName);
statusText = statusText.replace("#2", aDestFolder.server.prettyName);
- }
- else
- {
+ } else {
statusText = folder.server.prettyName;
}
this.lastMessage = {};
let displayText;
if (aMove)
displayText = PluralForm.get(displayCount,
this.getString("movedMessages"));
else
displayText = PluralForm.get(displayCount,
this.getString("copiedMessages"));
- displayText = displayText.replace("#1", displayCount)
+ displayText = displayText.replace("#1", displayCount);
this.lastMessage.count = displayCount;
- displayText = displayText.replace("#2", folder.prettyName)
+ displayText = displayText.replace("#2", folder.prettyName);
this.lastMessage.sourceFolder = folder.prettyName;
- displayText = displayText.replace("#3", aDestFolder.prettyName)
+ displayText = displayText.replace("#3", aDestFolder.prettyName);
this.lastMessage.destFolder = aDestFolder.prettyName;
// create an activity event
let event = new nsActEvent(displayText,
folder,
statusText,
Date.now(), // start time
Date.now()); // completion time
event.iconClass = aMove ? "moveMail" : "copyMail";
this.lastMessage.type = event.iconClass;
- for (let i = 0; i < count; i++)
- {
+ for (let i = 0; i < count; i++) {
let msgHdr = aSrcMsgList.queryElementAt(i, Ci.nsIMsgDBHdr);
event.addSubject(msgHdr.messageId);
}
this.lastMessage.id = this.activityMgr.addActivity(event);
} catch (e) {
- this.log.error("Exception: " + e)
+ this.log.error("Exception: " + e);
}
},
- folderAdded: function(aFolder) {
+ folderAdded(aFolder) {
},
- folderDeleted : function(aFolder) {
+ folderDeleted(aFolder) {
let server;
try {
// When a new account is created we get this notification with an empty named
// folder that can't return its server. Ignore it.
// TODO: find out what it is.
server = aFolder.server;
// If the account has been removed, we're going to ignore this notification.
MailServices.accounts.FindServer(server.username, server.hostName, server.type);
- }
- catch(ex) {return;}
+ } catch (ex) { return; }
let displayText;
let statusText = server.prettyName;
// Display a different message depending on whether we emptied the trash
// or actually deleted a folder
if (aFolder.isSpecialFolder(nsMsgFolderFlags.Trash, false))
displayText = this.getString("emptiedTrash");
@@ -214,69 +201,63 @@ var moveCopyModule =
// When we rename, we get a delete event as well as a rename, so store
// the last folder we deleted
this.lastFolder = {};
this.lastFolder.URI = aFolder.URI;
this.lastFolder.event = this.activityMgr.addActivity(event);
},
- folderMoveCopyCompleted: function(aMove, aSrcFolder, aDestFolder) {
+ folderMoveCopyCompleted(aMove, aSrcFolder, aDestFolder) {
this.log.info("in folderMoveCopyCompleted, aMove = " + aMove);
let displayText;
if (aMove)
displayText = this.getString("movedFolder");
else
displayText = this.getString("copiedFolder");
- displayText = displayText.replace('#1', aSrcFolder.prettyName);
- displayText = displayText.replace('#2', aDestFolder.prettyName);
+ displayText = displayText.replace("#1", aSrcFolder.prettyName);
+ displayText = displayText.replace("#2", aDestFolder.prettyName);
- let statusText = '';
- if (aSrcFolder.server != aDestFolder.server)
- {
+ let statusText = "";
+ if (aSrcFolder.server != aDestFolder.server) {
statusText = this.getString("fromServerToServer");
statusText = statusText.replace("#1", aSrcFolder.server.prettyName);
statusText = statusText.replace("#2", aDestFolder.server.prettyName);
- }
- else
- {
+ } else {
statusText = aSrcFolder.server.prettyName;
}
// create an activity event
let event = new nsActEvent(displayText,
aSrcFolder.server,
statusText,
Date.now(), // start time
Date.now()); // completion time
event.addSubject(aSrcFolder);
event.addSubject(aDestFolder);
event.iconClass = aMove ? "moveMail" : "copyMail";
this.activityMgr.addActivity(event);
},
- folderRenamed: function(aOrigFolder, aNewFolder) {
- this.log.info("in folderRenamed, aOrigFolder = "+ aOrigFolder.prettyName+", aNewFolder = "+
- aNewFolder.prettyName);
+ folderRenamed(aOrigFolder, aNewFolder) {
+ this.log.info("in folderRenamed, aOrigFolder = " + aOrigFolder.prettyName +
+ ", aNewFolder = " + aNewFolder.prettyName);
let displayText;
let statusText = aNewFolder.server.prettyName;
// Display a different message depending on whether we moved the folder
// to the trash or actually renamed the folder.
- if (aNewFolder.isSpecialFolder(nsMsgFolderFlags.Trash, true))
- {
+ if (aNewFolder.isSpecialFolder(nsMsgFolderFlags.Trash, true)) {
displayText = this.getString("movedFolderToTrash");
displayText = displayText.replace("#1", aOrigFolder.prettyName);
- }
- else
- {
+ } else {
displayText = this.getString("renamedFolder");
displayText = displayText.replace("#1", aOrigFolder.prettyName);
displayText = displayText.replace("#2", aNewFolder.prettyName);
}
// When renaming a folder, a delete event is always fired first
if (this.lastFolder.URI == aOrigFolder.URI)
this.activityMgr.removeActivity(this.lastFolder.event);
@@ -289,85 +270,81 @@ var moveCopyModule =
Date.now()); // completion time
event.addSubject(aOrigFolder);
event.addSubject(aNewFolder);
this.activityMgr.addActivity(event);
},
- itemEvent: function(aItem, aEvent, aData, aString) {
+ itemEvent(aItem, aEvent, aData, aString) {
if (aEvent == "UnincorporatedMessageMoved") {
let srcFolder = aItem.QueryInterface(Ci.nsIMsgFolder);
let msgHdr = aData.QueryInterface(Ci.nsIMsgDBHdr);
try {
this.log.info("in UnincorporatedMessageMoved");
// get the folder of the moved/copied messages
let destFolder = msgHdr.folder;
this.log.info("got folder");
let displayCount = 1;
let activities = this.activityMgr.getActivities({});
if (activities.length > 0 &&
- activities[activities.length-1].id == this.lastMessage.id &&
+ activities[activities.length - 1].id == this.lastMessage.id &&
this.lastMessage.type == "moveMail" &&
this.lastMessage.sourceFolder == srcFolder.prettyName &&
- this.lastMessage.destFolder == destFolder.prettyName)
- {
+ this.lastMessage.destFolder == destFolder.prettyName) {
displayCount += this.lastMessage.count;
this.activityMgr.removeActivity(this.lastMessage.id);
}
- let statusText = '';
- if (srcFolder.server != destFolder.server)
- {
+ let statusText = "";
+ if (srcFolder.server != destFolder.server) {
statusText = this.getString("fromServerToServer");
statusText = statusText.replace("#1", srcFolder.server.prettyName);
statusText = statusText.replace("#2", destFolder.server.prettyName);
- }
- else
- {
+ } else {
statusText = srcFolder.server.prettyName;
}
this.lastMessage = {};
let displayText;
displayText = PluralForm.get(displayCount,
this.getString("movedMessages"));
- displayText = displayText.replace("#1", displayCount)
+ displayText = displayText.replace("#1", displayCount);
this.lastMessage.count = displayCount;
- displayText = displayText.replace("#2", srcFolder.prettyName)
+ displayText = displayText.replace("#2", srcFolder.prettyName);
this.lastMessage.sourceFolder = srcFolder.prettyName;
- displayText = displayText.replace("#3", destFolder.prettyName)
+ displayText = displayText.replace("#3", destFolder.prettyName);
this.lastMessage.destFolder = destFolder.prettyName;
// create an activity event
let event = new nsActEvent(displayText,
srcFolder,
statusText,
Date.now(), // start time
Date.now()); // completion time
event.iconClass = "moveMail";
this.lastMessage.type = event.iconClass;
event.addSubject(msgHdr.messageId);
this.lastMessage.id = this.activityMgr.addActivity(event);
} catch (e) {
- this.log.error("Exception: " + e)
+ this.log.error("Exception: " + e);
}
}
},
- init: function() {
+ init() {
// XXX when do we need to remove ourselves?
MailServices.mfn.addListener(this,
MailServices.mfn.msgsDeleted |
MailServices.mfn.msgsMoveCopyCompleted |
MailServices.mfn.folderDeleted |
MailServices.mfn.folderMoveCopyCompleted |
MailServices.mfn.folderRenamed |
MailServices.mfn.itemEvent);
- }
-}
+ },
+};
rename from mail/components/activity/modules/pop3Download.js
rename to mail/components/activity/modules/pop3Download.jsm
--- a/mail/components/activity/modules/pop3Download.js
+++ b/mail/components/activity/modules/pop3Download.jsm
@@ -1,27 +1,22 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
-this.EXPORTED_SYMBOLS = ['pop3DownloadModule'];
+this.EXPORTED_SYMBOLS = ["pop3DownloadModule"];
-var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
- "nsIActivityProcess", "init");
var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
"nsIActivityEvent", "init");
-var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
- "nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
// This module provides a link between the pop3 service code and the activity
// manager.
var pop3DownloadModule =
{
// hash table of most recent download items per folder
_mostRecentActivityForFolder: new Map(),
// hash table of prev download items per folder, so we can
@@ -40,26 +35,26 @@ var pop3DownloadModule =
},
get bundle() {
delete this.bundle;
return this.bundle = Services.strings
.createBundle("chrome://messenger/locale/activity.properties");
},
- getString: function(stringName) {
+ getString(stringName) {
try {
- return this.bundle.GetStringFromName(stringName)
+ return this.bundle.GetStringFromName(stringName);
} catch (e) {
this.log.error("error trying to get a string called: " + stringName);
- throw(e);
+ throw e;
}
},
- onDownloadStarted : function(aFolder) {
+ onDownloadStarted(aFolder) {
this.log.info("in onDownloadStarted");
let displayText =
this.bundle.formatStringFromName("pop3EventStartDisplayText2",
[aFolder.server.prettyName, // account name
aFolder.prettyName], 2); // folder name
// remember the prev activity for this folder, if any.
this._prevActivityForFolder.set(aFolder.URI,
@@ -75,39 +70,38 @@ var pop3DownloadModule =
event.iconClass = "syncMail";
let downloadItem = {};
downloadItem.eventID = this.activityMgr.addActivity(event);
this._mostRecentActivityForFolder.set(aFolder.URI, downloadItem);
},
- onDownloadProgress : function(aFolder, aNumMsgsDownloaded, aTotalMsgs) {
+ onDownloadProgress(aFolder, aNumMsgsDownloaded, aTotalMsgs) {
this.log.info("in onDownloadProgress");
},
- onDownloadCompleted : function(aFolder, aNumMsgsDownloaded) {
+ onDownloadCompleted(aFolder, aNumMsgsDownloaded) {
this.log.info("in onDownloadCompleted");
// Remove activity if there was any.
// It can happen that download never started (e.g. couldn't connect to server),
// with onDownloadStarted, but we still get a onDownloadCompleted event
// when the connection is given up.
let recentActivity = this._mostRecentActivityForFolder.get(aFolder.URI);
if (recentActivity)
this.activityMgr.removeActivity(recentActivity.eventID);
let displayText;
- if (aNumMsgsDownloaded > 0)
- {
+ if (aNumMsgsDownloaded > 0) {
displayText = PluralForm.get(aNumMsgsDownloaded, this.getString("pop3EventStatusText"));
displayText = displayText.replace("#1", aNumMsgsDownloaded);
+ } else {
+ displayText = this.getString("pop3EventStatusTextNoMsgs");
}
- else
- displayText = this.getString("pop3EventStatusTextNoMsgs");
let statusText = aFolder.server.prettyName;
// create an activity event
let event = new nsActEvent(displayText,
aFolder,
statusText,
Date.now(), // start time
@@ -124,13 +118,13 @@ var pop3DownloadModule =
// prev event from the activity manager.
let prevItem = this._prevActivityForFolder.get(aFolder.URI);
if (prevItem != undefined && !prevItem.numMsgsDownloaded) {
if (this.activityMgr.containsActivity(prevItem.eventID))
this.activityMgr.removeActivity(prevItem.eventID);
}
}
},
- init: function() {
+ init() {
// XXX when do we need to remove ourselves?
MailServices.pop3.addListener(this);
- }
+ },
};
rename from mail/components/activity/modules/sendLater.js
rename to mail/components/activity/modules/sendLater.jsm
--- a/mail/components/activity/modules/sendLater.js
+++ b/mail/components/activity/modules/sendLater.jsm
@@ -1,51 +1,49 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
-this.EXPORTED_SYMBOLS = ['sendLaterModule'];
+this.EXPORTED_SYMBOLS = ["sendLaterModule"];
var nsActProcess = Components.Constructor("@mozilla.org/activity-process;1",
"nsIActivityProcess", "init");
var nsActEvent = Components.Constructor("@mozilla.org/activity-event;1",
"nsIActivityEvent", "init");
var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
"nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
/**
* This really, really, sucks. Due to mailnews widespread use of
* nsIMsgStatusFeedback we're bound to the UI to get any sensible feedback of
* mail sending operations. The current send later code can't hook into the
* progress listener easily to get the state of messages being sent, so we'll
* just have to do it here.
*/
var sendMsgProgressListener = {
QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgStatusFeedback,
Ci.nsISupportsWeakReference]),
- showStatusString: function(aStatusText) {
+ showStatusString(aStatusText) {
sendLaterModule.onMsgStatus(aStatusText);
},
- startMeteors: function() {
+ startMeteors() {
},
- stopMeteors: function() {
+ stopMeteors() {
},
- showProgress: function (aPercentage) {
+ showProgress(aPercentage) {
sendLaterModule.onMessageSendProgress(0, 0, aPercentage, 0);
- }
+ },
};
// This module provides a link between the send later service and the activity
// manager.
var sendLaterModule =
{
_sendProcess: null,
_copyProcess: null,
@@ -66,24 +64,24 @@ var sendLaterModule =
get bundle() {
delete this.bundle;
return this.bundle = Services.strings
.createBundle("chrome://messenger/locale/activity.properties");
},
QueryInterface: ChromeUtils.generateQI([Ci.nsIMsgSendLaterListener]),
- _displayTextForHeader: function(aLocaleStringBase, aSubject) {
+ _displayTextForHeader(aLocaleStringBase, aSubject) {
return aSubject ?
this.bundle.formatStringFromName(aLocaleStringBase + "WithSubject",
[aSubject], 1) :
this.bundle.GetStringFromName(aLocaleStringBase);
},
- _newProcess: function(aLocaleStringBase, aAddSubject) {
+ _newProcess(aLocaleStringBase, aAddSubject) {
let process =
new nsActProcess(this._displayTextForHeader(aLocaleStringBase,
aAddSubject ?
this._subject :
""),
this.activityMgr);
process.iconClass = "sendMail";
@@ -91,72 +89,70 @@ var sendLaterModule =
process.contextObj = this;
process.contextType = "SendLater";
process.contextDisplayText = this.bundle.GetStringFromName("sendingMessages");
return process;
},
// Use this to group an activity by the identity if we have one.
- _applyIdentityGrouping: function(aActivity) {
+ _applyIdentityGrouping(aActivity) {
if (this._identity) {
aActivity.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT;
aActivity.contextType = this._identity.key;
aActivity.contextObj = this._identity;
let contextDisplayText = this._identity.identityName;
if (!contextDisplayText)
contextDisplayText = this._identity.email;
aActivity.contextDisplayText = contextDisplayText;
+ } else {
+ aActivity.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
}
- else
- aActivity.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
},
// Replaces the process with an event that reflects a completed process.
- _replaceProcessWithEvent: function(aProcess) {
+ _replaceProcessWithEvent(aProcess) {
this.activityMgr.removeActivity(aProcess.id);
let event = new nsActEvent(this._displayTextForHeader("sentMessage",
this._subject),
this.activityMgr, "", aProcess.startTime,
new Date());
event.iconClass = "sendMail";
this._applyIdentityGrouping(event);
this.activityMgr.addActivity(event);
},
// Replaces the process with a warning that reflects the failed process.
- _replaceProcessWithWarning: function(aProcess, aCopyOrSend, aStatus, aMsg,
- aMessageHeader) {
+ _replaceProcessWithWarning(aProcess, aCopyOrSend, aStatus, aMsg, aMessageHeader) {
this.activityMgr.removeActivity(aProcess.id);
let warning =
new nsActWarning(this._displayTextForHeader("failedTo" + aCopyOrSend,
this._subject),
this.activityMgr, "");
warning.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
this._applyIdentityGrouping(warning);
this.activityMgr.addActivity(warning);
},
- onStartSending: function(aTotalMessageCount) {
+ onStartSending(aTotalMessageCount) {
if (!aTotalMessageCount) {
this.log.error("onStartSending called with zero messages\n");
- return;
+
}
},
- onMessageStartSending: function(aCurrentMessage, aTotalMessageCount,
- aMessageHeader, aIdentity) {
+ onMessageStartSending(aCurrentMessage, aTotalMessageCount, aMessageHeader, aIdentity) {
// We want to use the identity and subject later, so store them for now.
this._identity = aIdentity;
if (aMessageHeader)
this._subject = aMessageHeader.mime2DecodedSubject;
// Create the process to display the send activity.
let process = this._newProcess("sendingMessage", true);
@@ -164,95 +160,89 @@ var sendLaterModule =
this.activityMgr.addActivity(process);
// Now the one for the copy process.
process = this._newProcess("copyMessage", false);
this._copyProcess = process;
this.activityMgr.addActivity(process);
},
- onMessageSendProgress: function(aCurrentMessage, aTotalMessageCount,
- aMessageSendPercent,
- aMessageCopyPercent) {
+ onMessageSendProgress(aCurrentMessage, aTotalMessageCount,
+ aMessageSendPercent, aMessageCopyPercent) {
if (aMessageSendPercent < 100) {
// Ensure we are in progress...
if (this._sendProcess.state != Ci.nsIActivityProcess.STATE_INPROGRESS)
this._sendProcess.state = Ci.nsIActivityProcess.STATE_INPROGRESS;
// ... and update the progress.
this._sendProcess.setProgress(this._sendProcess.lastStatusText,
aMessageSendPercent, 100);
- }
- else if (aMessageSendPercent == 100) {
+ } else if (aMessageSendPercent == 100) {
if (aMessageCopyPercent == 0) {
// Set send state to completed
if (this._sendProcess.state != Ci.nsIActivityProcess.STATE_COMPLETED)
this._sendProcess.state = Ci.nsIActivityProcess.STATE_COMPLETED;
this._replaceProcessWithEvent(this._sendProcess);
// Set copy state to in progress.
if (this._copyProcess.state != Ci.nsIActivityProcess.STATE_INPROGRESS)
this._copyProcess.state = Ci.nsIActivityProcess.STATE_INPROGRESS;
// We don't know the progress of the copy, so just set to 0, and we'll
// display an undetermined progress meter.
this._copyProcess.setProgress(this._copyProcess.lastStatusText,
0, 0);
- }
- else if (aMessageCopyPercent < 100) {
- }
- else {
+ } else if (aMessageCopyPercent >= 100) {
// We need to set this to completed otherwise activity manager
// complains.
if (this._copyProcess.state != Ci.nsIActivityProcess.STATE_COMPLETED)
this._copyProcess.state = Ci.nsIActivityProcess.STATE_COMPLETED;
// Just drop the copy process, we don't need it now.
this.activityMgr.removeActivity(this._copyProcess.id);
this._sendProcess = null;
this._copyProcess = null;
}
}
},
- onMessageSendError: function(aCurrentMessage, aMessageHeader, aStatus,
- aMsg) {
+ onMessageSendError(aCurrentMessage, aMessageHeader, aStatus, aMsg) {
if (this._sendProcess &&
this._sendProcess.state != Ci.nsIActivityProcess.STATE_COMPLETED) {
this._sendProcess.state = Ci.nsIActivityProcess.STATE_COMPLETED;
this._replaceProcessWithWarning(this._sendProcess, "SendMessage", aStatus, aMsg,
aMessageHeader);
this._sendProcess = null;
if (this._copyProcess &&
this._copyProcess.state != Ci.nsIActivityProcess.STATE_COMPLETED) {
this._copyProcess.state = Ci.nsIActivityProcess.STATE_COMPLETED;
this.activityMgr.removeActivity(this._copyProcess.id);
this._copyProcess = null;
}
}
},
- onMsgStatus: function(aStatusText) {
+ onMsgStatus(aStatusText) {
this._sendProcess.setProgress(aStatusText, this._sendProcess.workUnitComplete,
this._sendProcess.totalWorkUnits);
},
- onStopSending: function(aStatus, aMsg, aTotalTried, aSuccessful) {
+ onStopSending(aStatus, aMsg, aTotalTried, aSuccessful) {
},
- init: function() {
+ init() {
// We should need to remove the listener as we're not being held by anyone
// except by the send later instance.
let sendLaterService = Cc["@mozilla.org/messengercompose/sendlater;1"]
.getService(Ci.nsIMsgSendLater);
sendLaterService.addListener(this);
// Also add the nsIMsgStatusFeedback object.
let statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"]
.createInstance(Ci.nsIMsgStatusFeedback);
statusFeedback.setWrappedStatusFeedback(sendMsgProgressListener);
sendLaterService.statusFeedback = statusFeedback;
- }
+ },
};
--- a/mail/components/activity/moz.build
+++ b/mail/components/activity/moz.build
@@ -14,18 +14,18 @@ XPIDL_MODULE = 'activity'
EXTRA_COMPONENTS += [
'activityComponents.manifest',
'nsActivity.js',
'nsActivityManager.js',
'nsActivityManagerUI.js',
]
EXTRA_JS_MODULES.activity += [
- 'modules/activityModules.js',
- 'modules/alertHook.js',
- 'modules/autosync.js',
- 'modules/glodaIndexer.js',
- 'modules/moveCopy.js',
- 'modules/pop3Download.js',
- 'modules/sendLater.js',
+ 'modules/activityModules.jsm',
+ 'modules/alertHook.jsm',
+ 'modules/autosync.jsm',
+ 'modules/glodaIndexer.jsm',
+ 'modules/moveCopy.jsm',
+ 'modules/pop3Download.jsm',
+ 'modules/sendLater.jsm',
]
JAR_MANIFESTS += ['jar.mn']
--- a/mail/components/activity/nsActivity.js
+++ b/mail/components/activity/nsActivity.js
@@ -1,98 +1,85 @@
/* 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/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
-
-////////////////////////////////////////////////////////////////////////////////
-//// Constants
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
-////////////////////////////////////////////////////////////////////////////////
-//// Base class for nsActivityProcess and nsActivityEvent objects
+// Base class for nsActivityProcess and nsActivityEvent objects
-function nsActivity()
-{
+function nsActivity() {
this._initLogging();
this._listeners = [];
this._subjects = [];
}
nsActivity.prototype = {
-
id: -1,
bindingName: "",
iconClass: "",
groupingStyle: Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT,
facet: "",
displayText: "",
initiator: null,
contextType: "",
context: "",
contextObj: null,
- _initLogging: function () {
+ _initLogging() {
this.log = Log4Moz.getConfiguredLogger("nsActivity");
},
- addListener: function(aListener) {
+ addListener(aListener) {
this._listeners.push(aListener);
},
- removeListener: function(aListener) {
+ removeListener(aListener) {
for (let i = 0; i < this._listeners.length; i++) {
if (this._listeners[i] == aListener) {
this._listeners.splice(i, 1);
break;
}
}
},
- addSubject: function(aSubject) {
+ addSubject(aSubject) {
this._subjects.push(aSubject);
},
- getSubjects: function(aCount) {
+ getSubjects(aCount) {
let list = this._subjects.slice();
aCount.value = list.length;
return list;
},
};
-////////////////////////////////////////////////////////////////////////////////
-//// nsActivityProcess class
-
-function nsActivityProcess()
-{
+function nsActivityProcess() {
nsActivity.call(this);
this.bindingName = "activity-process";
this.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT;
}
nsActivityProcess.prototype = {
__proto__: nsActivity.prototype,
classID: Components.ID("B2C036A3-F7CE-401C-95EE-9C21505167FD"),
- //////////////////////////////////////////////////////////////////////////////
- //// nsIActivityProcess
-
percentComplete: -1,
lastStatusText: "",
workUnitComplete: 0,
totalWorkUnits: 0,
startTime: Date.now(),
_cancelHandler: null,
_pauseHandler: null,
_retryHandler: null,
_state: Ci.nsIActivityProcess.STATE_INPROGRESS,
- init: function(aDisplayText, aInitiator) {
+ init(aDisplayText, aInitiator) {
this.displayText = aDisplayText;
this.initiator = aInitiator;
},
get state() {
return this._state;
},
@@ -141,43 +128,40 @@ nsActivityProcess.prototype = {
let oldState = this._state;
this._state = val;
// let the listeners know about the change
this.log.debug("Notifying onStateChanged listeners");
for (let value of this._listeners) {
try {
value.onStateChanged(this, oldState);
- }
- catch(e) {
- this.log.error("Exception thrown by onStateChanged listener: "+ e);
+ } catch (e) {
+ this.log.error("Exception thrown by onStateChanged listener: " + e);
}
}
},
- setProgress: function(aStatusText, aWorkUnitsComplete, aTotalWorkUnits) {
+ setProgress(aStatusText, aWorkUnitsComplete, aTotalWorkUnits) {
if (aTotalWorkUnits == 0) {
this.percentComplete = -1;
this.workUnitComplete = 0;
this.totalWorkUnits = 0;
- }
- else {
+ } else {
this.percentComplete = parseInt(100.0 * aWorkUnitsComplete / aTotalWorkUnits);
this.workUnitComplete = aWorkUnitsComplete;
this.totalWorkUnits = aTotalWorkUnits;
}
this.lastStatusText = aStatusText;
// notify listeners
for (let value of this._listeners) {
try {
value.onProgressChanged(this, aStatusText, aWorkUnitsComplete,
aTotalWorkUnits);
- }
- catch(e) {
+ } catch (e) {
this.log.error("Exception thrown by onProgressChanged listener: " + e);
}
}
},
get cancelHandler() {
return this._cancelHandler;
},
@@ -185,18 +169,17 @@ nsActivityProcess.prototype = {
set cancelHandler(val) {
this._cancelHandler = val;
// let the listeners know about the change
this.log.debug("Notifying onHandlerChanged listeners");
for (let value of this._listeners) {
try {
value.onHandlerChanged(this);
- }
- catch(e) {
+ } catch (e) {
this.log.error("Exception thrown by onHandlerChanged listener: " + e);
}
}
},
get pauseHandler() {
return this._pauseHandler;
},
@@ -220,53 +203,42 @@ nsActivityProcess.prototype = {
// let the listeners know about the change
this.log.debug("Notifying onHandlerChanged listeners");
for (let value of this._listeners) {
value.onHandlerChanged(this);
}
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityProcess, Ci.nsIActivity])
+ QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityProcess, Ci.nsIActivity]),
};
-///////////////////////////////////////////////////////////////////////////////
-//// nsActivityEvent class
-
-function nsActivityEvent()
-{
+function nsActivityEvent() {
nsActivity.call(this);
this.bindingName = "activity-event";
this.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_STANDALONE;
}
nsActivityEvent.prototype = {
__proto__: nsActivity.prototype,
classID: Components.ID("87AAEB20-89D9-4B95-9542-3BF72405CAB2"),
- //////////////////////////////////////////////////////////////////////////////
- //// nsIActivityEvent
-
statusText: "",
startTime: 0,
completionTime: 0,
_undoHandler: null,
- init: function(aDisplayText, aInitiator, aStatusText, aStartTime,
- aCompletionTime) {
+ init(aDisplayText, aInitiator, aStatusText, aStartTime, aCompletionTime) {
this.displayText = aDisplayText;
this.statusText = aStatusText;
this.startTime = aStartTime;
if (aCompletionTime)
this.completionTime = aCompletionTime;
else
- this.completionTime = Date.now()
+ this.completionTime = Date.now();
this.initiator = aInitiator;
this._completionTime = aCompletionTime;
},
get undoHandler() {
return this._undoHandler;
},
@@ -275,44 +247,34 @@ nsActivityEvent.prototype = {
// let the listeners know about the change
this.log.debug("Notifying onHandlerChanged listeners");
for (let value of this._listeners) {
value.onHandlerChanged(this);
}
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityEvent, Ci.nsIActivity])
+ QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityEvent, Ci.nsIActivity]),
};
-///////////////////////////////////////////////////////////////////////////////
-//// nsActivityWarning class
-
-function nsActivityWarning()
-{
+function nsActivityWarning() {
nsActivity.call(this);
this.bindingName = "activity-warning";
this.groupingStyle = Ci.nsIActivity.GROUPING_STYLE_BYCONTEXT;
}
nsActivityWarning.prototype = {
__proto__: nsActivity.prototype,
classID: Components.ID("968BAC9E-798B-4952-B384-86B21B8CC71E"),
- //////////////////////////////////////////////////////////////////////////////
- //// nsIActivityWarning
-
recoveryTipText: "",
_time: 0,
_recoveryHandler: null,
- init: function(aWarningText, aInitiator, aRecoveryTipText) {
+ init(aWarningText, aInitiator, aRecoveryTipText) {
this.displayText = aWarningText;
this.initiator = aInitiator;
this.recoveryTipText = aRecoveryTipText;
this._time = Date.now();
},
get recoveryHandler() {
return this._recoveryHandler;
@@ -327,19 +289,13 @@ nsActivityWarning.prototype = {
value.onHandlerChanged(this);
}
},
get time() {
return this._time;
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityWarning, Ci.nsIActivity])
+ QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityWarning, Ci.nsIActivity]),
};
-///////////////////////////////////////////////////////////////////////////////
-//// Module
-
var components = [nsActivityProcess, nsActivityEvent, nsActivityWarning];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mail/components/activity/nsActivityManager.js
+++ b/mail/components/activity/nsActivityManager.js
@@ -1,30 +1,21 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
-
-////////////////////////////////////////////////////////////////////////////////
-//// Constants
+const { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/log4moz.js", null);
-////////////////////////////////////////////////////////////////////////////////
-//// nsActivityManager class
-
-function nsActivityManager()
-{}
+function nsActivityManager() {}
nsActivityManager.prototype = {
classID: Components.ID("8aa5972e-19cb-41cc-9696-645f8a8d1a06"),
- //////////////////////////////////////////////////////////////////////////////
- //// nsIActivityManager
log: Log4Moz.getConfiguredLogger("nsActivityManager"),
_listeners: [],
_processCount: 0,
_db: null,
_idCounter: 1,
_activities: new Map(),
get processCount() {
@@ -32,17 +23,17 @@ nsActivityManager.prototype = {
for (let value of this._activities.values()) {
if (value instanceof Ci.nsIActivityProcess)
count++;
}
return count;
},
- getProcessesByContext: function(aContextType, aContextObj, aCount) {
+ getProcessesByContext(aContextType, aContextObj, aCount) {
let list = [];
for (let activity of this._activities.values()) {
if (activity instanceof Ci.nsIActivityProcess &&
activity.contextType == aContextType &&
activity.contextObj == aContextObj) {
list.push(activity);
}
}
@@ -54,117 +45,109 @@ nsActivityManager.prototype = {
get db() {
return null;
},
get nextId() {
return this._idCounter++;
},
- addActivity: function (aActivity) {
+ addActivity(aActivity) {
try {
this.log.info("adding Activity");
// get the next valid id for this activity
let id = this.nextId;
aActivity.id = id;
// add activity into the activities table
this._activities.set(id, aActivity);
// notify all the listeners
for (let value of this._listeners) {
try {
value.onAddedActivity(id, aActivity);
- }
- catch(e) {
- this.log.error("Exception calling onAddedActivity" + e)
+ } catch (e) {
+ this.log.error("Exception calling onAddedActivity" + e);
}
}
return id;
} catch (e) {
// for some reason exceptions don't end up on the console if we don't
// explicitly log them.
this.log.error("Exception: " + e);
- throw(e);
+ throw e;
}
},
- removeActivity: function (aID) {
+ removeActivity(aID) {
let activity = this.getActivity(aID);
// make sure that the activity is not in-progress state
if (activity instanceof Ci.nsIActivityProcess &&
activity.state == Ci.nsIActivityProcess.STATE_INPROGRESS)
throw Cr.NS_ERROR_FAILURE;
// remove the activity
this._activities.delete(aID);
// notify all the listeners
for (let value of this._listeners) {
try {
value.onRemovedActivity(aID);
- }
- catch(e) {
+ } catch (e) {
// ignore the exception
}
}
},
- cleanUp: function () {
+ cleanUp() {
// Get the list of aIDs.
this.log.info("cleanUp\n");
for (let [id, activity] of this._activities) {
if (activity instanceof Ci.nsIActivityProcess) {
// Note: The .state property will return undefined if you aren't in
// this if-instanceof block.
let state = activity.state;
if (state != Ci.nsIActivityProcess.STATE_INPROGRESS &&
state != Ci.nsIActivityProcess.STATE_PAUSED &&
state != Ci.nsIActivityProcess.STATE_WAITINGFORINPUT &&
state != Ci.nsIActivityProcess.STATE_WAITINGFORRETRY)
this.removeActivity(id);
+ } else {
+ this.removeActivity(id);
}
- else
- this.removeActivity(id);
}
},
- getActivity: function(aID) {
+ getActivity(aID) {
if (!this._activities.has(aID))
throw Cr.NS_ERROR_NOT_AVAILABLE;
return this._activities.get(aID);
},
- containsActivity: function (aID) {
+ containsActivity(aID) {
return this._activities.has(aID);
},
- getActivities: function(aCount) {
+ getActivities(aCount) {
let list = [...this._activities.values()];
aCount.value = list.length;
return list;
},
- addListener: function(aListener) {
+ addListener(aListener) {
this.log.info("addListener\n");
this._listeners.push(aListener);
},
- removeListener: function(aListener) {
+ removeListener(aListener) {
this.log.info("removeListener\n");
for (let i = 0; i < this._listeners.length; i++) {
if (this._listeners[i] == aListener)
this._listeners.splice(i, 1);
}
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityManager])
+ QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityManager]),
};
-////////////////////////////////////////////////////////////////////////////////
-//// Module
-
var components = [nsActivityManager];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mail/components/activity/nsActivityManagerUI.js
+++ b/mail/components/activity/nsActivityManagerUI.js
@@ -1,33 +1,23 @@
/* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-////////////////////////////////////////////////////////////////////////////////
-//// Constants
-
-var ACTIVITY_MANAGER_URL = "chrome://messenger/content/activity.xul";
-var PREF_FLASH_COUNT = "messenger.activity.manager.flashCount";
+const ACTIVITY_MANAGER_URL = "chrome://messenger/content/activity.xul";
+const PREF_FLASH_COUNT = "messenger.activity.manager.flashCount";
-////////////////////////////////////////////////////////////////////////////////
-//// nsActivityManagerUI class
-
-function nsActivityManagerUI()
-{}
+function nsActivityManagerUI() {}
nsActivityManagerUI.prototype = {
classID: Components.ID("5fa5974e-09cb-40cc-9696-643f8a8d9a06"),
- //////////////////////////////////////////////////////////////////////////////
- //// nsIActivityManagerUI
-
show: function show(aWindowContext, aID) {
// First we see if it is already visible
let window = this.recentWindow;
if (window) {
window.focus();
return;
}
@@ -43,26 +33,17 @@ nsActivityManagerUI.prototype = {
"chrome,dialog=no,resizable",
{});
},
get visible() {
return (null != this.recentWindow);
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsActivityManagerUI
-
get recentWindow() {
return Services.wm.getMostRecentWindow("Activity:Manager");
},
- //////////////////////////////////////////////////////////////////////////////
- //// nsISupports
-
- QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityManagerUI])
+ QueryInterface: ChromeUtils.generateQI([Ci.nsIActivityManagerUI]),
};
-////////////////////////////////////////////////////////////////////////////////
-//// Module
-
var components = [nsActivityManagerUI];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mail/components/addrbook/content/addressbook.js
+++ b/mail/components/addrbook/content/addressbook.js
@@ -20,17 +20,17 @@
/* globals printEngineWindow */
// mailnews/base/util/ABQueryUtils.jsm
/* globals getModelQuery, getSearchTokens, generateQueryURI */
// toolkit/content/globalOverlay.js
/* globals goUpdateCommand */
// Ensure the activity modules are loaded for this window.
-ChromeUtils.import("resource:///modules/activity/activityModules.js");
+ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2,17 +2,17 @@
* 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/. */
/**
* Commands for the message composition window.
*/
// Ensure the activity modules are loaded for this window.
-ChromeUtils.import("resource:///modules/activity/activityModules.js");
+ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
ChromeUtils.import("resource:///modules/attachmentChecker.js");
ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
ChromeUtils.import("resource:///modules/mimeParser.jsm");
ChromeUtils.import("resource:///modules/errUtils.js");
ChromeUtils.import("resource:///modules/folderUtils.jsm");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
ChromeUtils.import("resource:///modules/MailServices.jsm");
ChromeUtils.import("resource:///modules/MailUtils.js");