зеркало из https://github.com/mozilla/pjs.git
Bug 72522, implemented DOM Level 3 baseURI property (node interface). r=harishd, sr=jst.
This commit is contained in:
Родитель
f9d313e055
Коммит
2f7d5496ae
|
@ -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<nsIDOMNode> node(do_QueryInterface(mContent));
|
||||
if (node)
|
||||
rv = node->GetBaseURI(aURI);
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<nsIDOMNode> 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)
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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<nsIURI> uri;
|
||||
nsCOMPtr<nsIXMLDocument> 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<nsIContent> content(do_QueryInterface(NS_STATIC_CAST(nsIContent*,this)));
|
||||
while (content) {
|
||||
nsCOMPtr<nsIXMLContent> xmlContent(do_QueryInterface(content));
|
||||
if (xmlContent) {
|
||||
xmlContent->GetXMLBaseURI(getter_AddRefs(uri));
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsIContent> 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)
|
||||
{
|
||||
|
|
|
@ -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___ */
|
||||
|
|
|
@ -1705,6 +1705,21 @@ nsHTMLDocument::IsSupported(const nsAReadableString& aFeature,
|
|||
return nsDocument::IsSupported(aFeature, aVersion, aReturn);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLDocument::GetBaseURI(nsAWritableString &aURI)
|
||||
{
|
||||
aURI.Truncate();
|
||||
nsCOMPtr<nsIURI> 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<nsIContent> content = do_QueryInterface(NS_STATIC_CAST(nsIXMLContent*,this),&rv);
|
||||
nsCOMPtr<nsIContent> 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<nsIURI> docBase = dont_AddRef(mDocument->GetDocumentURL());
|
||||
nsCOMPtr<nsIURI> 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
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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<nsIDOMDocument> doc(do_QueryInterface(mDocument));
|
||||
if (doc) {
|
||||
rv = doc->GetBaseURI(aURI);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIXULContent interface
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNSDocument_h__
|
||||
#define nsIDOMNSDocument_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsIDOMElement;
|
||||
class nsIDOMPluginArray;
|
||||
class nsIBoxObject;
|
||||
class nsIDOMRange;
|
||||
|
||||
#define NS_IDOMNSDOCUMENT_IID \
|
||||
{ 0xa6cf90cd, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
|
||||
|
||||
class NS_NO_VTABLE nsIDOMNSDocument : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMNSDOCUMENT_IID)
|
||||
|
||||
NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet)=0;
|
||||
|
||||
NS_IMETHOD GetDir(nsAWritableString& aDir)=0;
|
||||
NS_IMETHOD SetDir(const nsAReadableString& aDir)=0;
|
||||
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins)=0;
|
||||
|
||||
NS_IMETHOD GetLocation(jsval* aLocation)=0;
|
||||
NS_IMETHOD SetLocation(jsval aLocation)=0;
|
||||
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn)=0;
|
||||
|
||||
NS_IMETHOD Load(const nsAReadableString& aUrl)=0;
|
||||
|
||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject** aReturn)=0;
|
||||
|
||||
NS_IMETHOD SetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject* aBoxObject)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNSDOCUMENT \
|
||||
NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet); \
|
||||
NS_IMETHOD GetDir(nsAWritableString& aDir); \
|
||||
NS_IMETHOD SetDir(const nsAReadableString& aDir); \
|
||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins); \
|
||||
NS_IMETHOD GetLocation(jsval* aLocation); \
|
||||
NS_IMETHOD SetLocation(jsval aLocation); \
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn); \
|
||||
NS_IMETHOD Load(const nsAReadableString& aUrl); \
|
||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject** aReturn); \
|
||||
NS_IMETHOD SetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject* aBoxObject); \
|
||||
|
||||
|
||||
|
||||
#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 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); } \
|
||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn) { return _to CreateRange(aReturn); } \
|
||||
NS_IMETHOD Load(const nsAReadableString& aUrl) { return _to Load(aUrl); } \
|
||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject** aReturn) { return _to GetBoxObjectFor(aElt, aReturn); } \
|
||||
NS_IMETHOD SetBoxObjectFor(nsIDOMElement* aElt, nsIBoxObject* aBoxObject) { return _to SetBoxObjectFor(aElt, aBoxObject); } \
|
||||
|
||||
|
||||
#endif // nsIDOMNSDocument_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); } \
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -739,6 +739,7 @@
|
|||
"navigator.vendorsub", \
|
||||
"node.appendchild", \
|
||||
"node.attributes", \
|
||||
"node.baseuri", \
|
||||
"node.childnodes", \
|
||||
"node.clonenode", \
|
||||
"node.firstchild", \
|
||||
|
|
|
@ -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}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче