Closed Bug 1276347 Opened 8 years ago Closed 2 years ago

remove reportError from builtin-modules.js

Categories

(DevTools :: Framework, enhancement)

enhancement
Not set
normal

Tracking

(firefox107 fixed)

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: tromey, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I noticed that builtin-modules.js supplies "reportError" as a global. https://dxr.mozilla.org/mozilla-central/source/devtools/shared/builtin-modules.js#229 Some spots in devtools use this, despite bug 1265775. I think these uses should be removed and then this should be removed from the list of globals. This doesn't affect the inspector, so not adding it to devtools-html-3.
:jlong brought this up recently too. I think it was originally added because workers don't have Components access and thus can't use Cu.reportError, so a special `reportError` was added to the worker debugger's global[1]. So, it's only in the loader because we wanted to switch between worker vs. non-worker impls. :ejpbruel, is this history correct? [1]: https://dxr.mozilla.org/mozilla-central/source/dom/webidl/WorkerDebuggerGlobalScope.webidl#28
Flags: needinfo?(ejpbruel)
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #1) > :jlong brought this up recently too. > > I think it was originally added because workers don't have Components access > and thus can't use Cu.reportError, so a special `reportError` was added to > the worker debugger's global[1]. > > So, it's only in the loader because we wanted to switch between worker vs. > non-worker impls. :ejpbruel, is this history correct? > > [1]: > https://dxr.mozilla.org/mozilla-central/source/dom/webidl/ > WorkerDebuggerGlobalScope.webidl#28 Yes :-)
Flags: needinfo?(ejpbruel)
Product: Firefox → DevTools
Blocks: 1525652

This is a blocker for the migration of all devtools modules to ESM.
This global will no longer exist in ESM. We would have to expose this symbol by some other means.
But looking at the few usages of it, this doesn't seem to be used much from the worker thread.

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!

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/16790f7123a1 [devtools] Remove "reportError" from devtools module globals. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: