Bug 1418076 part 1. Get rid of nsIDOMHTMLDocument's domain attribute. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 26 Jan 2018 01:00:04 -0500
changeset 748753 e2b9d1d7a5e9672bc7098659648a4854ecbbc29d
parent 748752 c6e0fe339cb1e7c0c029e68be5332e52f53ab6b7
child 748754 ffbb8173065025fea677f9cfa678d376288eb739
push id97228
push usersfraser@mozilla.com
push dateTue, 30 Jan 2018 10:21:04 +0000
reviewersmystor
bugs1418076
milestone60.0a1
Bug 1418076 part 1. Get rid of nsIDOMHTMLDocument's domain attribute. r=mystor MozReview-Commit-ID: Igf83iosX8L
dom/html/nsHTMLDocument.cpp
dom/html/nsHTMLDocument.h
dom/interfaces/html/nsIDOMHTMLDocument.idl
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -895,36 +895,35 @@ nsHTMLDocument::GetDomainURI()
     return uri.forget();
   }
 
   principal->GetURI(getter_AddRefs(uri));
   return uri.forget();
 }
 
 
-NS_IMETHODIMP
+void
 nsHTMLDocument::GetDomain(nsAString& aDomain)
 {
   nsCOMPtr<nsIURI> uri = GetDomainURI();
 
   if (!uri) {
     SetDOMStringToNull(aDomain);
-    return NS_OK;
+    return;
   }
 
   nsAutoCString hostName;
   nsresult rv = nsContentUtils::GetHostOrIPv6WithBrackets(uri, hostName);
   if (NS_SUCCEEDED(rv)) {
     CopyUTF8toUTF16(hostName, aDomain);
   } else {
     // If we can't get the host from the URI (e.g. about:, javascript:,
     // etc), just return an null string.
     SetDOMStringToNull(aDomain);
   }
-  return NS_OK;
 }
 
 already_AddRefed<nsIURI>
 nsHTMLDocument::CreateInheritingURIForHost(const nsACString& aHostString)
 {
   if (aHostString.IsEmpty()) {
     return nullptr;
   }
@@ -1028,24 +1027,16 @@ nsHTMLDocument::IsRegistrableDomainSuffi
   if (!newURI) {
     // Error: illegal domain
     return false;
   }
   return true;
 }
 
 
-NS_IMETHODIMP
-nsHTMLDocument::SetDomain(const nsAString& aDomain)
-{
-  ErrorResult rv;
-  SetDomain(aDomain, rv);
-  return rv.StealNSResult();
-}
-
 void
 nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
 {
   if (mSandboxFlags & SANDBOXED_DOMAIN) {
     // We're sandboxed; disallow setting domain
     rv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
   }
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -158,16 +158,17 @@ public:
   virtual void DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const override;
   // DocAddSizeOfIncludingThis is inherited from nsIDocument.
 
   virtual bool WillIgnoreCharsetOverride() override;
 
   // WebIDL API
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
     override;
+  void GetDomain(nsAString& aDomain);
   void SetDomain(const nsAString& aDomain, mozilla::ErrorResult& rv);
   bool IsRegistrableDomainSuffixOfOrEqualTo(const nsAString& aHostSuffixString,
                                             const nsACString& aOrigHost);
   void GetCookie(nsAString& aCookie, mozilla::ErrorResult& rv);
   void SetCookie(const nsAString& aCookie, mozilla::ErrorResult& rv);
   void NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound,
                    JS::MutableHandle<JSObject*> aRetval,
                    mozilla::ErrorResult& rv);
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -11,17 +11,16 @@
  *
  * @see <http://www.whatwg.org/html/>
  */
 interface nsISelection;
 
 [uuid(cd31e61f-cfc2-4b91-9385-17b6a2d0633d)]
 interface nsIDOMHTMLDocument : nsIDOMDocument
 {
-           attribute DOMString            domain;
            attribute DOMString            cookie;
 
   readonly attribute nsISupports          head;
 
   // If aContentType is not something supported by nsHTMLDocument and
   // the HTML content sink, trying to write to the document will
   // probably throw.
   // Pass aReplace = true to trigger a replacement of the previous