Bug 1156742 Part 23: Assert in PrintTranslator when a lookup fails. r=bas
☠☠ backed out by 9bdfae920430 ☠ ☠
authorBob Owen <bobowencode@gmail.com>
Mon, 21 Dec 2015 20:33:14 +0000
changeset 277235 90c026d5dcb16cee4f024ff410fb8606ac214fff
parent 277234 8c6d14d80238076d5e788246441722f1c88ded0e
child 277236 f08df57ff700640b9cc196b14044ba585c3cc63c
push id29819
push usercbook@mozilla.com
push dateTue, 22 Dec 2015 10:47:17 +0000
treeherdermozilla-central@ad16863d1d45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1156742
milestone46.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 1156742 Part 23: Assert in PrintTranslator when a lookup fails. r=bas In theory these lookups should never fail. The plan is to move them to release asserts when any bugs have been fixed, as failed lookups may be an indication of data being sent from a compromised renderer.
layout/printing/PrintTranslator.h
--- a/layout/printing/PrintTranslator.h
+++ b/layout/printing/PrintTranslator.h
@@ -33,42 +33,54 @@ class PrintTranslator final : public Tra
 {
 public:
   explicit PrintTranslator(nsDeviceContext* aDeviceContext);
 
   bool TranslateRecording(std::istream& aRecording);
 
   DrawTarget* LookupDrawTarget(ReferencePtr aRefPtr) final
   {
-    return mDrawTargets.GetWeak(aRefPtr);
+    DrawTarget* result = mDrawTargets.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   Path* LookupPath(ReferencePtr aRefPtr) final
   {
-    return mPaths.GetWeak(aRefPtr);
+    Path* result = mPaths.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   SourceSurface* LookupSourceSurface(ReferencePtr aRefPtr) final
   {
-    return mSourceSurfaces.GetWeak(aRefPtr);
+    SourceSurface* result = mSourceSurfaces.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   FilterNode* LookupFilterNode(ReferencePtr aRefPtr) final
   {
-    return mFilterNodes.GetWeak(aRefPtr);
+    FilterNode* result = mFilterNodes.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   GradientStops* LookupGradientStops(ReferencePtr aRefPtr) final
   {
-    return mGradientStops.GetWeak(aRefPtr);
+    GradientStops* result =  mGradientStops.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   ScaledFont* LookupScaledFont(ReferencePtr aRefPtr) final
   {
-    return mScaledFonts.GetWeak(aRefPtr);
+    ScaledFont* result = mScaledFonts.GetWeak(aRefPtr);
+    MOZ_ASSERT(result);
+    return result;
   }
 
   void AddDrawTarget(ReferencePtr aRefPtr, DrawTarget *aDT) final
   {
     mDrawTargets.Put(aRefPtr, aDT);
   }
 
   void AddPath(ReferencePtr aRefPtr, Path *aPath) final