diff --git a/mozilla/content/base/src/nsContentList.cpp b/mozilla/content/base/src/nsContentList.cpp index ada26bde2dc..f7d47d62a6f 100644 --- a/mozilla/content/base/src/nsContentList.cpp +++ b/mozilla/content/base/src/nsContentList.cpp @@ -188,8 +188,10 @@ nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) if (nsnull != content) { nsAutoString name; // XXX Should it be an EqualsIgnoreCase? - if ((content->GetAttribute("name", name) == eContentAttr_HasValue) && - (aName.Equals(name))) { + if (((content->GetAttribute("NAME", name) == eContentAttr_HasValue) && + (aName.Equals(name))) || + ((content->GetAttribute("ID", name) == eContentAttr_HasValue) && + (aName.Equals(name)))) { return content->QueryInterface(kIDOMNodeIID, (void **)aReturn); } } diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 071a5f5caec..0ee4fce431c 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -39,6 +39,7 @@ #include "CNavDTD.h" #include "nsIScriptGlobalObject.h" #include "nsContentList.h" +#include "nsINetService.h" //#define rickgdebug 1 #ifdef rickgdebug @@ -502,15 +503,35 @@ nsHTMLDocument::GetAnchors(nsIDOMHTMLCollection** aAnchors) NS_IMETHODIMP nsHTMLDocument::GetCookie(nsString& aCookie) { - //XXX TBI - return NS_ERROR_NOT_IMPLEMENTED; + nsINetService *service; + nsresult res = NS_OK; + + res = NS_NewINetService(&service, nsnull); + if ((NS_OK == res) && (nsnull != service)) { + + res = service->GetCookieString(mDocumentURL, aCookie); + + NS_RELEASE(service); + } + + return res; } NS_IMETHODIMP nsHTMLDocument::SetCookie(const nsString& aCookie) { - //XXX TBI - return NS_ERROR_NOT_IMPLEMENTED; + nsINetService *service; + nsresult res = NS_OK; + + res = NS_NewINetService(&service, nsnull); + if ((NS_OK == res) && (nsnull != service)) { + + res = service->SetCookieString(mDocumentURL, aCookie); + + NS_RELEASE(service); + } + + return res; } NS_IMETHODIMP diff --git a/mozilla/layout/base/src/nsContentList.cpp b/mozilla/layout/base/src/nsContentList.cpp index ada26bde2dc..f7d47d62a6f 100644 --- a/mozilla/layout/base/src/nsContentList.cpp +++ b/mozilla/layout/base/src/nsContentList.cpp @@ -188,8 +188,10 @@ nsContentList::NamedItem(const nsString& aName, nsIDOMNode** aReturn) if (nsnull != content) { nsAutoString name; // XXX Should it be an EqualsIgnoreCase? - if ((content->GetAttribute("name", name) == eContentAttr_HasValue) && - (aName.Equals(name))) { + if (((content->GetAttribute("NAME", name) == eContentAttr_HasValue) && + (aName.Equals(name))) || + ((content->GetAttribute("ID", name) == eContentAttr_HasValue) && + (aName.Equals(name)))) { return content->QueryInterface(kIDOMNodeIID, (void **)aReturn); } } diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 071a5f5caec..0ee4fce431c 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -39,6 +39,7 @@ #include "CNavDTD.h" #include "nsIScriptGlobalObject.h" #include "nsContentList.h" +#include "nsINetService.h" //#define rickgdebug 1 #ifdef rickgdebug @@ -502,15 +503,35 @@ nsHTMLDocument::GetAnchors(nsIDOMHTMLCollection** aAnchors) NS_IMETHODIMP nsHTMLDocument::GetCookie(nsString& aCookie) { - //XXX TBI - return NS_ERROR_NOT_IMPLEMENTED; + nsINetService *service; + nsresult res = NS_OK; + + res = NS_NewINetService(&service, nsnull); + if ((NS_OK == res) && (nsnull != service)) { + + res = service->GetCookieString(mDocumentURL, aCookie); + + NS_RELEASE(service); + } + + return res; } NS_IMETHODIMP nsHTMLDocument::SetCookie(const nsString& aCookie) { - //XXX TBI - return NS_ERROR_NOT_IMPLEMENTED; + nsINetService *service; + nsresult res = NS_OK; + + res = NS_NewINetService(&service, nsnull); + if ((NS_OK == res) && (nsnull != service)) { + + res = service->SetCookieString(mDocumentURL, aCookie); + + NS_RELEASE(service); + } + + return res; } NS_IMETHODIMP