Detect DOM instances by constructor function instead of XPCOM interface
This commit is contained in:
parent
fc7f336c69
commit
db487f32bb
@ -569,7 +569,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
var parent = aNode.parentNode;
|
var parent = aNode.parentNode;
|
||||||
var doc = aNode.ownerDocument || aNode;
|
var doc = aNode.ownerDocument || aNode;
|
||||||
var view = doc.defaultView;
|
var view = doc.defaultView;
|
||||||
while (parent && parent instanceof Ci.nsIDOMElement)
|
while (parent && parent instanceof wiew.Element)
|
||||||
{
|
{
|
||||||
let position = view.getComputedStyle(parent, null).getPropertyValue('position');
|
let position = view.getComputedStyle(parent, null).getPropertyValue('position');
|
||||||
if (position != 'static')
|
if (position != 'static')
|
||||||
@ -738,9 +738,9 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
}
|
}
|
||||||
else if (typeof arg == 'string')
|
else if (typeof arg == 'string')
|
||||||
type = arg;
|
type = arg;
|
||||||
else if (arg instanceof Ci.nsIDOMDocument)
|
else if (arg instanceof this.window.Document)
|
||||||
document = arg;
|
document = arg;
|
||||||
else if (arg instanceof Ci.nsIDOMEventTarget)
|
else if (arg instanceof this.window.EventTarget)
|
||||||
target = arg;
|
target = arg;
|
||||||
else
|
else
|
||||||
data = arg;
|
data = arg;
|
||||||
@ -963,11 +963,11 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
|
|
||||||
getTabStrip : function TSTBase_getTabStrip(aTabBrowser)
|
getTabStrip : function TSTBase_getTabStrip(aTabBrowser)
|
||||||
{
|
{
|
||||||
if (!(aTabBrowser instanceof Ci.nsIDOMElement))
|
if (!(aTabBrowser instanceof this.window.Element))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var strip = aTabBrowser.mStrip;
|
var strip = aTabBrowser.mStrip;
|
||||||
return (strip && strip instanceof Ci.nsIDOMElement) ?
|
return (strip && strip instanceof this.window.Element) ?
|
||||||
strip :
|
strip :
|
||||||
this.evaluateXPath(
|
this.evaluateXPath(
|
||||||
'ancestor::xul:toolbar[1]',
|
'ancestor::xul:toolbar[1]',
|
||||||
@ -982,7 +982,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
|
|
||||||
getTabContainerBox : function TSTBase_getTabContainerBox(aTabBrowser)
|
getTabContainerBox : function TSTBase_getTabContainerBox(aTabBrowser)
|
||||||
{
|
{
|
||||||
if (!(aTabBrowser instanceof Ci.nsIDOMElement))
|
if (!(aTabBrowser instanceof this.window.Element))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var strip = this.getTabStrip(aTabBrowser);
|
var strip = this.getTabStrip(aTabBrowser);
|
||||||
@ -1291,7 +1291,7 @@ var TreeStyleTabBase = inherit(TreeStyleTabConstants, {
|
|||||||
if (!aId)
|
if (!aId)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (aTabBrowserChildren && !(aTabBrowserChildren instanceof Ci.nsIDOMNode))
|
if (aTabBrowserChildren && !(aTabBrowserChildren instanceof this.window.Node))
|
||||||
aTabBrowserChildren = null;
|
aTabBrowserChildren = null;
|
||||||
|
|
||||||
var b = this.getTabBrowserFromChild(aTabBrowserChildren) || this.browser;
|
var b = this.getTabBrowserFromChild(aTabBrowserChildren) || this.browser;
|
||||||
|
@ -1195,7 +1195,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
var b = self.mTabBrowser;
|
var b = self.mTabBrowser;
|
||||||
var tabs = !aTarget ?
|
var tabs = !aTarget ?
|
||||||
[b.selectedTab] :
|
[b.selectedTab] :
|
||||||
(aTarget instanceof Ci.nsIDOMElement) ?
|
(aTarget instanceof self.window.Element) ?
|
||||||
[aTarget] :
|
[aTarget] :
|
||||||
(typeof aTarget == 'object' && 'length' in aTarget) ?
|
(typeof aTarget == 'object' && 'length' in aTarget) ?
|
||||||
Array.slice(aTarget) :
|
Array.slice(aTarget) :
|
||||||
@ -4709,7 +4709,7 @@ TreeStyleTabBrowser.prototype = inherit(TreeStyleTabWindow.prototype, {
|
|||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!aEvent.originalTarget ||
|
!aEvent.originalTarget ||
|
||||||
!(aEvent.originalTarget instanceof Ci.nsIDOMWindow)
|
!(aEvent.originalTarget instanceof this.window.Window)
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
|
|||||||
|
|
||||||
getPropertyPixelValue : function TSTWindow_getPropertyPixelValue(aElementOrStyle, aProp)
|
getPropertyPixelValue : function TSTWindow_getPropertyPixelValue(aElementOrStyle, aProp)
|
||||||
{
|
{
|
||||||
var style = aElementOrStyle instanceof Ci.nsIDOMCSSStyleDeclaration ?
|
var style = aElementOrStyle instanceof this.window.CSSStyleDeclaration ?
|
||||||
aElementOrStyle :
|
aElementOrStyle :
|
||||||
this.window.getComputedStyle(aElementOrStyle, null) ;
|
this.window.getComputedStyle(aElementOrStyle, null) ;
|
||||||
return Number(style.getPropertyValue(aProp).replace(/px$/, ''));
|
return Number(style.getPropertyValue(aProp).replace(/px$/, ''));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user