1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #1118 from brendandahl/amowarnings

Address AMO Review Concerns
This commit is contained in:
notmasteryet 2012-02-01 04:33:51 -08:00
commit 13f207424c
10 changed files with 298 additions and 126 deletions

View file

@ -624,9 +624,19 @@ var PDFDoc = (function PDFDocClosure() {
}
try {
// Some versions of FF can't create a worker on localhost, see:
// https://bugzilla.mozilla.org/show_bug.cgi?id=683280
var worker = new Worker(workerSrc);
var worker;
if (PDFJS.isFirefoxExtension) {
// The firefox extension can't load the worker from the resource://
// url so we have to inline the script and then use the blob loader.
var bb = new MozBlobBuilder();
bb.append(document.querySelector('#PDFJS_SCRIPT_TAG').textContent);
var blobUrl = window.URL.createObjectURL(bb.getBlob());
worker = new Worker(blobUrl);
} else {
// Some versions of FF can't create a worker on localhost, see:
// https://bugzilla.mozilla.org/show_bug.cgi?id=683280
worker = new Worker(workerSrc);
}
var messageHandler = new MessageHandler('main', worker);
@ -645,7 +655,9 @@ var PDFDoc = (function PDFDocClosure() {
// serializing the typed array.
messageHandler.send('test', testObj);
return;
} catch (e) {}
} catch (e) {
warn('The worker has been disabled.');
}
}
// Either workers are disabled, not supported or have thrown an exception.
// Thus, we fallback to a faked worker.