Bug 1793275 - Convert chat frontend to es modules. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D158446 Depends on D158445 --HG-- rename : mail/components/im/IMIncomingServer.jsm => mail/components/im/IMIncomingServer.sys.mjs rename : mail/components/im/IMProtocolInfo.jsm => mail/components/im/IMProtocolInfo.sys.mjs rename : mail/components/im/modules/ChatEncryption.jsm => mail/components/im/modules/ChatEncryption.sys.mjs rename : mail/components/im/modules/GlodaIMSearcher.jsm => mail/components/im/modules/GlodaIMSearcher.sys.mjs rename : mail/components/im/modules/chatHandler.jsm => mail/components/im/modules/chatHandler.sys.mjs rename : mail/components/im/modules/chatIcons.jsm => mail/components/im/modules/chatIcons.sys.mjs rename : mail/components/im/modules/chatNotifications.jsm => mail/components/im/modules/chatNotifications.sys.mjs rename : mail/components/im/modules/index_im.jsm => mail/components/im/modules/index_im.sys.mjs rename : mail/components/im/test/TestProtocol.jsm => mail/components/im/test/TestProtocol.sys.mjs extra : histedit_source : f03e4920d055350c124e6afc0677c04d6a8bde0b
This commit is contained in:
Родитель
d0606d97cd
Коммит
625f77f765
|
@ -2,13 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["IMIncomingServer"];
|
||||
import { IMServices } from "resource:///modules/IMServices.sys.mjs";
|
||||
|
||||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
|
||||
function IMIncomingServer() {}
|
||||
export function IMIncomingServer() {}
|
||||
|
||||
IMIncomingServer.prototype = {
|
||||
get wrappedJSObject() {
|
|
@ -2,9 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["IMProtocolInfo"];
|
||||
|
||||
function IMProtocolInfo() {}
|
||||
export function IMProtocolInfo() {}
|
||||
|
||||
IMProtocolInfo.prototype = {
|
||||
defaultLocalPath: null,
|
|
@ -8,13 +8,13 @@ Classes = [
|
|||
{
|
||||
'cid': '{13118758-dad2-418c-a03d-1acbfed0cd01}',
|
||||
'contract_ids': ['@mozilla.org/messenger/protocol/info;1?type=im'],
|
||||
'jsm': 'resource:///modules/IMProtocolInfo.jsm',
|
||||
'esModule': 'resource:///modules/IMProtocolInfo.sys.mjs',
|
||||
'constructor': 'IMProtocolInfo',
|
||||
},
|
||||
{
|
||||
'cid': '{9dd7f36b-5960-4f0a-8789-f5f516bd083d}',
|
||||
'contract_ids': ['@mozilla.org/messenger/server;1?type=im'],
|
||||
'jsm': 'resource:///modules/IMIncomingServer.jsm',
|
||||
'esModule': 'resource:///modules/IMIncomingServer.sys.mjs',
|
||||
'constructor': 'IMIncomingServer',
|
||||
},
|
||||
]
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
var { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
var { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
var addBuddy = {
|
||||
onload() {
|
||||
|
|
|
@ -5,16 +5,14 @@
|
|||
// chat/content/imAccountOptionsHelper.js
|
||||
/* globals accountOptionsHelper */
|
||||
|
||||
const { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
ChatEncryption: "resource:///modules/ChatEncryption.sys.mjs",
|
||||
OTR: "resource:///modules/OTR.sys.mjs",
|
||||
OTRUI: "resource:///modules/OTRUI.sys.mjs",
|
||||
});
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"ChatEncryption",
|
||||
"resource:///modules/ChatEncryption.jsm"
|
||||
);
|
||||
|
||||
var autoJoinPref = "autoJoin";
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
const { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
const { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
/**
|
||||
* The MozChatContactRichlistitem widget displays contact information about user under
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
// Wrap in a block to prevent leaking to window scope.
|
||||
{
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
const { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
OTR: "resource:///modules/OTR.sys.mjs",
|
||||
|
|
|
@ -40,11 +40,9 @@
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"ChatEncryption",
|
||||
"resource:///modules/ChatEncryption.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
ChatEncryption: "resource:///modules/ChatEncryption.sys.mjs",
|
||||
});
|
||||
|
||||
this.observer = {
|
||||
// @see {nsIObserver}
|
||||
|
|
|
@ -14,7 +14,9 @@
|
|||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
const { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
/**
|
||||
* The MozChatConvRichlistitem widget displays opened conversation information from the
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
/* globals MailToolboxCustomizeDone, openIMAccountMgr,
|
||||
PROTO_TREE_VIEW, Status, statusSelector, ZoomManager, gSpacesToolbar */
|
||||
|
||||
var { Notifications } = ChromeUtils.import(
|
||||
"resource:///modules/chatNotifications.jsm"
|
||||
var { Notifications } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatNotifications.sys.mjs"
|
||||
);
|
||||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
|
@ -23,13 +23,9 @@ var { InlineSpellChecker } = ChromeUtils.importESModule(
|
|||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
ChatEncryption: "resource:///modules/ChatEncryption.sys.mjs",
|
||||
OTRUI: "resource:///modules/OTRUI.sys.mjs",
|
||||
});
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"ChatEncryption",
|
||||
"resource:///modules/ChatEncryption.jsm"
|
||||
);
|
||||
|
||||
var gChatSpellChecker;
|
||||
var gRangeParent;
|
||||
|
@ -1859,9 +1855,11 @@ var chatHandler = {
|
|||
document.getElementById("conversationsGroup").sortComparator = (a, b) =>
|
||||
a.title.toLowerCase().localeCompare(b.title.toLowerCase());
|
||||
|
||||
const { allContacts, onlineContacts, ChatCore } = ChromeUtils.import(
|
||||
"resource:///modules/chatHandler.jsm"
|
||||
);
|
||||
const {
|
||||
allContacts,
|
||||
onlineContacts,
|
||||
ChatCore,
|
||||
} = ChromeUtils.importESModule("resource:///modules/chatHandler.sys.mjs");
|
||||
this.allContacts = allContacts;
|
||||
this.onlineContacts = onlineContacts;
|
||||
this.ChatCore = ChatCore;
|
||||
|
|
|
@ -11,7 +11,9 @@ var { IMServices } = ChromeUtils.importESModule(
|
|||
var { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
var { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
var { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
var PREF_EXTENSIONS_GETMOREPROTOCOLSURL = "extensions.getMoreProtocolsURL";
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@ var { Status } = ChromeUtils.importESModule(
|
|||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
var { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
var { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
var statusSelector = {
|
||||
observe(aSubject, aTopic, aMsg) {
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
var { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
var { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
var autoJoinPref = "autoJoin";
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["ChatEncryption"];
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
@ -28,7 +26,7 @@ const STATE_STRING = {
|
|||
[Ci.prplIConversation.ENCRYPTION_TRUSTED]: "private",
|
||||
};
|
||||
|
||||
const ChatEncryption = {
|
||||
export const ChatEncryption = {
|
||||
/**
|
||||
* If OTR is enabled.
|
||||
*
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["GlodaIMSearcher"];
|
||||
|
||||
const { Gloda } = ChromeUtils.import(
|
||||
"resource:///modules/gloda/GlodaPublic.jsm"
|
||||
);
|
||||
|
@ -192,7 +190,7 @@ function scoreOffsets(aMessage, aContext) {
|
|||
* mechanism to explicitly score the IM conversations given the search context in
|
||||
* addition to the more generic score adjusting rules.
|
||||
*/
|
||||
function GlodaIMSearcher(aListener, aSearchString, aAndTerms) {
|
||||
export function GlodaIMSearcher(aListener, aSearchString, aAndTerms) {
|
||||
this.listener = aListener;
|
||||
|
||||
this.searchString = aSearchString;
|
||||
|
@ -204,6 +202,7 @@ function GlodaIMSearcher(aListener, aSearchString, aAndTerms) {
|
|||
|
||||
this.scores = null;
|
||||
}
|
||||
|
||||
GlodaIMSearcher.prototype = {
|
||||
/**
|
||||
* Number of messages to retrieve initially.
|
|
@ -2,19 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["allContacts", "onlineContacts", "ChatCore"];
|
||||
import { IMServices } from "resource:///modules/IMServices.sys.mjs";
|
||||
|
||||
const { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
||||
var allContacts = {};
|
||||
var onlineContacts = {};
|
||||
export var allContacts = {};
|
||||
export var onlineContacts = {};
|
||||
|
||||
var ChatCore = {
|
||||
export var ChatCore = {
|
||||
initialized: false,
|
||||
_initializing: false,
|
||||
init() {
|
|
@ -2,9 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["ChatIcons"];
|
||||
|
||||
var ChatIcons = {
|
||||
export var ChatIcons = {
|
||||
/**
|
||||
* Get the icon URI for the given protocol.
|
||||
*
|
|
@ -2,11 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = ["Notifications"];
|
||||
import { IMServices } from "resource:///modules/IMServices.sys.mjs";
|
||||
|
||||
const { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
@ -16,13 +13,13 @@ const { PluralForm } = ChromeUtils.import(
|
|||
const { clearTimeout, setTimeout } = ChromeUtils.import(
|
||||
"resource://gre/modules/Timer.jsm"
|
||||
);
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
import { ChatIcons } from "resource:///modules/chatIcons.sys.mjs";
|
||||
|
||||
// Time in seconds: it is the minimum time of inactivity
|
||||
// needed to show the bundled notification.
|
||||
var kTimeToWaitForMoreMsgs = 3;
|
||||
|
||||
var Notifications = {
|
||||
export var Notifications = {
|
||||
get ellipsis() {
|
||||
let ellipsis = "[\u2026]";
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const EXPORTED_SYMBOLS = [];
|
||||
|
||||
var CC = Components.Constructor;
|
||||
|
||||
const { Gloda } = ChromeUtils.import(
|
||||
|
@ -18,15 +16,11 @@ const { GlodaConstants } = ChromeUtils.import(
|
|||
const { GlodaIndexer, IndexingJob } = ChromeUtils.import(
|
||||
"resource:///modules/gloda/GlodaIndexer.jsm"
|
||||
);
|
||||
const { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
);
|
||||
import { IMServices } from "resource:///modules/IMServices.sys.mjs";
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
const { FileUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/FileUtils.sys.mjs"
|
||||
);
|
||||
import { FileUtils } from "resource://gre/modules/FileUtils.sys.mjs";
|
||||
const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
|
@ -4,18 +4,18 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
"IMIncomingServer.jsm",
|
||||
"IMProtocolInfo.jsm",
|
||||
"modules/ChatEncryption.jsm",
|
||||
"modules/chatHandler.jsm",
|
||||
"modules/chatIcons.jsm",
|
||||
"modules/chatNotifications.jsm",
|
||||
"modules/GlodaIMSearcher.jsm",
|
||||
"modules/index_im.jsm",
|
||||
"IMIncomingServer.sys.mjs",
|
||||
"IMProtocolInfo.sys.mjs",
|
||||
"modules/ChatEncryption.sys.mjs",
|
||||
"modules/chatHandler.sys.mjs",
|
||||
"modules/chatIcons.sys.mjs",
|
||||
"modules/chatNotifications.sys.mjs",
|
||||
"modules/GlodaIMSearcher.sys.mjs",
|
||||
"modules/index_im.sys.mjs",
|
||||
]
|
||||
|
||||
TESTING_JS_MODULES += [
|
||||
"test/TestProtocol.jsm",
|
||||
"test/TestProtocol.sys.mjs",
|
||||
]
|
||||
|
||||
JAR_MANIFESTS += ["jar.mn"]
|
||||
|
|
|
@ -2,13 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = [
|
||||
"registerTestProtocol",
|
||||
"unregisterTestProtocol",
|
||||
"TestProtocol",
|
||||
];
|
||||
|
||||
var {
|
||||
import {
|
||||
GenericAccountPrototype,
|
||||
GenericConvChatPrototype,
|
||||
GenericConvIMPrototype,
|
||||
|
@ -17,10 +11,9 @@ var {
|
|||
GenericConvChatBuddyPrototype,
|
||||
GenericMessagePrototype,
|
||||
TooltipInfo,
|
||||
} = ChromeUtils.importESModule("resource:///modules/jsProtoHelper.sys.mjs");
|
||||
var { nsSimpleEnumerator } = ChromeUtils.importESModule(
|
||||
"resource:///modules/imXPCOMUtils.sys.mjs"
|
||||
);
|
||||
} from "resource:///modules/jsProtoHelper.sys.mjs";
|
||||
|
||||
import { nsSimpleEnumerator } from "resource:///modules/imXPCOMUtils.sys.mjs";
|
||||
|
||||
function Message(who, text, properties, conversation) {
|
||||
this._init(who, text, properties, conversation);
|
||||
|
@ -255,7 +248,7 @@ Account.prototype = {
|
|||
remove() {},
|
||||
};
|
||||
|
||||
function TestProtocol() {}
|
||||
export function TestProtocol() {}
|
||||
TestProtocol.prototype = {
|
||||
__proto__: GenericProtocolPrototype,
|
||||
get id() {
|
||||
|
@ -295,7 +288,7 @@ TestProtocol.prototype = {
|
|||
classID: Components.ID("{a4617631-b8b8-4053-8afa-5c4c43498280}"),
|
||||
};
|
||||
|
||||
function registerTestProtocol() {
|
||||
export function registerTestProtocol() {
|
||||
Services.catMan.addCategoryEntry(
|
||||
"im-protocol-plugin",
|
||||
TestProtocol.prototype.id,
|
||||
|
@ -305,7 +298,7 @@ function registerTestProtocol() {
|
|||
);
|
||||
}
|
||||
|
||||
function unregisterTestProtocol() {
|
||||
export function unregisterTestProtocol() {
|
||||
Services.catMan.deleteCategoryEntry(
|
||||
"im-protocol-plugin",
|
||||
TestProtocol.prototype.id,
|
|
@ -9,7 +9,9 @@
|
|||
const { MockRegistrar } = ChromeUtils.import(
|
||||
"resource://testing-common/MockRegistrar.jsm"
|
||||
);
|
||||
const { ChatIcons } = ChromeUtils.import("resource:///modules/chatIcons.jsm");
|
||||
const { ChatIcons } = ChromeUtils.importESModule(
|
||||
"resource:///modules/chatIcons.sys.mjs"
|
||||
);
|
||||
|
||||
let originalAlertsServiceCID;
|
||||
let alertShown;
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, you can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var { registerTestProtocol, unregisterTestProtocol } = ChromeUtils.import(
|
||||
"resource://testing-common/TestProtocol.jsm"
|
||||
var {
|
||||
registerTestProtocol,
|
||||
unregisterTestProtocol,
|
||||
} = ChromeUtils.importESModule(
|
||||
"resource://testing-common/TestProtocol.sys.mjs"
|
||||
);
|
||||
var { IMServices } = ChromeUtils.importESModule(
|
||||
"resource:///modules/IMServices.sys.mjs"
|
||||
|
|
|
@ -8,7 +8,7 @@ Classes = [
|
|||
{
|
||||
'cid': '{a4617631-b8b8-4053-8afa-5c4c43498280}',
|
||||
'contract_ids': ['@mozilla.org/chat/mochitest;1'],
|
||||
'jsm': 'resource://testing-common/TestProtocol.jsm',
|
||||
'esModule': 'resource://testing-common/TestProtocol.sys.mjs',
|
||||
'constructor': 'TestProtocol',
|
||||
},
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче