Bug 1358410 - Gt rid of CX parameter in BlobSet::AppendString(), r=qdot
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 25 Apr 2017 22:30:23 +0200
changeset 354817 24f0f4caa0313ca2f6135a1cc350b6f8a3f6064c
parent 354816 6a8d0cded18b12eacd2c1abe7b2e96a66349c1cf
child 354818 a3b4b98b525b75f3276f9e226781ee4bcc1a33c0
push id89572
push useramarchesini@mozilla.com
push dateTue, 25 Apr 2017 20:30:40 +0000
treeherdermozilla-inbound@24f0f4caa031 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1358410
milestone55.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 1358410 - Gt rid of CX parameter in BlobSet::AppendString(), r=qdot
dom/file/Blob.cpp
dom/file/BlobSet.cpp
dom/file/BlobSet.h
dom/file/File.cpp
dom/file/MultipartBlobImpl.cpp
dom/file/MultipartBlobImpl.h
--- a/dom/file/Blob.cpp
+++ b/dom/file/Blob.cpp
@@ -251,17 +251,17 @@ Blob::Constructor(const GlobalObject& aG
                   const BlobPropertyBag& aBag,
                   ErrorResult& aRv)
 {
   RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl();
 
   if (aData.WasPassed()) {
     nsAutoString type(aBag.mType);
     MakeValidBlobType(type);
-    impl->InitializeBlob(aGlobal.Context(), aData.Value(), type,
+    impl->InitializeBlob(aData.Value(), type,
                          aBag.mEndings == EndingTypes::Native, aRv);
   } else {
     impl->InitializeBlob(aRv);
   }
 
   if (NS_WARN_IF(aRv.Failed())) {
     return nullptr;
   }
--- a/dom/file/BlobSet.cpp
+++ b/dom/file/BlobSet.cpp
@@ -30,17 +30,17 @@ BlobSet::AppendVoidPtr(const void* aData
 
   RefPtr<BlobImpl> blobImpl = new MemoryBlobImpl(data, aLength, EmptyString());
   mBlobImpls.AppendElement(blobImpl);
 
   return NS_OK;
 }
 
 nsresult
-BlobSet::AppendString(const nsAString& aString, bool nativeEOL, JSContext* aCx)
+BlobSet::AppendString(const nsAString& aString, bool nativeEOL)
 {
   nsCString utf8Str = NS_ConvertUTF16toUTF8(aString);
 
   if (nativeEOL) {
     if (utf8Str.Contains('\r')) {
       utf8Str.ReplaceSubstring("\r\n", "\n");
       utf8Str.ReplaceSubstring("\r", "\n");
     }
--- a/dom/file/BlobSet.h
+++ b/dom/file/BlobSet.h
@@ -17,18 +17,17 @@ namespace dom {
 
 class BlobImpl;
 
 class BlobSet final
 {
 public:
   nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
 
-  nsresult AppendString(const nsAString& aString, bool nativeEOL,
-                        JSContext* aCx);
+  nsresult AppendString(const nsAString& aString, bool nativeEOL);
 
   nsresult AppendBlobImpl(BlobImpl* aBlobImpl);
 
   nsTArray<RefPtr<BlobImpl>>& GetBlobImpls() { return mBlobImpls; }
 
 private:
   nsTArray<RefPtr<BlobImpl>> mBlobImpls;
 };
--- a/dom/file/File.cpp
+++ b/dom/file/File.cpp
@@ -143,17 +143,17 @@ File::Constructor(const GlobalObject& aG
   // Normalizing the filename
   nsString name(aName);
   name.ReplaceChar('/', ':');
 
   RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(name);
 
   nsAutoString type(aBag.mType);
   MakeValidBlobType(type);
-  impl->InitializeBlob(aGlobal.Context(), aData, type, false, aRv);
+  impl->InitializeBlob(aData, type, false, aRv);
   if (aRv.Failed()) {
     return nullptr;
   }
   MOZ_ASSERT(impl->IsFile());
 
   if (aBag.mLastModified.WasPassed()) {
     impl->SetLastModified(aBag.mLastModified.Value());
   }
--- a/dom/file/MultipartBlobImpl.cpp
+++ b/dom/file/MultipartBlobImpl.cpp
@@ -166,35 +166,34 @@ MultipartBlobImpl::CreateSlice(uint64_t 
 void
 MultipartBlobImpl::InitializeBlob(ErrorResult& aRv)
 {
   SetLengthAndModifiedDate(aRv);
   NS_WARNING_ASSERTION(!aRv.Failed(), "SetLengthAndModifiedDate failed");
 }
 
 void
-MultipartBlobImpl::InitializeBlob(JSContext* aCx,
-                                  const Sequence<Blob::BlobPart>& aData,
+MultipartBlobImpl::InitializeBlob(const Sequence<Blob::BlobPart>& aData,
                                   const nsAString& aContentType,
                                   bool aNativeEOL,
                                   ErrorResult& aRv)
 {
   mContentType = aContentType;
   BlobSet blobSet;
 
   for (uint32_t i = 0, len = aData.Length(); i < len; ++i) {
     const Blob::BlobPart& data = aData[i];
 
     if (data.IsBlob()) {
       RefPtr<Blob> blob = data.GetAsBlob().get();
       blobSet.AppendBlobImpl(blob->Impl());
     }
 
     else if (data.IsUSVString()) {
-      aRv = blobSet.AppendString(data.GetAsUSVString(), aNativeEOL, aCx);
+      aRv = blobSet.AppendString(data.GetAsUSVString(), aNativeEOL);
       if (aRv.Failed()) {
         return;
       }
     }
 
     else if (data.IsArrayBuffer()) {
       const ArrayBuffer& buffer = data.GetAsArrayBuffer();
       buffer.ComputeLengthAndData();
--- a/dom/file/MultipartBlobImpl.h
+++ b/dom/file/MultipartBlobImpl.h
@@ -44,18 +44,17 @@ public:
   MultipartBlobImpl()
     : BaseBlobImpl(EmptyString(), UINT64_MAX),
       mIsFromNsIFile(false)
   {
   }
 
   void InitializeBlob(ErrorResult& aRv);
 
-  void InitializeBlob(JSContext* aCx,
-                      const Sequence<Blob::BlobPart>& aData,
+  void InitializeBlob(const Sequence<Blob::BlobPart>& aData,
                       const nsAString& aContentType,
                       bool aNativeEOL,
                       ErrorResult& aRv);
 
   nsresult InitializeChromeFile(nsIFile* aData,
                                 const nsAString& aType,
                                 const nsAString& aName,
                                 bool aLastModifiedPassed,