Closed
Bug 1260938
Opened 8 years ago
Closed 8 years ago
Add the `ThreadSafeDevToolsUtils.isSet` utility
Categories
(DevTools :: General, defect)
DevTools
General
Tracking
(firefox48 fixed)
RESOLVED
FIXED
Firefox 48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: fitzgen, Assigned: fitzgen)
References
Details
Attachments
(1 file, 1 obsolete file)
2.82 KB,
patch
|
fitzgen
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•8 years ago
|
||
Attachment #8736522 -
Flags: review?(jimb)
Assignee | ||
Updated•8 years ago
|
Assignee | ||
Comment 2•8 years ago
|
||
Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3c42993982c2
Comment 3•8 years ago
|
||
Comment on attachment 8736522 [details] [diff] [review] Add the `ThreadSafeDevToolsUtils.isSet` utility Review of attachment 8736522 [details] [diff] [review]: ----------------------------------------------------------------- ::: devtools/shared/ThreadSafeDevToolsUtils.js @@ +248,5 @@ > + * Return true iff `thing` is a `Set` object (possibly from another global). > + */ > +exports.isSet = function(thing) { > + return Object.prototype.toString.call(thing) === "[object Set]"; > +}; This is a pretty ugly technique. I see that we've already got other predicates like this, though. What would the truly ES6-esque way of doing this be? ::: devtools/shared/tests/unit/test_isSet.js @@ +7,5 @@ > +function run_test() { > + const { isSet } = DevToolsUtils; > + > + equal(isSet(new Set()), true); > + equal(isSet(new Map()), false); Should we test it on primitives and plain objects too?
Attachment #8736522 -
Flags: review?(jimb) → review+
Assignee | ||
Comment 4•8 years ago
|
||
(In reply to Jim Blandy :jimb from comment #3) > Comment on attachment 8736522 [details] [diff] [review] > Add the `ThreadSafeDevToolsUtils.isSet` utility > > Review of attachment 8736522 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: devtools/shared/ThreadSafeDevToolsUtils.js > @@ +248,5 @@ > > + * Return true iff `thing` is a `Set` object (possibly from another global). > > + */ > > +exports.isSet = function(thing) { > > + return Object.prototype.toString.call(thing) === "[object Set]"; > > +}; > > This is a pretty ugly technique. I see that we've already got other > predicates like this, though. > > What would the truly ES6-esque way of doing this be? Asked around, no better answers. Suggestion was to add a chrome-only instrinsic, which seems like overkill here. Apparently ES6 is going to make this even worse by adding a hook for any old class/object to customize <foo> in "[object <foo>]"... Yay. > ::: devtools/shared/tests/unit/test_isSet.js > @@ +7,5 @@ > > +function run_test() { > > + const { isSet } = DevToolsUtils; > > + > > + equal(isSet(new Set()), true); > > + equal(isSet(new Map()), false); > > Should we test it on primitives and plain objects too? Sure, I'll add that.
Assignee | ||
Comment 5•8 years ago
|
||
Attachment #8736762 -
Flags: review+
Assignee | ||
Updated•8 years ago
|
Attachment #8736522 -
Attachment is obsolete: true
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 6•8 years ago
|
||
bugherder landing |
https://hg.mozilla.org/integration/fx-team/rev/49adb658e099
Keywords: checkin-needed
Comment 7•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/49adb658e099
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•