From 61dbcdeb2a36db2dad2fbf6a626a27412875eec0 Mon Sep 17 00:00:00 2001 From: Ryan Hunt Date: Wed, 24 Apr 2019 23:28:31 -0500 Subject: [PATCH] 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 --- dom/base/nsFrameLoader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 22a9832fa4e5..3f7776dcfe72 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -3235,6 +3235,12 @@ void nsFrameLoader::Print(uint64_t aOuterWindowID, already_AddRefed 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 global = GetOwnerContent()->GetOwnerGlobal(); RefPtr promise = Promise::Create(global, aRv); if (NS_WARN_IF(aRv.Failed())) {