Skip to content

Commit

Permalink
Improved compatibility with the Tab Mix Plus extension.
Browse files Browse the repository at this point in the history
Tab Mix Plus reuses blank tabs when opening tabs from e.g. bookmarks, and it confuses tabs on the bar tab with blank ones.  BarTab now makes sure that this no longer happens.

Closes #18
  • Loading branch information
philikon committed Feb 28, 2010
1 parent 8613ecd commit 5aec4b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
an optional automatic timer that will trigger after a certain amount
of time specified by the user.

* Improved compatibility with the Tab Mix Plus extension. Tab Mix
Plus reuses blank tabs when opening tabs from e.g. bookmarks, and it
confuses tabs on the bar tab with blank ones. BarTab now makes sure
that this no longer happens.

* New coaster logo, thanks to Róman Joost.


Expand Down
16 changes: 16 additions & 0 deletions chrome/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ var BarTap = {
'BarTap.writeBarTap(t, b, aURI, flags, aReferrerURI, aCharset, aPostData); $&'
));

/* Tab Mix Plus compatibility: It likes reusing blank tabs. In doing
so it confuses tabs on the bar tab with blank ones. Fix that. */
if (tabbrowser.isBlankBrowser) {
tabbrowser.TMPisBlankBrowser = tabbrowser.isBlankBrowser;
tabbrowser.isBlankBrowser = function (aBrowser) {
if (aBrowser.getAttribute("ontap") == "true") {
return false;
}
return this.TMPisBlankBrowser(aBrowser);
};
}

/* When the user wants one or all tabs to reload, do the right thing
in case it's tapped. */
tabbrowser.reloadTab = function(aTab) {
Expand Down Expand Up @@ -100,6 +112,7 @@ var BarTap = {
return;
}
tab.setAttribute("ontap", "true");
tab.linkedBrowser.setAttribute("ontap", "true");
},

/* Called when a tab is opened with a new URI (e.g. by opening a link in
Expand All @@ -121,6 +134,7 @@ var BarTap = {
});
}
aTab.setAttribute("ontap", "true");
aBrowser.setAttribute("ontap", "true");
aBrowser.setAttribute("bartap", bartap);
} else if (this.mPrefs.getBoolPref("extensions.bartap.tapAfterTimeout")) {
this.getTabBrowserForTab(aTab).BarTapTimer.startTimer(aTab);
Expand Down Expand Up @@ -224,6 +238,7 @@ var BarTap = {
in case of about:blank where there's no event handler, continue to
function normally. */
tab.removeAttribute("ontap");
tab.linkedBrowser.removeAttribute("ontap");

let event = document.createEvent("Event");
event.initEvent("BarTapLoad", true, true);
Expand Down Expand Up @@ -256,6 +271,7 @@ var BarTap = {
That's why we need to make sure this attribute exists before
restoring the tab state. */
newtab.setAttribute("ontap", "true");
newtab.linkedBrowser.setAttribute("ontap", "true");
sessionstore.setTabState(newtab, state);

/* Move the new tab next to the one we're removing, but not in front
Expand Down

0 comments on commit 5aec4b1

Please sign in to comment.