Bug 1690945 - Remove ErrUtils.jsm. r=rnons
Differential Revision: https://phabricator.services.mozilla.com/D113006 --HG-- extra : rebase_source : 2fc77b6fcc4ffdb995e8c36248fc8b7c15a698a0
This commit is contained in:
Родитель
ffc3b1dc97
Коммит
8e170aabf9
|
@ -1048,7 +1048,7 @@ FolderDisplayWidget.prototype = {
|
|||
this._clearSavedSelection();
|
||||
}
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
gDBView = null; // eslint-disable-line no-global-assign
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
"resource://gre/modules/PluralForm.jsm"
|
||||
);
|
||||
const { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
|
||||
const { logException } = ChromeUtils.import(
|
||||
"resource:///modules/ErrUtils.jsm"
|
||||
);
|
||||
|
||||
var glodaFacetStrings = Services.strings.createBundle(
|
||||
"chrome://messenger/locale/glodaFacetView.properties"
|
||||
|
@ -218,7 +215,7 @@
|
|||
this.messagesNode.appendChild(msgNode);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1149,7 +1146,7 @@
|
|||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return logException(e);
|
||||
return Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1168,7 @@
|
|||
|
||||
return false;
|
||||
} catch (e) {
|
||||
return logException(e);
|
||||
return Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1327,7 +1324,7 @@
|
|||
);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1344,7 +1341,7 @@
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1359,7 +1356,7 @@
|
|||
this.doUndo();
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1408,7 @@
|
|||
this.undoNode.focus();
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1423,7 +1420,7 @@
|
|||
this.node.focus();
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1429,7 @@
|
|||
this.facetNode.includeFacet(this.node);
|
||||
this.hide();
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1629,7 +1626,7 @@
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
// - Starred
|
||||
|
|
|
@ -20,10 +20,6 @@ var { MailServices } = ChromeUtils.import(
|
|||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
var { TagUtils } = ChromeUtils.import("resource:///modules/TagUtils.jsm");
|
||||
var { logObject, logException } = ChromeUtils.import(
|
||||
"resource:///modules/ErrUtils.jsm"
|
||||
);
|
||||
|
||||
var { Gloda } = ChromeUtils.import("resource:///modules/gloda/GlodaPublic.jsm");
|
||||
var { FacetDriver, FacetUtils } = ChromeUtils.import(
|
||||
"resource:///modules/gloda/Facet.jsm"
|
||||
|
@ -127,7 +123,7 @@ const QueryExplanation = {
|
|||
}
|
||||
label = label + constraintStrings.join(", "); // XXX l10n?
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -486,7 +482,7 @@ var FacetContext = {
|
|||
this._sortBy = val;
|
||||
this.build(this._sieveAll());
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
@ -650,8 +646,7 @@ var FacetContext = {
|
|||
try {
|
||||
explicitBinding.build(true);
|
||||
} catch (e) {
|
||||
logObject(explicitBinding);
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
explicitBinding.removeAttribute("uninitialized");
|
||||
}
|
||||
|
@ -766,7 +761,7 @@ var FacetContext = {
|
|||
this._hideTimeline(false);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
var { MsgHdrSyntheticView } = ChromeUtils.import(
|
||||
"resource:///modules/MsgHdrSyntheticView.jsm"
|
||||
);
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
|
||||
var { getSpecialFolderString } = ChromeUtils.import(
|
||||
|
@ -200,7 +199,7 @@ var mailTabType = {
|
|||
};
|
||||
return retval;
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
@ -282,7 +281,7 @@ var mailTabType = {
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
onTitleChanged(aTab, aTabNode) {
|
||||
|
|
|
@ -1945,7 +1945,7 @@ function GetFirstSelectedMsgFolder() {
|
|||
try {
|
||||
var selectedFolders = GetSelectedMsgFolders();
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
return selectedFolders.length > 0 ? selectedFolders[0] : null;
|
||||
}
|
||||
|
|
|
@ -1071,7 +1071,7 @@ function updateExpandedView() {
|
|||
try {
|
||||
AdjustHeaderView(Services.prefs.getIntPref("mail.show_headers"));
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3580,7 +3580,7 @@ ConversationOpener.prototype = {
|
|||
this._msgHdr = messages[0];
|
||||
this._queries = [Gloda.getMessageCollectionForHeaders(messages, this)];
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
isSelectedMessageIndexed() {
|
||||
|
@ -3614,7 +3614,7 @@ ConversationOpener.prototype = {
|
|||
});
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
/* globals loadCalendarComponent */
|
||||
|
||||
ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
var { MailConsts } = ChromeUtils.import("resource:///modules/MailConsts.jsm");
|
||||
var { MailInstrumentation } = ChromeUtils.import(
|
||||
"resource:///modules/MailInstrumentation.jsm"
|
||||
|
@ -636,7 +635,7 @@ var gMailInit = {
|
|||
try {
|
||||
MailInstrumentation.init();
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
|
||||
if (!Services.policies.isAllowed("devtools")) {
|
||||
|
@ -839,7 +838,7 @@ var gMailInit = {
|
|||
try {
|
||||
MailInstrumentation.uninit.bind(MailInstrumentation);
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -1614,7 +1613,7 @@ function ClearMessagePane() {
|
|||
});
|
||||
}
|
||||
} catch (ex) {
|
||||
logException(ex, false, "error clearing message pane");
|
||||
Cu.reportError(ex); // error clearing message pane
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
/* import-globals-from folderDisplay.js */
|
||||
/* import-globals-from mailWindow.js */
|
||||
|
||||
var { logException, errorWithDebug } = ChromeUtils.import(
|
||||
"resource:///modules/ErrUtils.jsm"
|
||||
);
|
||||
var {
|
||||
MessageTextFilter,
|
||||
QuickFilterManager,
|
||||
|
@ -231,7 +228,7 @@ var QuickFilterBarMuxer = {
|
|||
);
|
||||
QuickFilterBarMuxer.deferredUpdateSearch();
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
@ -598,7 +595,7 @@ var QuickFilterBarMuxer = {
|
|||
) {
|
||||
return this.tabmail.currentTabInfo._ext.quickFilter;
|
||||
}
|
||||
throw errorWithDebug("There is no active filterer but we want one.");
|
||||
throw new Error("There is no active filterer but we want one.");
|
||||
},
|
||||
|
||||
// ----------------------
|
||||
|
|
|
@ -1066,7 +1066,7 @@
|
|||
|
||||
return tab;
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ const EXPORTED_SYMBOLS = ["MailInstrumentation"];
|
|||
|
||||
var nsIMFNService = Ci.nsIMsgFolderNotificationService;
|
||||
|
||||
const { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
|
@ -76,7 +75,7 @@ var MailInstrumentation = {
|
|||
MailInstrumentation._postStateObject();
|
||||
}
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -185,7 +184,7 @@ var MailInstrumentation = {
|
|||
req.send(dataToPost);
|
||||
},
|
||||
_onError(e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
},
|
||||
_onLoad() {
|
||||
Services.prefs.setCharPref(
|
||||
|
@ -262,7 +261,7 @@ var MailInstrumentation = {
|
|||
this._postStateObject();
|
||||
}
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -16,10 +16,6 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
||||
const { logException, logObject } = ChromeUtils.import(
|
||||
"resource:///modules/ErrUtils.jsm"
|
||||
);
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
|
@ -268,8 +264,7 @@ QuickFilterSearchListener.prototype = {
|
|||
try {
|
||||
this.listener.onSearchMessage(this.scratch, aMsgHdr, aFolder);
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
logObject(this.scratch, "scratch object");
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -553,7 +548,7 @@ var QuickFilterManager = {
|
|||
listeners.push([listener, filterDef]);
|
||||
}
|
||||
} catch (ex) {
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
}
|
||||
return searchTerms.length ? [searchTerms, listeners] : [null, listeners];
|
||||
|
|
|
@ -12,7 +12,6 @@ ChromeUtils.defineModuleGetter(
|
|||
"AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
);
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
/**
|
||||
* Tries to get a configuration from an MS Exchange server
|
||||
|
@ -429,7 +428,7 @@ function readAutoDiscoverXML(autoDiscoverXML, username) {
|
|||
|
||||
// else unknown or unsupported protocol
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
/* import-globals-from accountSetup.js */
|
||||
|
||||
var { JXON } = ChromeUtils.import("resource:///modules/JXON.jsm");
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
/**
|
||||
* Set up a fetch.
|
||||
|
@ -311,7 +310,7 @@ FetchHTTP.prototype = {
|
|||
try {
|
||||
this._successCallback(this.result);
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
e.stack = this._callStack;
|
||||
this._error(e);
|
||||
}
|
||||
|
@ -328,12 +327,12 @@ FetchHTTP.prototype = {
|
|||
try {
|
||||
this._finishedCallback(this);
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// error in our fetchhttp._response() code
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
this._error(e);
|
||||
}
|
||||
},
|
||||
|
@ -342,7 +341,7 @@ FetchHTTP.prototype = {
|
|||
this._errorCallback(e);
|
||||
} catch (e) {
|
||||
// error in errorCallback, too!
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
alertPrompt("Error in errorCallback for fetchhttp", e);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
/* import-globals-from accountSetup.js */
|
||||
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
var {
|
||||
cleanUpHostName,
|
||||
isLegalHostNameOrIP,
|
||||
|
@ -58,13 +57,13 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
try {
|
||||
d.displayName = sanitize.label(xml.displayName);
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
for (var domain of xml.$domain) {
|
||||
try {
|
||||
d.domains.push(sanitize.hostname(domain));
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
@ -141,21 +140,21 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
iO.owaURL = sanitize.url(iX.owaURL);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
try {
|
||||
if ("ewsURL" in iX) {
|
||||
iO.ewsURL = sanitize.url(iX.ewsURL);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
try {
|
||||
if ("easURL" in iX) {
|
||||
iO.easURL = sanitize.url(iX.easURL);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
iO.oauthSettings = {
|
||||
issuer: iO.hostname,
|
||||
|
@ -176,14 +175,14 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
try {
|
||||
if ("downloadOnBiff" in iX.pop3) {
|
||||
iO.downloadOnBiff = sanitize.boolean(iX.pop3.downloadOnBiff);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,7 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
// processed successfully, now add to result object
|
||||
|
@ -301,7 +300,7 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
// processed successfully, now add to result object
|
||||
|
@ -312,7 +311,7 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
d.outgoingAlternatives.push(oO);
|
||||
}
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +331,7 @@ function readFromXML(clientConfigXML, subSource) {
|
|||
};
|
||||
d.inputFields.push(fieldset);
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
// For now, don't throw,
|
||||
// because we don't support custom fields yet anyways.
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
/* import-globals-from accountSetup.js */
|
||||
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
|
||||
|
@ -153,7 +152,7 @@ Exception.prototype = {
|
|||
|
||||
function NotReached(msg) {
|
||||
Exception.call(this, msg); // call super constructor
|
||||
logException(this);
|
||||
Cu.reportError(this);
|
||||
}
|
||||
// Make NotReached extend Exception.
|
||||
NotReached.prototype = Object.create(Exception.prototype);
|
||||
|
|
|
@ -11,7 +11,6 @@ var { MailServices } = ChromeUtils.import(
|
|||
var { OAuth2Providers } = ChromeUtils.import(
|
||||
"resource:///modules/OAuth2Providers.jsm"
|
||||
);
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
/**
|
||||
* This checks a given config, by trying a real connection and login,
|
||||
|
|
|
@ -1,356 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* This file contains helper methods for debugging -- things like logging
|
||||
* exception objects, dumping DOM nodes, Events, and generic object dumps.
|
||||
*/
|
||||
|
||||
const EXPORTED_SYMBOLS = [
|
||||
"logObject",
|
||||
"logException",
|
||||
"logElement",
|
||||
"logEvent",
|
||||
"errorWithDebug",
|
||||
];
|
||||
|
||||
/**
|
||||
* Report on an object to stdout.
|
||||
* @param aObj the object to be dumped
|
||||
* @param aName the name of the object, for informational purposes
|
||||
*/
|
||||
function logObject(aObj, aName) {
|
||||
dump("Dumping Object: " + aName + "\n");
|
||||
stringifier.dumpObj(aObj, aName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception to stdout. This function should not be called in
|
||||
* expected circumstances.
|
||||
* @param aException the exception to log
|
||||
* @param [aRethrow] set to true to rethrow the exception after logging
|
||||
* @param [aMsg] optional message to log
|
||||
*/
|
||||
function logException(aException, aRethrow, aMsg) {
|
||||
stringifier.dumpException(aException, aMsg);
|
||||
|
||||
if (aMsg) {
|
||||
Cu.reportError(aMsg);
|
||||
}
|
||||
Cu.reportError(aException);
|
||||
|
||||
if (aRethrow) {
|
||||
throw aException;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an DOM element to stdout.
|
||||
* @param aElement the DOM element to dump
|
||||
*/
|
||||
function logElement(aElement) {
|
||||
stringifier.dumpDOM(aElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an DOM event to stdout.
|
||||
* @param aEvent the DOM event object to dump
|
||||
*/
|
||||
function logEvent(aEvent) {
|
||||
stringifier.dumpEvent(aEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the current stack and return an Error suitable for throwing. We return
|
||||
* the new Error so that your code can use a "throw" statement which makes it
|
||||
* obvious to syntactic analysis that there is an exit occurring at that point.
|
||||
*
|
||||
* Example:
|
||||
* throw errorWithDebug("I did not expect this!");
|
||||
*
|
||||
* @param aString The message payload for the exception.
|
||||
*/
|
||||
function errorWithDebug(aString) {
|
||||
dump("PROBLEM: " + aString + "\n");
|
||||
dump("CURRENT STACK (and throwing):\n");
|
||||
// skip this frame.
|
||||
dump(stringifier.getStack(1));
|
||||
return new Error(aString);
|
||||
}
|
||||
|
||||
function Stringifier() {}
|
||||
|
||||
Stringifier.prototype = {
|
||||
dumpObj(o, name) {
|
||||
this._reset();
|
||||
this._append(this.objectTreeAsString(o, true, true, 0));
|
||||
dump(this._asString());
|
||||
},
|
||||
|
||||
dumpDOM(node, level, recursive) {
|
||||
this._reset();
|
||||
let s = this.DOMNodeAsString(node, level, recursive);
|
||||
dump(s);
|
||||
},
|
||||
|
||||
dumpEvent(event) {
|
||||
dump(this.eventAsString(event));
|
||||
},
|
||||
|
||||
dumpException(exc, message) {
|
||||
dump(exc + "\n");
|
||||
this._reset();
|
||||
if (message) {
|
||||
this._append("Exception (" + message + ")\n");
|
||||
}
|
||||
|
||||
this._append("-- Exception object --\n");
|
||||
this._append(this.objectTreeAsString(exc));
|
||||
if (exc.stack) {
|
||||
this._append("-- Stack Trace --\n");
|
||||
this._append(exc.stack); // skip dumpException and logException
|
||||
}
|
||||
dump(this._asString());
|
||||
},
|
||||
|
||||
_reset() {
|
||||
this._buffer = [];
|
||||
},
|
||||
|
||||
_append(string) {
|
||||
this._buffer.push(string);
|
||||
},
|
||||
|
||||
_asString() {
|
||||
let str = this._buffer.join("");
|
||||
this._reset();
|
||||
return str;
|
||||
},
|
||||
|
||||
getStack(skipCount) {
|
||||
if (typeof Components != "object" || typeof Cc != "object") {
|
||||
return "No stack trace available.";
|
||||
}
|
||||
if (typeof skipCount === undefined) {
|
||||
skipCount = 0;
|
||||
}
|
||||
|
||||
let frame = Components.stack.caller;
|
||||
let str = "<top>";
|
||||
|
||||
while (frame) {
|
||||
if (skipCount > 0) {
|
||||
// Skip this frame.
|
||||
skipCount -= 1;
|
||||
} else {
|
||||
// Include the data from this frame.
|
||||
let name = frame.name ? frame.name : "[anonymous]";
|
||||
str += "\n" + name + "@" + frame.filename + ":" + frame.lineNumber;
|
||||
}
|
||||
frame = frame.caller;
|
||||
}
|
||||
return str + "\n";
|
||||
},
|
||||
|
||||
objectTreeAsString(o, recurse, compress, level) {
|
||||
let s = "";
|
||||
if (recurse === undefined) {
|
||||
recurse = 0;
|
||||
}
|
||||
if (level === undefined) {
|
||||
level = 0;
|
||||
}
|
||||
if (compress === undefined) {
|
||||
compress = true;
|
||||
}
|
||||
let pfx = "";
|
||||
|
||||
for (var junk = 0; junk < level; junk++) {
|
||||
pfx += compress ? "| " : "| ";
|
||||
}
|
||||
|
||||
let tee = compress ? "+ " : "+- ";
|
||||
|
||||
if (typeof o != "object") {
|
||||
s += pfx + tee + " (" + typeof o + ") " + o + "\n";
|
||||
} else {
|
||||
for (let i in o) {
|
||||
try {
|
||||
let t = typeof o[i];
|
||||
switch (t) {
|
||||
case "function":
|
||||
let sfunc = String(o[i]).split("\n");
|
||||
if (sfunc[2] == " [native code]") {
|
||||
sfunc = "[native code]";
|
||||
} else {
|
||||
sfunc = sfunc.length + " lines";
|
||||
}
|
||||
s += pfx + tee + i + " (function) " + sfunc + "\n";
|
||||
break;
|
||||
case "object":
|
||||
s += pfx + tee + i + " (object) " + o[i] + "\n";
|
||||
if (!compress) {
|
||||
s += pfx + "|\n";
|
||||
}
|
||||
if (i != "parent" && recurse) {
|
||||
s += this.objectTreeAsString(
|
||||
o[i],
|
||||
recurse - 1,
|
||||
compress,
|
||||
level + 1
|
||||
);
|
||||
}
|
||||
break;
|
||||
case "string":
|
||||
if (o[i].length > 200) {
|
||||
s += pfx + tee + i + " (" + t + ") " + o[i].length + " chars\n";
|
||||
} else {
|
||||
s += pfx + tee + i + " (" + t + ") '" + o[i] + "'\n";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s += pfx + tee + i + " (" + t + ") " + o[i] + "\n";
|
||||
}
|
||||
} catch (ex) {
|
||||
s += pfx + tee + " (exception) " + ex + "\n";
|
||||
}
|
||||
if (!compress) {
|
||||
s += pfx + "|\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
s += pfx + "*\n";
|
||||
return s;
|
||||
},
|
||||
|
||||
_repeatStr(str, aCount) {
|
||||
let res = "";
|
||||
while (--aCount >= 0) {
|
||||
res += str;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
|
||||
DOMNodeAsString(node, level, recursive) {
|
||||
if (level === undefined) {
|
||||
level = 0;
|
||||
}
|
||||
if (recursive === undefined) {
|
||||
recursive = true;
|
||||
}
|
||||
this._append(this._repeatStr(" ", 2 * level) + "<" + node.nodeName + "\n");
|
||||
|
||||
if (node.nodeType == 3) {
|
||||
this._append(
|
||||
this._repeatStr(" ", 2 * level + 4) + node.nodeValue + "'\n"
|
||||
);
|
||||
} else {
|
||||
if (node.attributes) {
|
||||
for (let i = 0; i < node.attributes.length; i++) {
|
||||
this._append(
|
||||
this._repeatStr(" ", 2 * level + 4) +
|
||||
node.attributes[i].nodeName +
|
||||
"='" +
|
||||
node.attributes[i].nodeValue +
|
||||
"'\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
if (node.childNodes.length == 0) {
|
||||
this._append(this._repeatStr(" ", 2 * level) + "/>\n");
|
||||
} else if (recursive) {
|
||||
this._append(this._repeatStr(" ", 2 * level) + ">\n");
|
||||
for (let i = 0; i < node.childNodes.length; i++) {
|
||||
this._append(this.DOMNodeAsString(node.childNodes[i], level + 1));
|
||||
}
|
||||
this._append(
|
||||
this._repeatStr(" ", 2 * level) + "</" + node.nodeName + ">\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
return this._asString();
|
||||
},
|
||||
|
||||
eventAsString(event) {
|
||||
this._reset();
|
||||
this._append("-EVENT --------------------------\n");
|
||||
this._append("type: " + event.type + "\n");
|
||||
this._append("eventPhase: " + event.eventPhase + "\n");
|
||||
if ("charCode" in event) {
|
||||
this._append("charCode: " + event.charCode + "\n");
|
||||
if ("name" in event) {
|
||||
this._append(
|
||||
"str(charCode): '" + String.fromCharCode(event.charCode) + "'\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
if ("target" in event && event.target) {
|
||||
this._append("target: " + event.target + "\n");
|
||||
if ("nodeName" in event.target) {
|
||||
this._append("target.nodeName: " + event.target.nodeName + "\n");
|
||||
}
|
||||
if ("getAttribute" in event.target) {
|
||||
this._append("target.id: " + event.target.getAttribute("id") + "\n");
|
||||
}
|
||||
}
|
||||
if ("currentTarget" in event && event.currentTarget) {
|
||||
this._append("currentTarget: " + event.currentTarget + "\n");
|
||||
if ("nodeName" in event.currentTarget) {
|
||||
this._append(
|
||||
"currentTarget.nodeName: " + event.currentTarget.nodeName + "\n"
|
||||
);
|
||||
}
|
||||
if ("getAttribute" in event.currentTarget) {
|
||||
this._append(
|
||||
"currentTarget.id: " + event.currentTarget.getAttribute("id") + "\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
if ("originalTarget" in event && event.originalTarget) {
|
||||
this._append("originalTarget: " + event.originalTarget + "\n");
|
||||
if ("nodeName" in event.originalTarget) {
|
||||
this._append(
|
||||
"originalTarget.nodeName: " + event.originalTarget.nodeName + "\n"
|
||||
);
|
||||
}
|
||||
if ("getAttribute" in event.originalTarget) {
|
||||
this._append(
|
||||
"originalTarget.id: " + event.originalTarget.getAttribute("id") + "\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
let names = [
|
||||
"bubbles",
|
||||
"cancelable",
|
||||
"detail",
|
||||
"button",
|
||||
"keyCode",
|
||||
"isChar",
|
||||
"shiftKey",
|
||||
"altKey",
|
||||
"ctrlKey",
|
||||
"metaKey",
|
||||
"clientX",
|
||||
"clientY",
|
||||
"screenX",
|
||||
"screenY",
|
||||
"layerX",
|
||||
"layerY",
|
||||
"isTrusted",
|
||||
"timeStamp",
|
||||
"currentTargetXPath",
|
||||
"targetXPath",
|
||||
"originalTargetXPath",
|
||||
];
|
||||
for (let name of names) {
|
||||
if (name in event) {
|
||||
this._append(name + ": " + event[name] + "\n");
|
||||
}
|
||||
}
|
||||
this._append("-------------------------------------\n");
|
||||
return this._asString();
|
||||
},
|
||||
};
|
||||
|
||||
var stringifier = new Stringifier();
|
|
@ -99,7 +99,6 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
|||
EXTRA_JS_MODULES += [
|
||||
"ABQueryUtils.jsm",
|
||||
"converterWorker.js",
|
||||
"ErrUtils.jsm",
|
||||
"FolderLookupService.jsm",
|
||||
"folderUtils.jsm",
|
||||
"hostnameUtils.jsm",
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
var EXPORTED_SYMBOLS = ["GlodaAutoComplete"];
|
||||
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
var Gloda = null;
|
||||
var MultiSuffixTree = null;
|
||||
var TagNoun = null;
|
||||
|
@ -532,7 +530,7 @@ function GlodaAutoComplete() {
|
|||
this.completers.push(new ContactTagCompleter()); // not async.
|
||||
this.completers.push(new MessageTagCompleter()); // not async.
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,7 +563,7 @@ GlodaAutoComplete.prototype = {
|
|||
|
||||
result.announceYourself();
|
||||
} catch (e) {
|
||||
logException(e);
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -283,8 +283,8 @@ function verify_nonMatches(aQueries, aCollections) {
|
|||
|
||||
for (let item of nonmatches) {
|
||||
if (testQuery.test(item)) {
|
||||
logObject(item, "item");
|
||||
logObject(testQuery._constraints, "constraints");
|
||||
dump("item: " + JSON.stringify(item) + "\n");
|
||||
dump("constraints: " + JSON.stringify(testQuery._constraints) + "\n");
|
||||
do_throw(
|
||||
"Something should not match query.test(), but it does: " + item
|
||||
);
|
||||
|
|
|
@ -53,8 +53,6 @@ var msgGen = (gMessageGenerator = new MessageGenerator());
|
|||
// Create a message scenario generator using that message generator
|
||||
var scenarios = new MessageScenarioFactory(msgGen);
|
||||
|
||||
var { logObject } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
/**
|
||||
* Create a 'me' identity of "me@localhost" for the benefit of Gloda. At the
|
||||
* time of this writing, Gloda only initializes Gloda.myIdentities and
|
||||
|
@ -541,8 +539,6 @@ var _indexMessageState = {
|
|||
previousValue = verifier(synMsg, glodaMsg, previousValue);
|
||||
} catch (ex) {
|
||||
// ugh, too verbose
|
||||
// logObject(synMsg, "synMsg");
|
||||
// logObject(glodaMsg, "glodaMsg");
|
||||
dump("synMsg: " + synMsg + "\n");
|
||||
dump("glodaMsg: " + glodaMsg + "\n");
|
||||
mark_failure([
|
||||
|
@ -562,7 +558,6 @@ var _indexMessageState = {
|
|||
for (let messageId in this._glodaMessagesByMessageId) {
|
||||
let glodaMsg = this._glodaMessagesByMessageId[messageId];
|
||||
if (glodaMsg != null) {
|
||||
// logObject is too verbose right now
|
||||
dump("gloda message: " + glodaMsg + "\n");
|
||||
mark_failure([
|
||||
"Gloda message",
|
||||
|
@ -590,7 +585,7 @@ var _indexMessageState = {
|
|||
for (let messageId in this._glodaDeletionsByMessageId) {
|
||||
let glodaMsg = this._glodaDeletionsByMessageId[messageId];
|
||||
if (glodaMsg != null) {
|
||||
logObject(glodaMsg, "glodaMsg");
|
||||
dump("glodaMsg: " + glodaMsg + "\n");
|
||||
do_throw(
|
||||
"Gloda message with message id " +
|
||||
messageId +
|
||||
|
@ -1024,7 +1019,6 @@ QueryExpectationListener.prototype = {
|
|||
|
||||
// make sure the query's test method agrees with the database about this
|
||||
if (!aCollection.query.test(item)) {
|
||||
logObject(item);
|
||||
do_throw(
|
||||
"Query test returned false when it should have been true on " +
|
||||
"extracted: " +
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
* }
|
||||
*/
|
||||
|
||||
var { logException } = ChromeUtils.import("resource:///modules/ErrUtils.jsm");
|
||||
|
||||
/**
|
||||
* Url listener that can wrap another listener and trigger a callback, but
|
||||
* definitely calls async_driver to resume asynchronous processing. Use
|
||||
|
@ -198,7 +196,7 @@ function _async_driver() {
|
|||
asyncStack.push(asyncGeneratorStack[i][1]);
|
||||
}
|
||||
dump("*********\n");
|
||||
logException(ex);
|
||||
Cu.reportError(ex);
|
||||
mark_failure([
|
||||
"Generator explosion. ex:",
|
||||
ex,
|
||||
|
|
Загрузка…
Ссылка в новой задаче