Bug 1481176 - P3. Remove nsIMIMEHeaderParam dependency in nsContentTypeParser. r=bzbarsky
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 07 Aug 2018 17:29:50 +0200
changeset 430420 ce551bb46aa27833cdd9e69c8ce5e831f33c9ad7
parent 430419 046c09c65b4a286274fb57ba47adf872cd5f3e3b
child 430421 cbc8352f9578b9881ae27e4e20a9e328e9d0ac7e
push id34403
push usercbrindusan@mozilla.com
push dateTue, 07 Aug 2018 21:52:23 +0000
treeherdermozilla-central@d9e6ce390607 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1481176
milestone63.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 1481176 - P3. Remove nsIMIMEHeaderParam dependency in nsContentTypeParser. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D2863
dom/base/nsContentTypeParser.cpp
dom/base/nsContentTypeParser.h
--- a/dom/base/nsContentTypeParser.cpp
+++ b/dom/base/nsContentTypeParser.cpp
@@ -1,36 +1,27 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "nsContentTypeParser.h"
-#include "nsContentUtils.h"
+#include "nsNetUtil.h"
 
 nsContentTypeParser::nsContentTypeParser(const nsAString& aString)
   : mString(aString)
-  , mService(nullptr)
 {
-  CallGetService("@mozilla.org/network/mime-hdrparam;1", &mService);
-}
-
-nsContentTypeParser::~nsContentTypeParser()
-{
-  NS_IF_RELEASE(mService);
 }
 
 nsresult
 nsContentTypeParser::GetParameter(const char* aParameterName,
                                   nsAString& aResult) const
 {
-  NS_ENSURE_TRUE(mService, NS_ERROR_FAILURE);
-  return mService->GetParameterHTTP(
-    mString, aParameterName, EmptyCString(), false, nullptr, aResult);
+  return net::GetParameterHTTP(mString, aParameterName, aResult);
 }
 
 nsresult
 nsContentTypeParser::GetType(nsAString& aResult) const
 {
   nsresult rv = GetParameter(nullptr, aResult);
   if (NS_FAILED(rv)) {
     return rv;
--- a/dom/base/nsContentTypeParser.h
+++ b/dom/base/nsContentTypeParser.h
@@ -4,25 +4,22 @@
  * 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/. */
 
 #ifndef nsContentTypeParser_h
 #define nsContentTypeParser_h
 
 #include "nsAString.h"
 
-class nsIMIMEHeaderParam;
-
-class nsContentTypeParser {
+class nsContentTypeParser
+{
 public:
   explicit nsContentTypeParser(const nsAString& aString);
-  ~nsContentTypeParser();
 
   nsresult GetParameter(const char* aParameterName, nsAString& aResult) const;
   nsresult GetType(nsAString& aResult) const;
 
 private:
   NS_ConvertUTF16toUTF8 mString;
-  nsIMIMEHeaderParam*   mService;
 };
 
 #endif