New tabs from GM_openInTab() should become children of the current tab

This commit is contained in:
SHIMODA Hiroshi 2011-08-15 19:44:11 +09:00
parent 79231c9123
commit b99cdae4c9

View File

@ -667,9 +667,8 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
// Greasemonkey // Greasemonkey
// https://addons.mozilla.org/firefox/addon/748 // https://addons.mozilla.org/firefox/addon/748
if ('GM_BrowserUI' in window && if (sv.getTreePref('compatibility.Greasemonkey')) {
'openInTab' in GM_BrowserUI && if ('GM_BrowserUI' in window && 'openInTab' in GM_BrowserUI) {
sv.getTreePref('compatibility.Greasemonkey')) {
eval('GM_BrowserUI.openInTab = '+ eval('GM_BrowserUI.openInTab = '+
GM_BrowserUI.openInTab.toSource().replace( GM_BrowserUI.openInTab.toSource().replace(
/(if\s*\(this\.isMyWindow\([^\)]+\)\)\s*\{\s*)(this\.tabBrowser)/, /(if\s*\(this\.isMyWindow\([^\)]+\)\)\s*\{\s*)(this\.tabBrowser)/,
@ -677,6 +676,21 @@ TreeStyleTabWindowHelper.overrideExtensionsAfterBrowserInit = function TSTWH_ove
) )
); );
} }
else if ('@greasemonkey.mozdev.org/greasemonkey-service;1' in Components.classes) {
let service = Components.classes['@greasemonkey.mozdev.org/greasemonkey-service;1'].getService().wrappedJSObject;
if (service) {
let _openInTab = service.__proto__._openInTab;
if (_openInTab.toSource().indexOf('TreeStyleTabService') < 0) {
service.__proto__._openInTab = function() {
let contentWindow = arguments[0];
let chromeWindow = arguments[1];
chromeWindow.TreeStyleTabService.readyToOpenChildTabNow(contentWindow);
return _openInTab.apply(this, arguments);
};
}
}
}
}
// SBM Counter // SBM Counter
// http://miniturbo.org/products/sbmcounter/ // http://miniturbo.org/products/sbmcounter/