Bug 1103328 (Part 4) - Force decoding in test_has_transparency. r=tn
authorSeth Fowler <seth@mozilla.com>
Mon, 24 Nov 2014 23:42:43 -0800
changeset 241752 d92d3a036dfd1124f1b474e3dd2cfd03b4799ddb
parent 241751 48a1c4550955f894e4e45edbdb687999aa5ef9d9
child 241753 b020dee629bec0bbf2c182f264a5c8b1708d3630
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1103328
milestone36.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 1103328 (Part 4) - Force decoding in test_has_transparency. r=tn
image/test/mochitest/test_has_transparency.html
--- a/image/test/mochitest/test_has_transparency.html
+++ b/image/test/mochitest/test_has_transparency.html
@@ -22,16 +22,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 SimpleTest.waitForExplicitFinish();
 
 const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const gContent = document.getElementById("content");
 
+var gCanvas;
+var gCanvasCtx;
 var gImg;
 var gMyDecoderObserver;
 var gIsTestFinished = false;
 var gFiles;
 var gCurrentFileIsTransparent = false;
 var gHasTransparencyWasCalled = false;
 
 function testFiles() {
@@ -94,16 +96,21 @@ function onError() {
   loadNext();
 }
 
 function onLoad() {
   if (gIsTestFinished) {
     return;
   }
   ok(true, "Should successfully load " + gImg.src);
+
+  // Force decoding of the image.
+  SimpleTest.executeSoon(function() {
+    gCanvasCtx.drawImage(gImg, 0, 0);
+  });
 }
 
 function failTest() {
   ok(false, "timing out after " + FAILURE_TIMEOUT + "ms.  " +
             "currently displaying " + gImg.src);
   cleanUpAndFinish();
 }
 
@@ -114,16 +121,18 @@ function cleanUpAndFinish() {
   gIsTestFinished = true;
   let imgLoadingContent = gImg.QueryInterface(Ci.nsIImageLoadingContent);
   imgLoadingContent.removeObserver(gMyDecoderObserver);
   SimpleTest.finish();
 }
 
 function main() {
   gFiles = testFiles();
+  gCanvas = document.createElement('canvas');
+  gCanvasCtx = gCanvas.getContext('2d');
   gImg = new Image();
   gImg.onload = onLoad;
   gImg.onerror = onError;
 
   // Create, customize & attach decoder observer.
   observer = new ImageDecoderObserverStub();
   observer.hasTransparency = onHasTransparency;
   observer.decodeComplete = onDecodeComplete;