Stringify object only once

This commit is contained in:
YUKI Hiroshi 2016-08-30 17:16:39 +09:00
parent 8e216196ef
commit dda3981a51

View File

@ -1016,7 +1016,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
var currentBrowser = this.browser.selectedTab.linkedBrowser; var currentBrowser = this.browser.selectedTab.linkedBrowser;
if (!aTarget) if (!aTarget)
return currentBrowser; return currentBrowser;
if (aTarget == '[object XULElement]') { var stringifiedTarget = aTarget.toString();
if (stringifiedTarget == '[object XULElement]') {
if (aTarget.localName == 'tab') if (aTarget.localName == 'tab')
return aTarget.linkedBrowser; return aTarget.linkedBrowser;
@ -1029,7 +1030,8 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
else else
return null; return null;
} }
if (aTarget == '[object Window]' || aTarget == '[object ChromeWindow]') { if (stringifiedTarget == '[object Window]' ||
stringifiedTarget == '[object ChromeWindow]') {
let tab = this.getTabFromFrame(aTarget, this.getTabBrowserFromFrame(aTarget)); let tab = this.getTabFromFrame(aTarget, this.getTabBrowserFromFrame(aTarget));
if (tab) if (tab)
return tab.linkedBrowser; return tab.linkedBrowser;