Closed
Bug 1342025
Opened 7 years ago
Closed 7 years ago
browser-ctrlTab.js calls ctrlTab.updatePreview too frequently for TabAttrModified events
Categories
(Firefox :: Tabbed Browser, defect)
Firefox
Tabbed Browser
Tracking
()
RESOLVED
FIXED
Firefox 55
Tracking | Status | |
---|---|---|
firefox55 | --- | fixed |
People
(Reporter: dao, Assigned: milindl, Mentored)
References
Details
(Keywords: good-first-bug, perf, Whiteboard: [good first bug][lang=js])
Attachments
(1 file)
See https://hg.mozilla.org/mozilla-central/annotate/0eef1d5a39366059677c6d7944cfe8a97265a011/browser/base/content/browser-ctrlTab.js#l475 We only care about certain attributes there, namely "label", "busy", "image" and "selected". These days TabAttrModified gets dispatched for more tab attributes that this code doesn't really care about, thus it should detect these cases. This can be done by looking at event.detail.changed, which is an array of the names of the attributes that changed.
Reporter | ||
Comment 1•7 years ago
|
||
Note that the feature implemented by this code is disabled by default and can be enabled in about:preferences#general ("Ctrl+Tab cycles through tabs in recently used order").
Keywords: perf
Reporter | ||
Updated•7 years ago
|
Mentor: dao+bmo
Hey Dao is anybody currently working on this bug? I'm in a class at my university and this seems like a bug we'd like to dig around in and try to fix. If I'm understanding this correctly the function updatePreview is being called on too many attribute tags and you want this reduced to only label, busy, image, and selected tags?
Reporter | ||
Comment 3•7 years ago
|
||
(In reply to jason r from comment #2) > Hey Dao is anybody currently working on this bug? No, not yet. > I'm in a class at my > university and this seems like a bug we'd like to dig around in and try to > fix. If I'm understanding this correctly the function updatePreview is being > called on too many attribute tags and you want this reduced to only label, > busy, image, and selected tags? Exactly!
Reporter | ||
Comment 4•7 years ago
|
||
Jason, do you still intend to work on this?
Flags: needinfo?(renaudjj)
Hello Dao, I am new to Open Source Development. Is it possible for me to work on this?
Reporter | ||
Comment 6•7 years ago
|
||
(In reply to Nitish from comment #5) > Hello Dao, I am new to Open Source Development. Is it possible for me to > work on this? Since we haven't heard from Jason in more than a week, please go ahead.
Flags: needinfo?(renaudjj)
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Attachment #8843689 -
Flags: review?(dao+bmo)
Assignee | ||
Comment 8•7 years ago
|
||
Hi, I'm also new to contributing here. I have tried to fix this bug to the best of my capabilities. I started on this yesterday, without noticing Nitish's comment, but I've sent him a mail so we can collaborate on this, like the "How to submit patches" guide says. Thanks
Reporter | ||
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8843689 [details] Bug 1342025 - reduce calls to ctrlTab.updatePreview https://reviewboard.mozilla.org/r/117290/#review118952 Looks good apart from some minor issues... ::: browser/base/content/browser-ctrlTab.js:478 (Diff revision 1) > this._initRecentlyUsedTabs(); > break; > case "TabAttrModified": > - // tab attribute modified (e.g. label, busy, image, selected) > + // tab attribute modified (i.e. label, busy, image, selected) > + // update preview only if tab attribute modified in the list > + if (["label", "busy", "image", "selected"].reduce( Please use 'some' instead of 'reduce' ::: browser/base/content/browser-ctrlTab.js:479 (Diff revision 1) > break; > case "TabAttrModified": > - // tab attribute modified (e.g. label, busy, image, selected) > + // tab attribute modified (i.e. label, busy, image, selected) > + // update preview only if tab attribute modified in the list > + if (["label", "busy", "image", "selected"].reduce( > + (res, elem) => res || (event.detail.changed.indexOf(elem) !== -1), Please use 'includes' instead of 'indexOf' ::: browser/base/content/browser-ctrlTab.js:481 (Diff revision 1) > - // tab attribute modified (e.g. label, busy, image, selected) > + // tab attribute modified (i.e. label, busy, image, selected) > + // update preview only if tab attribute modified in the list > + if (["label", "busy", "image", "selected"].reduce( > + (res, elem) => res || (event.detail.changed.indexOf(elem) !== -1), > + false)) { > - for (let i = this.previews.length - 1; i >= 0; i--) { > + for (let i = this.previews.length - 1; i >= 0; i--) { Intentation is off by two spaces
Attachment #8843689 -
Flags: review?(dao+bmo) → review-
Comment hidden (mozreview-request) |
Assignee | ||
Comment 11•7 years ago
|
||
mozreview-review |
Comment on attachment 8843689 [details] Bug 1342025 - reduce calls to ctrlTab.updatePreview https://reviewboard.mozilla.org/r/117288/#review118954
Assignee | ||
Comment 12•7 years ago
|
||
I have made the changes, I think it should be OK now Thanks
Reporter | ||
Comment 13•7 years ago
|
||
mozreview-review |
Comment on attachment 8843689 [details] Bug 1342025 - reduce calls to ctrlTab.updatePreview https://reviewboard.mozilla.org/r/117290/#review119122 Looks good!
Attachment #8843689 -
Flags: review?(dao+bmo) → review+
Comment 14•7 years ago
|
||
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/17b068bfce7c reduce calls to ctrlTab.updatePreview. r=dao
Comment 15•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/17b068bfce7c
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55
Reporter | ||
Updated•7 years ago
|
Assignee: nobody → i.milind.luthra
You need to log in
before you can comment on or make changes to this bug.
Description
•