Closed Bug 1207490 Opened 9 years ago Closed 9 years ago

Remove use of expression closure from browser/, except browser/components/.

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(16 files)

16.93 KB, patch
dao
: review+
Details | Diff | Splinter Review
46.63 KB, patch
dao
: review+
Details | Diff | Splinter Review
2.04 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
12.49 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
18.08 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
15.92 KB, patch
vporof
: review+
Details | Diff | Splinter Review
1.15 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
5.43 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.33 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.26 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.48 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.21 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.66 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
2.76 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.82 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
1.63 KB, patch
Gijs
: review+
Details | Diff | Splinter Review
Need to replace non-standard expression closure with one of: * function declaration * function expression * arrow function before fixing bug 1083458. converting rules are following: * function declaration add `return` and braces * standalone named function expression add `return` and braces * standalone anonymous function expression contans and receives `this` (Array.filter, bind, etc) convert to arrow function, and remove code passing |this| * standalone anonymous function expression contans no `this` convert to arrow function * property with anonymous function expression, contains `this` add `return` and braces * property with anonymous function expression, contains no `this`, short body convert to arrow function * property with anonymous function expression, contains no `this`, long body add `return` and braces * property with named function expression add `return` and braces * getter property add `return` and braces * setter property add braces Since there are a lot of patches, separated into 8 bugs, each bug corresponds to one of following directories: * browser/, except browser/components/. * browser/components/. * dom/. * layout/. * services/. * toolkit/, except toolkit/components/. * toolkit/components/. * b2g/, chrome/, docshell/, mobiles/, modules/, netwerk/, parser/, security/, storage/, testing/, webapprt/, widget/, xpcom/ (not yet touched addon-sdk) I have draft patches, will post them (may take some time to prepare and post).
Assignee: nobody → arai.unmht
Attachment #8664714 - Flags: review?(dao)
Attachment #8664728 - Flags: review?(gijskruitbosch+bugs) → review+
Attachment #8664723 - Flags: review?(jaws) → review+
Attachment #8664733 - Flags: review?(dao) → review+
Attachment #8664732 - Flags: review?(jmathies) → review+
Attachment #8664729 - Flags: review?(mrbkap) → review+
Attachment #8664727 - Flags: review?(markh) → review+
Comment on attachment 8664714 [details] [diff] [review] Part 1: Remove use of expression closure from browser/base/. >@@ -5193,19 +5195,25 @@ var TabsInTitlebar = { > _lastSizeMode: null, > > _readPref: function () { > this.allowedBy("pref", > Services.prefs.getBoolPref(this._prefName)); > }, > > _update: function (aForce=false) { >- function $(id) document.getElementById(id); >- function rect(ele) ele.getBoundingClientRect(); >- function verticalMargins(cstyle) parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop); >+ function $(id) { >+ return document.getElementById(id); >+ } >+ function rect(ele) { >+ return ele.getBoundingClientRect(); >+ } >+ function verticalMargins(cstyle) { >+ return parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop); >+ } I think I'd prefer 'let $ = id => document.getElementById(id);' etc. here
Attachment #8664714 - Flags: review?(dao) → review+
Attachment #8664726 - Flags: review?(adw) → review+
Attachment #8664725 - Flags: review?(seth) → review+
thank you for reviewing :) here's try run result: https://treeherder.mozilla.org/#/jobs?repo=try&revision=c844b363eef3 some oranges, but there seems no regression from this patch series
Comment on attachment 8664721 [details] [diff] [review] Part 7: Remove use of expression closure from browser/experiments/. Review of attachment 8664721 [details] [diff] [review]: ----------------------------------------------------------------- r=me either way, but: ::: browser/experiments/Experiments.jsm @@ +2224,5 @@ > > this.Experiments.PreviousExperimentProvider.prototype = Object.freeze({ > + get name() { > + return "PreviousExperimentProvider"; > + }, Considering we freeze this object, I don't really see a reason not to just use name: "PreviousExperimentProvider" Is there a difference in behaviour I am unaware of?
Attachment #8664721 - Flags: review?(gfritzsche) → review+
Comment on attachment 8664715 [details] [diff] [review] Part 2: Remove use of expression closure from browser/base/content/test/general/. >--- a/browser/base/content/test/general/browser_ctrlTab.js >+++ b/browser/base/content/test/general/browser_ctrlTab.js >@@ -85,24 +85,27 @@ function test() { > } > > // cleanup > if (gPrefService.prefHasUserValue("browser.ctrlTab.previews")) > gPrefService.clearUserPref("browser.ctrlTab.previews"); > > /* private utility functions */ > >- function pressCtrlTab(aShiftKey) >- EventUtils.synthesizeKey("VK_TAB", { ctrlKey: true, shiftKey: !!aShiftKey }); >+ function pressCtrlTab(aShiftKey) { >+ return EventUtils.synthesizeKey("VK_TAB", { ctrlKey: true, shiftKey: !!aShiftKey }); >+ } > >- function releaseCtrl() >- EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" }); >+ function releaseCtrl() { >+ return EventUtils.synthesizeKey("VK_CONTROL", { type: "keyup" }); >+ } These two functions don't need to return anything. >--- a/browser/base/content/test/general/browser_overflowScroll.js >+++ b/browser/base/content/test/general/browser_overflowScroll.js >@@ -1,23 +1,43 @@ > var tabstrip = gBrowser.tabContainer.mTabstrip; > var scrollbox = tabstrip._scrollbox; > var originalSmoothScroll = tabstrip.smoothScroll; > var tabs = gBrowser.tabs; > >-function rect(ele) ele.getBoundingClientRect(); >-function width(ele) rect(ele).width; >-function left(ele) rect(ele).left; >-function right(ele) rect(ele).right; >-function isLeft(ele, msg) is(left(ele) + tabstrip._tabMarginLeft, left(scrollbox), msg); >-function isRight(ele, msg) is(right(ele) - tabstrip._tabMarginRight, right(scrollbox), msg); >-function elementFromPoint(x) tabstrip._elementFromPoint(x); >-function nextLeftElement() elementFromPoint(left(scrollbox) - 1); >-function nextRightElement() elementFromPoint(right(scrollbox) + 1); >-function firstScrollable() tabs[gBrowser._numPinnedTabs]; >+function rect(ele) { >+ return ele.getBoundingClientRect(); >+} >+function width(ele) { >+ return rect(ele).width; >+} >+function left(ele) { >+ return rect(ele).left; >+} >+function right(ele) { >+ return rect(ele).right; >+} >+function isLeft(ele, msg) { >+ return is(left(ele) + tabstrip._tabMarginLeft, left(scrollbox), msg); >+} >+function isRight(ele, msg) { >+ return is(right(ele) - tabstrip._tabMarginRight, right(scrollbox), msg); >+} >+function elementFromPoint(x) { >+ return tabstrip._elementFromPoint(x); >+} >+function nextLeftElement() { >+ return elementFromPoint(left(scrollbox) - 1); >+} >+function nextRightElement() { >+ return elementFromPoint(right(scrollbox) + 1); >+} >+function firstScrollable() { >+ return tabs[gBrowser._numPinnedTabs]; >+} let rect = ele => ele.getBoundingClientRect(); etc.
Attachment #8664715 - Flags: review?(dao) → review+
(In reply to :Gijs Kruitbosch from comment #17) > Comment on attachment 8664722 [details] [diff] [review] > Part 8: Remove use of expression closure from browser/fuel/. > > Review of attachment 8664722 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: browser/fuel/fuelApplication.js > @@ +17,5 @@ > > var Utilities = { > > get bookmarks() { > > let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. > > getService(Ci.nsINavBookmarksService); > > + this.__defineGetter__("bookmarks", () => bookmarks); > > nit: here and elsewhere you can use _ => ... Why would that be better?
(In reply to Dão Gottwald [:dao] from comment #22) > (In reply to :Gijs Kruitbosch from comment #17) > > Comment on attachment 8664722 [details] [diff] [review] > > Part 8: Remove use of expression closure from browser/fuel/. > > > > Review of attachment 8664722 [details] [diff] [review]: > > ----------------------------------------------------------------- > > > > ::: browser/fuel/fuelApplication.js > > @@ +17,5 @@ > > > var Utilities = { > > > get bookmarks() { > > > let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"]. > > > getService(Ci.nsINavBookmarksService); > > > + this.__defineGetter__("bookmarks", () => bookmarks); > > > > nit: here and elsewhere you can use _ => ... > > Why would that be better? We (arai and I) discussed this over IRC already, please ignore (I'll mark the comment obsolete in a sec). :-)
Attachment #8664719 - Flags: review?(markh) → review+
Attachment #8664717 - Flags: review?(mconley) → review+
Attachment #8664716 - Flags: review?(adw) → review+
thank you dao and Gijs :D looks like Android M(13) is perm-fail, I'll investigate it shortly. (In reply to :Gijs Kruitbosch from comment #20) > ::: browser/experiments/Experiments.jsm > @@ +2224,5 @@ > > > > this.Experiments.PreviousExperimentProvider.prototype = Object.freeze({ > > + get name() { > > + return "PreviousExperimentProvider"; > > + }, > > Considering we freeze this object, I don't really see a reason not to just > use name: "PreviousExperimentProvider" > > Is there a difference in behaviour I am unaware of? it will throw different error when setting value, but it won't matter. I'll change it to |name: "PreviousExperimentProvider"|.
pushed some separated patch series to try. so far, M(13) fails on all patterns, even without my patches :/ https://treeherder.mozilla.org/#/jobs?repo=try&revision=e794bfb693d7 (with patches for bug 1207490) https://treeherder.mozilla.org/#/jobs?repo=try&revision=4ff0c2623bd0 (with patches for bug 1207491) https://treeherder.mozilla.org/#/jobs?repo=try&revision=e86f20db8e7d (with patches for bug 1207494) https://treeherder.mozilla.org/#/jobs?repo=try&revision=f59a74fcbc1b (without patches, only m-c) I feel like it's not related orange.
Attachment #8664720 - Flags: review?(vporof) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: