]> git.parisson.com Git - pdf.js.git/commitdiff
Disable work on firefox using feature detection
authorJulian Viereck <julian.viereck@gmail.com>
Thu, 10 Nov 2011 17:33:45 +0000 (18:33 +0100)
committerJulian Viereck <julian.viereck@gmail.com>
Thu, 10 Nov 2011 17:38:22 +0000 (18:38 +0100)
src/core.js
test/driver.js

index 5e97763abc80f58f7c943056b708efc05325ab8d..43c059b5634f7ef8b2e3fa4071660b28ebe92d87 100644 (file)
@@ -15,10 +15,6 @@ if (!globalScope.PDFJS) {
   globalScope.PDFJS = {};
 }
 
-// Temporarily disabling workers until 'localhost' FF bugfix lands:
-// https://bugzilla.mozilla.org/show_bug.cgi?id=683280
-globalScope.PDFJS.disableWorker = true;
-
 // getPdf()
 // Convenience function to perform binary Ajax GET
 // Usage: getPdf('http://...', callback)
@@ -471,6 +467,7 @@ var PDFDoc = (function pdfDoc() {
     this.objs = new PDFObjects();
 
     this.pageCache = [];
+    this.fontsLoading = {};
     this.workerReadyPromise = new Promise('workerReady');
 
     // If worker support isn't disabled explicit and the browser has worker
@@ -484,7 +481,16 @@ var PDFDoc = (function pdfDoc() {
         throw 'No PDFJS.workerSrc specified';
       }
 
-      var worker = new Worker(workerSrc);
+      var worker
+      try {
+        worker = new Worker(workerSrc);
+      } catch (e) {
+        // Some versions of FF can't create a worker on localhost, see:
+        // https://bugzilla.mozilla.org/show_bug.cgi?id=683280
+        globalScope.PDFJS.disableWorker = true;
+        this.setupFakeWorker();
+        return;
+      }
 
       var messageHandler = new MessageHandler('main', worker);
 
@@ -505,8 +511,6 @@ var PDFDoc = (function pdfDoc() {
     } else {
       this.setupFakeWorker();
     }
-
-    this.fontsLoading = {};
   }
 
   constructor.prototype = {
index 16375c30b3ec0c5eff49fe6688c80faa04b576d4..e84b7c8e089f4d291135b4040d6d8088cf523486 100644 (file)
@@ -7,6 +7,11 @@
 
 'use strict';
 
+// Disable worker support for running test as
+//   https://github.com/mozilla/pdf.js/pull/764#issuecomment-2638944
+//   "firefox-bin: Fatal IO error 12 (Cannot allocate memory) on X server :1."
+PDFJS.disableWorker = true;
+
 var appPath, browser, canvas, currentTaskIdx, manifest, stdout;
 var inFlightRequests = 0;