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 : source : b255e0a84e12657a62a2cdfd4a4c2ebb893b2a0d
This commit is contained in:
Ryan Hunt 2019-04-24 23:28:31 -05:00
parent 936683ad1d
commit 61dbcdeb2a

View File

@ -3235,6 +3235,12 @@ void nsFrameLoader::Print(uint64_t aOuterWindowID,
already_AddRefed<mozilla::dom::Promise> nsFrameLoader::DrawSnapshot(
double aX, double aY, double aW, double aH, double aScale,
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<Promise> promise = Promise::Create(global, aRv);
if (NS_WARN_IF(aRv.Failed())) {