Bug 1583251 - P2 - Fix some format nits or naming nits for StructuredClone::Write; r=nika,lth
☠☠ backed out by 53bf396c988d ☠ ☠
authorTom Tung <ttung@mozilla.com>
Tue, 15 Oct 2019 13:49:26 +0000
changeset 498140 5d5e3dc1711872b853b30dd061b6bd9030df4f45
parent 498139 9e9eaa78c43664445e620c82217f4aa6224f82ab
child 498141 248ad59168dd79138efdf8bed3d5863473142b75
push id98311
push userttung@mozilla.com
push dateFri, 18 Oct 2019 13:44:19 +0000
treeherderautoland@bfe390ad771b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika, lth
bugs1583251
milestone71.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 1583251 - P2 - Fix some format nits or naming nits for StructuredClone::Write; r=nika,lth Differential Revision: https://phabricator.services.mozilla.com/D48348
dom/base/StructuredCloneHolder.cpp
dom/base/StructuredCloneHolder.h
js/public/StructuredClone.h
--- a/dom/base/StructuredCloneHolder.cpp
+++ b/dom/base/StructuredCloneHolder.cpp
@@ -167,24 +167,24 @@ void StructuredCloneHolderBase::Clear() 
 bool StructuredCloneHolderBase::Write(JSContext* aCx,
                                       JS::Handle<JS::Value> aValue) {
   return Write(aCx, aValue, JS::UndefinedHandleValue, JS::CloneDataPolicy());
 }
 
 bool StructuredCloneHolderBase::Write(JSContext* aCx,
                                       JS::Handle<JS::Value> aValue,
                                       JS::Handle<JS::Value> aTransfer,
-                                      JS::CloneDataPolicy cloneDataPolicy) {
+                                      JS::CloneDataPolicy aCloneDataPolicy) {
   MOZ_ASSERT(!mBuffer, "Double Write is not allowed");
   MOZ_ASSERT(!mClearCalled, "This method cannot be called after Clear.");
 
   mBuffer = MakeUnique<JSAutoStructuredCloneBuffer>(
       mStructuredCloneScope, &StructuredCloneHolder::sCallbacks, this);
 
-  if (!mBuffer->write(aCx, aValue, aTransfer, cloneDataPolicy,
+  if (!mBuffer->write(aCx, aValue, aTransfer, aCloneDataPolicy,
                       &StructuredCloneHolder::sCallbacks, this)) {
     mBuffer = nullptr;
     return false;
   }
 
   return true;
 }
 
@@ -348,20 +348,20 @@ JSObject* StructuredCloneHolder::ReadFul
     }
 
     JS::RootedValue result(aCx);
     {
       // nsJSPrincipals::ReadKnownPrincipalType addrefs for us, but because of
       // the casting between JSPrincipals* and nsIPrincipal* we can't use
       // getter_AddRefs above and have to already_AddRefed here.
       nsCOMPtr<nsIPrincipal> principal =
-        already_AddRefed<nsIPrincipal>(nsJSPrincipals::get(prin));
+          already_AddRefed<nsIPrincipal>(nsJSPrincipals::get(prin));
 
       nsresult rv = nsContentUtils::WrapNative(
-        aCx, principal, &NS_GET_IID(nsIPrincipal), &result);
+          aCx, principal, &NS_GET_IID(nsIPrincipal), &result);
       if (NS_FAILED(rv)) {
         xpc::Throw(aCx, NS_ERROR_DOM_DATA_CLONE_ERR);
         return nullptr;
       }
     }
     return result.toObjectOrNull();
   }
 
@@ -833,17 +833,17 @@ JSObject* ReadInputStream(JSContext* aCx
   }
 #endif
   MOZ_ASSERT(aIndex < aHolder->InputStreams().Length());
   JS::RootedValue result(aCx);
   {
     nsCOMPtr<nsIInputStream> inputStream = aHolder->InputStreams()[aIndex];
 
     nsresult rv = nsContentUtils::WrapNative(
-      aCx, inputStream, &NS_GET_IID(nsIInputStream), &result);
+        aCx, inputStream, &NS_GET_IID(nsIInputStream), &result);
     if (NS_FAILED(rv)) {
       return nullptr;
     }
   }
 
   return &result.toObject();
 }
 
--- a/dom/base/StructuredCloneHolder.h
+++ b/dom/base/StructuredCloneHolder.h
@@ -93,17 +93,17 @@ class StructuredCloneHolderBase {
   // Execute the serialization of aValue using the Structured Clone Algorithm.
   // The data can read back using Read().
   bool Write(JSContext* aCx, JS::Handle<JS::Value> aValue);
 
   // Like Write() but it supports the transferring of objects and handling
   // of cloning policy.
   bool Write(JSContext* aCx, JS::Handle<JS::Value> aValue,
              JS::Handle<JS::Value> aTransfer,
-             JS::CloneDataPolicy cloneDataPolicy);
+             JS::CloneDataPolicy aCloneDataPolicy);
 
   // If Write() has been called, this method retrieves data and stores it into
   // aValue.
   bool Read(JSContext* aCx, JS::MutableHandle<JS::Value> aValue);
 
   bool HasData() const { return !!mBuffer; }
 
   JSStructuredCloneData& BufferData() const {
@@ -155,17 +155,17 @@ class StructuredCloneHolder : public Str
   StructuredCloneHolder(StructuredCloneHolder&& aOther) = delete;
 
   // Normally you should just use Write() and Read().
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aValue, ErrorResult& aRv);
 
   void Write(JSContext* aCx, JS::Handle<JS::Value> aValue,
              JS::Handle<JS::Value> aTransfer,
-             JS::CloneDataPolicy cloneDataPolicy, ErrorResult& aRv);
+             JS::CloneDataPolicy aCloneDataPolicy, ErrorResult& aRv);
 
   void Read(nsISupports* aParent, JSContext* aCx,
             JS::MutableHandle<JS::Value> aValue, ErrorResult& aRv);
 
   // Call this method to know if this object is keeping some DOM object alive.
   bool HasClonedDOMObjects() const {
     return !mBlobImplArray.IsEmpty() || !mWasmModuleArray.IsEmpty() ||
            !mClonedSurfaces.IsEmpty() || !mInputStreamArray.IsEmpty();
--- a/js/public/StructuredClone.h
+++ b/js/public/StructuredClone.h
@@ -203,17 +203,17 @@ enum TransferableOwnership {
 
   SCTAG_TMO_USER_MIN
 };
 
 class CloneDataPolicy {
   bool sharedArrayBuffer_;
 
  public:
-  // The default is to allow all policy-controlled aspects.
+  // The default is to deny all policy-controlled aspects.
 
   CloneDataPolicy() : sharedArrayBuffer_(false) {}
 
   // In the JS engine, SharedArrayBuffers can only be cloned intra-process
   // because the shared memory areas are allocated in process-private memory.
   // Clients should therefore deny SharedArrayBuffers when cloning data that
   // are to be transmitted inter-process.
   //