Open Bug 1410921 Opened 6 years ago Updated 5 months ago

All BrowserLoader instances in panels should be given a commonLibRequire argument


(DevTools :: General, defect, P3)



(Not tracked)


(Reporter: ochameau, Unassigned)


(Blocks 2 open bugs)


(Keywords: regression)


(3 files)

This was regressed by bug 1350215 (netmonitor) and bug 1402262 (console).

See bug 1333131 comment 3 which highlights the cost of dupliated React instances.

Toolbox already need to load React and various other significant 3rd party libraries.

In order to reuse these instances, BrowserLoader supports "commonLibRequire" argument which allow to share some modules.
As of today, it is only used by old Console frontend:
But it should be used in every BrowserLoader instance. Except the toolbox one and code that lives outside of a toolbox like about:debugging, RDM or panels loaded in a tab.

This is missing in many places:
* animation inspector
* debugger
* dom
* memory
* netmonitor
* performance
* new webconsole frontend
Comment on attachment 8921106 [details]
Bug 1410921 - Fix netmonitor and webconsole URLs in react-dom monkey patch. ?

The URLs were outdated in react-dom patch. This reintroduces issues with DOM events. For example the filter bar doesn't toggle correctly.
Blocks: 1333131
We may want to add a test to ensure this behavior is preserved, so we can avoid regressing it (again) in the future.
Ah. This becomes interesting.
DAMP reports significant regression.
I'm wondering if it is:
* cross compartment wrappers between toolbox and panel documents?
  We end up using toolbox's React which comes from another document and so I imagine there may be wrappers here.
* cost of the monkey patch of ReactDOM?
  This patch involves Proxy, if this is in a React hot codepath, it must be slow:
Priority: -- → P2
It may be interesting to revisit this as the monkey patch has been removed.

Also, Julian recently highlighted that the inspector is doing something special, that can be replaced with a dedicated BrowserLoader using `commonLibRequire`.
Instead of that, it requires all react and component modules via toolbox's BrowserLoader instance, via toolbox.browserRequire/inspectorPanel.browserRequire:

(The toolbox has its own BrowserLoader instanciated here:
As of today, `commonLibRequire` is no longer used anywhere.

It has been removed from console without clear reason in bug 1402262.

The inspector still uses toolbox loader to share react instances as described in comment 8.
Product: Firefox → DevTools
Moving this inactive P2 to the backlog (P3)
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.