Closed Bug 1133282 Opened 5 years ago Closed 5 years ago

Remove nonstandard expression closures from netwerk

Categories

(Core :: Networking, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

Expression closures (shorthand function syntax) are a nonstandard SpiderMonkey feature we would like to remove (in bug 1083459).
Attachment #8564658 - Flags: review?(mcmanus)
Comment on attachment 8564658 [details] [diff] [review]
exclo-netwerk.patch

Review of attachment 8564658 [details] [diff] [review]:
-----------------------------------------------------------------

thanks rs=mcmanus
Attachment #8564658 - Flags: review?(mcmanus) → review+
Comment on attachment 8564658 [details] [diff] [review]
exclo-netwerk.patch

>+  _getParameters() {
>+    return {
>+      "%DATE%": function() { return Date.now().toString(); },
>+      "%PRODUCT%": function() { return gApp.name; },
>+      "%APP_ID%": function() { return gApp.ID; },
>+      "%APP_VERSION%": function() { return gApp.version; },
>+      "%BUILD_ID%": function() { return gApp.appBuildID; },
>+      "%OS%": function() { return gApp.OS; },
>+      "%CHANNEL%": function() { return UpdateChannel.get(); },
>+      "%DISTRIBUTION%": function() { return this._getPref(PREF_APP_DISTRIBUTION, ""); },
>+      "%DISTRIBUTION_VERSION%": function() { return this._getPref(PREF_APP_DISTRIBUTION_VERSION, ""); },
>+    };
>+  },
> 
>   _getUpdateURL: function() {
>     let url = this._getPref(PREF_UPDATES_URL, "");
>     let params = this._getParameters();
>     return url.replace(/%[A-Z_]+%/g, function(match) {
>       let param = params[match];
>       // preserve the %FOO% string (e.g. as an encoding) if it's not a valid parameter
>       return param ? encodeURIComponent(param()) : match;

_getParameters() is missing the colon & function keyword.
(In reply to Dave Garrett from comment #2)
> Comment on attachment 8564658 [details] [diff] [review]
> exclo-netwerk.patch
> 
> >+  _getParameters() {
> ...
> 
> _getParameters() is missing the colon & function keyword.

ES6 method syntax allows `: function` to be omitted in object literals:

https://github.com/google/traceur-compiler/wiki/LanguageFeatures#property-method-assignment
https://hg.mozilla.org/mozilla-central/rev/ad824f6cef5f
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.