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•4 years ago
|
Comment 1•4 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•4 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•4 years ago
|
Updated•4 years ago
|
Comment 3•4 years ago
|
||
That shouldn't actually block beta.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 4•2 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•2 years ago
|
||
Depends on D124391
Assignee | ||
Comment 6•2 years ago
|
||
Depends on D124392
Assignee | ||
Comment 7•2 years ago
|
||
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b9f9c4e0bb1d Add nsIUUIDGenerator to the Javascript Services object. r=Gijs https://hg.mozilla.org/integration/autoland/rev/d0ec1bb4c138 Automated replacements to use Services.uuid. r=Gijs,necko-reviewers,preferences-reviewers,kershaw https://hg.mozilla.org/integration/autoland/rev/1ffad363c97e Manual fixes to fix issues in files. r=Gijs,necko-reviewers,rpl,kershaw
Comment 9•2 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•2 years ago
|
||
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/7855fef22513 fix Thunderbird consumers of nsIUUIDGenerator which is now in Services.jsm. rs=eslint
Description
•