Open Bug 1453915 Opened 2 years ago Updated 2 years ago

Stop pulling loader's globals from another JSM scope and use Sandbox one instead

Categories

(DevTools :: Framework, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: ochameau, Unassigned)

References

(Blocks 1 open bug)

Details

In bug 1453385, I'm adding yet another global "StructuredCloneHolder" to the list of global for fetch from another JSM's global scope.

This is hacky and would be easier to fetch all of them:
 * console
 * heapsnapshot
 * StructuredCloneHolder
from a Sandbox, like we do here:
  https://searchfox.org/mozilla-central/source/devtools/shared/builtin-modules.js#26-58
const {
  atob,
  ..
  XMLHttpRequest,
} = Cu.Sandbox(CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")(), {
  wantGlobalProperties: [
    "atob",
    ...
    "XMLHttpRequest",
  ]
});

This would require tweaking platform code to export these three symbols that aren't exportable yet:
  https://searchfox.org/mozilla-central/rev/9f3da81290054c5b8955bb67ff98cae66676f745/js/xpconnect/src/Sandbox.cpp#787-860
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.