Bug 1224007 part 4. Fix some cases in which ErrorResult instances are destroyed without doing anything useful with exceptions on them. r=peterv

This commit is contained in:
Boris Zbarsky 2015-11-20 16:29:41 -05:00
parent bb0be9b0b7
commit 86acff3567
10 changed files with 19 additions and 4 deletions

View File

@ -6138,10 +6138,12 @@ nsGlobalWindow::FinishFullscreenChange(bool aIsFullscreen)
mWakeLock = pmService->NewWakeLock(NS_LITERAL_STRING("DOM_Fullscreen"),
this, rv);
NS_WARN_IF_FALSE(!rv.Failed(), "Failed to lock the wakelock");
rv.SuppressException();
} else if (mWakeLock && !mFullScreen) {
ErrorResult rv;
mWakeLock->Unlock(rv);
mWakeLock = nullptr;
rv.SuppressException();
}
}
@ -11764,6 +11766,7 @@ nsGlobalWindow::RunTimeoutHandler(nsTimeout* aTimeout,
ErrorResult ignored;
JS::Rooted<JS::Value> ignoredVal(CycleCollectedJSRuntime::Get()->Runtime());
callback->Call(me, handler->GetArgs(), &ignoredVal, ignored, reason);
ignored.SuppressException();
}
// We ignore any failures from calling EvaluateString() on the context or

View File

@ -1131,7 +1131,10 @@ public:
{
MOZ_ASSERT(IsOuterWindow());
mozilla::ErrorResult ignored;
return GetContentInternal(ignored, /* aUnprivilegedCaller = */ false);
nsCOMPtr<nsIDOMWindow> win =
GetContentInternal(ignored, /* aUnprivilegedCaller = */ false);
ignored.SuppressException();
return win.forget();
}
void Get_content(JSContext* aCx,

View File

@ -1276,8 +1276,6 @@ nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState a
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread());
ErrorResult ignored;
switch (aState) {
case CameraControlListener::kHardwareOpen:
DOM_CAMERA_LOGI("DOM OnHardwareStateChange: open\n");
@ -1405,7 +1403,6 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a
DOM_CAMERA_LOGT("%s:%d : this=%p, state=%u\n", __func__, __LINE__, this, aState);
MOZ_ASSERT(NS_IsMainThread());
ErrorResult ignored;
nsString state;
switch (aState) {

View File

@ -3967,6 +3967,7 @@ gfxFontGroup *CanvasRenderingContext2D::GetCurrentFontStyle()
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
bool fontUpdated = SetFontInternal(kDefaultFontStyle, err);
if (err.Failed() || !fontUpdated) {
err.SuppressException();
gfxFontStyle style;
style.size = kDefaultFontSize;
gfxTextPerfMetrics* tp = nullptr;

View File

@ -2409,6 +2409,7 @@ HTMLMediaElement::WakeLockRelease()
if (mWakeLock) {
ErrorResult rv;
mWakeLock->Unlock(rv);
rv.SuppressException();
mWakeLock = nullptr;
}
}

View File

@ -267,6 +267,7 @@ HTMLVideoElement::UpdateScreenWakeLock()
if (mScreenWakeLock && (mPaused || hidden || !mUseScreenWakeLock)) {
ErrorResult rv;
mScreenWakeLock->Unlock(rv);
rv.SuppressException();
mScreenWakeLock = nullptr;
return;
}

View File

@ -1162,6 +1162,7 @@ MediaRecorder::NotifyOwnerDocumentActivityChanged()
// Stop the session.
ErrorResult result;
Stop(result);
result.SuppressException();
}
}

View File

@ -496,6 +496,9 @@ private:
ErrorResult rv;
scriptloader::LoadMainScript(aCx, mScriptURL, WorkerScript, rv);
if (NS_WARN_IF(rv.Failed())) {
// I guess suppress the exception since that's what we used to
// do, though this seems moderately weird.
rv.SuppressException();
return false;
}
@ -532,6 +535,9 @@ private:
JSAutoCompartment ac(aCx, global);
scriptloader::LoadMainScript(aCx, mScriptURL, DebuggerScript, rv);
if (NS_WARN_IF(rv.Failed())) {
// I guess suppress the exception since that's what we used to
// do, though this seems moderately weird.
rv.SuppressException();
return false;
}

View File

@ -356,6 +356,7 @@ nsXULTemplateQueryProcessorXML::AddBinding(nsIDOMNode* aRuleNode,
nsAutoPtr<XPathExpression> compiledexpr;
compiledexpr = CreateExpression(aExpr, ruleNode, rv);
if (rv.Failed()) {
rv.SuppressException();
nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_BAD_BINDING_XPATH);
return NS_OK;
}

View File

@ -236,6 +236,7 @@ AccessibleCaret::RemoveCaretElement(nsIDocument* aDocument)
ErrorResult rv;
aDocument->RemoveAnonymousContent(*mCaretElementHolder, rv);
// It's OK rv is failed since nsCanvasFrame might not exists now.
rv.SuppressException();
}
AccessibleCaret::PositionChangedResult