Bug 1476565: Fix DEAD_STORE errors in dom/base/*. r=baku

MozReview-Commit-ID: IjsOrpz9VF3

--HG--
extra : rebase_source : 7a7e1f796f24f623afe614297e2f779c916c64e6
This commit is contained in:
Robert Bartlensky 2018-07-18 16:17:22 +01:00
parent cc7457bf9e
commit 3a2bf15b12
5 changed files with 17 additions and 28 deletions

View File

@ -2939,7 +2939,6 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
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)) {
@ -2950,7 +2949,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
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
@ -2991,7 +2990,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
// 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;
@ -6510,10 +6509,9 @@ nsContentUtils::WrapNative(JSContext *cx, nsISupports *native,
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;
}

View File

@ -4877,8 +4877,6 @@ 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;
@ -4888,12 +4886,11 @@ nsGlobalWindowInner::DispatchSyncPopState()
// 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();
@ -6695,7 +6692,7 @@ nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
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);

View File

@ -1695,8 +1695,6 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
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.
@ -1794,11 +1792,11 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
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");

View File

@ -447,13 +447,12 @@ nsImageLoadingContent::AddObserver(imgINotificationObserver* 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;
}
@ -462,7 +461,7 @@ nsImageLoadingContent::AddObserver(imgINotificationObserver* aObserver)
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;

View File

@ -725,7 +725,6 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
return NS_OK;
}
nsresult rv = NS_ERROR_FAILURE;
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
if (!pluginHost) {
@ -742,9 +741,9 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
}
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) {
@ -2150,7 +2149,6 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
mPendingCheckPluginStopEvent || mFinalListener)
{
MOZ_ASSERT_UNREACHABLE("Trying to load new plugin with existing content");
rv = NS_ERROR_UNEXPECTED;
return NS_OK;
}
@ -2158,7 +2156,6 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
// 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;
}