Bug 1525720, part 4 - Assert in DrawSnapshot if not the chrome process. r=mattwoodrow

This API is only intended to be used in the chrome process and this commit
makes this explicit to simplify a later refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D31434

--HG--
extra : rebase_source : 79f143fb7fce889284b23fb65580f8e8dab83df7
extra : histedit_source : 823209f777fcb0e3e6579ac1afc0d6bf8e566051
This commit is contained in:
Ryan Hunt 2019-04-24 23:28:31 -05:00
Родитель 5592e0d298
Коммит edf885fc82
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -3235,6 +3235,12 @@ void nsFrameLoader::Print(uint64_t aOuterWindowID,
already_AddRefed<mozilla::dom::Promise> nsFrameLoader::DrawSnapshot( already_AddRefed<mozilla::dom::Promise> nsFrameLoader::DrawSnapshot(
double aX, double aY, double aW, double aH, double aScale, double aX, double aY, double aW, double aH, double aScale,
const nsAString& aBackgroundColor, mozilla::ErrorResult& aRv) { const nsAString& aBackgroundColor, mozilla::ErrorResult& aRv) {
MOZ_ASSERT(XRE_IsParentProcess());
if (!XRE_IsParentProcess()) {
aRv = NS_ERROR_FAILURE;
return nullptr;
}
RefPtr<nsIGlobalObject> global = GetOwnerContent()->GetOwnerGlobal(); RefPtr<nsIGlobalObject> global = GetOwnerContent()->GetOwnerGlobal();
RefPtr<Promise> promise = Promise::Create(global, aRv); RefPtr<Promise> promise = Promise::Create(global, aRv);
if (NS_WARN_IF(aRv.Failed())) { if (NS_WARN_IF(aRv.Failed())) {