Bug 987556 Part 12 Remove the nsString ConvertToUTF16() compat shim. r=bz
authorBen Kelly <ben@wanderview.com>
Fri, 25 Apr 2014 10:11:57 -0400
changeset 180571 02eb81ab06cb0abcd849c480363083fa7faa915c
parent 180570 e034bbc3172ef6a7f11f859aeaf5ca9972cdc548
child 180572 1bab9339e6d427eb6d5745ccdd2358027c2c4cbf
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersbz
bugs987556
milestone31.0a1
Bug 987556 Part 12 Remove the nsString ConvertToUTF16() compat shim. r=bz
content/base/src/nsScriptLoader.cpp
content/base/src/nsScriptLoader.h
--- a/content/base/src/nsScriptLoader.cpp
+++ b/content/base/src/nsScriptLoader.cpp
@@ -1341,33 +1341,16 @@ nsScriptLoader::ConvertToUTF16(nsIChanne
   if (NS_FAILED(rv)) {
     js_free(aBufOut);
     aBufOut = nullptr;
     aLengthOut = 0;
   }
   return rv;
 }
 
-/* static */ nsresult
-nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
-                               uint32_t aLength, const nsAString& aHintCharset,
-                               nsIDocument* aDocument, nsString& aString)
-{
-  jschar* bufOut = nullptr;
-  size_t lengthOut = 0;
-  nsresult rv = ConvertToUTF16(aChannel, aData, aLength, aHintCharset,
-                aDocument, bufOut, lengthOut);
-  aString.SetLength(lengthOut);
-  if (bufOut) {
-    memcpy(aString.BeginWriting(), bufOut, lengthOut * sizeof(jschar));
-    js_free(bufOut);
-  }
-  return rv;
-}
-
 NS_IMETHODIMP
 nsScriptLoader::OnStreamComplete(nsIStreamLoader* aLoader,
                                  nsISupports* aContext,
                                  nsresult aStatus,
                                  uint32_t aStringLen,
                                  const uint8_t* aString)
 {
   nsScriptLoadRequest* request = static_cast<nsScriptLoadRequest*>(aContext);
--- a/content/base/src/nsScriptLoader.h
+++ b/content/base/src/nsScriptLoader.h
@@ -152,32 +152,16 @@ public:
    */
   static nsresult ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
                                  uint32_t aLength,
                                  const nsAString& aHintCharset,
                                  nsIDocument* aDocument,
                                  jschar*& aBufOut, size_t& aLengthOut);
 
   /**
-   * Convert the given buffer to a UTF-16 string.
-   * @param aChannel     Channel corresponding to the data. May be null.
-   * @param aData        The data to convert
-   * @param aLength      Length of the data
-   * @param aHintCharset Hint for the character set (e.g., from a charset
-   *                     attribute). May be the empty string.
-   * @param aDocument    Document which the data is loaded for. Must not be
-   *                     null.
-   * @param aString      [out] Data as converted to unicode
-   */
-  static nsresult ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
-                                 uint32_t aLength,
-                                 const nsAString& aHintCharset,
-                                 nsIDocument* aDocument, nsString& aString);
-
-  /**
    * Processes any pending requests that are ready for processing.
    */
   void ProcessPendingRequests();
 
   /**
    * Check whether it's OK to load a script from aURI in
    * aDocument.
    */