no bug - stop using switchToTabHavingURI in this test
authorDão Gottwald <dao@mozilla.com>
Sun, 17 Oct 2010 21:50:15 +0200
changeset 55992 4056867a34ac368ed9d2ec8f5f9d7d2bde81cf36
parent 55991 36aa9c19420eccfba960a5c7c656ccc26f5c2e62
child 55993 cfd18201f49be4aa725b832b413dee7afaf6d4cf
push id16363
push userdgottwald@mozilla.com
push dateMon, 18 Oct 2010 09:26:09 +0000
treeherdermozilla-central@cfd18201f49b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b8pre
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
no bug - stop using switchToTabHavingURI in this test
modules/libpr0n/test/browser/browser_image.js
--- a/modules/libpr0n/test/browser/browser_image.js
+++ b/modules/libpr0n/test/browser/browser_image.js
@@ -5,30 +5,31 @@ waitForExplicitFinish();
 var gTimer;
 
 // Browsing to a new URL - pushing us into the bfcache - should cause
 // animations to stop, and resume when we return
 function testBFCache() {
   function theTest() {
     var abort = false;
     var chances, gImage, gFrames;
-    gBrowser.selectedTab = gBrowser.addTab();
-    switchToTabHavingURI(TESTROOT + "image.html", true, function(aBrowser) {
-      var window = aBrowser.contentWindow;
+    gBrowser.selectedTab = gBrowser.addTab(TESTROOT + "image.html");
+    gBrowser.selectedBrowser.addEventListener("pageshow", function () {
+      gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
+      var window = gBrowser.contentWindow;
       // If false, we are in an optimized build, and we abort this and
       // all further tests
       if (!actOnMozImage(window.document, "img1", function(image) {
         gImage = image;
         gFrames = gImage.framesNotified;
       })) {
         gBrowser.removeCurrentTab();
         abort = true;
       }
       goer.next();
-    });
+    }, true);
     yield;
     if (abort) {
       finish();
       yield; // optimized build
     }
 
     // Let animation run for a bit
     chances = 120;
@@ -103,43 +104,45 @@ function testBFCache() {
 
 // Check that imgContainers are shared on the same page and
 // between tabs
 function testSharedContainers() {
   function theTest() {
     var gImages = [];
     var gFrames;
 
-    gBrowser.selectedTab = gBrowser.addTab();
-    switchToTabHavingURI(TESTROOT + "image.html", true, function(aBrowser) {
-      actOnMozImage(aBrowser.contentWindow.window.document, "img1", function(image) {
+    gBrowser.selectedTab = gBrowser.addTab(TESTROOT + "image.html");
+    gBrowser.selectedBrowser.addEventListener("pageshow", function () {
+      gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
+      actOnMozImage(gBrowser.contentDocument, "img1", function(image) {
         gImages[0] = image;
         gFrames = image.framesNotified; // May in theory have frames from last test
                                         // in this counter - so subtract them out
       });
       goer.next();
-    });
+    }, true);
     yield;
 
     // Load next tab somewhat later
     gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     gTimer.initWithCallback(function() {
-      gBrowser.selectedTab = gBrowser.addTab();
       goer.next();
     }, 1500, Ci.nsITimer.TYPE_ONE_SHOT);
     yield;
 
-    switchToTabHavingURI(TESTROOT + "imageX2.html", true, function(aBrowser) {
+    gBrowser.selectedTab = gBrowser.addTab(TESTROOT + "imageX2.html");
+    gBrowser.selectedBrowser.addEventListener("pageshow", function () {
+      gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
       [1,2].forEach(function(i) {
-        actOnMozImage(aBrowser.contentWindow.window.document, "img"+i, function(image) {
+        actOnMozImage(gBrowser.contentDocument, "img"+i, function(image) {
           gImages[i] = image;
         });
       });
       goer.next();
-    });
+    }, true);
     yield;
 
     chances = 120;
     do {
       gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
       gTimer.initWithCallback(function() {
         if (gImages[0].framesNotified - gFrames >= 10) {
           goer.send(true);