Bug 799905 - .URL and .compatMode should be defined on Document, not HTMLDocument; r=bz

This commit is contained in:
Aryeh Gregor 2012-10-11 14:48:31 +02:00
parent 1db5e37444
commit 0159561890
8 changed files with 41 additions and 64 deletions

View File

@ -6073,7 +6073,35 @@ nsDocument::GetDocumentURI(nsAString& aDocumentURI)
mDocumentURI->GetSpec(uri);
CopyUTF8toUTF16(uri, aDocumentURI);
} else {
SetDOMStringToNull(aDocumentURI);
aDocumentURI.Truncate();
}
return NS_OK;
}
// Alias of above
NS_IMETHODIMP
nsDocument::GetURL(nsAString& aURL)
{
return GetDocumentURI(aURL);
}
// readonly attribute DOMString compatMode;
// Returns "BackCompat" if we are in quirks mode, "CSS1Compat" if we are
// in almost standards or full standards mode. See bug 105640. This was
// implemented to match MSIE's compatMode property.
NS_IMETHODIMP
nsDocument::GetCompatMode(nsAString& aCompatMode)
{
NS_ASSERTION(mCompatMode == eCompatibility_NavQuirks ||
mCompatMode == eCompatibility_AlmostStandards ||
mCompatMode == eCompatibility_FullStandards,
"mCompatMode is neither quirks nor strict for this document");
if (mCompatMode == eCompatibility_NavQuirks) {
aCompatMode.AssignLiteral("BackCompat");
} else {
aCompatMode.AssignLiteral("CSS1Compat");
}
return NS_OK;

View File

@ -1002,20 +1002,6 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain)
return NodePrincipal()->SetDomain(newURI);
}
NS_IMETHODIMP
nsHTMLDocument::GetURL(nsAString& aURL)
{
nsAutoCString str;
if (mDocumentURI) {
mDocumentURI->GetSpec(str);
}
CopyUTF8toUTF16(str, aURL);
return NS_OK;
}
nsIContent*
nsHTMLDocument::GetBody()
{
@ -2046,27 +2032,6 @@ nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
return NS_OK;
}
// readonly attribute DOMString compatMode;
// Returns "BackCompat" if we are in quirks mode, "CSS1Compat" if we are
// in almost standards or full standards mode. See bug 105640. This was
// implemented to match MSIE's compatMode property
NS_IMETHODIMP
nsHTMLDocument::GetCompatMode(nsAString& aCompatMode)
{
NS_ASSERTION(mCompatMode == eCompatibility_NavQuirks ||
mCompatMode == eCompatibility_AlmostStandards ||
mCompatMode == eCompatibility_FullStandards,
"mCompatMode is neither quirks nor strict for this document");
if (mCompatMode == eCompatibility_NavQuirks) {
aCompatMode.AssignLiteral("BackCompat");
} else {
aCompatMode.AssignLiteral("CSS1Compat");
}
return NS_OK;
}
// Mapped to document.embeds for NS4 compatibility
NS_IMETHODIMP
nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)

View File

@ -58,23 +58,6 @@ nsSVGDocument::GetDomain(nsAString& aDomain)
return NS_OK;
}
/* readonly attribute DOMString URL; */
NS_IMETHODIMP
nsSVGDocument::GetURL(nsAString& aURL)
{
SetDOMStringToNull(aURL);
if (mDocumentURI) {
nsAutoCString url;
nsresult rv = mDocumentURI->GetSpec(url);
if (url.IsEmpty() || NS_FAILED(rv))
return rv;
CopyUTF8toUTF16(url, aURL);
}
return NS_OK;
}
/* readonly attribute SVGSVGElement rootElement; */
NS_IMETHODIMP
nsSVGDocument::GetRootElement(nsIDOMSVGSVGElement** aRootElement)

View File

@ -161,8 +161,6 @@
"XMLDocument interface: existence and properties of interface prototype object": true,
"XMLDocument interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Stringification of xmlDoc": "debug",
"Document interface: xmlDoc must inherit property \"URL\" with the proper type (1)": true,
"Document interface: xmlDoc must inherit property \"compatMode\" with the proper type (3)": true,
"Document interface: calling getElementsByTagName(DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling getElementsByTagNameNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError": true,
"Document interface: calling getElementsByClassName(DOMString) on xmlDoc with too few arguments must throw TypeError": true,

View File

@ -27,7 +27,7 @@ interface nsIDOMLocation;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(FDB92F4F-C6B4-4509-A29D-A309981E28AC)]
[scriptable, uuid(22af46a3-64ac-430a-bcc7-d0a9aefe474f)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -68,6 +68,8 @@ interface nsIDOMDocument : nsIDOMNode
readonly attribute DOMString inputEncoding;
// Introduced in DOM Level 3:
readonly attribute DOMString documentURI;
// Alias introduced for all documents in recent DOM standards
readonly attribute DOMString URL;
// Introduced in DOM Level 3:
nsIDOMNode adoptNode(in nsIDOMNode source)
raises(DOMException);
@ -385,4 +387,10 @@ interface nsIDOMDocument : nsIDOMNode
*/
readonly attribute boolean mozHidden;
readonly attribute DOMString mozVisibilityState;
/**
* Returns "BackCompat" if we're in quirks mode or "CSS1Compat" if we're in
* strict mode. (XML documents are always in strict mode.)
*/
readonly attribute DOMString compatMode;
};

View File

@ -13,15 +13,11 @@
*/
interface nsISelection;
[scriptable, uuid(ecae54c6-2ab9-4167-b0ef-61960aadbb68)]
[scriptable, uuid(3f8666a9-76f0-4733-ae11-4aea8753062d)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
readonly attribute DOMString URL;
attribute DOMString domain;
attribute DOMString cookie;
// returns "BackCompat" if we're in quirks mode,
// or "CSS1Compat" if we're in strict mode
readonly attribute DOMString compatMode;
readonly attribute nsIDOMHTMLHeadElement head;
attribute nsIDOMHTMLElement body;

View File

@ -7,10 +7,9 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(4AEBF9E7-F275-4147-AA90-601626476132)]
[scriptable, uuid(8fe506e4-5563-4b16-9228-182071e3f8f8)]
interface nsIDOMSVGDocument : nsIDOMDocument
{
readonly attribute DOMString domain;
readonly attribute DOMString URL;
readonly attribute nsIDOMSVGSVGElement rootElement;
};

View File

@ -95,6 +95,7 @@ members = [
'nsIDOMDocument.onreadystatechange',
'nsIDOMDocument.onmouseenter',
'nsIDOMDocument.onmouseleave',
'nsIDOMDocument.URL',
'nsIDOMElement.removeAttributeNS',
'nsIDOMElement.removeAttribute',
'nsIDOMElement.getAttribute',
@ -207,7 +208,6 @@ members = [
'nsIDOMHTMLDocument.getElementsByName',
'nsIDOMHTMLDocument.anchors',
'nsIDOMHTMLDocument.links',
'nsIDOMHTMLDocument.URL',
'nsIDOMHTMLDocument.forms',
'nsIDOMHTMLDocument.cookie',
'nsIDOMHTMLDocument.images',