[Pkg-mozext-commits] [firebug] 54/82: Better recognition of DOM constants
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 22:45:40 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag fbtest-1.11.2
in repository firebug.
commit 956f699351bc499cdd0b2ff84ba6860f779045c5
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date: Sun Jan 13 01:34:11 2013 +0100
Better recognition of DOM constants
Related to issue 5418.
---
extension/content/firebug/lib/dom.js | 43 +++++++++++-------------------------
1 file changed, 13 insertions(+), 30 deletions(-)
diff --git a/extension/content/firebug/lib/dom.js b/extension/content/firebug/lib/dom.js
index 72ea5fe..925bc58 100644
--- a/extension/content/firebug/lib/dom.js
+++ b/extension/content/firebug/lib/dom.js
@@ -827,37 +827,24 @@ Dom.isDOMMember = function(object, propName)
Dom.isDOMConstant = function(object, name)
{
- if (name == undefined)
- return Dom.isDOMConstantDep({},object);
-
- // The constant map has also its own prototype, but it isn't considered to be a constant.
- if (name == "__proto__")
+ if (!Dom.domConstantMap.hasOwnProperty(name))
return false;
- // object isn't recognized as such when using ===,
- // so use this as workaround
- var str = Object.prototype.toString.call(object);
- var isDOMProperty = ["[object Window]", "[object Node]", "[object Location]",
- "[object Event]"].indexOf(str) !== -1;
-
- if (!(object === window.Window ||
- object === window.Object ||
- object === window.Node ||
- object === window.Location ||
- object === window.Event ||
- object === Dom.EventCopy ||
- object instanceof window.Window ||
- object instanceof window.Node ||
- object instanceof window.Location ||
- object instanceof window.Event ||
- object instanceof Dom.EventCopy ||
- isDOMProperty))
+ try
+ {
+ // Test for nativeness. This is a fragile piece of dark magic, and might be
+ // equivalent to |Cu.isXrayWrapper(XPCNativeWrapper(object))| in >= Fx 20.
+ object = XPCNativeWrapper.unwrap(object);
+ var isNative = (XPCNativeWrapper(object).toString !== XPCNativeWrapper(object.toString));
+ return (isNative ||
+ object instanceof window.Event ||
+ object instanceof Dom.EventCopy);
+ }
+ catch (exc)
{
return false;
}
-
- return Dom.domConstantMap.hasOwnProperty(name);
-}
+};
Dom.isInlineEventHandler = function(name)
{
@@ -876,10 +863,6 @@ Dom.EventCopy = function(event)
}
}
-var isDOMConstantDep = Deprecated.deprecated(
- "isDOMConstant(name) signature changed (object,name)",
- Dom.isDOMConstant);
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
domMemberMap.Window =
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git
More information about the Pkg-mozext-commits
mailing list