1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Merge pull request #1953 from brendandahl/b2g

Add B2G build and new preprocessor.
This commit is contained in:
Yury Delendik 2012-08-08 08:37:26 -07:00
commit 70beb11a50
11 changed files with 545 additions and 301 deletions

View file

@ -430,19 +430,18 @@ var WorkerTransport = (function WorkerTransportClosure() {
try {
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);
}
//#if !(FIREFOX || MOZCENTRAL)
// 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);
//#else
// // 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);
//#endif
var messageHandler = new MessageHandler('main', worker);
this.messageHandler = messageHandler;

View file

@ -29,9 +29,11 @@ function getPdf(arg, callback) {
var params = arg;
if (typeof arg === 'string')
params = { url: arg };
//#if !B2G
var xhr = new XMLHttpRequest();
//#else
//var xhr = new XMLHttpRequest({mozSystem: true});
//#endif
xhr.open('GET', params.url);
var headers = params.headers;

View file

@ -7,9 +7,13 @@ var PDFJS = {};
// Use strict in our context only - users might not want it
'use strict';
PDFJS.build = 'PDFJSSCRIPT_BUNDLE_VER';
PDFJS.build =
//#if !BUNDLE_VERSION
'PDFJSSCRIPT_BUNDLE_VER';
//#else
//#expand '__BUNDLE_VERSION__';
//#endif
// Files are inserted below - see Makefile
/* PDFJSSCRIPT_INCLUDE_ALL */
//#expand __BUNDLE__
}).call((typeof window === 'undefined') ? this : window);