Bug 1525720, part 4 - Assert in DrawSnapshot if not the chrome process. r=mattwoodrow
authorRyan Hunt <rhunt@eqrion.net>
Wed, 24 Apr 2019 23:28:31 -0500
changeset 474982 5ff1726275aad728e080f4a904885a16261a6c4d
parent 474981 707a48ef23385b4b143a9218fe788efcd3e1e3fc
child 474983 420f10c25da19ddb398bc6c7a1089ee9e7e6839b
push id113186
push userrhunt@eqrion.net
push dateThu, 23 May 2019 03:45:28 +0000
treeherdermozilla-inbound@d4a9b4dd03ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1525720
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -3230,16 +3230,22 @@ void nsFrameLoader::Print(uint64_t aOute
     return;
   }
 #endif
 }
 
 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())) {
     return nullptr;
   }
 
   RefPtr<Document> document = GetOwnerContent()->GetOwnerDocument();
   if (NS_WARN_IF(!document)) {