Closed
Bug 920497
Opened 11 years ago
Closed 11 years ago
Update closeTab method in tabs.js to prevent wrong index values
Categories
(Mozilla QA Graveyard :: Mozmill Tests, defect)
Mozilla QA Graveyard
Mozmill Tests
Tracking
(firefox24 wontfix, firefox25 fixed, firefox26 fixed, firefox27 fixed, firefox28 fixed, firefox-esr17 wontfix, firefox-esr24 fixed)
People
(Reporter: mario.garbi, Assigned: mario.garbi)
Details
Attachments
(2 files, 2 obsolete files)
527 bytes,
application/javascript
|
Details | |
1.19 KB,
patch
|
AndreeaMatei
:
review+
|
Details | Diff | Splinter Review |
While working on other issues I have noticed that closeTab() method doesn't work right when we set the aIndex parameter to 0. This happens because 0 can have boolean value when used with || and as such we get the default value as can be seen in the minimized testcase attached. Dump log shows: aIndex parameter: 0 Final value: defaultValue aIndex parameter: 1 Final value: 1
Assignee | ||
Comment 1•11 years ago
|
||
We can handle this issue by casting the parameter as a string so we won't have any confusions when combined with ||.
Assignee: nobody → mario.garbi
Status: NEW → ASSIGNED
Attachment #809832 -
Flags: review?(andrei.eftimie)
Attachment #809832 -
Flags: review?(andreea.matei)
Comment 2•11 years ago
|
||
Comment on attachment 809832 [details] [diff] [review] indexToString.patch Review of attachment 809832 [details] [diff] [review]: ----------------------------------------------------------------- Sorry for highjacking... ::: lib/tabs.js @@ +189,5 @@ > * Index of the tab to close (only used for middleClick) > */ > closeTab : function tabBrowser_closeTab(aEventType, aIndex) { > var type = aEventType || "menu"; > + var index = aIndex.toString() || this.selectedIndex; No, don't change the datatype of the parameter. Use a check for undefined instead.
Attachment #809832 -
Flags: review?(andrei.eftimie)
Attachment #809832 -
Flags: review?(andreea.matei)
Attachment #809832 -
Flags: review-
Assignee | ||
Comment 3•11 years ago
|
||
Updated the patch to check for 0 value. If the parameter is undefined it will be assigned a default value correctly.
Attachment #809832 -
Attachment is obsolete: true
Attachment #809861 -
Flags: review?(hskupin)
Attachment #809861 -
Flags: review?(andrei.eftimie)
Attachment #809861 -
Flags: review?(andreea.matei)
Comment 4•11 years ago
|
||
Comment on attachment 809861 [details] [diff] [review] indexToString_v2.patch Review of attachment 809861 [details] [diff] [review]: ----------------------------------------------------------------- ::: lib/tabs.js @@ +189,5 @@ > * Index of the tab to close (only used for middleClick) > */ > closeTab : function tabBrowser_closeTab(aEventType, aIndex) { > var type = aEventType || "menu"; > + var index = (aIndex === 0) ? aIndex : In my last review I said that you should check for undefined and not 0. So please do so.
Attachment #809861 -
Flags: review?(hskupin)
Attachment #809861 -
Flags: review?(andrei.eftimie)
Attachment #809861 -
Flags: review?(andreea.matei)
Attachment #809861 -
Flags: review-
Assignee | ||
Comment 5•11 years ago
|
||
Updated the patch to check if the parameter is undefined and only then set a default value for it. Seems to work fine now with aIndex = 0 and undefined values.
Attachment #809861 -
Attachment is obsolete: true
Attachment #810564 -
Flags: review?(hskupin)
Attachment #810564 -
Flags: review?(andrei.eftimie)
Attachment #810564 -
Flags: review?(andreea.matei)
Comment 6•11 years ago
|
||
Comment on attachment 810564 [details] [diff] [review] indexToString_v3.patch Review of attachment 810564 [details] [diff] [review]: ----------------------------------------------------------------- http://hg.mozilla.org/qa/mozmill-tests/rev/a8bb09dbda2a (default) This needs backporting, please check that.
Attachment #810564 -
Flags: review?(hskupin)
Attachment #810564 -
Flags: review?(andrei.eftimie)
Attachment #810564 -
Flags: review?(andreea.matei)
Attachment #810564 -
Flags: review+
Updated•11 years ago
|
status-firefox24:
--- → affected
status-firefox25:
--- → affected
status-firefox26:
--- → affected
status-firefox27:
--- → fixed
status-firefox-esr17:
--- → affected
status-firefox-esr24:
--- → affected
Assignee | ||
Comment 7•11 years ago
|
||
It applies cleanly on all branches as the part of the code that this changes is the same on all branches.
Assignee | ||
Comment 8•11 years ago
|
||
I have tested this again on a fresh repository and it applies cleanly up to esr17 with the exception of Aurora branch where it got merged already.
Assignee | ||
Comment 9•11 years ago
|
||
Beta: http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be148419f http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be1484c88 Release: http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be14850a6 http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be14852ac ESR24: http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be1485b7d http://mozmill-crowd.blargon7.com/#/functional/report/ad464590da4913b3dafe381be1486f78
Comment 10•11 years ago
|
||
Backported: http://hg.mozilla.org/qa/mozmill-tests/rev/c09701875ffd (mozilla-beta) http://hg.mozilla.org/qa/mozmill-tests/rev/6b490a93fbca (mozilla-release) http://hg.mozilla.org/qa/mozmill-tests/rev/51353c26ed05 (mozilla-esr24) Nothing critical here, we can safely skip it for ESR17.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
status-firefox28:
--- → fixed
Resolution: --- → FIXED
Updated•5 years ago
|
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•