<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>35115</bug_id>
          
          <creation_ts>2010-02-18 11:03:09 -0800</creation_ts>
          <short_desc>REGRESSION: r54919 can cause image animation to start late</short_desc>
          <delta_ts>2010-02-24 13:52:28 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Images</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>35287</dependson>
          <blocked>35065</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Peter Kasting">pkasting</reporter>
          <assigned_to name="Peter Kasting">pkasting</assigned_to>
          <cc>mjs</cc>
    
    <cc>mrowe</cc>
    
    <cc>sam</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>191666</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-18 11:03:09 -0800</bug_when>
    <thetext>The patch on bug 35065 introduced this bug.  Fix is easy.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>191703</commentid>
    <comment_count>1</comment_count>
      <attachid>49035</attachid>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-18 12:56:08 -0800</bug_when>
    <thetext>Created attachment 49035
patch v1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>191706</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2010-02-18 13:01:52 -0800</bug_when>
    <thetext>Attachment 49035 did not pass style-queue:

Failed to run &quot;WebKitTools/Scripts/check-webkit-style&quot; exit_code: 1
WebCore/platform/graphics/BitmapImage.cpp:271:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>191707</commentid>
    <comment_count>3</comment_count>
      <attachid>49037</attachid>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-18 13:03:51 -0800</bug_when>
    <thetext>Created attachment 49037
patch v2

Fix style nit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192110</commentid>
    <comment_count>4</comment_count>
      <attachid>49037</attachid>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-02-19 16:36:32 -0800</bug_when>
    <thetext>Comment on attachment 49037
patch v2

Are we not able to test image animation bugs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192113</commentid>
    <comment_count>5</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-19 16:42:00 -0800</bug_when>
    <thetext>I have utterly no clue how to test this particular case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192115</commentid>
    <comment_count>6</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-19 16:46:00 -0800</bug_when>
    <thetext>Fixed in r55039.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192323</commentid>
    <comment_count>7</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-21 16:42:17 -0800</bug_when>
    <thetext>I filed bug 35222 about a regression this introduced.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192401</commentid>
    <comment_count>8</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-22 03:19:37 -0800</bug_when>
    <thetext>Reopening as this was rolled out in r55076 to address bug 35222.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192570</commentid>
    <comment_count>9</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-22 12:54:01 -0800</bug_when>
    <thetext>Let me circle back and describe what&apos;s going on with all these bugs.

Skipping frames during image load is possible when the network is bursty -- if you are given some data, then no data, then data for multiple frames at once, you can skip to the last available frame in one shot.  The more common behavior is that data streams in slowly and you see each frame show up until we have the next one.  In either case, we won&apos;t skip past the end -- when we load the image completely (and it finishes animating if necessary) we&apos;ll start animating from the beginning at the correct speed.

The patch on this bug does not change this behavior.  This behavior comes from the original set of timing fixes a couple of years ago.  The patch on this bug merely preserves the behavior that we had before bug 35065 was fixed, where the timer starts from when we first ask the image to animate, rather than when we are able to advance to frame 2.

This can make a visible change in the following scenario.  The network gives us frame 1 of the animation, then hangs a long time, then provides most of the rest of the data all at once.  The behaviors are:
* Before bug 35065 landed: We would erroneously keep adding the frame 1 start time every time through this function, resulting in the image not animating at all for a long time during and after load, and then starting to animate smoothly.
* After bug 35065 landed: We would erroneously fail to start the animation timer until frame 2 arrived, at which point we&apos;d begin animating smoothly.
* After this patch landed: We start the timer immediately, and when the rest of the data arrives, skip forward.

HOWEVER, note the following similar case: if we get frames 1 _and 2_, then a pause, then the rest of the data, the behavior before and after this patch landed is identical, and corresponds to the third bullet above.

What&apos;s really happening here is that the fix on bug 35065 eliminated a bunch of unintentional delays during the initial load and exposed the (designed) behavior that we can frameskip during initial load (although we usually don&apos;t).  So this patch did not really &quot;cause&quot; bug 35222, although it made it possible to occur in one more frame&apos;s worth of cases.

We can decide that we are OK with this behavior (better for sites that sync GIFs to each other or other page elements), in which case we should simply reland this patch and move on.  Or we can decide that we&apos;d like each frame to appear for at least its desired duration during load, in which case I can rewrite the timing code to accomplish this, which will probably equate to relanding this patch and adding some conditionals.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192658</commentid>
    <comment_count>10</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-22 15:10:07 -0800</bug_when>
    <thetext>Can you please provide a concrete example of the issue that you’re attempting to describe here?  It’s much easier to discuss a concrete problem than a hypothetical issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192665</commentid>
    <comment_count>11</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-22 15:14:41 -0800</bug_when>
    <thetext>Which issue are you referring to?  Comment 9 is applicable to any animated GIF, it is merely dependent on the network.

(If possible I&apos;d really like to discuss over IRC, I think it will be faster and easier than bugzilla)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192739</commentid>
    <comment_count>12</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-22 18:38:02 -0800</bug_when>
    <thetext>(In reply to comment #11)
&gt; Which issue are you referring to?  Comment 9 is applicable to any animated GIF,
&gt; it is merely dependent on the network.
&gt; 

The issue that this bug was filed about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192772</commentid>
    <comment_count>13</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-22 20:34:45 -0800</bug_when>
    <thetext>The issue that this was filed about can apply to any animated GIF, its magnitude is merely dependent on network performance.  As I tried to say on bug 35065, the issue is that after the patch on that bug, we display the first frame until we have the complete second frame, and then start the first frame&apos;s animation timer.  This means that the animation start lags by however long it takes us to get the second frame&apos;s data, which depends on the network.  Note that the issue here is not about how we display frames in general as the image is loading -- as I tried to say in comment 9, that behavior, such as whether bursty networks can cause frameskipping during the initial load, is a more general issue.  This bug was only about whether we start the animation timer when we receive frame 1 or when we receive frame 2, nothing more.

Whatever decision we make about how the user should see frames during load, we want this patch or something similar.  If the network is fast, it makes us display the animation with perfect timing, and if the network is slow and we want to modify the current display algorithm, we&apos;d want to do it by ensuring we show each frame for its entire duration, not the behavior that this patch fixes (which is just a plain and simple bug).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192797</commentid>
    <comment_count>14</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-22 23:25:25 -0800</bug_when>
    <thetext>(In reply to comment #13)
&gt; The issue that this was filed about can apply to any animated GIF, its
&gt; magnitude is merely dependent on network performance.  As I tried to say on bug
&gt; 35065, the issue is that after the patch on that bug, we display the first
&gt; frame until we have the complete second frame, and then start the first frame&apos;s
&gt; animation timer.  This means that the animation start lags by however long it
&gt; takes us to get the second frame&apos;s data, which depends on the network.  Note
&gt; that the issue here is not about how we display frames in general as the image
&gt; is loading -- as I tried to say in comment 9, that behavior, such as whether
&gt; bursty networks can cause frameskipping during the initial load, is a more
&gt; general issue.  This bug was only about whether we start the animation timer
&gt; when we receive frame 1 or when we receive frame 2, nothing more.

Ok, now I see what you’re saying.  I have a concern here that is based on looking at the computed values for BitmapImage::frameIsCompleteAtIndex inside BitmapImage::startAnimation while loading some animated GIFs over a slow-ish network: frameIsCompleteAtIndex appears to always return false until the image has completely loaded.  This happens even for frame 0 when the initial frame of the animation has already painted on-screen.  This doesn’t seem to match the intended behavior of the function.

&gt; Whatever decision we make about how the user should see frames during load, we
&gt; want this patch or something similar.  If the network is fast, it makes us
&gt; display the animation with perfect timing, and if the network is slow and we
&gt; want to modify the current display algorithm, we&apos;d want to do it by ensuring we
&gt; show each frame for its entire duration, not the behavior that this patch fixes
&gt; (which is just a plain and simple bug).

It is not clear to me what you mean by “modify the current display algorithm”.  Are you talking about the algorithm as designed, or as it currently behaves?  From my observations these seem to be two different things.

It seems that the “as designed” behavior is that which I describe as being wrong in bug 35222: after painting the first frame the animation starts, and we drop any frames that aren’t loaded by the time they would have painted had the image been animating smoothly.  Given the behavior of BitmapImage::frameIsCompleteAtIndex that I describe above, you can see that this results in no animation occurring while the image loads and then us immediately skipping many frames in the animation to catch up to where the animation would have been.

The current behavior is different: after the second frame of the animation is available, the animation starts.  Due to the behavior of BitmapImage::frameIsCompleteAtIndex always returning false until the image is completely loaded, this leads to the animation being paused until the image is completely loaded meaning that no frames will be dropped even when the network is slow.  In the case that the image is already cached it presumably results in the initial frame being displayed for slightly longer than was intended.

I suspect that if BitmapImage::frameIsCompleteAtIndex was behaving as expected that the only difference between the two behaviors would be that the second would lead to initial frame being displayed for longer than was intended (e.g., the original topic of this bug).  If we fix the behavior of BitmapImage::frameIsCompleteAtIndex the original patch on this bug may then be what is needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192817</commentid>
    <comment_count>15</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-23 00:46:19 -0800</bug_when>
    <thetext>(In reply to comment #14)
&gt; I have a concern here that is based on
&gt; looking at the computed values for BitmapImage::frameIsCompleteAtIndex inside
&gt; BitmapImage::startAnimation while loading some animated GIFs over a slow-ish
&gt; network: frameIsCompleteAtIndex appears to always return false until the image
&gt; has completely loaded.  This happens even for frame 0 when the initial frame of
&gt; the animation has already painted on-screen.  This doesn’t seem to match the
&gt; intended behavior of the function.

Yeah, that&apos;s not right at all.  I suspect a CG-specific bug here; for CG this eventually boils down to the statement (in ImageSourceCG.cpp):

CGImageSourceGetStatusAtIndex(m_decoder, index) == kCGImageStatusComplete

It may be that this function is not returning &quot;complete&quot; for any index until the whole image is done, or perhaps it&apos;s just doing that for &lt; Snow Leopard (since I know some GIF shouldn&apos;t-need-the-whole-image-but-we-do issues were supposed to be fixed in Snow Leopard).  Seems like you could probably test this fairly quickly?

I haven&apos;t tested closely, but based on the overall behavior I see and the code in them, I think the open-source decoders return the desired values for this function.  This means that Safari and Chromium would see vastly different behavior here which would help explain why we&apos;ve been talking past each other.

I could be wrong and there&apos;s a bug in BitmapImage.cpp instead, but a quick inspection didn&apos;t highlight anything obvious and I&apos;ve never seen the behavior you describe locally.

&gt; It seems that the “as designed” behavior is that which I describe as being
&gt; wrong in bug 35222: after painting the first frame the animation starts, and we
&gt; drop any frames that aren’t loaded by the time they would have painted had the
&gt; image been animating smoothly.

With the caveat of &quot;if we have frames beyond them to skip to&quot;, I think this is accurate.

&gt; Given the behavior of
&gt; BitmapImage::frameIsCompleteAtIndex that I describe above, you can see that
&gt; this results in no animation occurring while the image loads and then us
&gt; immediately skipping many frames in the animation to catch up to where the
&gt; animation would have been.

Yes, that&apos;s obviously gruesomely bad.  That turns what I described as a rare case into the common case, even for moderately fast networks.

There is a small saving grace here, which is that if the load has taken longer than the entire length of the animation, the code (with the buggy frameIsCompleteAtIndex()) will start the animation at the beginning (of its second cycle, not that that&apos;s visible to the user), so on REALLY slow networks, this doesn&apos;t look as bad.  But that&apos;s fairly irrelevant as we definitely want to fix this broken oracle function.

&gt; The current behavior is different: after the second frame of the animation is
&gt; available, the animation starts.  Due to the behavior of
&gt; BitmapImage::frameIsCompleteAtIndex always returning false until the image is
&gt; completely loaded, this leads to the animation being paused until the image is
&gt; completely loaded meaning that no frames will be dropped even when the network
&gt; is slow.  In the case that the image is already cached it presumably results in
&gt; the initial frame being displayed for slightly longer than was intended.

That sounds accurate to me.

&gt; I suspect that if BitmapImage::frameIsCompleteAtIndex was behaving as expected
&gt; that the only difference between the two behaviors would be that the second
&gt; would lead to initial frame being displayed for longer than was intended (e.g.,
&gt; the original topic of this bug).  If we fix the behavior of
&gt; BitmapImage::frameIsCompleteAtIndex the original patch on this bug may then be
&gt; what is needed.

Thanks for the great analysis.  Fixing this function should certainly be the top priority, and it&apos;s nice to know why the seemingly-innocent patch on this bug could have caused such a large-seeming regression.  Once we fix, then we should be back in the world described by comment 9, and can move forward.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192828</commentid>
    <comment_count>16</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-23 01:22:51 -0800</bug_when>
    <thetext>(In reply to comment #15)
&gt; (In reply to comment #14)
&gt; &gt; I have a concern here that is based on
&gt; &gt; looking at the computed values for BitmapImage::frameIsCompleteAtIndex inside
&gt; &gt; BitmapImage::startAnimation while loading some animated GIFs over a slow-ish
&gt; &gt; network: frameIsCompleteAtIndex appears to always return false until the image
&gt; &gt; has completely loaded.  This happens even for frame 0 when the initial frame of
&gt; &gt; the animation has already painted on-screen.  This doesn’t seem to match the
&gt; &gt; intended behavior of the function.
&gt; 
&gt; Yeah, that&apos;s not right at all.  I suspect a CG-specific bug here; for CG this
&gt; eventually boils down to the statement (in ImageSourceCG.cpp):
&gt; 
&gt; CGImageSourceGetStatusAtIndex(m_decoder, index) == kCGImageStatusComplete
&gt; 
&gt; It may be that this function is not returning &quot;complete&quot; for any index until
&gt; the whole image is done, or perhaps it&apos;s just doing that for &lt; Snow Leopard
&gt; (since I know some GIF shouldn&apos;t-need-the-whole-image-but-we-do issues were
&gt; supposed to be fixed in Snow Leopard).  Seems like you could probably test this
&gt; fairly quickly?

That’s basically the conclusion that I had arrived at too.  It seems CGImageSourceGetStatusAtIndex claims that all frames of an animated GIF are incomplete when using an incremental image source that has not yet received the complete data of the image.  This certainly isn’t the behavior that the author of ImageSource::frameIsCompleteAtIndex (or any reasonable person) expects.  I’m not sure if this behavior changed from Leopard to SnowLeopard, but I filed a bug against CGImageSourceGetStatusAtIndex expressing my displeasure at the misleading results that it gives (&lt;rdar://problem/7679174&gt;).

&gt; I haven&apos;t tested closely, but based on the overall behavior I see and the code
&gt; in them, I think the open-source decoders return the desired values for this
&gt; function.  This means that Safari and Chromium would see vastly different
&gt; behavior here which would help explain why we&apos;ve been talking past each other.

That would explain a lot!

&gt; Thanks for the great analysis.  Fixing this function should certainly be the
&gt; top priority, and it&apos;s nice to know why the seemingly-innocent patch on this
&gt; bug could have caused such a large-seeming regression.  Once we fix, then we
&gt; should be back in the world described by comment 9, and can move forward.

I think I may have a solution for this.  I’ll write up a bug about BitmapImage::frameIsCompleteAtIndex and will throw a patch up after some more testing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>192835</commentid>
    <comment_count>17</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-23 01:46:39 -0800</bug_when>
    <thetext>Bug for that issue is bug 35287.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193152</commentid>
    <comment_count>18</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-23 15:15:15 -0800</bug_when>
    <thetext>Now that bug 35287 is fixed (thanks!), should we re-land this?  And then do you want to take a further look at how we should behave during image load, or do you think the current behavior is OK?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193210</commentid>
    <comment_count>19</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2010-02-23 18:14:14 -0800</bug_when>
    <thetext>(In reply to comment #18)
&gt; Now that bug 35287 is fixed (thanks!), should we re-land this?  And then do you
&gt; want to take a further look at how we should behave during image load, or do
&gt; you think the current behavior is OK?

Yes, I think it’s fine to land this change now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>193496</commentid>
    <comment_count>20</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2010-02-24 13:52:28 -0800</bug_when>
    <thetext>Fixed in r55199.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>49035</attachid>
            <date>2010-02-18 12:56:08 -0800</date>
            <delta_ts>2010-02-18 13:03:51 -0800</delta_ts>
            <desc>patch v1</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>3398</size>
            <attacher name="Peter Kasting">pkasting</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1NDk4MSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMDItMTggIFBldGVyIEthc3RpbmcgIDx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"
              ispatch="1"
              isprivate="0"
          >
            <attachid>49037</attachid>
            <date>2010-02-18 13:03:51 -0800</date>
            <delta_ts>2010-02-19 16:36:31 -0800</delta_ts>
            <desc>patch v2</desc>
            <filename>patch</filename>
            <type>text/plain</type>
            <size>3394</size>
            <attacher name="Peter Kasting">pkasting</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1NDk4MSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMTAtMDItMTggIFBldGVyIEthc3RpbmcgIDxwa2FzdGluZ0Bnb29n
bGUuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAg
IEZpeCByZWdyZXNzaW9uIGluIGNhbGN1bGF0aW5nIGFuIGFuaW1hdGVkIGltYWdlJ3Mgc3RhcnQg
dGltZS4KKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTM1
MTE1CisKKyAgICAgICAgKiBwbGF0Zm9ybS9ncmFwaGljcy9CaXRtYXBJbWFnZS5jcHA6CisgICAg
ICAgIChXZWJDb3JlOjpCaXRtYXBJbWFnZTo6c3RhcnRBbmltYXRpb24pOgorCiAyMDEwLTAyLTE3
ICBEdW1pdHJ1IERhbmlsaXVjICA8ZHVtaUBjaHJvbWl1bS5vcmc+CiAKICAgICAgICAgUmV2aWV3
ZWQgYnkgRGFyaW4gQWRsZXIuCkluZGV4OiBXZWJDb3JlL3BsYXRmb3JtL2dyYXBoaWNzL0JpdG1h
cEltYWdlLmNwcAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P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Lgog
ICAgIGlmIChuZXh0RnJhbWUgPT0gMCAmJiBtX3JlcGV0aXRpb25zQ29tcGxldGUgPT0gMCAmJiBt
X2Rlc2lyZWRGcmFtZVN0YXJ0VGltZSA8IHRpbWUpCi0gICAgICBtX2Rlc2lyZWRGcmFtZVN0YXJ0
VGltZSA9IHRpbWU7CisgICAgICAgIG1fZGVzaXJlZEZyYW1lU3RhcnRUaW1lID0gdGltZTsKIAog
ICAgIGlmICghY2F0Y2hVcElmTmVjZXNzYXJ5IHx8IHRpbWUgPCBtX2Rlc2lyZWRGcmFtZVN0YXJ0
VGltZSkgewogICAgICAgICAvLyBIYXZlbid0IHlldCByZWFjaGVkIHRpbWUgZm9yIG5leHQgZnJh
bWUgdG8gc3RhcnQ7IGRlbGF5IHVudGlsIHRoZW4uCg==
</data>
<flag name="review"
          id="31793"
          type_id="1"
          status="+"
          setter="abarth"
    />
          </attachment>
      

    </bug>

</bugzilla>