Bug 1399079 - Fix StreamingLexer::Clone assert to handle SourceBuffer insertion failures. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 13 Sep 2017 07:26:04 -0400
changeset 430168 39ac5504b7780d02ec1853e54407e30a1c53ff01
parent 430167 93effc10ccb11ea9fcf94d258b39588180e482a5
child 430169 1171dced91e1926277712a89b95b85c2844e5a1e
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)
reviewerstnikkel
bugs1399079
milestone57.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 1399079 - Fix StreamingLexer::Clone assert to handle SourceBuffer insertion failures. r=tnikkel
image/StreamingLexer.h
--- a/image/StreamingLexer.h
+++ b/image/StreamingLexer.h
@@ -424,17 +424,20 @@ public:
     // Since the current iterator has already advanced to this point, we
     // know that the state can only be READY or COMPLETE. That does not mean
     // everything is stored in a single chunk, and may require multiple Advance
     // calls to get where we want to be.
     SourceBufferIterator::State state;
     do {
       state = other.Advance(pos);
       if (state != SourceBufferIterator::READY) {
-        MOZ_ASSERT_UNREACHABLE("Cannot advance to existing position");
+        // The only way we should fail to advance over data we already seen is
+        // if we hit an error while inserting data into the buffer. This will
+        // cause an early exit.
+        MOZ_ASSERT(NS_FAILED(other.CompletionStatus()));
         return Nothing();
       }
       MOZ_ASSERT(pos >= other.Length());
       pos -= other.Length();
     } while (pos > 0);
 
     // Force the data pointer to be where we expect it to be.
     state = other.Advance(0);