Bug 819475 - Make document.domain non-nullable; r=bz
authorKyle Machulis <kyle@nonpolynomial.com>
Thu, 07 Jun 2018 12:29:23 -0700
changeset 421995 5edda305eaf0239be020b2e8bc8f90be4bca62d9
parent 421994 8a278eebbe5df459eab42bc7f1f515cbc8e38a01
child 421996 e39c365ce293da434015a5f3ccd55912f39f6f59
push id34113
push userbtara@mozilla.com
push dateSat, 09 Jun 2018 12:05:46 +0000
treeherdermozilla-central@21bc698a4d9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs819475
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 819475 - Make document.domain non-nullable; r=bz Make document.domain non-nullable, to conform to the HTML spec. MozReview-Commit-ID: B1YuQekBgZD
dom/html/nsHTMLDocument.cpp
dom/webidl/HTMLDocument.webidl
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -885,28 +885,28 @@ nsHTMLDocument::GetDomainURI()
 
 
 void
 nsHTMLDocument::GetDomain(nsAString& aDomain)
 {
   nsCOMPtr<nsIURI> uri = GetDomainURI();
 
   if (!uri) {
-    SetDOMStringToNull(aDomain);
+    aDomain.Truncate();
     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);
+    // etc), just return an empty string.
+    aDomain.Truncate();
   }
 }
 
 already_AddRefed<nsIURI>
 nsHTMLDocument::CreateInheritingURIForHost(const nsACString& aHostString)
 {
   if (aHostString.IsEmpty()) {
     return nullptr;
--- a/dom/webidl/HTMLDocument.webidl
+++ b/dom/webidl/HTMLDocument.webidl
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [OverrideBuiltins]
 interface HTMLDocument : Document {
            [SetterThrows]
-           attribute DOMString? domain;
+           attribute DOMString domain;
            [Throws]
            attribute DOMString cookie;
   // DOM tree accessors
   [Throws]
   getter object (DOMString name);
 
   // dynamic markup insertion
   [CEReactions, Throws]