[Pkg-javascript-commits] [pdf.js] 147/161: Cools down Chrome/Windows during testing

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 14:16:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 4d3b15a4868c05296943c77b7fcbeaf3d5250cbe
Author: Yury Delendik <ydelendik at mozilla.com>
Date:   Mon Mar 31 07:46:11 2014 -0500

    Cools down Chrome/Windows during testing
---
 test/driver.js    | 20 +++++++++++++++++---
 test/webserver.js |  4 ++--
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/test/driver.js b/test/driver.js
index 6602f14..f171c36 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -35,6 +35,9 @@ var appPath, masterMode, browser, canvas, dummyCanvas, currentTaskIdx,
     manifest, stdout;
 var inFlightRequests = 0;
 
+// Chrome for Windows locks during testing on low end machines
+var letItCooldown = /Windows.*?Chrom/i.test(navigator.userAgent);
+
 function queryParams() {
   var qs = window.location.search.substring(1);
   var kvs = qs.split('&');
@@ -84,7 +87,7 @@ window.load = function load() {
   }, delay);
 };
 
-function cleanup() {
+function cleanup(callback) {
   // Clear out all the stylesheets since a new one is created for each font.
   while (document.styleSheets.length > 0) {
     var styleSheet = document.styleSheets[0];
@@ -107,6 +110,11 @@ function cleanup() {
       delete manifest[i].pdfDoc;
     }
   }
+  if (letItCooldown) {
+    setTimeout(callback, 500);
+  } else {
+    callback();
+  }
 }
 
 function exceptionToString(e) {
@@ -120,8 +128,10 @@ function exceptionToString(e) {
 }
 
 function nextTask() {
-  cleanup();
+  cleanup(continueNextTask);
+}
 
+function continueNextTask() {
   if (currentTaskIdx == manifest.length) {
     done();
     return;
@@ -401,7 +411,11 @@ function send(url, message, callback) {
         });
       }
       if (callback) {
-        callback();
+        if (letItCooldown) {
+          setTimeout(callback, 100);
+        } else {
+          callback();
+        }
       }
     }
   };
diff --git a/test/webserver.js b/test/webserver.js
index b854619..5ffeaba 100644
--- a/test/webserver.js
+++ b/test/webserver.js
@@ -47,6 +47,7 @@ function WebServer() {
   this.port = 8000;
   this.server = null;
   this.verbose = false;
+  this.disableRangeRequests = false;
   this.hooks = {
     'GET': [],
     'POST': []
@@ -89,8 +90,7 @@ WebServer.prototype = {
       return;
     }
 
-    // disables range requests for chrome windows -- locks during testing
-    var disableRangeRequests = /Windows.*?Chrom/i.test(agent);
+    var disableRangeRequests = this.disableRangeRequests;
 
     var filePath;
     fs.realpath(path.join(this.root, pathPart), checkFile);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list