Closed Bug 1215965 Opened 9 years ago Closed 9 years ago

Remove use of non-standard features from toolkit/components/social/SocialService.jsm.

Categories

(Firefox Graveyard :: SocialAPI, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

https://dxr.mozilla.org/mozilla-central/source/toolkit/components/social/SocialService.jsm Most use of non-standard SpiderMonkey extensions (legacy generator, for each, legacy array comprehension, etc) related to |SocialServiceInternal.manifests| have to be removed at once for simplicity. I'll post a patch shortly.
> - return [p for ([, p] of Iterator(this.providers))]; > + return Object.keys(this.providers).map(origin => this.providers[origin]); We could use Object.values once it's implemented (bug 1208464), but not now. for now, changed it to Object.keys + map. > - get manifests() { > + *manifestsGenerator() { ... > + get manifests() { > + return this.manifestsGenerator(); > + }, This is a getter with legacy generator, that cannot be expressed in standard way. I separated it into getter and ES6 generator method (SocialServiceInternal.manifestsGenerator), and now |manifests| getter calls manifestsGenerator and returns Generator object. > - [ '"' + host + '"' for each (host in hosts) ].join(",") + ") " > + hosts.map(host => '"' + host + '"').join(",") + ") " |[f(x) for each (x in array)]| can be rewritten as |array.map(x => f(x))| > - let providerHasFeatures = [url for (url of featureURLs) if (data[url])].length > 0; > + let providerHasFeatures = featureURLs.some(url => data[url]); |[x for each (x in array) if (g(x)]| can be rewritten as |array.filter(x => g(x))| also, |array.filter(x => g(x)).length > 0| can be rewritten as |array.some(x => g(x))| if g(x) has no side effect > - aCallback([new AddonWrapper(a) for each (a in SocialServiceInternal.manifests)]); > + aCallback([...SocialServiceInternal.manifests].map(a => new AddonWrapper(a))); |[f(x) for each (x in iterable)]| can be rewritten as |[...iterable].map(x => f(x))| Green on try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=be9bccacc8c1&group_state=expanded
Assignee: nobody → arai.unmht
Attachment #8675525 - Flags: review?(jaws)
Attachment #8675525 - Flags: review?(jaws) → review?(mixedpuppy)
Comment on attachment 8675525 [details] [diff] [review] Remove use of non-standard features from toolkit/components/social/SocialService.jsm. looks ok. I've never cared for spread syntax, every time I see it I have a WTF moment.
Attachment #8675525 - Flags: review?(mixedpuppy) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c41fe3decc83c6c02aff6ed4e0a502e142c31fed Bug 1215965 - Remove use of non-standard features from toolkit/components/social/SocialService.jsm. r=mixedpuppy
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: