Closed
Bug 1513366
Opened 6 years ago
Closed 6 years ago
Add C++ helper for importing a JS module and wrapping in an XPIDL interface.
Categories
(Core :: XPConnect, enhancement, P2)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla66
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: kmag, Assigned: kmag)
Details
Attachments
(6 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
3.27 KB,
patch
|
Details | Diff | Splinter Review |
This should allow us to simply define XPIDL interfaces for the symbols exported from a JSM and then import those modules directly, rather than go through all of the mess and overhead of registering them as components.
Assignee | ||
Comment 1•6 years ago
|
||
This helper makes it considerably easier for C++ code to import a JS module
and wrap it in an appropriately-defined XPIDL interface for its exports.
Typical usage is something like:
Foo.jsm:
var EXPORTED_SYMBOLS = ["foo"];
function foo(bar) {
return bar.toString();
}
mozIFoo.idl:
interface mozIFoo : nsISupports {
AString foo(double meh);
}
Thing.cpp:
nsCOMPtr<mozIFoo> foo = do_ImportModule(
"resource://meh/Foo.jsm");
MOZ_TRY(foo->Foo(42));
Assignee | ||
Comment 2•6 years ago
|
||
It makes things much simpler.
Assignee | ||
Comment 3•6 years ago
|
||
This makes the code much simpler, and also likely much more efficient, since
it does not involve creating a sandbox, and the resulting copies and
cross-compartment-wrapper overhead.
Assignee | ||
Comment 4•6 years ago
|
||
Updated•6 years ago
|
Priority: -- → P2
Assignee | ||
Comment 5•6 years ago
|
||
This simplifies things all around, and gets rid of one more unnecessary
component registration.
Assignee | ||
Comment 6•6 years ago
|
||
It makes things much simpler.
Differential Revision: https://phabricator.services.mozilla.com/D14210
Attachment #9031577 -
Flags: review?(erahm)
Assignee | ||
Comment 7•6 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/5e6ff65ae3305d337684d9e7d44a83aa594b132e
Bug 1513366: Part 1 - Add do_ImportModule helper for importing JS modules. r=mccr8
https://hg.mozilla.org/integration/mozilla-inbound/rev/8a96de7a04728e56eb0b89fabb5ab769d3de97de
Bug 1513366: Part 2 - Update MemoryTelemetry to use do_ImportModule. r=erahm
https://hg.mozilla.org/integration/mozilla-inbound/rev/8aa82890a1ab7ca428f300fbc38d461939763548
Bug 1513366: Part 3 - Update txEXSLTFunctions to use do_ImportModule. r=Ehsan
https://hg.mozilla.org/integration/mozilla-inbound/rev/945badc82d9ab5f41c81b074d9442f84f1c0c2b3
Bug 1513366: Part 4 - Use do_ImportModule in WebReplay code. r=bhackett
https://hg.mozilla.org/integration/mozilla-inbound/rev/3dce47a0184b26b38ba08a387ac6a931f6a81012
Bug 1513366: Part 5 - Migrate extension process script to a JSM. r=aswan
Comment 8•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/5e6ff65ae330
https://hg.mozilla.org/mozilla-central/rev/8a96de7a0472
https://hg.mozilla.org/mozilla-central/rev/8aa82890a1ab
https://hg.mozilla.org/mozilla-central/rev/945badc82d9a
https://hg.mozilla.org/mozilla-central/rev/3dce47a0184b
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox66:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Pushed by richard.marti@gmail.com:
https://hg.mozilla.org/comm-central/rev/03ca21bafc5f
Port bug 1513366 - remove extension-process-script.js from package manifest. rs=bustage-fix DONTBUILD
Updated•6 years ago
|
Attachment #9031577 -
Flags: review?(erahm)
You need to log in
before you can comment on or make changes to this bug.
Description
•