Bug 1476565: Fix DEAD_STORE errors in dom/base/*. r=baku
☠☠ backed out by 4adf44121119 ☠ ☠
authorRobert Bartlensky <rbartlensky@mozilla.com>
Wed, 18 Jul 2018 16:17:22 +0100
changeset 427306 f4f24738dbf7
parent 427305 47b3297877fa
child 427307 75cbc42803d7
push id66589
push userrgurzau@mozilla.com
push dateThu, 19 Jul 2018 13:43:01 +0000
treeherderautoland@f4f24738dbf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1476565
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 1476565: Fix DEAD_STORE errors in dom/base/*. r=baku MozReview-Commit-ID: IjsOrpz9VF3
dom/base/nsContentUtils.cpp
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsImageLoadingContent.cpp
dom/base/nsObjectLoadingContent.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2934,28 +2934,27 @@ nsContentUtils::GenerateStateKey(nsICont
     //
     nsCOMPtr<nsIFormControl> control(do_QueryInterface(aContent));
     if (control) {
 
       // Append the control type
       KeyAppendInt(control->ControlType(), aKey);
 
       // If in a form, add form name / index of form / index in form
-      int32_t index = -1;
       Element *formElement = control->GetFormElement();
       if (formElement) {
         if (IsAutocompleteOff(formElement)) {
           aKey.Truncate();
           return NS_OK;
         }
 
         KeyAppendString(NS_LITERAL_CSTRING("f"), aKey);
 
         // Append the index of the form in the document
-        index = htmlForms->IndexOf(formElement, false);
+        int32_t index = htmlForms->IndexOf(formElement, false);
         if (index <= -1) {
           //
           // XXX HACK this uses some state that was dumped into the document
           // specifically to fix bug 138892.  What we are trying to do is *guess*
           // which form this control's state is found in, with the highly likely
           // guess that the highest form parsed so far is the one.
           // This code should not be on trunk, only branch.
           //
@@ -2986,17 +2985,17 @@ nsContentUtils::GenerateStateKey(nsICont
         // If not in a form, add index of control in document
         // Less desirable than indexing by form info.
 
         // Hash by index of control in doc (we are not in a form)
         // These are important as they are unique, and type/name may not be.
 
         // We have to flush sink notifications at this point to make
         // sure that htmlFormControls is up to date.
-        index = htmlFormControls->IndexOf(aContent, true);
+        int32_t index = htmlFormControls->IndexOf(aContent, true);
         if (index > -1) {
           KeyAppendInt(index, aKey);
           generatedUniqueKey = true;
         }
       }
 
       // Append the control name
       nsAutoString name;
@@ -6505,20 +6504,19 @@ nsContentUtils::WrapNative(JSContext *cx
   }
 
   NS_ENSURE_TRUE(sXPConnect, NS_ERROR_UNEXPECTED);
 
   if (!NS_IsMainThread()) {
     MOZ_CRASH();
   }
 
-  nsresult rv = NS_OK;
   JS::Rooted<JSObject*> scope(cx, JS::CurrentGlobalOrNull(cx));
-  rv = sXPConnect->WrapNativeToJSVal(cx, scope, native, cache, aIID,
-                                     aAllowWrapping, vp);
+  nsresult rv = sXPConnect->WrapNativeToJSVal(cx, scope, native, cache, aIID,
+                                              aAllowWrapping, vp);
   return rv;
 }
 
 nsresult
 nsContentUtils::CreateArrayBuffer(JSContext *aCx, const nsACString& aData,
                                   JSObject** aResult)
 {
   if (!aCx) {
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -4872,33 +4872,30 @@ nsGlobalWindowInner::FireHashchange(cons
 }
 
 nsresult
 nsGlobalWindowInner::DispatchSyncPopState()
 {
   NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
                "Must be safe to run script here.");
 
-  nsresult rv = NS_OK;
-
   // Bail if the window is frozen.
   if (IsFrozen()) {
     return NS_OK;
   }
 
   // Get the document's pending state object -- it contains the data we're
   // going to send along with the popstate event.  The object is serialized
   // using structured clone.
   nsCOMPtr<nsIVariant> stateObj;
-  rv = mDoc->GetStateObject(getter_AddRefs(stateObj));
+  nsresult rv = mDoc->GetStateObject(getter_AddRefs(stateObj));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  bool result = true;
   AutoJSAPI jsapi;
-  result = jsapi.Init(this);
+  bool result = jsapi.Init(this);
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   JSContext* cx = jsapi.cx();
   JS::Rooted<JS::Value> stateJSValue(cx, JS::NullValue());
   result = stateObj ? VariantToJsval(cx, stateObj, &stateJSValue) : true;
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   RootedDictionary<PopStateEventInit> init(cx);
@@ -6690,17 +6687,17 @@ nsGlobalWindowInner::RunTimeoutHandler(T
       // New script entry point required, due to the "Create a script" sub-step of
       // http://www.whatwg.org/specs/web-apps/current-work/#timer-initialisation-steps
       nsAutoMicroTask mt;
       AutoEntryScript aes(this, reason, true);
       JS::CompileOptions options(aes.cx());
       options.setFileAndLine(filename, lineNo);
       options.setNoScriptRval(true);
       JS::Rooted<JSObject*> global(aes.cx(), FastGetGlobalJSObject());
-      nsresult rv = NS_OK;
+      nsresult rv;
       {
         nsJSUtils::ExecutionContext exec(aes.cx(), global);
         rv = exec.CompileAndExec(options, script);
       }
 
       if (rv == NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE) {
         abortIntervalHandler = true;
       }
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -1690,18 +1690,16 @@ nsGlobalWindowOuter::SetNewDocument(nsID
   nsContentUtils::AddScriptRunner(NewRunnableMethod(
     "nsGlobalWindowOuter::ClearStatus", this, &nsGlobalWindowOuter::ClearStatus));
 
   // Sometimes, WouldReuseInnerWindow() returns true even if there's no inner
   // window (see bug 776497). Be safe.
   bool reUseInnerWindow = (aForceReuseInnerWindow || wouldReuseInnerWindow) &&
                           GetCurrentInnerWindowInternal();
 
-  nsresult rv = NS_OK;
-
   // We set mDoc even though this is an outer window to avoid
   // having to *always* reach into the inner window to find the
   // document.
   mDoc = aDocument;
 
   // Take this opportunity to clear mSuspendedDoc. Our old inner window is now
   // responsible for unsuspending it.
   mSuspendedDoc = nullptr;
@@ -1789,21 +1787,21 @@ nsGlobalWindowOuter::SetNewDocument(nsID
       // and proto, which makes the JS engine look up classes in
       // cx->globalObject, i.e. this outer window].
 
       mInnerWindow = nullptr;
 
       mCreatingInnerWindow = true;
       // Every script context we are initialized with must create a
       // new global.
-      rv = CreateNativeGlobalForInner(cx, newInnerWindow,
-                                      aDocument->GetDocumentURI(),
-                                      aDocument->NodePrincipal(),
-                                      &newInnerGlobal,
-                                      ComputeIsSecureContext(aDocument));
+      nsresult rv = CreateNativeGlobalForInner(cx, newInnerWindow,
+                                               aDocument->GetDocumentURI(),
+                                               aDocument->NodePrincipal(),
+                                               &newInnerGlobal,
+                                               ComputeIsSecureContext(aDocument));
       NS_ASSERTION(NS_SUCCEEDED(rv) && newInnerGlobal &&
                    newInnerWindow->GetWrapperPreserveColor() == newInnerGlobal,
                    "Failed to get script global");
 
       mCreatingInnerWindow = false;
       createdInnerWindow = true;
 
       NS_ENSURE_SUCCESS(rv, rv);
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -442,32 +442,31 @@ nsImageLoadingContent::RemoveNativeObser
 
 void
 nsImageLoadingContent::AddObserver(imgINotificationObserver* aObserver)
 {
   if (NS_WARN_IF(!aObserver)) {
     return;
   }
 
-  nsresult rv = NS_OK;
   RefPtr<imgRequestProxy> currentReq;
   if (mCurrentRequest) {
     // Scripted observers may not belong to the same document as us, so when we
     // create the imgRequestProxy, we shouldn't use any. This allows the request
     // to dispatch notifications from the correct scheduler group.
-    rv = mCurrentRequest->Clone(aObserver, nullptr, getter_AddRefs(currentReq));
+    nsresult rv = mCurrentRequest->Clone(aObserver, nullptr, getter_AddRefs(currentReq));
     if (NS_FAILED(rv)) {
       return;
     }
   }
 
   RefPtr<imgRequestProxy> pendingReq;
   if (mPendingRequest) {
     // See above for why we don't use the loading document.
-    rv = mPendingRequest->Clone(aObserver, nullptr, getter_AddRefs(pendingReq));
+    nsresult rv = mPendingRequest->Clone(aObserver, nullptr, getter_AddRefs(pendingReq));
     if (NS_FAILED(rv)) {
       mCurrentRequest->CancelAndForgetObserver(NS_BINDING_ABORTED);
       return;
     }
   }
 
   mScriptedObservers.AppendElement(
     new ScriptedImageObserver(aObserver, std::move(currentReq), std::move(pendingReq)));
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -720,36 +720,35 @@ nsObjectLoadingContent::InstantiatePlugi
   // Flushing layout may have re-entered and loaded something underneath us
   NS_ENSURE_TRUE(mInstantiating, NS_OK);
 
   if (!thisContent->GetPrimaryFrame()) {
     LOG(("OBJLC [%p]: Not instantiating plugin with no frame", this));
     return NS_OK;
   }
 
-  nsresult rv = NS_ERROR_FAILURE;
   RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
 
   if (!pluginHost) {
     MOZ_ASSERT_UNREACHABLE("No pluginhost");
     return NS_ERROR_FAILURE;
   }
 
   // If you add early return(s), be sure to balance this call to
   // appShell->SuspendNative() with additional call(s) to
   // appShell->ReturnNative().
   nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
   if (appShell) {
     appShell->SuspendNative();
   }
 
   RefPtr<nsPluginInstanceOwner> newOwner;
-  rv = pluginHost->InstantiatePluginInstance(mContentType,
-                                             mURI.get(), this,
-                                             getter_AddRefs(newOwner));
+  nsresult rv = pluginHost->InstantiatePluginInstance(mContentType,
+                                                      mURI.get(), this,
+                                                      getter_AddRefs(newOwner));
 
   // XXX(johns): We don't suspend native inside stopping plugins...
   if (appShell) {
     appShell->ResumeNative();
   }
 
   if (!mInstantiating || NS_FAILED(rv)) {
     LOG(("OBJLC [%p]: Plugin instantiation failed or re-entered, "
@@ -2145,25 +2144,23 @@ nsObjectLoadingContent::LoadObject(bool 
   }
 
   // Sanity check: We shouldn't have any loaded resources, pending events, or
   // a final listener at this point
   if (mFrameLoader || mPendingInstantiateEvent || mInstanceOwner ||
       mPendingCheckPluginStopEvent || mFinalListener)
   {
     MOZ_ASSERT_UNREACHABLE("Trying to load new plugin with existing content");
-    rv = NS_ERROR_UNEXPECTED;
     return NS_OK;
   }
 
   // More sanity-checking:
   // If mChannel is set, mChannelLoaded should be set, and vice-versa
   if (mType != eType_Null && !!mChannel != mChannelLoaded) {
     MOZ_ASSERT_UNREACHABLE("Trying to load with bad channel state");
-    rv = NS_ERROR_UNEXPECTED;
     return NS_OK;
   }
 
   ///
   /// Attempt to load new type
   ///