diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 82f7649f855..e4f0a87ca8f 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -2075,6 +2075,43 @@ nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aRetu return NS_OK; } +NS_IMETHODIMP +nsHTMLDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + + PRBool nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData) { diff --git a/mozilla/content/xml/document/src/nsXMLDocument.cpp b/mozilla/content/xml/document/src/nsXMLDocument.cpp index 8896f72d138..9fec1fe670c 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/content/xml/document/src/nsXMLDocument.cpp @@ -696,6 +696,50 @@ nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName, return rv; } +NS_IMETHODIMP +nsXMLDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::GetElementById(const nsString& aElementId, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + // nsIXMLDocument interface static nsIContent * diff --git a/mozilla/content/xml/document/src/nsXMLDocument.h b/mozilla/content/xml/document/src/nsXMLDocument.h index 28cf5448b7b..cf7eed48e4b 100644 --- a/mozilla/content/xml/document/src/nsXMLDocument.h +++ b/mozilla/content/xml/document/src/nsXMLDocument.h @@ -68,6 +68,21 @@ public: NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn); + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn); + NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn); + NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn); + NS_IMETHOD GetElementById(const nsString& aElementId, + nsIDOMElement** aReturn); + NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn); + // nsIXMLDocument interface NS_IMETHOD GetContentById(const nsString& aName, nsIContent** aContent); diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index d1e81ae15b0..a49bb0ec79e 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -2732,6 +2732,33 @@ nsXULDocument::GetControls(nsIDOMHTMLCollection ** aResult) { return NS_OK; } +NS_IMETHODIMP +nsXULDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) { @@ -2752,6 +2779,15 @@ nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) return rv; } +NS_IMETHODIMP +nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + nsresult nsXULDocument::AddSubtreeToDocument(nsIContent* aElement) { diff --git a/mozilla/content/xul/document/src/nsXULDocument.h b/mozilla/content/xul/document/src/nsXULDocument.h index aa94d9e409b..4a1d3515947 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.h +++ b/mozilla/content/xul/document/src/nsXULDocument.h @@ -325,19 +325,7 @@ public: PRBool aUseCapture); // nsIDOMDocument interface - NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype); - NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); - NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); - - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); - NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); + NS_DECL_IDOMDOCUMENT // nsIDOMNSDocument interface NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets); diff --git a/mozilla/dom/public/coreDom/nsIDOMDocument.h b/mozilla/dom/public/coreDom/nsIDOMDocument.h index d543886abd7..2dc48627e3a 100644 --- a/mozilla/dom/public/coreDom/nsIDOMDocument.h +++ b/mozilla/dom/public/coreDom/nsIDOMDocument.h @@ -30,8 +30,9 @@ #include "nsIDOMNode.h" class nsIDOMElement; -class nsIDOMProcessingInstruction; class nsIDOMAttr; +class nsIDOMProcessingInstruction; +class nsIDOMNode; class nsIDOMCDATASection; class nsIDOMText; class nsIDOMDOMImplementation; @@ -72,6 +73,16 @@ public: NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn)=0; NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn)=0; + + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn)=0; + + NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn)=0; + + NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn)=0; + + NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn)=0; + + NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn)=0; }; @@ -88,6 +99,11 @@ public: NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); \ NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); \ NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); \ + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn); \ + NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn); \ + NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn); \ + NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn); \ + NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn); \ @@ -104,6 +120,11 @@ public: NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn) { return _to CreateAttribute(aName, aReturn); } \ NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn) { return _to CreateEntityReference(aName, aReturn); } \ NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn) { return _to GetElementsByTagName(aTagname, aReturn); } \ + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep, nsIDOMNode** aReturn) { return _to ImportNode(aImportedNode, aDeep, aReturn); } \ + NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMElement** aReturn) { return _to CreateElementNS(aNamespaceURI, aQualifiedName, aReturn); } \ + NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, const nsString& aQualifiedName, nsIDOMAttr** aReturn) { return _to CreateAttributeNS(aNamespaceURI, aQualifiedName, aReturn); } \ + NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, const nsString& aLocalName, nsIDOMNodeList** aReturn) { return _to GetElementsByTagNameNS(aNamespaceURI, aLocalName, aReturn); } \ + NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) { return _to GetElementById(aElementId, aReturn); } \ extern "C" NS_DOM nsresult NS_InitDocumentClass(nsIScriptContext *aContext, void **aPrototype); diff --git a/mozilla/dom/public/html/nsIDOMHTMLDocument.h b/mozilla/dom/public/html/nsIDOMHTMLDocument.h index a8859b8c799..8dfc6ace7bd 100644 --- a/mozilla/dom/public/html/nsIDOMHTMLDocument.h +++ b/mozilla/dom/public/html/nsIDOMHTMLDocument.h @@ -29,7 +29,6 @@ #include "nsIScriptContext.h" #include "nsIDOMDocument.h" -class nsIDOMElement; class nsIDOMHTMLElement; class nsIDOMHTMLCollection; class nsIDOMNodeList; @@ -76,8 +75,6 @@ public: NS_IMETHOD Writeln(const nsString& aText)=0; - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn)=0; - NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn)=0; }; @@ -102,7 +99,6 @@ public: NS_IMETHOD Close(); \ NS_IMETHOD Write(const nsString& aText); \ NS_IMETHOD Writeln(const nsString& aText); \ - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn); \ NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn); \ @@ -127,7 +123,6 @@ public: NS_IMETHOD Close() { return _to Close(); } \ NS_IMETHOD Write(const nsString& aText) { return _to Write(aText); } \ NS_IMETHOD Writeln(const nsString& aText) { return _to Writeln(aText); } \ - NS_IMETHOD GetElementById(const nsString& aElementId, nsIDOMElement** aReturn) { return _to GetElementById(aElementId, aReturn); } \ NS_IMETHOD GetElementsByName(const nsString& aElementName, nsIDOMNodeList** aReturn) { return _to GetElementsByName(aElementName, aReturn); } \ diff --git a/mozilla/dom/public/idl/coreDom/Document.idl b/mozilla/dom/public/idl/coreDom/Document.idl index 2039e6f460e..5aa7cb14106 100644 --- a/mozilla/dom/public/idl/coreDom/Document.idl +++ b/mozilla/dom/public/idl/coreDom/Document.idl @@ -20,6 +20,24 @@ EntityReference createEntityReference(in DOMString name) raises(DOMException); NodeList getElementsByTagName(in DOMString tagname); + + // Introduced in DOM Level 2: + Node importNode(in Node importedNode, + in boolean deep) + raises(DOMException); + // Introduced in DOM Level 2: + Element createElementNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + Attr createAttributeNS(in DOMString namespaceURI, + in DOMString qualifiedName) + raises(DOMException); + // Introduced in DOM Level 2: + NodeList getElementsByTagNameNS(in DOMString namespaceURI, + in DOMString localName); + // Introduced in DOM Level 2: + Element getElementById(in DOMString elementId); }; interface NSDocument { @@ -30,6 +48,7 @@ readonly attribute long height; readonly attribute StyleSheetCollection styleSheets; readonly attribute DOMString characterSet; +// XXX This should be removed, the new createElementNS should be used in stead Element createElementWithNameSpace(in DOMString tagName, in DOMString nameSpace) raises(DOMException); Range createRange(); diff --git a/mozilla/dom/public/idl/html/HTMLDocument.idl b/mozilla/dom/public/idl/html/HTMLDocument.idl index 1f25287859b..3da133d32a7 100644 --- a/mozilla/dom/public/idl/html/HTMLDocument.idl +++ b/mozilla/dom/public/idl/html/HTMLDocument.idl @@ -18,7 +18,6 @@ void close(); noscript void write(in DOMString text); noscript void writeln(in DOMString text); - Element getElementById(in DOMString elementId); NodeList getElementsByName(in DOMString elementName); }; diff --git a/mozilla/dom/public/idl/xul/XULDocument.idl b/mozilla/dom/public/idl/xul/XULDocument.idl index 64b003f3227..72765b38b06 100644 --- a/mozilla/dom/public/idl/xul/XULDocument.idl +++ b/mozilla/dom/public/idl/xul/XULDocument.idl @@ -8,7 +8,6 @@ interface XULDocument : Document { readonly attribute XULCommandDispatcher commandDispatcher; - Element getElementById(in DOMString id); NodeList getElementsByAttribute(in DOMString name, in DOMString value); void persist(in DOMString id, in DOMString attr); diff --git a/mozilla/dom/public/nsDOMPropEnums.h b/mozilla/dom/public/nsDOMPropEnums.h index 8135ad2cce1..a589b9c5b81 100644 --- a/mozilla/dom/public/nsDOMPropEnums.h +++ b/mozilla/dom/public/nsDOMPropEnums.h @@ -206,17 +206,22 @@ enum nsDOMProp { NS_DOM_PROP_CSSSTYLESHEET_PARENTSTYLESHEET, NS_DOM_PROP_CSSSTYLESHEET_TITLE, NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTE, + NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTENS, NS_DOM_PROP_DOCUMENT_CREATECDATASECTION, NS_DOM_PROP_DOCUMENT_CREATECOMMENT, NS_DOM_PROP_DOCUMENT_CREATEDOCUMENTFRAGMENT, NS_DOM_PROP_DOCUMENT_CREATEELEMENT, + NS_DOM_PROP_DOCUMENT_CREATEELEMENTNS, NS_DOM_PROP_DOCUMENT_CREATEENTITYREFERENCE, NS_DOM_PROP_DOCUMENT_CREATEPROCESSINGINSTRUCTION, NS_DOM_PROP_DOCUMENT_CREATETEXTNODE, NS_DOM_PROP_DOCUMENT_DOCTYPE, NS_DOM_PROP_DOCUMENT_DOCUMENTELEMENT, + NS_DOM_PROP_DOCUMENT_GETELEMENTBYID, NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAME, + NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAMENS, NS_DOM_PROP_DOCUMENT_IMPLEMENTATION, + NS_DOM_PROP_DOCUMENT_IMPORTNODE, NS_DOM_PROP_DOCUMENTTYPE_ENTITIES, NS_DOM_PROP_DOCUMENTTYPE_INTERNALSUBSET, NS_DOM_PROP_DOCUMENTTYPE_NAME, @@ -327,7 +332,6 @@ enum nsDOMProp { NS_DOM_PROP_HTMLDOCUMENT_COOKIE, NS_DOM_PROP_HTMLDOCUMENT_DOMAIN, NS_DOM_PROP_HTMLDOCUMENT_FORMS, - NS_DOM_PROP_HTMLDOCUMENT_GETELEMENTBYID, NS_DOM_PROP_HTMLDOCUMENT_GETELEMENTSBYNAME, NS_DOM_PROP_HTMLDOCUMENT_IMAGES, NS_DOM_PROP_HTMLDOCUMENT_LINKS, diff --git a/mozilla/dom/public/nsDOMPropNames.h b/mozilla/dom/public/nsDOMPropNames.h index 4fae402b968..b06dec9b8af 100644 --- a/mozilla/dom/public/nsDOMPropNames.h +++ b/mozilla/dom/public/nsDOMPropNames.h @@ -205,17 +205,22 @@ "cssstylesheet.parentstylesheet", \ "cssstylesheet.title", \ "document.createattribute", \ + "document.createattributens", \ "document.createcdatasection", \ "document.createcomment", \ "document.createdocumentfragment", \ "document.createelement", \ + "document.createelementns", \ "document.createentityreference", \ "document.createprocessinginstruction", \ "document.createtextnode", \ "document.doctype", \ "document.documentelement", \ + "document.getelementbyid", \ "document.getelementsbytagname", \ + "document.getelementsbytagnamens", \ "document.implementation", \ + "document.importnode", \ "documenttype.entities", \ "documenttype.internalsubset", \ "documenttype.name", \ @@ -326,7 +331,6 @@ "htmldocument.cookie", \ "htmldocument.domain", \ "htmldocument.forms", \ - "htmldocument.getelementbyid", \ "htmldocument.getelementsbyname", \ "htmldocument.images", \ "htmldocument.links", \ diff --git a/mozilla/dom/public/xul/nsIDOMXULDocument.h b/mozilla/dom/public/xul/nsIDOMXULDocument.h index 0f192ae47e6..fa04b1ddb77 100644 --- a/mozilla/dom/public/xul/nsIDOMXULDocument.h +++ b/mozilla/dom/public/xul/nsIDOMXULDocument.h @@ -29,7 +29,6 @@ #include "nsIScriptContext.h" #include "nsIDOMDocument.h" -class nsIDOMElement; class nsIDOMNode; class nsIDOMXULCommandDispatcher; class nsIDOMHTMLCollection; @@ -53,8 +52,6 @@ public: NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0; - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn)=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr)=0; @@ -68,7 +65,6 @@ public: NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode); \ NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher); \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \ - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn); \ NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \ @@ -81,7 +77,6 @@ public: NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode) { return _to SetTooltipNode(aTooltipNode); } \ NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher) { return _to GetCommandDispatcher(aCommandDispatcher); } \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \ - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn) { return _to GetElementById(aId, aReturn); } \ NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \ diff --git a/mozilla/dom/src/coreDOM/nsJSDocument.cpp b/mozilla/dom/src/coreDOM/nsJSDocument.cpp index 3667a076da4..36af1881d5d 100644 --- a/mozilla/dom/src/coreDOM/nsJSDocument.cpp +++ b/mozilla/dom/src/coreDOM/nsJSDocument.cpp @@ -35,9 +35,10 @@ #include "nsDOMPropEnums.h" #include "nsString.h" #include "nsIDOMElement.h" -#include "nsIDOMDocument.h" #include "nsIDOMAttr.h" +#include "nsIDOMDocument.h" #include "nsIDOMProcessingInstruction.h" +#include "nsIDOMNode.h" #include "nsIDOMCDATASection.h" #include "nsIDOMStyleSheetCollection.h" #include "nsIDOMText.h" @@ -55,9 +56,10 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID); -static NS_DEFINE_IID(kIDocumentIID, NS_IDOMDOCUMENT_IID); static NS_DEFINE_IID(kIAttrIID, NS_IDOMATTR_IID); +static NS_DEFINE_IID(kIDocumentIID, NS_IDOMDOCUMENT_IID); static NS_DEFINE_IID(kIProcessingInstructionIID, NS_IDOMPROCESSINGINSTRUCTION_IID); +static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID); static NS_DEFINE_IID(kICDATASectionIID, NS_IDOMCDATASECTION_IID); static NS_DEFINE_IID(kIStyleSheetCollectionIID, NS_IDOMSTYLESHEETCOLLECTION_IID); static NS_DEFINE_IID(kITextIID, NS_IDOMTEXT_IID); @@ -671,6 +673,232 @@ DocumentGetElementsByTagName(JSContext *cx, JSObject *obj, uintN argc, jsval *ar } +// +// Native method ImportNode +// +PR_STATIC_CALLBACK(JSBool) +DocumentImportNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMDocument *nativeThis = (nsIDOMDocument*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + nsIDOMNode* nativeRet; + nsCOMPtr b0; + PRBool b1; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_IMPORTNODE, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + if (argc < 2) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); + } + + if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)(void**)getter_AddRefs(b0), + kINodeIID, + "Node", + cx, + argv[0])) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR); + } + if (!nsJSUtils::nsConvertJSValToBool(&b1, cx, argv[1])) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_BOOLEAN_ERR); + } + + result = nativeThis->ImportNode(b0, b1, &nativeRet); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); + } + + return JS_TRUE; +} + + +// +// Native method CreateElementNS +// +PR_STATIC_CALLBACK(JSBool) +DocumentCreateElementNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMDocument *nativeThis = (nsIDOMDocument*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + nsIDOMElement* nativeRet; + nsAutoString b0; + nsAutoString b1; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEELEMENTNS, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + if (argc < 2) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); + } + + nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); + nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]); + + result = nativeThis->CreateElementNS(b0, b1, &nativeRet); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); + } + + return JS_TRUE; +} + + +// +// Native method CreateAttributeNS +// +PR_STATIC_CALLBACK(JSBool) +DocumentCreateAttributeNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMDocument *nativeThis = (nsIDOMDocument*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + nsIDOMAttr* nativeRet; + nsAutoString b0; + nsAutoString b1; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_CREATEATTRIBUTENS, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + if (argc < 2) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); + } + + nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); + nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]); + + result = nativeThis->CreateAttributeNS(b0, b1, &nativeRet); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); + } + + return JS_TRUE; +} + + +// +// Native method GetElementsByTagNameNS +// +PR_STATIC_CALLBACK(JSBool) +DocumentGetElementsByTagNameNS(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMDocument *nativeThis = (nsIDOMDocument*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + nsIDOMNodeList* nativeRet; + nsAutoString b0; + nsAutoString b1; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_GETELEMENTSBYTAGNAMENS, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + if (argc < 2) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); + } + + nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); + nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]); + + result = nativeThis->GetElementsByTagNameNS(b0, b1, &nativeRet); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); + } + + return JS_TRUE; +} + + +// +// Native method GetElementById +// +PR_STATIC_CALLBACK(JSBool) +DocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + nsIDOMDocument *nativeThis = (nsIDOMDocument*)nsJSUtils::nsGetNativeThis(cx, obj); + nsresult result = NS_OK; + nsIDOMElement* nativeRet; + nsAutoString b0; + // If there's no private data, this must be the prototype, so ignore + if (nsnull == nativeThis) { + return JS_TRUE; + } + + { + *rval = JSVAL_NULL; + nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); + if (!secMan) + return PR_FALSE; + result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_DOCUMENT_GETELEMENTBYID, PR_FALSE); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + if (argc < 1) { + return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); + } + + nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); + + result = nativeThis->GetElementById(b0, &nativeRet); + if (NS_FAILED(result)) { + return nsJSUtils::nsReportError(cx, obj, result); + } + + nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); + } + + return JS_TRUE; +} + + // // Native method CreateElementWithNameSpace // @@ -811,6 +1039,11 @@ static JSFunctionSpec DocumentMethods[] = {"createAttribute", DocumentCreateAttribute, 1}, {"createEntityReference", DocumentCreateEntityReference, 1}, {"getElementsByTagName", DocumentGetElementsByTagName, 1}, + {"importNode", DocumentImportNode, 2}, + {"createElementNS", DocumentCreateElementNS, 2}, + {"createAttributeNS", DocumentCreateAttributeNS, 2}, + {"getElementsByTagNameNS", DocumentGetElementsByTagNameNS, 2}, + {"getElementById", DocumentGetElementById, 1}, {"createElementWithNameSpace", NSDocumentCreateElementWithNameSpace, 2}, {"createRange", NSDocumentCreateRange, 0}, {0} diff --git a/mozilla/dom/src/html/nsJSHTMLDocument.cpp b/mozilla/dom/src/html/nsJSHTMLDocument.cpp index 43ab9cb3283..cc996b6f613 100644 --- a/mozilla/dom/src/html/nsJSHTMLDocument.cpp +++ b/mozilla/dom/src/html/nsJSHTMLDocument.cpp @@ -34,7 +34,6 @@ #include "nsCOMPtr.h" #include "nsDOMPropEnums.h" #include "nsString.h" -#include "nsIDOMElement.h" #include "nsIDOMHTMLElement.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMNSHTMLDocument.h" @@ -46,7 +45,6 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); -static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID); static NS_DEFINE_IID(kIHTMLElementIID, NS_IDOMHTMLELEMENT_IID); static NS_DEFINE_IID(kIHTMLDocumentIID, NS_IDOMHTMLDOCUMENT_IID); static NS_DEFINE_IID(kINSHTMLDocumentIID, NS_IDOMNSHTMLDOCUMENT_IID); @@ -674,48 +672,6 @@ HTMLDocumentClose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval * } -// -// Native method GetElementById -// -PR_STATIC_CALLBACK(JSBool) -HTMLDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - nsIDOMHTMLDocument *nativeThis = (nsIDOMHTMLDocument*)nsJSUtils::nsGetNativeThis(cx, obj); - nsresult result = NS_OK; - nsIDOMElement* nativeRet; - nsAutoString b0; - // If there's no private data, this must be the prototype, so ignore - if (nsnull == nativeThis) { - return JS_TRUE; - } - - { - *rval = JSVAL_NULL; - nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); - if (!secMan) - return PR_FALSE; - result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLDOCUMENT_GETELEMENTBYID, PR_FALSE); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - if (argc < 1) { - return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); - } - - nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - - result = nativeThis->GetElementById(b0, &nativeRet); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - - nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); - } - - return JS_TRUE; -} - - // // Native method GetElementsByName // @@ -1202,7 +1158,6 @@ static JSPropertySpec HTMLDocumentProperties[] = static JSFunctionSpec HTMLDocumentMethods[] = { {"close", HTMLDocumentClose, 0}, - {"getElementById", HTMLDocumentGetElementById, 1}, {"getElementsByName", HTMLDocumentGetElementsByName, 1}, {"getSelection", NSHTMLDocumentGetSelection, 0}, {"namedItem", NSHTMLDocumentNamedItem, 0}, diff --git a/mozilla/dom/src/xul/nsJSXULDocument.cpp b/mozilla/dom/src/xul/nsJSXULDocument.cpp index 60077e61389..0d448588058 100644 --- a/mozilla/dom/src/xul/nsJSXULDocument.cpp +++ b/mozilla/dom/src/xul/nsJSXULDocument.cpp @@ -34,7 +34,6 @@ #include "nsCOMPtr.h" #include "nsDOMPropEnums.h" #include "nsString.h" -#include "nsIDOMElement.h" #include "nsIDOMNode.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULDocument.h" @@ -45,7 +44,6 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); -static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID); static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID); static NS_DEFINE_IID(kIXULCommandDispatcherIID, NS_IDOMXULCOMMANDDISPATCHER_IID); static NS_DEFINE_IID(kIXULDocumentIID, NS_IDOMXULDOCUMENT_IID); @@ -243,48 +241,6 @@ ResolveXULDocument(JSContext *cx, JSObject *obj, jsval id) } -// -// Native method GetElementById -// -PR_STATIC_CALLBACK(JSBool) -XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj); - nsresult result = NS_OK; - nsIDOMElement* nativeRet; - nsAutoString b0; - // If there's no private data, this must be the prototype, so ignore - if (nsnull == nativeThis) { - return JS_TRUE; - } - - { - *rval = JSVAL_NULL; - nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); - if (!secMan) - return PR_FALSE; - result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID, PR_FALSE); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - if (argc < 1) { - return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); - } - - nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - - result = nativeThis->GetElementById(b0, &nativeRet); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - - nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); - } - - return JS_TRUE; -} - - // // Native method GetElementsByAttribute // @@ -410,7 +366,6 @@ static JSPropertySpec XULDocumentProperties[] = // static JSFunctionSpec XULDocumentMethods[] = { - {"getElementById", XULDocumentGetElementById, 1}, {"getElementsByAttribute", XULDocumentGetElementsByAttribute, 2}, {"persist", XULDocumentPersist, 2}, {0} diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 82f7649f855..e4f0a87ca8f 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -2075,6 +2075,43 @@ nsHTMLDocument::GetElementById(const nsString& aElementId, nsIDOMElement** aRetu return NS_OK; } +NS_IMETHODIMP +nsHTMLDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsHTMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + + PRBool nsHTMLDocument::MatchNameAttribute(nsIContent* aContent, nsString* aData) { diff --git a/mozilla/layout/xml/document/src/nsXMLDocument.cpp b/mozilla/layout/xml/document/src/nsXMLDocument.cpp index 8896f72d138..9fec1fe670c 100644 --- a/mozilla/layout/xml/document/src/nsXMLDocument.cpp +++ b/mozilla/layout/xml/document/src/nsXMLDocument.cpp @@ -696,6 +696,50 @@ nsXMLDocument::CreateElementWithNameSpace(const nsString& aTagName, return rv; } +NS_IMETHODIMP +nsXMLDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::GetElementById(const nsString& aElementId, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXMLDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + // nsIXMLDocument interface static nsIContent * diff --git a/mozilla/layout/xml/document/src/nsXMLDocument.h b/mozilla/layout/xml/document/src/nsXMLDocument.h index 28cf5448b7b..cf7eed48e4b 100644 --- a/mozilla/layout/xml/document/src/nsXMLDocument.h +++ b/mozilla/layout/xml/document/src/nsXMLDocument.h @@ -68,6 +68,21 @@ public: NS_IMETHOD CreateElementWithNameSpace(const nsString& aTagName, const nsString& aNameSpace, nsIDOMElement** aReturn); + NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn); + NS_IMETHOD CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn); + NS_IMETHOD CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn); + NS_IMETHOD GetElementById(const nsString& aElementId, + nsIDOMElement** aReturn); + NS_IMETHOD GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn); + // nsIXMLDocument interface NS_IMETHOD GetContentById(const nsString& aName, nsIContent** aContent); diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index 41430c09d1e..f990476603b 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -382,24 +382,28 @@ pref("signed.applets.codebase_principal_support", false); pref("security.policy.default.barprop.visible.write", "UniversalBrowserWrite"); pref("security.policy.default.document.createattribute", "sameOrigin"); +pref("security.policy.default.document.createattributens", "sameOrigin"); pref("security.policy.default.document.createcdatasection", "sameOrigin"); pref("security.policy.default.document.createcomment", "sameOrigin"); pref("security.policy.default.document.createdocumentfragment", "sameOrigin"); pref("security.policy.default.document.createelement", "sameOrigin"); +pref("security.policy.default.document.createelementns", "sameOrigin"); pref("security.policy.default.document.createentityreference", "sameOrigin"); pref("security.policy.default.document.createprocessinginstruction", "sameOrigin"); pref("security.policy.default.document.createtextnode", "sameOrigin"); pref("security.policy.default.document.doctype", "sameOrigin"); pref("security.policy.default.document.documentelement", "sameOrigin"); +pref("security.policy.default.document.getelementbyid", "sameOrigin"); pref("security.policy.default.document.getelementsbytagname", "sameOrigin"); +pref("security.policy.default.document.getelementsbytagnamens", "sameOrigin"); pref("security.policy.default.document.implementation", "sameOrigin"); +pref("security.policy.default.document.importnode", "sameOrigin"); pref("security.policy.default.htmldocument.anchors", "sameOrigin"); pref("security.policy.default.htmldocument.applets", "sameOrigin"); pref("security.policy.default.htmldocument.body", "sameOrigin"); pref("security.policy.default.htmldocument.cookie", "sameOrigin"); pref("security.policy.default.htmldocument.domain", "sameOrigin"); pref("security.policy.default.htmldocument.forms", "sameOrigin"); -pref("security.policy.default.htmldocument.getelementbyid", "sameOrigin"); pref("security.policy.default.htmldocument.getelementsbyname", "sameOrigin"); pref("security.policy.default.htmldocument.links", "sameOrigin"); pref("security.policy.default.htmldocument.referrer", "sameOrigin"); diff --git a/mozilla/rdf/content/public/idl/XULDocument.idl b/mozilla/rdf/content/public/idl/XULDocument.idl index 64b003f3227..72765b38b06 100644 --- a/mozilla/rdf/content/public/idl/XULDocument.idl +++ b/mozilla/rdf/content/public/idl/XULDocument.idl @@ -8,7 +8,6 @@ interface XULDocument : Document { readonly attribute XULCommandDispatcher commandDispatcher; - Element getElementById(in DOMString id); NodeList getElementsByAttribute(in DOMString name, in DOMString value); void persist(in DOMString id, in DOMString attr); diff --git a/mozilla/rdf/content/public/nsIDOMXULDocument.h b/mozilla/rdf/content/public/nsIDOMXULDocument.h index 0f192ae47e6..fa04b1ddb77 100644 --- a/mozilla/rdf/content/public/nsIDOMXULDocument.h +++ b/mozilla/rdf/content/public/nsIDOMXULDocument.h @@ -29,7 +29,6 @@ #include "nsIScriptContext.h" #include "nsIDOMDocument.h" -class nsIDOMElement; class nsIDOMNode; class nsIDOMXULCommandDispatcher; class nsIDOMHTMLCollection; @@ -53,8 +52,6 @@ public: NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls)=0; - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn)=0; - NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn)=0; NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr)=0; @@ -68,7 +65,6 @@ public: NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode); \ NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher); \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls); \ - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn); \ NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn); \ NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr); \ @@ -81,7 +77,6 @@ public: NS_IMETHOD SetTooltipNode(nsIDOMNode* aTooltipNode) { return _to SetTooltipNode(aTooltipNode); } \ NS_IMETHOD GetCommandDispatcher(nsIDOMXULCommandDispatcher** aCommandDispatcher) { return _to GetCommandDispatcher(aCommandDispatcher); } \ NS_IMETHOD GetControls(nsIDOMHTMLCollection** aControls) { return _to GetControls(aControls); } \ - NS_IMETHOD GetElementById(const nsString& aId, nsIDOMElement** aReturn) { return _to GetElementById(aId, aReturn); } \ NS_IMETHOD GetElementsByAttribute(const nsString& aName, const nsString& aValue, nsIDOMNodeList** aReturn) { return _to GetElementsByAttribute(aName, aValue, aReturn); } \ NS_IMETHOD Persist(const nsString& aId, const nsString& aAttr) { return _to Persist(aId, aAttr); } \ diff --git a/mozilla/rdf/content/src/nsJSXULDocument.cpp b/mozilla/rdf/content/src/nsJSXULDocument.cpp index 60077e61389..0d448588058 100644 --- a/mozilla/rdf/content/src/nsJSXULDocument.cpp +++ b/mozilla/rdf/content/src/nsJSXULDocument.cpp @@ -34,7 +34,6 @@ #include "nsCOMPtr.h" #include "nsDOMPropEnums.h" #include "nsString.h" -#include "nsIDOMElement.h" #include "nsIDOMNode.h" #include "nsIDOMXULCommandDispatcher.h" #include "nsIDOMXULDocument.h" @@ -45,7 +44,6 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); -static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID); static NS_DEFINE_IID(kINodeIID, NS_IDOMNODE_IID); static NS_DEFINE_IID(kIXULCommandDispatcherIID, NS_IDOMXULCOMMANDDISPATCHER_IID); static NS_DEFINE_IID(kIXULDocumentIID, NS_IDOMXULDOCUMENT_IID); @@ -243,48 +241,6 @@ ResolveXULDocument(JSContext *cx, JSObject *obj, jsval id) } -// -// Native method GetElementById -// -PR_STATIC_CALLBACK(JSBool) -XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) -{ - nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj); - nsresult result = NS_OK; - nsIDOMElement* nativeRet; - nsAutoString b0; - // If there's no private data, this must be the prototype, so ignore - if (nsnull == nativeThis) { - return JS_TRUE; - } - - { - *rval = JSVAL_NULL; - nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj); - if (!secMan) - return PR_FALSE; - result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULDOCUMENT_GETELEMENTBYID, PR_FALSE); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - if (argc < 1) { - return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR); - } - - nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]); - - result = nativeThis->GetElementById(b0, &nativeRet); - if (NS_FAILED(result)) { - return nsJSUtils::nsReportError(cx, obj, result); - } - - nsJSUtils::nsConvertObjectToJSVal(nativeRet, cx, obj, rval); - } - - return JS_TRUE; -} - - // // Native method GetElementsByAttribute // @@ -410,7 +366,6 @@ static JSPropertySpec XULDocumentProperties[] = // static JSFunctionSpec XULDocumentMethods[] = { - {"getElementById", XULDocumentGetElementById, 1}, {"getElementsByAttribute", XULDocumentGetElementsByAttribute, 2}, {"persist", XULDocumentPersist, 2}, {0} diff --git a/mozilla/rdf/content/src/nsXULDocument.cpp b/mozilla/rdf/content/src/nsXULDocument.cpp index d1e81ae15b0..a49bb0ec79e 100644 --- a/mozilla/rdf/content/src/nsXULDocument.cpp +++ b/mozilla/rdf/content/src/nsXULDocument.cpp @@ -2732,6 +2732,33 @@ nsXULDocument::GetControls(nsIDOMHTMLCollection ** aResult) { return NS_OK; } +NS_IMETHODIMP +nsXULDocument::ImportNode(nsIDOMNode* aImportedNode, + PRBool aDeep, + nsIDOMNode** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXULDocument::CreateElementNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMElement** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP +nsXULDocument::CreateAttributeNS(const nsString& aNamespaceURI, + const nsString& aQualifiedName, + nsIDOMAttr** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + NS_IMETHODIMP nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) { @@ -2752,6 +2779,15 @@ nsXULDocument::GetElementById(const nsString& aId, nsIDOMElement** aReturn) return rv; } +NS_IMETHODIMP +nsXULDocument::GetElementsByTagNameNS(const nsString& aNamespaceURI, + const nsString& aLocalName, + nsIDOMNodeList** aReturn) +{ + NS_NOTYETIMPLEMENTED("write me"); + return NS_ERROR_NOT_IMPLEMENTED; +} + nsresult nsXULDocument::AddSubtreeToDocument(nsIContent* aElement) { diff --git a/mozilla/rdf/content/src/nsXULDocument.h b/mozilla/rdf/content/src/nsXULDocument.h index aa94d9e409b..4a1d3515947 100644 --- a/mozilla/rdf/content/src/nsXULDocument.h +++ b/mozilla/rdf/content/src/nsXULDocument.h @@ -325,19 +325,7 @@ public: PRBool aUseCapture); // nsIDOMDocument interface - NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype); - NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation); - NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement); - - NS_IMETHOD CreateElement(const nsString& aTagName, nsIDOMElement** aReturn); - NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn); - NS_IMETHOD CreateTextNode(const nsString& aData, nsIDOMText** aReturn); - NS_IMETHOD CreateComment(const nsString& aData, nsIDOMComment** aReturn); - NS_IMETHOD CreateCDATASection(const nsString& aData, nsIDOMCDATASection** aReturn); - NS_IMETHOD CreateProcessingInstruction(const nsString& aTarget, const nsString& aData, nsIDOMProcessingInstruction** aReturn); - NS_IMETHOD CreateAttribute(const nsString& aName, nsIDOMAttr** aReturn); - NS_IMETHOD CreateEntityReference(const nsString& aName, nsIDOMEntityReference** aReturn); - NS_IMETHOD GetElementsByTagName(const nsString& aTagname, nsIDOMNodeList** aReturn); + NS_DECL_IDOMDOCUMENT // nsIDOMNSDocument interface NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetCollection** aStyleSheets);