mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1580617 - Make nsDocShell::GetContentBlockingLog() reject its returned promise when there's no content viewer; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D45587 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7389ffb35c
commit
e8b78f99fc
@ -3626,19 +3626,20 @@ NS_IMETHODIMP
|
||||
nsDocShell::GetContentBlockingLog(Promise** aPromise) {
|
||||
NS_ENSURE_ARG_POINTER(aPromise);
|
||||
|
||||
if (!mContentViewer) {
|
||||
*aPromise = nullptr;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Document* doc = mContentViewer->GetDocument();
|
||||
ErrorResult rv;
|
||||
RefPtr<Promise> promise = Promise::Create(doc->GetOwnerGlobal(), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
promise->MaybeResolve(
|
||||
NS_ConvertUTF8toUTF16(doc->GetContentBlockingLog()->Stringify()));
|
||||
|
||||
if (mContentViewer) {
|
||||
promise->MaybeResolve(
|
||||
NS_ConvertUTF8toUTF16(doc->GetContentBlockingLog()->Stringify()));
|
||||
} else {
|
||||
promise->MaybeRejectWithUndefined();
|
||||
}
|
||||
|
||||
promise.forget(aPromise);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user