diff --git a/mozilla/content/base/src/nsDOMAttribute.cpp b/mozilla/content/base/src/nsDOMAttribute.cpp index 4829cda18e7..81df09ea2ba 100644 --- a/mozilla/content/base/src/nsDOMAttribute.cpp +++ b/mozilla/content/base/src/nsDOMAttribute.cpp @@ -527,6 +527,16 @@ nsDOMAttribute::IsSupported(const nsAReadableString& aFeature, return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn); } +NS_IMETHODIMP +nsDOMAttribute::GetBaseURI(nsAWritableString &aURI) +{ + aURI.Truncate(); + nsresult rv = NS_OK; + nsCOMPtr node(do_QueryInterface(mContent)); + if (node) + rv = node->GetBaseURI(aURI); + return rv; +} //---------------------------------------------------------------------- diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index ce3391ff9b1..9306a9f21dc 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -2738,6 +2738,20 @@ nsDocument::IsSupported(const nsAReadableString& aFeature, return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn); } +NS_IMETHODIMP +nsDocument::GetBaseURI(nsAWritableString &aURI) +{ + aURI.Truncate(); + if (mDocumentURL) { + nsXPIDLCString spec; + mDocumentURL->GetSpec(getter_Copies(spec)); + if (spec) { + CopyASCIItoUCS2(nsLiteralCString(spec), aURI); + } + } + return NS_OK; +} + NS_IMETHODIMP nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument) { diff --git a/mozilla/content/base/src/nsDocumentFragment.cpp b/mozilla/content/base/src/nsDocumentFragment.cpp index 9ea14322382..239f5730948 100644 --- a/mozilla/content/base/src/nsDocumentFragment.cpp +++ b/mozilla/content/base/src/nsDocumentFragment.cpp @@ -101,6 +101,8 @@ public: PRBool* aReturn) { return nsGenericContainerElement::IsSupported(aFeature, aVersion, aReturn); } + NS_IMETHOD GetBaseURI(nsAWritableString& aURI) + { return nsGenericContainerElement::GetBaseURI(aURI); } // interface nsIScriptObjectOwner NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject); diff --git a/mozilla/content/base/src/nsGenericDOMDataNode.cpp b/mozilla/content/base/src/nsGenericDOMDataNode.cpp index 2e3c5b0d84c..31c1497224f 100644 --- a/mozilla/content/base/src/nsGenericDOMDataNode.cpp +++ b/mozilla/content/base/src/nsGenericDOMDataNode.cpp @@ -47,7 +47,6 @@ #include "prprf.h" #include "nsCOMPtr.h" - //---------------------------------------------------------------------- nsGenericDOMDataNode::nsGenericDOMDataNode() @@ -239,6 +238,25 @@ nsGenericDOMDataNode::IsSupported(const nsAReadableString& aFeature, return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn); } +nsresult +nsGenericDOMDataNode::GetBaseURI(nsAWritableString& aURI) +{ + aURI.Truncate(); + nsresult rv = NS_OK; + // DOM Data Node inherits the base from its parent element/document + nsCOMPtr node; + if (mParent) { + node = do_QueryInterface(mParent); + } else if (mDocument) { + node = do_QueryInterface(mDocument); + } + + if (node) + rv = node->GetBaseURI(aURI); + + return rv; +} + #if 0 nsresult nsGenericDOMDataNode::Equals(nsIDOMNode* aNode, PRBool aDeep, PRBool* aReturn) diff --git a/mozilla/content/base/src/nsGenericDOMDataNode.h b/mozilla/content/base/src/nsGenericDOMDataNode.h index c30384e500f..2e1aebf11b7 100644 --- a/mozilla/content/base/src/nsGenericDOMDataNode.h +++ b/mozilla/content/base/src/nsGenericDOMDataNode.h @@ -124,6 +124,7 @@ struct nsGenericDOMDataNode { nsresult IsSupported(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); + nsresult GetBaseURI(nsAWritableString& aURI); // Implementation for nsIDOMCharacterData nsresult GetData(nsAWritableString& aData); @@ -353,6 +354,9 @@ struct nsGenericDOMDataNode { PRBool* aReturn) { \ return _g.IsSupported(aFeature, aVersion, aReturn); \ } \ + NS_IMETHOD GetBaseURI(nsAWritableString& aURI) { \ + return _g.GetBaseURI(aURI); \ + } \ NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); #define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \ diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index d92e94d7937..d7c620cdd4b 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -81,6 +81,9 @@ #include "jsapi.h" +// baseURI +#include "nsIXMLDocument.h" + //---------------------------------------------------------------------- nsChildContentList::nsChildContentList(nsIContent *aContent) @@ -696,6 +699,56 @@ nsGenericElement::HasAttributes(PRBool* aReturn) return NS_OK; } +NS_IMETHODIMP +nsGenericElement::GetXMLBaseURI(nsIURI **aURI) +{ + NS_ENSURE_ARG_POINTER(aURI); + aURI=nsnull; + return NS_OK; +} + + +NS_IMETHODIMP +nsGenericElement::GetBaseURI(nsAWritableString& aURI) +{ + aURI.Truncate(); + nsCOMPtr uri; + nsCOMPtr xmlDoc(do_QueryInterface(mDocument)); + if (xmlDoc) { + // XML documents can use the XML Base (W3C spec) way of setting the base + // per element. We look at this node and its ancestors until we find + // the first XML content and get it's base. + nsCOMPtr content(do_QueryInterface(NS_STATIC_CAST(nsIContent*,this))); + while (content) { + nsCOMPtr xmlContent(do_QueryInterface(content)); + if (xmlContent) { + xmlContent->GetXMLBaseURI(getter_AddRefs(uri)); + break; + } + nsCOMPtr tmp(content); + tmp->GetParent(*getter_AddRefs(content)); + } + } + + if (!uri && mDocument) { + // HTML document or for some reason there was no XML content in XML document + mDocument->GetBaseURL(*getter_AddRefs(uri)); + if (!uri) { + uri = dont_AddRef(mDocument->GetDocumentURL()); + } + } + + if (uri) { + nsXPIDLCString spec; + uri->GetSpec(getter_Copies(spec)); + if (spec) { + CopyASCIItoUCS2(nsLiteralCString(spec), aURI); + } + } + + return NS_OK; +} + NS_IMETHODIMP nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes) { diff --git a/mozilla/content/base/src/nsGenericElement.h b/mozilla/content/base/src/nsGenericElement.h index 6b67ac19f24..8dac32d4a0d 100644 --- a/mozilla/content/base/src/nsGenericElement.h +++ b/mozilla/content/base/src/nsGenericElement.h @@ -210,6 +210,7 @@ public: NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace); NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const; NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell); + NS_IMETHOD GetXMLBaseURI(nsIURI **aURI); // nsIHTMLContent interface methods NS_IMETHOD Compact(); @@ -268,6 +269,7 @@ public: NS_IMETHOD IsSupported(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn); NS_IMETHOD HasAttributes(PRBool* aHasAttributes); + NS_IMETHOD GetBaseURI(nsAWritableString& aURI); // nsIDOMElement method implementation NS_IMETHOD GetTagName(nsAWritableString& aTagName); @@ -471,5 +473,6 @@ protected: NS_IMETHOD Normalize() { return _to Normalize(); } \ NS_IMETHOD IsSupported(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return _to IsSupported(aFeature, aVersion, aReturn); } \ NS_IMETHOD HasAttributes(PRBool* aReturn) { return _to HasAttributes(aReturn); } \ + NS_IMETHOD GetBaseURI(nsAWritableString& aURI) { return _to GetBaseURI(aURI); } \ #endif /* nsGenericElement_h___ */ diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 81842d16645..b98c892013d 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -1705,6 +1705,21 @@ nsHTMLDocument::IsSupported(const nsAReadableString& aFeature, return nsDocument::IsSupported(aFeature, aVersion, aReturn); } +NS_IMETHODIMP +nsHTMLDocument::GetBaseURI(nsAWritableString &aURI) +{ + aURI.Truncate(); + nsCOMPtr uri(do_QueryInterface(mBaseURL ? mBaseURL : mDocumentURL)); + if (uri) { + nsXPIDLCString spec; + uri->GetSpec(getter_Copies(spec)); + if (spec) { + CopyASCIItoUCS2(nsLiteralCString(spec), aURI); + } + } + return NS_OK; +} + // // nsIDOMHTMLDocument interface implementation diff --git a/mozilla/content/xml/content/public/nsIXMLContent.h b/mozilla/content/xml/content/public/nsIXMLContent.h index b087efcdebe..5691fd44410 100644 --- a/mozilla/content/xml/content/public/nsIXMLContent.h +++ b/mozilla/content/xml/content/public/nsIXMLContent.h @@ -30,6 +30,7 @@ class nsINameSpace; class nsINodeInfo; class nsIWebShell; +class nsIURI; #define NS_IXMLCONTENT_IID \ { 0xa6cf90cb, 0x15b3, 0x11d2, \ @@ -55,6 +56,8 @@ public: * links, so processing should usually stop after that as well. */ NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell) = 0; + + NS_IMETHOD GetXMLBaseURI(nsIURI **aURI) = 0; }; // Some return values for MaybeTriggerAutoLink diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index 929688c119d..3b0e398ab62 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -162,19 +162,16 @@ static inline nsresult MakeURI(const char *aSpec, nsIURI *aBase, nsIURI **aURI) return service->NewURI(aSpec,aBase,aURI); } -nsresult +NS_IMETHODIMP nsXMLElement::GetXMLBaseURI(nsIURI **aURI) { - NS_ABORT_IF_FALSE(aURI,"null ptr"); - if (!aURI) - return NS_ERROR_NULL_POINTER; - + NS_ENSURE_ARG_POINTER(aURI); *aURI = nsnull; nsresult rv; nsAutoString base; - nsCOMPtr content = do_QueryInterface(NS_STATIC_CAST(nsIXMLContent*,this),&rv); + nsCOMPtr content(do_QueryInterface(NS_STATIC_CAST(nsIXMLContent*,this),&rv)); while (NS_SUCCEEDED(rv) && content) { nsAutoString value; rv = content->GetAttribute(kNameSpaceID_XML,kBaseAtom,value); @@ -228,7 +225,11 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI) if (NS_SUCCEEDED(rv)) { if (!*aURI && mDocument) { - nsCOMPtr docBase = dont_AddRef(mDocument->GetDocumentURL()); + nsCOMPtr docBase; + mDocument->GetBaseURL(*getter_AddRefs(docBase)); + if (!docBase) { + docBase = dont_AddRef(mDocument->GetDocumentURL()); + } if (base.IsEmpty()) { *aURI = docBase.get(); NS_IF_ADDREF(*aURI); // nsCOMPtr releases this once diff --git a/mozilla/content/xml/content/src/nsXMLElement.h b/mozilla/content/xml/content/src/nsXMLElement.h index fc1853d02b9..abefdc83106 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.h +++ b/mozilla/content/xml/content/src/nsXMLElement.h @@ -61,6 +61,7 @@ public: NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace); NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const; NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell); + NS_IMETHOD GetXMLBaseURI(nsIURI **aURI); // nsIStyledContent NS_IMETHOD GetID(nsIAtom*& aResult) const; @@ -77,7 +78,6 @@ public: NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const; protected: - nsresult GetXMLBaseURI(nsIURI **aURI); // XXX This should perhaps be moved to nsIXMLContent PRBool mIsLink; nsINameSpace* mNameSpace; }; diff --git a/mozilla/content/xul/content/src/nsXULAttributes.cpp b/mozilla/content/xul/content/src/nsXULAttributes.cpp index 6adef5ea4ef..b5bf5e02d43 100644 --- a/mozilla/content/xul/content/src/nsXULAttributes.cpp +++ b/mozilla/content/xul/content/src/nsXULAttributes.cpp @@ -462,6 +462,12 @@ nsXULAttribute::IsSupported(const nsAReadableString& aFeature, return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP +nsXULAttribute::GetBaseURI(nsAWritableString &aURI) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} // nsIDOMAttr interface diff --git a/mozilla/content/xul/content/src/nsXULElement.cpp b/mozilla/content/xul/content/src/nsXULElement.cpp index 59d11a2a446..f2ef5a38b5a 100644 --- a/mozilla/content/xul/content/src/nsXULElement.cpp +++ b/mozilla/content/xul/content/src/nsXULElement.cpp @@ -1791,6 +1791,36 @@ nsXULElement::MaybeTriggerAutoLink(nsIWebShell *aShell) return NS_OK; } +NS_IMETHODIMP +nsXULElement::GetXMLBaseURI(nsIURI **aURI) +{ + // XXX TODO, should share the impl with nsXMLElement + NS_ENSURE_ARG_POINTER(aURI); + *aURI=nsnull; + if (mDocument) { + mDocument->GetBaseURL(*aURI); + if (!*aURI) { + *aURI = mDocument->GetDocumentURL(); + } + } + return NS_OK; +} + +NS_IMETHODIMP +nsXULElement::GetBaseURI(nsAWritableString &aURI) +{ + // XXX TODO, should share the impl with nsXMLElement + aURI.Truncate(); + nsresult rv = NS_OK; + if (mDocument) { + nsCOMPtr doc(do_QueryInterface(mDocument)); + if (doc) { + rv = doc->GetBaseURI(aURI); + } + } + return rv; +} + //---------------------------------------------------------------------- // nsIXULContent interface diff --git a/mozilla/content/xul/content/src/nsXULElement.h b/mozilla/content/xul/content/src/nsXULElement.h index 69e27d085c1..6a5d2fda060 100644 --- a/mozilla/content/xul/content/src/nsXULElement.h +++ b/mozilla/content/xul/content/src/nsXULElement.h @@ -388,6 +388,7 @@ public: NS_IMETHOD SetContainingNameSpace(nsINameSpace* aNameSpace); NS_IMETHOD GetContainingNameSpace(nsINameSpace*& aNameSpace) const; NS_IMETHOD MaybeTriggerAutoLink(nsIWebShell *aShell); + NS_IMETHOD GetXMLBaseURI(nsIURI **aURI); // nsIStyledContent NS_IMETHOD GetID(nsIAtom*& aResult) const; diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index ae2e2523447..463f19f2e94 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -3487,6 +3487,20 @@ nsXULDocument::IsSupported(const nsAReadableString& aFeature, return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP +nsXULDocument::GetBaseURI(nsAWritableString &aURI) +{ + aURI.Truncate(); + if (mDocumentURL) { + nsXPIDLCString spec; + mDocumentURL->GetSpec(getter_Copies(spec)); // XUL documents do not have base URL? + if (spec) { + CopyASCIItoUCS2(nsLiteralCString(spec), aURI); + } + } + return NS_OK; +} + //---------------------------------------------------------------------- // diff --git a/mozilla/dom/public/coreDom/nsIDOMNSDocument.h b/mozilla/dom/public/coreDom/nsIDOMNSDocument.h index 30edc745f88..2d3af063820 100644 --- a/mozilla/dom/public/coreDom/nsIDOMNSDocument.h +++ b/mozilla/dom/public/coreDom/nsIDOMNSDocument.h @@ -78,8 +78,8 @@ public: #define NS_FORWARD_IDOMNSDOCUMENT(_to) \ NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet) { return _to GetCharacterSet(aCharacterSet); } \ - NS_IMETHOD GetDir(nsAWritableString& aDir); \ - NS_IMETHOD SetDir(const nsAReadableString& aDir); \ + NS_IMETHOD GetDir(nsAWritableString& aDir) { return _to GetDir(aDir); } \ + NS_IMETHOD SetDir(const nsAReadableString& aDir) { return _to SetDir(aDir); } \ NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins) { return _to GetPlugins(aPlugins); } \ NS_IMETHOD GetLocation(jsval* aLocation) { return _to GetLocation(aLocation); } \ NS_IMETHOD SetLocation(jsval aLocation) { return _to SetLocation(aLocation); } \ diff --git a/mozilla/dom/public/coreDom/nsIDOMNode.h b/mozilla/dom/public/coreDom/nsIDOMNode.h index bb4ada22caf..47b704b059c 100644 --- a/mozilla/dom/public/coreDom/nsIDOMNode.h +++ b/mozilla/dom/public/coreDom/nsIDOMNode.h @@ -85,6 +85,8 @@ public: NS_IMETHOD GetLocalName(nsAWritableString& aLocalName)=0; + NS_IMETHOD GetBaseURI(nsAWritableString& aBaseURI)=0; + NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn)=0; NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn)=0; @@ -122,6 +124,7 @@ public: NS_IMETHOD GetPrefix(nsAWritableString& aPrefix); \ NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix); \ NS_IMETHOD GetLocalName(nsAWritableString& aLocalName); \ + NS_IMETHOD GetBaseURI(nsAWritableString& aBaseURI); \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn); \ NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \ NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn); \ @@ -151,6 +154,7 @@ public: NS_IMETHOD GetPrefix(nsAWritableString& aPrefix) { return _to GetPrefix(aPrefix); } \ NS_IMETHOD SetPrefix(const nsAReadableString& aPrefix) { return _to SetPrefix(aPrefix); } \ NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { return _to GetLocalName(aLocalName); } \ + NS_IMETHOD GetBaseURI(nsAWritableString& aBaseURI) { return _to GetBaseURI(aBaseURI); } \ NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild, nsIDOMNode** aReturn) { return _to InsertBefore(aNewChild, aRefChild, aReturn); } \ NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to ReplaceChild(aNewChild, aOldChild, aReturn); } \ NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn) { return _to RemoveChild(aOldChild, aReturn); } \ diff --git a/mozilla/dom/public/idl/coreDom/Node.idl b/mozilla/dom/public/idl/coreDom/Node.idl index b8121bbf20f..e9eb4fbe37b 100644 --- a/mozilla/dom/public/idl/coreDom/Node.idl +++ b/mozilla/dom/public/idl/coreDom/Node.idl @@ -56,6 +56,9 @@ interface Node { readonly attribute DOMString localName; // Introduced in DOM Level 2: boolean hasAttributes(); + + // Introduced in DOM Level 3: + readonly attribute DOMString baseURI; }; interface EventTarget { diff --git a/mozilla/dom/public/nsDOMPropEnums.h b/mozilla/dom/public/nsDOMPropEnums.h index 79760fcb0ff..108c7b5f027 100644 --- a/mozilla/dom/public/nsDOMPropEnums.h +++ b/mozilla/dom/public/nsDOMPropEnums.h @@ -741,6 +741,7 @@ enum nsDOMProp { NS_DOM_PROP_NAVIGATOR_VENDORSUB, NS_DOM_PROP_NODE_APPENDCHILD, NS_DOM_PROP_NODE_ATTRIBUTES, + NS_DOM_PROP_NODE_BASEURI, NS_DOM_PROP_NODE_CHILDNODES, NS_DOM_PROP_NODE_CLONENODE, NS_DOM_PROP_NODE_FIRSTCHILD, diff --git a/mozilla/dom/public/nsDOMPropNames.h b/mozilla/dom/public/nsDOMPropNames.h index 3e7a8fb3ad2..c36e3ff6c0d 100644 --- a/mozilla/dom/public/nsDOMPropNames.h +++ b/mozilla/dom/public/nsDOMPropNames.h @@ -739,6 +739,7 @@ "navigator.vendorsub", \ "node.appendchild", \ "node.attributes", \ + "node.baseuri", \ "node.childnodes", \ "node.clonenode", \ "node.firstchild", \ diff --git a/mozilla/dom/src/coreDOM/nsJSNode.cpp b/mozilla/dom/src/coreDOM/nsJSNode.cpp index d0ff576ef2e..ebfb6f8fe0d 100644 --- a/mozilla/dom/src/coreDOM/nsJSNode.cpp +++ b/mozilla/dom/src/coreDOM/nsJSNode.cpp @@ -71,7 +71,8 @@ enum Node_slots { NODE_OWNERDOCUMENT = -11, NODE_NAMESPACEURI = -12, NODE_PREFIX = -13, - NODE_LOCALNAME = -14 + NODE_LOCALNAME = -14, + NODE_BASEURI = -15 }; /***********************************************************************/ @@ -270,6 +271,18 @@ GetNodeProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp) } break; } + case NODE_BASEURI: + { + rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_NODE_BASEURI, PR_FALSE); + if (NS_SUCCEEDED(rv)) { + nsAutoString prop; + rv = a->GetBaseURI(prop); + if (NS_SUCCEEDED(rv)) { + nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); + } + } + break; + } default: return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp); } @@ -360,6 +373,7 @@ static JSPropertySpec NodeProperties[] = {"namespaceURI", NODE_NAMESPACEURI, JSPROP_ENUMERATE | JSPROP_READONLY}, {"prefix", NODE_PREFIX, JSPROP_ENUMERATE}, {"localName", NODE_LOCALNAME, JSPROP_ENUMERATE | JSPROP_READONLY}, + {"baseURI", NODE_BASEURI, JSPROP_ENUMERATE | JSPROP_READONLY}, {0} };