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)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(16 files)
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 | ||
Comment 1•9 years ago
|
||
Assignee: nobody → arai.unmht
Attachment #8664714 -
Flags: review?(dao)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8664715 -
Flags: review?(dao)
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8664716 -
Flags: review?(adw)
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8664717 -
Flags: review?(mconley)
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8664719 -
Flags: review?(markh)
Assignee | ||
Comment 6•9 years ago
|
||
Attachment #8664720 -
Flags: review?(vporof)
Assignee | ||
Comment 7•9 years ago
|
||
Attachment #8664721 -
Flags: review?(gfritzsche)
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8664722 -
Flags: review?(dao)
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8664723 -
Flags: review?(jaws)
Assignee | ||
Comment 10•9 years ago
|
||
Attachment #8664725 -
Flags: review?(seth)
Assignee | ||
Comment 11•9 years ago
|
||
Attachment #8664726 -
Flags: review?(adw)
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8664727 -
Flags: review?(markh)
Assignee | ||
Comment 13•9 years ago
|
||
Attachment #8664728 -
Flags: review?(gijskruitbosch+bugs)
Assignee | ||
Comment 14•9 years ago
|
||
Attachment #8664729 -
Flags: review?(mrbkap)
Assignee | ||
Comment 15•9 years ago
|
||
Attachment #8664732 -
Flags: review?(jmathies)
Assignee | ||
Comment 16•9 years ago
|
||
Attachment #8664733 -
Flags: review?(dao)
Updated•9 years ago
|
Attachment #8664728 -
Flags: review?(gijskruitbosch+bugs) → review+
Comment hidden (obsolete) |
Updated•9 years ago
|
Attachment #8664723 -
Flags: review?(jaws) → review+
Updated•9 years ago
|
Attachment #8664733 -
Flags: review?(dao) → review+
Updated•9 years ago
|
Attachment #8664732 -
Flags: review?(jmathies) → review+
Updated•9 years ago
|
Attachment #8664729 -
Flags: review?(mrbkap) → review+
Updated•9 years ago
|
Attachment #8664727 -
Flags: review?(markh) → review+
Comment 18•9 years ago
|
||
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+
Updated•9 years ago
|
Attachment #8664726 -
Flags: review?(adw) → review+
Updated•9 years ago
|
Attachment #8664725 -
Flags: review?(seth) → review+
Assignee | ||
Comment 19•9 years ago
|
||
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 20•9 years ago
|
||
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 21•9 years ago
|
||
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+
Comment 22•9 years ago
|
||
(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?
Comment 23•9 years ago
|
||
(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). :-)
Updated•9 years ago
|
Attachment #8664719 -
Flags: review?(markh) → review+
Updated•9 years ago
|
Attachment #8664717 -
Flags: review?(mconley) → review+
Updated•9 years ago
|
Attachment #8664716 -
Flags: review?(adw) → review+
Assignee | ||
Comment 24•9 years ago
|
||
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"|.
Assignee | ||
Comment 25•9 years ago
|
||
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.
Updated•9 years ago
|
Attachment #8664720 -
Flags: review?(vporof) → review+
Comment 26•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/fb921354f6ca
https://hg.mozilla.org/integration/mozilla-inbound/rev/323a9a3c1608
https://hg.mozilla.org/integration/mozilla-inbound/rev/f4a1e0b22871
https://hg.mozilla.org/integration/mozilla-inbound/rev/1e3a9fcf73d8
https://hg.mozilla.org/integration/mozilla-inbound/rev/b8815627054a
https://hg.mozilla.org/integration/mozilla-inbound/rev/98d3300738e3
https://hg.mozilla.org/integration/mozilla-inbound/rev/e9dda4b6e6e0
https://hg.mozilla.org/integration/mozilla-inbound/rev/c2646cfe32bf
https://hg.mozilla.org/integration/mozilla-inbound/rev/04ba29693dd5
https://hg.mozilla.org/integration/mozilla-inbound/rev/932cb872289f
https://hg.mozilla.org/integration/mozilla-inbound/rev/8593648ed49e
https://hg.mozilla.org/integration/mozilla-inbound/rev/c63ef61734b0
https://hg.mozilla.org/integration/mozilla-inbound/rev/a4cee17afa63
https://hg.mozilla.org/integration/mozilla-inbound/rev/e2c4a65fe790
https://hg.mozilla.org/integration/mozilla-inbound/rev/97264d043924
https://hg.mozilla.org/integration/mozilla-inbound/rev/b06d2002c03b
Comment 27•9 years ago
|
||
Comment 28•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/fb921354f6ca
https://hg.mozilla.org/mozilla-central/rev/323a9a3c1608
https://hg.mozilla.org/mozilla-central/rev/f4a1e0b22871
https://hg.mozilla.org/mozilla-central/rev/1e3a9fcf73d8
https://hg.mozilla.org/mozilla-central/rev/b8815627054a
https://hg.mozilla.org/mozilla-central/rev/98d3300738e3
https://hg.mozilla.org/mozilla-central/rev/e9dda4b6e6e0
https://hg.mozilla.org/mozilla-central/rev/c2646cfe32bf
https://hg.mozilla.org/mozilla-central/rev/04ba29693dd5
https://hg.mozilla.org/mozilla-central/rev/932cb872289f
https://hg.mozilla.org/mozilla-central/rev/8593648ed49e
https://hg.mozilla.org/mozilla-central/rev/c63ef61734b0
https://hg.mozilla.org/mozilla-central/rev/a4cee17afa63
https://hg.mozilla.org/mozilla-central/rev/e2c4a65fe790
https://hg.mozilla.org/mozilla-central/rev/97264d043924
https://hg.mozilla.org/mozilla-central/rev/b06d2002c03b
https://hg.mozilla.org/mozilla-central/rev/74062a46a01a
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
You need to log in
before you can comment on or make changes to this bug.
Description
•