Bug 787899 - Don't cancel the loading of a multipart/x-mixed-replace stream of we fail to initialize a part. r=jrmuizel
authorJoe Drew <joe@drew.ca>
Tue, 11 Sep 2012 14:03:52 -0400
changeset 107885 eea69a3e5c1bd5dcec17bec5a45be0534440d414
parent 107884 31f6e5e2ca84739852cc0da6bf8b061231e4db69
child 107886 e96de94819152214bc21bbdcd6bcd5222a948a97
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersjrmuizel
bugs787899
milestone18.0a1
Bug 787899 - Don't cancel the loading of a multipart/x-mixed-replace stream of we fail to initialize a part. r=jrmuizel
image/src/imgRequest.cpp
image/test/mochitest/Makefile.in
image/test/mochitest/bad.jpg
image/test/mochitest/bug733553.sjs
image/test/mochitest/rillybad.jpg
image/test/mochitest/test_bug733553.html
--- a/image/src/imgRequest.cpp
+++ b/image/src/imgRequest.cpp
@@ -1100,17 +1100,20 @@ imgRequest::OnDataAvailable(nsIRequest *
       rv = mURI->GetSpec(uriString);
       if (NS_FAILED(rv))
         uriString.Assign("<unknown image URI>");
 
       // Initialize the image that we created above. For RasterImages, this
       // instantiates a decoder behind the scenes, so if we don't have a decoder
       // for this mimetype we'll find out about it here.
       rv = mImage->Init(this, mContentType.get(), uriString.get(), imageFlags);
-      if (NS_FAILED(rv)) { // Probably bad mimetype
+
+      // We allow multipart images to fail to initialize without cancelling the
+      // load because subsequent images might be fine.
+      if (NS_FAILED(rv) && !mIsMultiPartChannel) { // Probably bad mimetype
 
         this->Cancel(rv);
         return NS_BINDING_ABORTED;
       }
 
       if (mImage->GetType() == imgIContainer::TYPE_RASTER) {
         /* Use content-length as a size hint for http channels. */
         nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aRequest));
--- a/image/test/mochitest/Makefile.in
+++ b/image/test/mochitest/Makefile.in
@@ -53,16 +53,19 @@ MOCHITEST_FILES =   imgutils.js \
                 bug552605.sjs \
                 bug671906-iframe.html \
                 bug671906.sjs \
                 test_bug671906.html \
                 test_bug733553.html \
                 bug733553.sjs \
                 bug733553-informant.sjs \
                 animated-gif2.gif \
+                invalid.jpg \
+                bad.jpg \
+                rillybad.jpg \
                 test_bug767779.html \
                 bug767779.sjs \
                 animated-gif_trailing-garbage.gif \
 		test_error_events.html \
 		error-early.png \
 		test_drawDiscardedImage.html \
                 $(NULL)
 
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..555a416d7d8e6c0f835a756994a8efca17c55cd8
GIT binary patch
literal 2477
zc$}TldpOg59|!Q?%xp+3BytF&RFv}}hj2@CJ0Egv2~l<<6LN|yC8yFd84=0IDaU9?
z%rQ~Om_tU<)Mkho?%eCXp2I)SAJ6l=zt{Es=kxh~ug~lH?2hlw0wPvtkY@l84*-C;
z2iTni%mE0PmzNg|;a(63gb%t02IWRrK#+eATzKC;xG-EqbicHOsF;+v2>gKj0V!!2
zIXO8|2?d0LEJ9jVPWIO)AnsErA9ODawpUgRE++dwXSW@I!vK509t=_dc;Fx~9JEUY
z<hXM}Kz|4LM?gGaUhb4IegQ#lLxTvw0|JA2xbt%X+-e-R4)DSu`{dP4`9vKqLKQ;A
zG;U@V!W7MF-iSMXU?DVpFp2yE`y~!YN+~HHKB96|OIt@*Pv5}&H;XftXOUJ;&MxO%
z-P}EV{Vw?jT)q+*b}c+2@_JM>_EysEJIQxb9^f8k;j<s*5Q?4_KPw@YmOZbnt8Zw0
z+0^{1qm$g#-P7CGKRhz}af~uPL8Z;jfBv$t_?5o2vby$TeS^Kp+4|)I0btNS^B-Ms
zu8W7e7GCHt7l<eFR|A|EBCpQ3&(r~WF;rAR<0eeZEVHoY4ZotMBTL)|^FaWiMN?Y&
zCHoup-?<Y1FWA3a|7KBvJzx-bcVIYR0&FX&Jk5^8(;D-nWp5Y0erPG&irGRDWpjw8
zidI!?eQOwfBYNA(v9WgK@zn}@BG}08Nd--dt+(jjzyJ4hVHA|=gDKe9X`Q+NLPs{)
zb>DfUmU>0i{K0}JRkjPJG0%stmRKZxK3*E*$1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M>Mllrp<StOzw<8qTV=}(*vbmw@T&~GU#hc&bEFDlOiD}Lb
zi=!>mL)N+Nx`b<TmopV#)fp;HlcF+p+h`*zT^{d$<mz3B9T0~)r4@8ERSREV^J4wU
zAQQCTH#X$-#aK(+N{kNrV`YotBA0PZ=8|R{F<p82XS7FNN6%>C_Uoi82fOmBgz9!D
G1pWd#D4b{j
--- a/image/test/mochitest/bug733553.sjs
+++ b/image/test/mochitest/bug733553.sjs
@@ -9,17 +9,22 @@ var bodyParts = [
   ["red.png", "image/png"],
   ["lime100x100.svg", "image/svg+xml"],
   ["lime100x100.svg", "image/svg+xml"],
   ["animated-gif2.gif", "image/gif"],
   ["red.png", "image/png"],
   ["damon.jpg", "image/jpeg"],
   ["damon.jpg", "application/octet-stream"],
   ["damon.jpg", "image/jpeg"],
-  ["lime100x100.svg", "image/svg+xml"]
+  ["rillybad.jpg", "application/x-unknown-content-type"],
+  ["damon.jpg", "image/jpeg"],
+  ["bad.jpg", "image/jpeg"],
+  ["red.png", "image/png"],
+  ["invalid.jpg", "image/jpeg"],
+  ["animated-gif2.gif", "image/gif"]
 ];
 var timer = Components.classes["@mozilla.org/timer;1"];
 var partTimer = timer.createInstance(Components.interfaces.nsITimer);
 
 function getFileAsInputStream(aFilename) {
   var file = Components.classes["@mozilla.org/file/directory_service;1"]
              .getService(Components.interfaces.nsIProperties)
              .get("CurWorkD", Components.interfaces.nsIFile);
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..e2fb1d303f244a1825636b6360ac4f7e5fc0601a
GIT binary patch
literal 11142
zc$}Sj1yEegw(cOw;0_sdfWa-eJHa6YcYes=GRQ!14<SJYCqR${he3jSf)5fT3>GZ7
z2lpT^|9N%JyZ6?)ukL%R>Z{tj*XrK=Rj<{(dUq?i!@TWa-n<6>9(Iz9PHr|1c2Au>
z>>LR3l-yx3JE*slJ4}*M$<-Zh_ov7P>S)LNN8#<|?kdUXX5+{E$6kh?hY{w^3-@;S
zvirvq^lvjB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_;fw!86OHW1d^4DM{q%30;>;@}FT1g|{5pUnH6bgz2roJL_8frcu|*zfXC
zkVX^=X46GTAzZxu?$<jhD-wr*JS>dh9`JMv7iZa^E4RhZwqv)2HGb6%Ie+@5&o>@`
kvz-x}L6#JWWMc>TRK|Li9mNNC&%bxL|L$S|@xzb*1u+o=xBvhE
--- a/image/test/mochitest/test_bug733553.html
+++ b/image/test/mochitest/test_bug733553.html
@@ -23,17 +23,29 @@ var testParts = [
   [40, "animated-gif2.gif"],
   [1, "red.png"],
   [100, "lime100x100.svg"],
   [100, "lime100x100.svg"],
   [40, "animated-gif2.gif"],
   [1, "red.png"],
   [80, "damon.jpg"],
   [80, "damon.jpg"],
-  [80, "damon.jpg"]
+  [80, "damon.jpg"],
+  // An invalid image (from bug 787899) that is further delivered with a
+  // "special" bad MIME type that indicates that the necko
+  // multipart/x-mixed-replace parser wasn't able to parse it.
+  [0, "rillybad.jpg"],
+  // Bad.jpg is bad such that it sniffs as a JPEG, and therefore doesn't change
+  // what's been decoded (since the RasterImage isn't deleted), so its width
+  // needs to be the same as the previous image.
+  [80, "damon.jpg"],
+  [80, "bad.jpg"],
+  [1, "red.png"],
+  [0, "invalid.jpg"],
+  [40, "animated-gif2.gif"]
 ];
 
 // We'll append the part number to this, and tell the informant
 const BASE_URL = "bug733553-informant.sjs?";
 
 function initializeOnload() {
   var firstimg = document.createElement('img');
   firstimg.addEventListener("load", imageLoad, false);
@@ -46,27 +58,24 @@ function initializeOnload() {
 }
 
 function readyForNext() {
   var loader = document.getElementById("loader");
   loader.src = BASE_URL + ++testIndex;
 }
 
 function imageLoad(aEvent) {
-  if (testParts.length > testIndex) {
-    var [width, fileName] = testParts[testIndex];
-    is(aEvent.target.width, width,
-       "Test " + testIndex + " " + fileName + " width correct");
-    readyForNext();
+  var [width, fileName] = testParts[testIndex];
+  is(aEvent.target.width, width,
+     "Test " + testIndex + " " + fileName + " width correct");
+
+  if ((testParts.length - 1) == testIndex) {
+    SimpleTest.finish();
   } else {
-    aEvent.target.removeEventListener("load", imageLoad, false);
-    aEvent.target.removeEventListener("error", imageLoad, false);
-    var loader = document.getElementById("loader");
     readyForNext();
-    SimpleTest.finish();
   }
 }
 
 </script>
 </pre>
 <div id="content"> <!-- style="display: none" -->
 <iframe id="loader"></iframe>
 </div>