Bug 1457689 - Fix documain.domain setting exception type; r=bz
Change exception type to comply with HTML spec, which uses security
error instead of bad document domain.
MozReview-Commit-ID: Iefkeskn9bM
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1014,34 +1014,34 @@ nsHTMLDocument::SetDomain(const nsAStrin
{
if (mSandboxFlags & SANDBOXED_DOMAIN) {
// We're sandboxed; disallow setting domain
rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
}
if (aDomain.IsEmpty()) {
- rv.Throw(NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN);
+ rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
}
nsCOMPtr<nsIURI> uri = GetDomainURI();
if (!uri) {
rv.Throw(NS_ERROR_FAILURE);
return;
}
// Check new domain - must be a superdomain of the current host
// For example, a page from foo.bar.com may set domain to bar.com,
// but not to ar.com, baz.com, or fi.foo.bar.com.
nsCOMPtr<nsIURI> newURI = RegistrableDomainSuffixOfInternal(aDomain, uri);
if (!newURI) {
// Error: illegal domain
- rv.Throw(NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN);
+ rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
return;
}
rv = NodePrincipal()->SetDomain(newURI);
}
already_AddRefed<nsIChannel>
nsHTMLDocument::CreateDummyChannelForCookies(nsIURI* aCodebaseURI)
deleted file mode 100644
--- a/testing/web-platform/meta/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[document_domain_setter.html]
- [failed setting of document.domain]
- expected: FAIL
-