]> git.parisson.com Git - pdf.js.git/commitdiff
Fixed worker_loader for examples/; simplified
authorArtur Adib <arturadib@gmail.com>
Thu, 22 Dec 2011 14:40:00 +0000 (09:40 -0500)
committerArtur Adib <arturadib@gmail.com>
Thu, 22 Dec 2011 14:40:00 +0000 (09:40 -0500)
src/core.js
src/worker.js
src/worker_loader.js

index 71c18f17815819fe6f2df09c5798e3494926b7c7..96e0c9fcc09af3931433b2d9f13b2e41c7e4155e 100644 (file)
@@ -582,9 +582,6 @@ var PDFDoc = (function PDFDocClosure() {
 
       var messageHandler = new MessageHandler('main', worker);
 
-      // Tell the worker the file it was created from.
-      messageHandler.send('workerSrc', workerSrc);
-
       messageHandler.on('test', function pdfDocTest(supportTypedArray) {
         if (supportTypedArray) {
           this.worker = worker;
index c18de65ad05808fd6a705ed0116cda98b12a1605..4d9dd1bb637a96c68398ca0015689eae9a63df5a 100644 (file)
@@ -85,13 +85,6 @@ var WorkerMessageHandler = {
       handler.send('test', data instanceof Uint8Array);
     });
 
-    handler.on('workerSrc', function wphSetupWorkerSrc(data) {
-      // In development, the `workerSrc` message is handled in the
-      // `worker_loader.js` file. In production the workerProcessHandler is
-      // called for this. This servers as a dummy to prevent calling an
-      // undefined action `workerSrc`.
-    });
-
     handler.on('doc', function wphSetupDoc(data) {
       // Create only the model of the PDFDoc, which is enough for
       // processing the content of the pdf.
index 7141fa3e39d7f02b463ab7cda7f0a80bde395241..aad19d3e6312a3f87f08b63d161bf329129de41a 100644 (file)
@@ -3,51 +3,30 @@
 
 'use strict';
 
-function onMessageLoader(evt) {
-  // Reset the `onmessage` function as it was only set to call
-  // this function the first time a message is passed to the worker
-  // but shouldn't get called anytime afterwards.
-  this.onmessage = null;
-
-  if (evt.data.action !== 'workerSrc') {
-    throw 'Worker expects first message to be `workerSrc`';
-  }
-
-  // Content of `PDFJS.workerSrc` as defined on the main thread.
-  var workerSrc = evt.data.data;
-
-  // Extract the directory that contains the source files to load.
-  // Assuming the source files have the same relative possition as the
-  // `workerSrc` file.
-  var dir = workerSrc.substring(0, workerSrc.lastIndexOf('/') + 1);
-
-  // List of files to include;
-  var files = [
-    'core.js',
-    'util.js',
-    'canvas.js',
-    'obj.js',
-    'function.js',
-    'charsets.js',
-    'cidmaps.js',
-    'colorspace.js',
-    'crypto.js',
-    'evaluator.js',
-    'fonts.js',
-    'glyphlist.js',
-    'image.js',
-    'metrics.js',
-    'parser.js',
-    'pattern.js',
-    'stream.js',
-    'worker.js',
-    '../external/jpgjs/jpg.js'
-  ];
-
-  // Load all the files.
-  for (var i = 0; i < files.length; i++) {
-    importScripts(dir + files[i]);
-  }
+// List of files to include;
+var files = [
+  'core.js',
+  'util.js',
+  'canvas.js',
+  'obj.js',
+  'function.js',
+  'charsets.js',
+  'cidmaps.js',
+  'colorspace.js',
+  'crypto.js',
+  'evaluator.js',
+  'fonts.js',
+  'glyphlist.js',
+  'image.js',
+  'metrics.js',
+  'parser.js',
+  'pattern.js',
+  'stream.js',
+  'worker.js',
+  '../external/jpgjs/jpg.js'
+];
+
+// Load all the files.
+for (var i = 0; i < files.length; i++) {
+  importScripts(files[i]);
 }
-
-this.onmessage = onMessageLoader;