Expose nsIUUIDGenerator on Services.jsm
Categories
(Toolkit :: General, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox94 | --- | fixed |
People
(Reporter: Gijs, Assigned: standard8)
References
Details
Attachments
(5 files)
As per summary. Services.uuid
seems like it should work.
Updated•5 years ago
|
Comment 1•5 years ago
|
||
By adding a shorthand for nsIUUIDGenerator to Services.jsm we can
avoid a lot of boilerplate code for a frequently used service.
Using nsIUUIDGenerator from JavaScript today normally looks something
like this:
const uuidGen = Cc["mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator);
uuidGen.generateUUID();
Which with this patch now be shortened to:
Services.uuid.generateUUID();
Comment 2•5 years ago
|
||
By adding a new generate() method returning a string directly from
nsIUUIDGenerator we are able to avoid many cumbersome string coercions.
In JavaScript, string representations of UUIDs are more often than
not the requirement. This is usually to ease serialisation.
We may want to consider renaming nsIUUIDGenerator.generateUUID()
in the future to generateIDPtr() or similar, but this would require
a larger refactoring due to existing usage. It would be advisable
to make JS usage move to generate() first, before attempting a
rewrite of the C++ consumers.
Updated•5 years ago
|
Updated•5 years ago
|
That shouldn't actually block beta.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 4•3 years ago
|
||
This also adds a commented out option for automatically fixing use-services in the ESLint rule. This cannot be enabled at the moment as it needs special treatment for chrome tests.
Assignee | ||
Comment 5•3 years ago
|
||
Depends on D124391
Assignee | ||
Comment 6•3 years ago
|
||
Depends on D124392
Assignee | ||
Comment 7•3 years ago
|
||
Comment 9•3 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b9f9c4e0bb1d
https://hg.mozilla.org/mozilla-central/rev/d0ec1bb4c138
https://hg.mozilla.org/mozilla-central/rev/1ffad363c97e
Comment 10•3 years ago
|
||
Description
•