[Pkg-mozext-commits] [tabmixplus] 20/44: Follow up bug 1039500 - tabbrowser's _getTabForBrowser is very slow with lots of tabs
David Prévot
taffit at moszumanska.debian.org
Wed Oct 15 02:10:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 372f88f0fa887cc1b8cc6df16a25f8593f5693a2
Author: onemen <tabmix.onemen at gmail.com>
Date: Mon Oct 6 14:25:15 2014 +0300
Follow up bug 1039500 - tabbrowser's _getTabForBrowser is very slow with lots of tabs
---
chrome/content/links/removeBlankTab.js | 4 ++--
chrome/content/links/setup.js | 13 +++++++++----
chrome/content/minit/tablib.js | 6 +++---
chrome/content/places/places.js | 4 ++--
chrome/content/tab/tab.js | 4 ++--
5 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/chrome/content/links/removeBlankTab.js b/chrome/content/links/removeBlankTab.js
index b7bf204..86827ac 100644
--- a/chrome/content/links/removeBlankTab.js
+++ b/chrome/content/links/removeBlankTab.js
@@ -17,7 +17,7 @@ let TabmixRemoveBlankTab = {
unknownContentType: function() {
let {win, b} = this.getWindowAndBrowser(dialog.mContext);
if (win && b) {
- let tab = win.gBrowser._getTabForBrowser(b);
+ let tab = win.gBrowser.getTabForBrowser(b);
// wait 250 ms after this window closed before removing mContext tab
// nsHelperAppDlg.js promptForSaveToFileAsync look for dialog.mContext
// before it opens nsIFilePicker.
@@ -42,7 +42,7 @@ let TabmixRemoveBlankTab = {
if (b && b.currentURI.spec == "about:blank") {
let uri = window.arguments[8].QueryInterface(Ci.nsIURI);
if (b.userTypedValue == uri.spec) {
- let tab = win.gBrowser._getTabForBrowser(b);
+ let tab = win.gBrowser.getTabForBrowser(b);
if (tab.selected)
win.gBrowser.previousTab(tab);
win.gBrowser.hideTab(tab);
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index 4c8bcd1..6d32282 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -265,9 +265,14 @@ Tabmix.beforeStartup = function TMP_beforeStartup(tabBrowser, aTabContainer) {
} catch (ex) {Tabmix.assert(ex); return true;}
}
- // gBrowser._getTabForBrowser exsit since Firefox 23 (Bug 662008)
- if (typeof tabBrowser._getTabForBrowser != "function") {
- tabBrowser._getTabForBrowser = function (aBrowser) {
+ /**
+ * add gBrowser.getTabForBrowser if it is not exist
+ * gBrowser.getTabForBrowser exsit since Firefox 35 (Bug 1039500)
+ * gBrowser._getTabForBrowser exsit since Firefox 23 (Bug 662008)
+ */
+ if (typeof tabBrowser.getTabForBrowser != "function") {
+ // this is _getTabForBrowser version from Firefox 23
+ tabBrowser.getTabForBrowser = function (aBrowser) {
for (let i = 0; i < this.tabs.length; i++) {
if (this.tabs[i].linkedBrowser == aBrowser)
return this.tabs[i];
@@ -280,7 +285,7 @@ Tabmix.beforeStartup = function TMP_beforeStartup(tabBrowser, aTabContainer) {
let notificationbox = this.mPanelContainer.lastChild;
let attrName = Tabmix.isVersion(180) ? "class" : "anonid"; // changed by Bug 768442
let browser = document.getAnonymousElementByAttribute(notificationbox, attrName, "browserStack").firstChild;
- return this._getTabForBrowser(browser);
+ return this.getTabForBrowser(browser);
}
var tabContainer = aTabContainer || tabBrowser.tabContainer ||
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 925cd21..2d57c43 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -28,7 +28,7 @@ var tablib = {
' }' +
' } catch (ex) {}'+
' var tabbrowser = document.getBindingParent(this);' +
- ' var tab = tabbrowser._getTabForBrowser(this);' +
+ ' var tab = tabbrowser.getTabForBrowser(this);' +
' var isBlankTab = tabbrowser.isBlankNotBusyTab(tab);' +
' var isLockedTab = tab.hasAttribute("locked");' +
' if (!allowLoad && !isBlankTab && isLockedTab) {' +
@@ -195,7 +195,7 @@ var tablib = {
Tabmix.changeCode(gBrowser, "gBrowser.getWindowTitleForBrowser")._replace(
'if (!docTitle)',
- 'let tab = this._getTabForBrowser(aBrowser);\
+ 'let tab = this.getTabForBrowser(aBrowser);\
if (tab.hasAttribute("tabmix_changed_label"))\
docTitle = tab.getAttribute("tabmix_changed_label");\
else\
@@ -846,7 +846,7 @@ var tablib = {
this.removeEventListener("load", updateNewHistoryTitle, true);
var history = this.webNavigation.sessionHistory;
var shEntry = history.getEntryAtIndex(history.index, false).QueryInterface(Ci.nsISHEntry);
- shEntry.setTitle(self._getTabForBrowser(this).label);
+ shEntry.setTitle(self.getTabForBrowser(this).label);
} catch (ex) {Tabmix.assert(ex);}
}
try {
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index 9f028fa..bfb3fcc 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -31,7 +31,7 @@ var TMP_Places = {
if ("PlacesCommandHook" in window) {
Tabmix.changeCode(PlacesCommandHook, "PlacesCommandHook.bookmarkPage")._replace(
/(webNav\.document\.)*title \|\| url\.spec;/,
- 'TMP_Places.getTabTitle(gBrowser._getTabForBrowser(aBrowser), url.spec) || $&'
+ 'TMP_Places.getTabTitle(gBrowser.getTabForBrowser(aBrowser), url.spec) || $&'
).toCode();
Tabmix.changeCode(PlacesCommandHook, "uniqueCurrentPages", {getter: true})._replace(
@@ -676,5 +676,5 @@ TMP_Places.contextMenu = {
/** DEPRECATED **/
TMP_Places.getTabFixedTitle = function(aBrowser, aUri) {
let win = aBrowser.ownerDocument.defaultView;
- return win.TMP_Places.getTabTitle(win.gBrowser._getTabForBrowser(aBrowser), aUri.spec);
+ return win.TMP_Places.getTabTitle(win.gBrowser.getTabForBrowser(aBrowser), aUri.spec);
}
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 2d77fb9..fffcfff 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1913,11 +1913,11 @@ var TabmixProgressListener = {
return;
var percentage = Math.ceil((aCurTotalProgress * 100) / aMaxTotalProgress);
if (percentage > 0 && percentage < 100)
- this.mTabBrowser._getTabForBrowser(aBrowser).setAttribute("tab-progress", percentage);
+ this.mTabBrowser.getTabForBrowser(aBrowser).setAttribute("tab-progress", percentage);
},
onStateChange: function TMP_onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- let tab = this.mTabBrowser._getTabForBrowser(aBrowser);
+ let tab = this.mTabBrowser.getTabForBrowser(aBrowser);
const nsIWebProgressListener = Ci.nsIWebProgressListener;
if (tab.hasAttribute("_tabmix_load_bypass_cache") &&
(aStateFlags & nsIWebProgressListener.STATE_START)) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list