Bug 1434318 part 12. Remove nsIDOMDocument's contentType attribute. r=mystor
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 31 Jan 2018 15:18:11 -0500
changeset 454373 0f7cbca8f63c4684847edd9afee4403272e7bafb
parent 454372 95f9f7eaff90dd35d548c43bf7882ad76edc3442
child 454374 d6abc2e5e842f5a820789a7b317183a6807f9d69
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1434318
milestone60.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 1434318 part 12. Remove nsIDOMDocument's contentType attribute. r=mystor MozReview-Commit-ID: DAXrxIxiac4
dom/base/nsDocument.cpp
dom/base/nsDocument.h
dom/base/nsIDocument.h
dom/interfaces/core/nsIDOMDocument.idl
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
editor/composer/nsEditingSession.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3334,22 +3334,20 @@ nsDocument::GetApplicationCache(nsIAppli
 NS_IMETHODIMP
 nsDocument::SetApplicationCache(nsIApplicationCache *aApplicationCache)
 {
   mApplicationCache = aApplicationCache;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsDocument::GetContentType(nsAString& aContentType)
+void
+nsIDocument::GetContentType(nsAString& aContentType)
 {
   CopyUTF8toUTF16(GetContentTypeInternal(), aContentType);
-
-  return NS_OK;
 }
 
 void
 nsDocument::SetContentType(const nsAString& aContentType)
 {
   SetContentTypeInternal(NS_ConvertUTF16toUTF8(aContentType));
 }
 
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -373,22 +373,16 @@ public:
   virtual already_AddRefed<nsIParser> CreatorParserOrNull() override;
 
   /**
    * Set the principal responsible for this document.
    */
   virtual void SetPrincipal(nsIPrincipal *aPrincipal) override;
 
   /**
-   * Get the Content-Type of this document.
-   */
-  // NS_IMETHOD GetContentType(nsAString& aContentType);
-  // Already declared in nsIDOMDocument
-
-  /**
    * Set the Content-Type of this document.
    */
   virtual void SetContentType(const nsAString& aContentType) override;
 
   virtual void SetBaseURI(nsIURI* aURI) override;
 
   /**
    * Get/Set the base target of a link in a document.
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -559,20 +559,18 @@ public:
    * Remove the (aObserver, aData, aForImage) triple for a specific ID, if
    * registered.
    */
   virtual void RemoveIDTargetObserver(nsAtom* aID, IDTargetObserver aObserver,
                                       void* aData, bool aForImage) = 0;
 
   /**
    * Get the Content-Type of this document.
-   * (This will always return NS_OK, but has this signature to be compatible
-   *  with nsIDOMDocument::GetContentType())
    */
-  NS_IMETHOD GetContentType(nsAString& aContentType) = 0;
+  void GetContentType(nsAString& aContentType);
 
   /**
    * Set the Content-Type of this document.
    */
   virtual void SetContentType(const nsAString& aContentType) = 0;
 
   /**
    * Return the language of this document.
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -117,22 +117,16 @@ interface nsIDOMDocument : nsIDOMNode
    * Callers from XUL documents should wait until the onload event has fired
    * before calling this method.
    *
    * @see <http://dev.w3.org/csswg/cssom-view/#dom-document-elementfrompoint>
    */
   nsIDOMElement             elementFromPoint(in float x, in float y);
 
 
-  // Mozilla extensions
-  /**
-   * @see <https://developer.mozilla.org/en/DOM/document.contentType>
-   */
-  readonly attribute DOMString      contentType;
-
   /**
    * True if this document is synthetic : stand alone image, video, audio file,
    * etc.
    */
   readonly attribute boolean        mozSyntheticDocument;
 
   /**
    * Returns the script element whose script is currently being processed.
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -112,21 +112,18 @@ WebBrowserPersistLocalDocument::GetBaseU
     }
     return uri->GetSpec(aURISpec);
 }
 
 NS_IMETHODIMP
 WebBrowserPersistLocalDocument::GetContentType(nsACString& aContentType)
 {
     nsAutoString utf16Type;
-    nsresult rv;
-
-    rv = mDocument->GetContentType(utf16Type);
-    NS_ENSURE_SUCCESS(rv, rv);
-    aContentType = NS_ConvertUTF16toUTF8(utf16Type);
+    mDocument->GetContentType(utf16Type);
+    CopyUTF16toUTF8(utf16Type, aContentType);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 WebBrowserPersistLocalDocument::GetCharacterSet(nsACString& aCharSet)
 {
     GetCharacterSet()->Name(aCharSet);
     return NS_OK;
--- a/editor/composer/nsEditingSession.cpp
+++ b/editor/composer/nsEditingSession.cpp
@@ -314,18 +314,18 @@ nsEditingSession::SetupEditorOnWindow(mo
   //must get the content type
   // Note: the doc gets this from the network channel during StartPageLoad,
   //    so we don't have to get it from there ourselves
   nsAutoCString mimeCType;
 
   //then lets check the mime type
   if (nsCOMPtr<nsIDocument> doc = window->GetDoc()) {
     nsAutoString mimeType;
-    if (NS_SUCCEEDED(doc->GetContentType(mimeType)))
-      AppendUTF16toUTF8(mimeType, mimeCType);
+    doc->GetContentType(mimeType);
+    AppendUTF16toUTF8(mimeType, mimeCType);
 
     if (IsSupportedTextType(mimeCType.get())) {
       mEditorType.AssignLiteral("text");
       mimeCType = "text/plain";
     } else if (!mimeCType.EqualsLiteral("text/html") &&
                !mimeCType.EqualsLiteral("application/xhtml+xml")) {
       // Neither an acceptable text or html type.
       mEditorStatus = eEditorErrorCantEditMimeType;