Closed
Bug 682791
Opened 14 years ago
Closed 14 years ago
Ensure that all functions have an internal name for Panorama
Categories
(Firefox Graveyard :: Panorama, defect)
Firefox Graveyard
Panorama
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 10
People
(Reporter: raymondlee, Assigned: raymondlee)
Details
Attachments
(1 file, 3 obsolete files)
13.27 KB,
patch
|
Details | Diff | Splinter Review |
Make all functions consistent to have internal name.
![]() |
Assignee | |
Comment 1•14 years ago
|
||
Attachment #556482 -
Flags: review?(tim.taubert)
![]() |
Assignee | |
Updated•14 years ago
|
OS: Mac OS X → All
![]() |
||
Updated•14 years ago
|
Hardware: x86 → All
![]() |
||
Comment 2•14 years ago
|
||
Comment on attachment 556482 [details] [diff] [review]
v1
Review of attachment 556482 [details] [diff] [review]:
-----------------------------------------------------------------
Yeah, that's indeed a good idea and will help us with debugging. But while we're on it, we should do it right and name every anonymous function out there. I marked some occurrences below but there should be some more...
::: browser/base/content/browser-tabview.js
@@ +230,5 @@
> if (this.isVisible())
> return;
>
> let self = this;
> this._initFrame(function() {
(anonymous function with out a name)
@@ +284,5 @@
> while (popup.firstChild && popup.firstChild != separator)
> popup.removeChild(popup.firstChild);
>
> let self = this;
> this._initFrame(function() {
(anonymous function with out a name)
::: browser/base/content/tabview/groupitems.js
@@ +970,4 @@
> let self = this;
>
> if (!this._undoButtonTimeoutId) {
> this._undoButtonTimeoutId = setTimeout(function() {
(anonymous function with out a name)
::: browser/base/content/tabview/search.js
@@ +333,3 @@
> let self = this;
> iQ("#search").hide();
> iQ("#searchshade").hide().click(function(event) {
(anonymous function with out a name)
@@ +336,5 @@
> if ( event.target.id != "searchbox")
> hideSearch();
> });
>
> iQ("#searchbox").keyup(function() {
(anonymous function with out a name)
@@ +421,4 @@
> let self = this;
> if (this.currentHandler)
> iQ(window).unbind("keydown", this.currentHandler);
> this.currentHandler = function(event) self.beforeSearchKeyHandler(event);
(anonymous function with out a name)
@@ +433,4 @@
> let self = this;
> if (this.currentHandler)
> iQ(window).unbind("keydown", this.currentHandler);
> this.currentHandler = function(event) self.inSearchKeyHandler(event);
(anonymous function with out a name)
@@ +470,5 @@
> // it is always a <TabItem>. Also note that index is offset
> // by the number of matches within the window.
> let item = iQ("<div/>")
> .addClass("inlineMatch")
> .click(function(event){
(anonymous function with out a name)
Attachment #556482 -
Flags: review?(tim.taubert)
![]() |
Assignee | |
Comment 3•14 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #2)
> ::: browser/base/content/browser-tabview.js
> @@ +230,5 @@
> > if (this.isVisible())
> > return;
> >
> > let self = this;
> > this._initFrame(function() {
>
> (anonymous function with out a name)
I think we should decide the format of the name for those anonymous. For the above case, shall we use
this._initFrame(function initFrame() {
OR
// since this line is inside function TabView_show(), shall we prefix that function name?
this._initFrame(function TabView_show_initFrame () {
Furthermore, I don't think we need to add internal name for loops e.g. Array.forEach(function() {})
>
> @@ +284,5 @@
> > while (popup.firstChild && popup.firstChild != separator)
> > popup.removeChild(popup.firstChild);
> >
> > let self = this;
> > this._initFrame(function() {
>
> (anonymous function with out a name)
>
> ::: browser/base/content/tabview/groupitems.js
> @@ +970,4 @@
> > let self = this;
> >
> > if (!this._undoButtonTimeoutId) {
> > this._undoButtonTimeoutId = setTimeout(function() {
>
> (anonymous function with out a name)
>
> ::: browser/base/content/tabview/search.js
> @@ +333,3 @@
> > let self = this;
> > iQ("#search").hide();
> > iQ("#searchshade").hide().click(function(event) {
>
> (anonymous function with out a name)
>
> @@ +336,5 @@
> > if ( event.target.id != "searchbox")
> > hideSearch();
> > });
> >
> > iQ("#searchbox").keyup(function() {
>
> (anonymous function with out a name)
>
> @@ +421,4 @@
> > let self = this;
> > if (this.currentHandler)
> > iQ(window).unbind("keydown", this.currentHandler);
> > this.currentHandler = function(event) self.beforeSearchKeyHandler(event);
>
> (anonymous function with out a name)
>
> @@ +433,4 @@
> > let self = this;
> > if (this.currentHandler)
> > iQ(window).unbind("keydown", this.currentHandler);
> > this.currentHandler = function(event) self.inSearchKeyHandler(event);
>
> (anonymous function with out a name)
>
> @@ +470,5 @@
> > // it is always a <TabItem>. Also note that index is offset
> > // by the number of matches within the window.
> > let item = iQ("<div/>")
> > .addClass("inlineMatch")
> > .click(function(event){
>
> (anonymous function with out a name)
![]() |
||
Comment 4•14 years ago
|
||
(In reply to Raymond Lee [:raymondlee] from comment #3)
> > > this._initFrame(function() {
> >
> > (anonymous function with out a name)
>
> I think we should decide the format of the name for those anonymous. For the
> above case, shall we use
>
> this._initFrame(function initFrame() {
>
> OR
>
> // since this line is inside function TabView_show(), shall we prefix that
> function name?
> this._initFrame(function TabView_show_initFrame () {
I think we should use the latter here. We could have a hard time figuring out which anonymous function is on the stack if they don't have absolute names.
> Furthermore, I don't think we need to add internal name for loops e.g.
> Array.forEach(function() {})
This might be a lot of "naming overhead" but those names come without a price so we should tend to name anonymous functions whenever we use them. Array.forEach() can contain failing code as well and life's much easier if we exactly know which function fails...
![]() |
Assignee | |
Comment 5•14 years ago
|
||
Attachment #556482 -
Attachment is obsolete: true
Attachment #557116 -
Flags: review?(tim.taubert)
![]() |
Assignee | |
Comment 6•14 years ago
|
||
This patch should not affect anything since it is adding names for anonymous functions. Tim: could you review this please?
![]() |
||
Comment 7•14 years ago
|
||
Comment on attachment 557116 [details] [diff] [review]
v2
Review of attachment 557116 [details] [diff] [review]:
-----------------------------------------------------------------
Raymond, can we please take your first patch? I know that was a lot of work naming those anonymous functions but I feel like this adds too much clutter and doesn't yields enough benefit. Additionally we "lose" a lot of blame information when touching all those lines. Patch v1 is totally fine... sorry about that :|
::: browser/base/content/tabview/modules/utils.jsm
@@ +339,5 @@
> // ----------
> // Function: overlaps
> // Whether the <Range> overlaps with the given <Range> or value or not.
> //
> // Paramaters
Please fix this typo while you're at it :)
Attachment #557116 -
Flags: review?(ttaubert) → review-
![]() |
||
Updated•14 years ago
|
Attachment #557116 -
Attachment is obsolete: true
![]() |
||
Updated•14 years ago
|
Attachment #556482 -
Attachment is obsolete: false
Attachment #556482 -
Flags: review+
![]() |
Assignee | |
Comment 8•14 years ago
|
||
Pushed to try and waiting for results
https://tbpl.mozilla.org/?tree=Try&rev=8b5a76750887
![]() |
Assignee | |
Updated•14 years ago
|
Attachment #556482 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 9•14 years ago
|
||
Attachment #565870 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 10•14 years ago
|
||
(In reply to Raymond Lee [:raymondlee] from comment #8)
> Created attachment 565870 [details] [diff] [review] [diff] [details] [review]
> Patch for checkin
>
> Pushed to try and waiting for results
> https://tbpl.mozilla.org/?tree=Try&rev=8b5a76750887
Passed Try!
Keywords: checkin-needed
![]() |
||
Comment 11•14 years ago
|
||
Target Milestone: --- → Firefox 10
![]() |
||
Updated•14 years ago
|
Keywords: checkin-needed
Comment 12•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Product: Firefox → Firefox Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•