Backed out changeset f4f24738dbf7 (bug 1476565) for bustage in /builds/worker/workspace/build/src/dom/base/nsGlobalWindowOuter.cpp on a CLOSED TREE
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Thu, 19 Jul 2018 16:55:16 +0300
changeset 482402 4adf441211197568b07dde0bec5e916582024928
parent 482401 6d259e78aa9c7e4f86e07312bc2194051bd808a0
child 482403 94dad95c09ef73813502379b6482df8f71d84a27
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1476565
milestone63.0a1
backs outf4f24738dbf743d0a244fa00a296d78417c72047
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
Backed out changeset f4f24738dbf7 (bug 1476565) for bustage in /builds/worker/workspace/build/src/dom/base/nsGlobalWindowOuter.cpp on a CLOSED TREE
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,27 +2934,28 @@ 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
-        int32_t index = htmlForms->IndexOf(formElement, false);
+        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.
           //
@@ -2985,17 +2986,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.
-        int32_t index = htmlFormControls->IndexOf(aContent, true);
+        index = htmlFormControls->IndexOf(aContent, true);
         if (index > -1) {
           KeyAppendInt(index, aKey);
           generatedUniqueKey = true;
         }
       }
 
       // Append the control name
       nsAutoString name;
@@ -6504,19 +6505,20 @@ 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));
-  nsresult rv = sXPConnect->WrapNativeToJSVal(cx, scope, native, cache, aIID,
-                                              aAllowWrapping, vp);
+  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,30 +4872,33 @@ 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;
-  nsresult rv = mDoc->GetStateObject(getter_AddRefs(stateObj));
+  rv = mDoc->GetStateObject(getter_AddRefs(stateObj));
   NS_ENSURE_SUCCESS(rv, rv);
 
+  bool result = true;
   AutoJSAPI jsapi;
-  bool result = jsapi.Init(this);
+  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);
@@ -6687,17 +6690,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;
+      nsresult rv = NS_OK;
       {
         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,16 +1690,18 @@ 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;
@@ -1787,21 +1789,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.
-      nsresult rv = CreateNativeGlobalForInner(cx, newInnerWindow,
-                                               aDocument->GetDocumentURI(),
-                                               aDocument->NodePrincipal(),
-                                               &newInnerGlobal,
-                                               ComputeIsSecureContext(aDocument));
+      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,31 +442,32 @@ 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.
-    nsresult rv = mCurrentRequest->Clone(aObserver, nullptr, getter_AddRefs(currentReq));
+    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.
-    nsresult rv = mPendingRequest->Clone(aObserver, nullptr, getter_AddRefs(pendingReq));
+    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,35 +720,36 @@ 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;
-  nsresult rv = pluginHost->InstantiatePluginInstance(mContentType,
-                                                      mURI.get(), this,
-                                                      getter_AddRefs(newOwner));
+  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, "
@@ -2144,23 +2145,25 @@ 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
   ///