Bug 1276347 - [devtools] Remove "reportError" from devtools module globals. r=jdescottes

This might have only be useful from the source actor.
In workers, you don't have access to Cu, so nor have access to Cu.reportError.
Otherwise from the main thread, you can safely use Cu.reportError.

In couple of places I'm removing the usage of reportError.
Hopefully throwing an exception is enough to get the error displayed!

Differential Revision: https://phabricator.services.mozilla.com/D157909
This commit is contained in:
Alexandre Poirot 2022-09-26 10:48:04 +00:00
Родитель ac59e542cd
Коммит f2bc8a3148
7 изменённых файлов: 5 добавлений и 12 удалений

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

@ -11,7 +11,6 @@ module.exports = {
isWorker: true,
loader: true,
module: true,
reportError: true,
require: true,
},
overrides: [

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

@ -18,7 +18,6 @@ module.exports = {
EventEmitter: true,
isWorker: true,
loader: true,
reportError: true,
Services: true,
Task: true,
XPCNativeWrapper: true,

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

@ -147,7 +147,7 @@ const WorkerDescriptorActor = protocol.ActorClassWithSpec(
},
_onWorkerError(filename, lineno, message) {
reportError("ERROR:" + filename + ":" + lineno + ":" + message + "\n");
Cu.reportError("ERROR:" + filename + ":" + lineno + ":" + message + "\n");
},
_getServiceWorkerRegistrationInfo() {

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

@ -630,7 +630,6 @@ const SourceActor = ActorClassWithSpec(sourceSpec, {
contentType,
};
} catch (error) {
reportError(error, "Got an exception during SA_onSource: ");
throw new Error(
"Could not load the source for " +
this.url +

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

@ -230,7 +230,10 @@ DevToolsServerConnection.prototype = {
_unknownError(from, prefix, error) {
const errorString = prefix + ": " + DevToolsUtils.safeErrorString(error);
reportError(errorString);
// On worker threads we don't have access to Cu.
if (!isWorker) {
Cu.reportError(errorString);
}
dumpn(errorString);
return {
from,

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

@ -234,7 +234,6 @@ exports.globals = {
},
Localization,
PathUtils,
reportError: Cu.reportError,
StructuredCloneHolder,
};
// DevTools loader copy globals property descriptors on each module global

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

@ -376,7 +376,6 @@ var {
dump,
rpc,
loadSubScript,
reportError,
setImmediate,
xpcInspector,
} = function() {
@ -424,8 +423,6 @@ addDebuggerToGlobal(globalThis);
subScriptLoader.loadSubScript(url, sandbox);
};
const reportError = Cu.reportError;
const Timer = ChromeUtils.import("resource://gre/modules/Timer.jsm");
const setImmediate = function(callback) {
@ -447,7 +444,6 @@ addDebuggerToGlobal(globalThis);
dump: this.dump,
rpc,
loadSubScript,
reportError,
setImmediate,
xpcInspector,
};
@ -486,7 +482,6 @@ addDebuggerToGlobal(globalThis);
dump: this.dump,
rpc: this.rpc,
loadSubScript: this.loadSubScript,
reportError: this.reportError,
setImmediate: this.setImmediate,
xpcInspector,
};
@ -502,7 +497,6 @@ this.worker = new WorkerDebuggerLoader({
isWorker: true,
dump,
loader,
reportError,
rpc,
URL,
setImmediate,