From 04a05caa28a1c953fed4e3ae2024cc6762c02053 Mon Sep 17 00:00:00 2001 From: "caillon%returnzero.com" Date: Wed, 30 Oct 2002 04:51:37 +0000 Subject: [PATCH] Prevent access to compareTreePosition and friends from script. bug 176135 r/sr=bzbarsky,jst a=roc+moz --- dom/public/idl/core/nsIDOM3Node.idl | 9 ++++++++- dom/public/idl/core/nsIDOMNode.idl | 26 +++++++++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/dom/public/idl/core/nsIDOM3Node.idl b/dom/public/idl/core/nsIDOM3Node.idl index 680bb13b8da..cb6f804f3c9 100644 --- a/dom/public/idl/core/nsIDOM3Node.idl +++ b/dom/public/idl/core/nsIDOM3Node.idl @@ -46,7 +46,14 @@ interface nsIDOM3Node : nsISupports // Introduced in DOM Level 3: readonly attribute DOMString baseURI; // Introduced in DOM Level 3: - unsigned short compareTreePosition(in nsIDOMNode other); + // XXXcaa compareTreePosition existed in an old DOM3 Core WD: + // + // It has been renamed in the newest WD to compareDocumentPosition: + // + // Disable compareTreePosition from script only for now since we + // rely on it in C++. When we implement this as per the latest + // spec, re-enable it for scripts. + [noscript] unsigned short compareTreePosition(in nsIDOMNode other); // Introduced in DOM Level 3: boolean isSameNode(in nsIDOMNode other); // Introduced in DOM Level 3: diff --git a/dom/public/idl/core/nsIDOMNode.idl b/dom/public/idl/core/nsIDOMNode.idl index 7e97166cdfe..605e7e24dc3 100644 --- a/dom/public/idl/core/nsIDOMNode.idl +++ b/dom/public/idl/core/nsIDOMNode.idl @@ -110,12 +110,24 @@ interface nsIDOMNode : nsISupports // Introduced in DOM Level 2: boolean hasAttributes(); +%{C++ // Introduced in DOM Level 3: - const unsigned short TREE_POSITION_PRECEDING = 0x01; - const unsigned short TREE_POSITION_FOLLOWING = 0x02; - const unsigned short TREE_POSITION_ANCESTOR = 0x04; - const unsigned short TREE_POSITION_DESCENDANT = 0x08; - const unsigned short TREE_POSITION_EQUIVALENT = 0x10; - const unsigned short TREE_POSITION_SAME_NODE = 0x20; - const unsigned short TREE_POSITION_DISCONNECTED = 0x00; + // XXXcaa the constants existed in an old DOM3 Core WD: + // + // They have been renamed in the newest WD: + // + // Disable these from script only for now since we rely on them + // in C++. When we implement them as per the latest spec, + // rename and re-enable them. + enum { + TREE_POSITION_PRECEDING = 0x01, + TREE_POSITION_FOLLOWING = 0x02, + TREE_POSITION_ANCESTOR = 0x04, + TREE_POSITION_DESCENDANT = 0x08, + TREE_POSITION_EQUIVALENT = 0x10, + TREE_POSITION_SAME_NODE = 0x20, + TREE_POSITION_DISCONNECTED = 0x00 + }; +%} + };