Backed out changeset f574c304f748 (bug 1392235) for asserting during wpt-reftest /css/css-masking-1/clip-path-svg-content/clip-path-recursion-002.svg on Linux. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 07 Sep 2017 18:38:57 +0200
changeset 429107 6e4988e39120b0a1f7a7eeeb872c4781f9d5d9ee
parent 429106 4fbe6972d2974789acaeb97369a7becc83cba4db
child 429108 8338a5c1ef2126264c910cd9aa6c3a25776643c5
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1392235
milestone57.0a1
backs outf574c304f748b44a501a0cde67e4d34174b348a2
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
Backed out changeset f574c304f748 (bug 1392235) for asserting during wpt-reftest /css/css-masking-1/clip-path-svg-content/clip-path-recursion-002.svg on Linux. r=backout
layout/svg/AutoReferenceChainGuard.h
--- a/layout/svg/AutoReferenceChainGuard.h
+++ b/layout/svg/AutoReferenceChainGuard.h
@@ -78,37 +78,32 @@ public:
   AutoReferenceChainGuard(nsIFrame* aFrame,
                           bool* aFrameInUse,
                           int16_t* aChainCounter,
                           int16_t aMaxChainLength = sDefaultMaxChainLength
                           MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
     : mFrame(aFrame)
     , mFrameInUse(aFrameInUse)
     , mMaxChainLength(aMaxChainLength)
-    , mBrokeReference(false)
   {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     MOZ_ASSERT(aFrame && aFrameInUse && aChainCounter);
+    MOZ_ASSERT(!(*mFrameInUse), "Undetected reference loop!");
     MOZ_ASSERT(aMaxChainLength > 0);
     MOZ_ASSERT(*aChainCounter == noChain ||
                (*aChainCounter >= 0 && *aChainCounter < aMaxChainLength));
 
     if (*aChainCounter == noChain) {
       // Initialize - we start at aMaxChainLength and decrement towards zero.
       *aChainCounter = aMaxChainLength;
     }
     mChainCounter = aChainCounter;
   }
 
   ~AutoReferenceChainGuard() {
-    if (mBrokeReference) {
-      // We didn't change mFrameInUse or mChainCounter
-      return;
-    }
-
     *mFrameInUse = false;
 
     // If we fail this assert then there were more destructor calls than
     // Reference() calls (a consumer forgot to to call Reference()), or else
     // someone messed with the variable pointed to by mChainCounter.
     MOZ_ASSERT(*mChainCounter < mMaxChainLength);
 
     (*mChainCounter)++;
@@ -122,35 +117,30 @@ public:
    * Returns true on success (no reference loop/reference chain length is
    * within the specified limits), else returns false on failure (there is a
    * reference loop/the reference chain has exceeded the specified limits).
    * If it returns false then an error message will be reported to the DevTools
    * console (only once).
    */
   MOZ_MUST_USE bool Reference() {
     if (MOZ_UNLIKELY(*mFrameInUse)) {
-      mBrokeReference = true;
       ReportErrorToConsole();
       return false;
     }
 
     // If we fail this assertion then either a consumer failed to break a
     // reference loop/chain, or else they called Reference() more than once
     MOZ_ASSERT(*mChainCounter >= 0);
 
-    if (MOZ_UNLIKELY(*mChainCounter < 1)) {
-      mBrokeReference = true;
+    (*mChainCounter)--;
+
+    if (MOZ_UNLIKELY(*mChainCounter < 0)) {
       ReportErrorToConsole();
       return false;
     }
-
-    // Only set these once we know we're returing true.
-    *mFrameInUse = true;
-    (*mChainCounter)--;
-
     return true;
   }
 
 private:
   void ReportErrorToConsole() {
     nsAutoString tag;
     mFrame->GetContent()->AsElement()->GetTagName(tag);
     const char16_t* params[] = { tag.get() };
@@ -161,15 +151,14 @@ private:
     doc->WarnOnceAbout(warning, /* asError */ true,
                        params, ArrayLength(params));
   }
 
   nsIFrame* mFrame;
   bool* mFrameInUse;
   int16_t* mChainCounter;
   const int16_t mMaxChainLength;
-  bool mBrokeReference;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 } // namespace mozilla
 
 #endif // NS_AUTOREFERENCELIMITER_H