Backed out changeset b29a45098630 (bug 1112947) for test bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 24 Apr 2015 16:55:55 -0400
changeset 260270 8fc6195511e5
parent 260269 0e69c76cbbe2
child 260271 0b01dd543c61
child 260273 eebbe2ef5db5
child 260274 37c6aaf5012c
child 260277 b95402a1f023
child 260375 4f80fecda802
push id733
push userryanvm@gmail.com
push date2015-04-24 20:56 +0000
treeherdermozilla-release@8fc6195511e5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1112947
milestone38.0
backs outb29a45098630
Backed out changeset b29a45098630 (bug 1112947) for test bustage.
browser/extensions/pdfjs/test/browser_pdfjs_navigation.js
--- a/browser/extensions/pdfjs/test/browser_pdfjs_navigation.js
+++ b/browser/extensions/pdfjs/test/browser_pdfjs_navigation.js
@@ -184,21 +184,21 @@ function runTests(document, window, fini
 
   // Wait for outline items, the start the navigation actions
   waitForOutlineItems(document).then(function () {
     // The key navigation has to happen in page-fit, otherwise it won't scroll
     // trough a complete page
     setZoomToPageFit(document).then(function () {
       runNextTest(document, window, finish);
     }, function () {
-      ok(false, "Current scale has been set to 'page-fit'");
+      ok(false, "Current scale has been ste to 'page-fit'");
       finish();
     });
   }, function () {
-    ok(false, "Outline items have been found");
+    ok(false, "Outline items have ben found");
     finish();
   });
 }
 
 /**
  * As the page changes asynchronously, we have to wait for the event after
  * we trigger the action so we will be at the expected page number after each action
  *
@@ -262,44 +262,43 @@ function runNextTest(document, window, e
  * Outline Items gets appended to the document latter on we have to
  * wait for them before we start to navigate though document
  *
  * @param document
  * @returns {deferred.promise|*}
  */
 function waitForOutlineItems(document) {
   var deferred = Promise.defer();
-  document.addEventListener("outlineloaded", function outlineLoaded(evt) {
-    document.removeEventListener("outlineloaded", outlineLoaded);
-    var outlineCount = evt.detail.outlineCount;
-
-    if (document.querySelectorAll(".outlineItem").length === outlineCount) {
+  var timeout = setTimeout(() => deferred.reject(), 10000);
+  var interval = setInterval(function () {
+    if (document.querySelectorAll(".outlineItem").length == PDF_OUTLINE_ITEMS) {
+      clearInterval(interval);
+      clearTimeout(timeout);
       deferred.resolve();
-    } else {
-      deferred.reject();
     }
-  });
+  }, 500);
 
   return deferred.promise;
 }
 
 /**
  * The key navigation has to happen in page-fit, otherwise it won't scroll
  * trough a complete page
  *
  * @param document
  * @returns {deferred.promise|*}
  */
 function setZoomToPageFit(document) {
   var deferred = Promise.defer();
   document.addEventListener("pagerendered", function onZoom(e) {
-    document.removeEventListener("pagerendered", onZoom);
+    document.removeEventListener("pagerendered", onZoom), false;
     document.querySelector("#viewer").click();
     deferred.resolve();
-  });
+
+  }, false);
 
   var select = document.querySelector("select#scaleSelect");
   select.selectedIndex = 2;
   select.dispatchEvent(new Event("change"));
 
   return deferred.promise;
 }