Bug 1520643 - Port bug 1514594: Fix some imports with two arguments. rs=bustage-fix,jorgk

This commit is contained in:
Geoff Lankow 2019-01-31 13:50:18 +01:00
Родитель a3335fe096
Коммит 067ccad40b
9 изменённых файлов: 42 добавлений и 77 удалений

Просмотреть файл

@ -1935,7 +1935,7 @@
<method name="setInitialSelection">
<body>
<![CDATA[
ChromeUtils.import("resource:///modules/MailUtils.jsm", this);
var {MailUtils} = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var view = this.tree.view;
@ -1958,7 +1958,7 @@
var index = -1;
var uri = this.parentNode.getAttribute("uri");
if (uri) {
index = view.getIndexOfResource(this.MailUtils.getOrCreateFolder(uri));
index = view.getIndexOfResource(MailUtils.getOrCreateFolder(uri));
}
view.selection.select(index);
return index;

Просмотреть файл

@ -1262,12 +1262,8 @@ function UpdateEmailNodeDetails(aEmailAddress, aDocumentNode, aCardDetails) {
if (jid)
chatAddresses.push(jid);
}
let {onlineContacts} = ChromeUtils.import("resource:///modules/chatHandler.jsm");
let chatContact;
if (!("chatHandler" in window)) {
window.chatHandler = {};
ChromeUtils.import("resource:///modules/chatHandler.jsm", chatHandler);
}
let onlineContacts = chatHandler.onlineContacts;
for (let chatAddress of chatAddresses) {
if (Object.prototype.hasOwnProperty.call(onlineContacts, chatAddresses)) {
chatContact = onlineContacts[chatAddress];

Просмотреть файл

@ -42,8 +42,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
});
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function() {
let tmp = {};
ChromeUtils.import("resource:///modules/GlobalPopupNotifications.jsm", tmp);
let {PopupNotifications} = ChromeUtils.import("resource:///modules/GlobalPopupNotifications.jsm");
try {
// Hide all notifications while the URL is being edited and the address bar
// has focus, including the virtual focus in the results popup.
@ -51,10 +50,10 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function() {
// minimized because of the effects of the "noautohide" attribute on Linux.
// This can be removed once bug 545265 and bug 1320361 are fixed.
let shouldSuppress = () => window.windowState == window.STATE_MINIMIZED;
return new tmp.PopupNotifications(document.getElementById("tabmail"),
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"),
{ shouldSuppress });
return new PopupNotifications(document.getElementById("tabmail"),
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"),
{ shouldSuppress });
} catch (ex) {
Cu.reportError(ex);
return null;
@ -436,8 +435,8 @@ function OnLoadMessenger() {
// On Win8 set an attribute when the window frame color is too dark for black text.
if (window.matchMedia("(-moz-os-version: windows-win8)").matches &&
window.matchMedia("(-moz-windows-default-theme)").matches) {
let windowFrameColor = new Color(...ChromeUtils.import("resource:///modules/Windows8WindowFrameColor.jsm", {})
.Windows8WindowFrameColor.get());
let {Windows8WindowFrameColor} = ChromeUtils.import("resource:///modules/Windows8WindowFrameColor.jsm");
let windowFrameColor = new Color(Windows8WindowFrameColor.get());
// Default to black for foreground text.
if (!windowFrameColor.isContrastRatioAcceptable(new Color(0, 0, 0))) {
document.documentElement.setAttribute("darkwindowframe", "true");
@ -1480,10 +1479,9 @@ var LightWeightThemeWebInstaller = {
},
get _manager() {
let temp = {};
ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
let {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm");
delete this._manager;
return this._manager = temp.LightweightThemeManager;
return this._manager = LightweightThemeManager;
},
_installRequest(event) {

Просмотреть файл

@ -17,9 +17,8 @@ var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {MailUtils} = ChromeUtils.import("resource:///modules/MailUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "PageMenuParent", function() {
let tmp = {};
ChromeUtils.import("resource://gre/modules/PageMenu.jsm", tmp);
return new tmp.PageMenuParent();
let {PageMenuParent} = ChromeUtils.import("resource://gre/modules/PageMenu.jsm");
return new PageMenuParent();
});
var gSpellChecker = new InlineSpellChecker();

Просмотреть файл

@ -6,6 +6,10 @@
/* import-globals-from utilityOverlay.js */
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var {
isLegalIPAddress,
isLegalLocalIPAddress,
} = ChromeUtils.import("resource:///modules/hostnameUtils.jsm");
var kPhishingNotSuspicious = 0;
var kPhishingWithIPAddress = 1;
@ -26,8 +30,6 @@ var gPhishingDetector = {
* Update the local tables if necessary.
*/
init() {
ChromeUtils.import("resource:///modules/hostnameUtils.jsm", this);
this.mCheckForIPAddresses = Services.prefs.getBoolPref("mail.phishing.detection.ipaddresses");
this.mCheckForMismatchedHosts = Services.prefs.getBoolPref("mail.phishing.detection.mismatched_hosts");
this.mDisallowFormActions = Services.prefs.getBoolPref("mail.phishing.detection.disallow_form_actions");
@ -120,9 +122,9 @@ var gPhishingDetector = {
if (aLinkText && aLinkText != aUrl &&
aLinkText.replace(/\/+$/, "") != aUrl.replace(/\/+$/, "")) {
if (this.mCheckForIPAddresses) {
let unobscuredHostNameValue = this.isLegalIPAddress(hrefURL.host, true);
let unobscuredHostNameValue = isLegalIPAddress(hrefURL.host, true);
if (unobscuredHostNameValue)
failsStaticTests = !this.isLegalLocalIPAddress(unobscuredHostNameValue);
failsStaticTests = !isLegalLocalIPAddress(unobscuredHostNameValue);
}
if (!failsStaticTests && this.mCheckForMismatchedHosts) {
@ -209,7 +211,7 @@ var gPhishingDetector = {
// only prompt for http and https urls
if (hrefURL.schemeIs("http") || hrefURL.schemeIs("https")) {
// unobscure the host name in case it's an encoded ip address..
let unobscuredHostNameValue = this.isLegalIPAddress(hrefURL.host, true)
let unobscuredHostNameValue = isLegalIPAddress(hrefURL.host, true)
|| hrefURL.host;
var brandShortName = document.getElementById("bundle_brand")

Просмотреть файл

@ -5,6 +5,9 @@
// This dialog can only be opened if we have a shell service.
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var {SearchIntegration} = ChromeUtils.import("resource:///modules/SearchIntegration.jsm");
var gSystemIntegrationDialog = {
_shellSvc: Cc["@mozilla.org/mail/shell-service;1"]
.getService(Ci.nsIShellService),
@ -20,11 +23,6 @@ var gSystemIntegrationDialog = {
_searchCheckbox: null,
onLoad() {
// Makes Services and SearchIntegration accessible via this.Services
// and this.SearchIntegration.
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
ChromeUtils.import("resource:///modules/SearchIntegration.jsm", this);
// initialize elements
this._mailCheckbox = document.getElementById("checkMail");
this._newsCheckbox = document.getElementById("checkNews");

Просмотреть файл

@ -467,20 +467,19 @@ function nsAutoCompleteGloda() {
try {
// set up our awesome globals!
if (Gloda === null) {
let loadNS = {};
ChromeUtils.import("resource:///modules/gloda/public.js", loadNS);
let loadNS = ChromeUtils.import("resource:///modules/gloda/public.js");
Gloda = loadNS.Gloda;
ChromeUtils.import("resource:///modules/gloda/utils.js", loadNS);
loadNS = ChromeUtils.import("resource:///modules/gloda/utils.js");
GlodaUtils = loadNS.GlodaUtils;
ChromeUtils.import("resource:///modules/gloda/suffixtree.js", loadNS);
loadNS = ChromeUtils.import("resource:///modules/gloda/suffixtree.js");
MultiSuffixTree = loadNS.MultiSuffixTree;
ChromeUtils.import("resource:///modules/gloda/noun_tag.js", loadNS);
loadNS = ChromeUtils.import("resource:///modules/gloda/noun_tag.js");
TagNoun = loadNS.TagNoun;
ChromeUtils.import("resource:///modules/gloda/noun_freetag.js", loadNS);
loadNS = ChromeUtils.import("resource:///modules/gloda/noun_freetag.js");
FreeTagNoun = loadNS.FreeTagNoun;
ChromeUtils.import("resource:///modules/gloda/log4moz.js", loadNS);
loadNS = ChromeUtils.import("resource:///modules/gloda/log4moz.js");
LOG = loadNS["Log4Moz"].repository.getLogger("gloda.autocomp");
}

Просмотреть файл

@ -45,10 +45,8 @@ var MAX_SANE_BODY_PART_SIZE = 20 * 1024;
* the part tree we have already built.
*/
function MimeMessageEmitter() {
this._mimeMsg = {};
ChromeUtils.import("resource:///modules/gloda/mimemsg.js", this._mimeMsg);
this._utils = {};
ChromeUtils.import("resource:///modules/gloda/utils.js", this._utils);
this._mimeMsg = ChromeUtils.import("resource:///modules/gloda/mimemsg.js");
this._utils = ChromeUtils.import("resource:///modules/gloda/utils.js");
this._url = null;
this._partRE = this._utils.GlodaUtils.PART_RE;

Просмотреть файл

@ -7,39 +7,14 @@ this.EXPORTED_SYMBOLS = [];
var {Log4Moz} = ChromeUtils.import("resource:///modules/gloda/log4moz.js");
var LOG = Log4Moz.repository.getLogger("gloda.everybody");
var importNS = {};
var {GlodaFundAttr} = ChromeUtils.import("resource:///modules/gloda/fundattr.js");
GlodaFundAttr.init();
var {GlodaExplicitAttr} = ChromeUtils.import("resource:///modules/gloda/explattr.js");
GlodaExplicitAttr.init();
function loadModule(aModuleURI, aNSContrib) {
try {
LOG.info("... loading " + aModuleURI);
ChromeUtils.import(aModuleURI, importNS);
}
catch (ex) {
LOG.error("!!! error loading " + aModuleURI);
LOG.error("(" + ex.fileName + ":" + ex.lineNumber + ") " + ex);
return false;
}
LOG.info("+++ loaded " + aModuleURI);
if (aNSContrib) {
try {
importNS[aNSContrib].init();
}
catch (ex) {
LOG.error("!!! error initializing " + aModuleURI);
LOG.error("(" + ex.fileName + ":" + ex.lineNumber + ") " + ex);
return false;
}
LOG.info("+++ inited " + aModuleURI);
}
return true;
}
loadModule("resource:///modules/gloda/fundattr.js", "GlodaFundAttr");
loadModule("resource:///modules/gloda/explattr.js", "GlodaExplicitAttr");
loadModule("resource:///modules/gloda/noun_tag.js");
loadModule("resource:///modules/gloda/noun_freetag.js");
loadModule("resource:///modules/gloda/noun_mimetype.js");
loadModule("resource:///modules/gloda/index_msg.js");
loadModule("resource:///modules/gloda/index_ab.js", "GlodaABAttrs");
ChromeUtils.import("resource:///modules/gloda/noun_tag.js");
ChromeUtils.import("resource:///modules/gloda/noun_freetag.js");
ChromeUtils.import("resource:///modules/gloda/noun_mimetype.js");
ChromeUtils.import("resource:///modules/gloda/index_msg.js");
var {GlodaABAttrs} = ChromeUtils.import("resource:///modules/gloda/index_ab.js");
GlodaABAttrs.init();