Bug 1331619 Make ServiceWorkerClients check the return value of OpenWindow2(). r=catalinb

This commit is contained in:
Ben Kelly 2017-01-24 06:10:50 -08:00
Родитель e5bccaf01d
Коммит 30664f7219
1 изменённых файлов: 23 добавлений и 14 удалений

Просмотреть файл

@ -625,6 +625,7 @@ private:
nsresult nsresult
OpenWindow(nsPIDOMWindowOuter** aWindow) OpenWindow(nsPIDOMWindowOuter** aWindow)
{ {
MOZ_DIAGNOSTIC_ASSERT(aWindow);
WorkerPrivate* workerPrivate = mPromiseProxy->GetWorkerPrivate(); WorkerPrivate* workerPrivate = mPromiseProxy->GetWorkerPrivate();
// [[1. Let url be the result of parsing url with entry settings object's API // [[1. Let url be the result of parsing url with entry settings object's API
@ -661,24 +662,31 @@ private:
NS_ENSURE_STATE(pwwatch); NS_ENSURE_STATE(pwwatch);
nsCString spec; nsCString spec;
uri->GetSpec(spec); rv = uri->GetSpec(spec);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<mozIDOMWindowProxy> newWindow; nsCOMPtr<mozIDOMWindowProxy> newWindow;
pwwatch->OpenWindow2(nullptr, rv = pwwatch->OpenWindow2(nullptr,
spec.get(), spec.get(),
nullptr, nullptr,
nullptr, nullptr,
false, false, true, nullptr, false, false, true, nullptr,
// Not a spammy popup; we got permission, we swear! // Not a spammy popup; we got permission, we swear!
/* aIsPopupSpam = */ false, /* aIsPopupSpam = */ false,
// Don't force noopener. We're not passing in an // Don't force noopener. We're not passing in an
// opener anyway, and we _do_ want the returned // opener anyway, and we _do_ want the returned
// window. // window.
/* aForceNoOpener = */ false, /* aForceNoOpener = */ false,
/* aLoadInfp = */ nullptr, /* aLoadInfp = */ nullptr,
getter_AddRefs(newWindow)); getter_AddRefs(newWindow));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsPIDOMWindowOuter> pwindow = nsPIDOMWindowOuter::From(newWindow); nsCOMPtr<nsPIDOMWindowOuter> pwindow = nsPIDOMWindowOuter::From(newWindow);
pwindow.forget(aWindow); pwindow.forget(aWindow);
MOZ_DIAGNOSTIC_ASSERT(*aWindow);
return NS_OK; return NS_OK;
} }
@ -716,6 +724,7 @@ private:
nsCOMPtr<nsPIDOMWindowOuter> pWin = nsPIDOMWindowOuter::From(win); nsCOMPtr<nsPIDOMWindowOuter> pWin = nsPIDOMWindowOuter::From(win);
pWin.forget(aWindow); pWin.forget(aWindow);
MOZ_DIAGNOSTIC_ASSERT(*aWindow);
return NS_OK; return NS_OK;
} }