Bug 1342025 - reduce calls to ctrlTab.updatePreview
Added if condition to do so
MozReview-Commit-ID: CzYCZgEtZS5
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -1,8 +1,9 @@
+
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Tab previews utility, produces thumbnails
*/
var tabPreviews = {
@@ -468,21 +469,25 @@ var ctrlTab = {
},
handleEvent: function ctrlTab_handleEvent(event) {
switch (event.type) {
case "SSWindowRestored":
this._initRecentlyUsedTabs();
break;
case "TabAttrModified":
- // tab attribute modified (e.g. label, busy, image, selected)
- for (let i = this.previews.length - 1; i >= 0; i--) {
- if (this.previews[i]._tab && this.previews[i]._tab == event.target) {
- this.updatePreview(this.previews[i], event.target);
- break;
+ // tab attribute modified (i.e. label, busy, image, selected)
+ // update preview only if tab attribute modified in the list
+ if (event.detail.changed.some(
+ (elem, ind, arr) => ["label", "busy", "image", "selected"].includes(elem))) {
+ for (let i = this.previews.length - 1; i >= 0; i--) {
+ if (this.previews[i]._tab && this.previews[i]._tab == event.target) {
+ this.updatePreview(this.previews[i], event.target);
+ break;
+ }
}
}
break;
case "TabSelect":
this.detachTab(event.target);
this.attachTab(event.target, 0);
break;
case "TabOpen":