diff --git a/make.js b/make.js index 83aff5b14fd340..4073da4a5ecc22 100644 --- a/make.js +++ b/make.js @@ -70,7 +70,6 @@ var DEFINES = { GENERIC: false, FIREFOX: false, MOZCENTRAL: false, - B2G: false, CHROME: false, MINIFIED: false, SINGLE_FILE: false, @@ -985,8 +984,7 @@ target.b2g = function() { echo(); echo('### Building B2G (Firefox OS App)'); var B2G_BUILD_CONTENT_DIR = B2G_BUILD_DIR + '/content/'; - var defines = builder.merge(DEFINES, { B2G: true }); - target.bundle({ defines: defines }); + target.bundle(); // Clear out everything in the b2g build directory cd(ROOT_DIR); @@ -999,7 +997,7 @@ target.b2g = function() { mkdir('-p', B2G_BUILD_CONTENT_DIR + '/pdfjs-components/cmaps'); var setup = { - defines: defines, + defines: DEFINES, copy: [ ['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'], ['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'], diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js index 427673c4ea7e5c..5b6b2ddfec1f07 100644 --- a/src/core/chunked_stream.js +++ b/src/core/chunked_stream.js @@ -287,11 +287,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() { } else { var getXhr = function getXhr() { -//#if B2G -// return new XMLHttpRequest({ mozSystem: true }); -//#else return new XMLHttpRequest(); -//#endif }; this.networkManager = new NetworkManager(this.url, { getXhr: getXhr, diff --git a/src/core/murmurhash3.js b/src/core/murmurhash3.js index cdc3500f0f7bd7..deaba73a700a69 100644 --- a/src/core/murmurhash3.js +++ b/src/core/murmurhash3.js @@ -35,7 +35,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) { } var alwaysUseUint32ArrayView = false; -//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME) +//#if !(FIREFOX || MOZCENTRAL || CHROME) // old webkits have issues with non-aligned arrays try { new Uint32Array(new Uint8Array(5).buffer, 0, 1); diff --git a/src/core/network.js b/src/core/network.js index c030f71a1ca697..2ae407424e7927 100644 --- a/src/core/network.js +++ b/src/core/network.js @@ -50,11 +50,7 @@ var NetworkManager = (function NetworkManagerClosure() { this.withCredentials = args.withCredentials || false; this.getXhr = args.getXhr || function NetworkManager_getXhr() { -//#if B2G -// return new XMLHttpRequest({ mozSystem: true }); -//#else return new XMLHttpRequest(); -//#endif }; this.currXhrId = 0; diff --git a/src/shared/util.js b/src/shared/util.js index 382f6437fc28c5..ee38bea39580cf 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -503,8 +503,8 @@ Object.defineProperty(PDFJS, 'isLittleEndian', { } }); -//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME) -//// Lazy test if the userAgant support CanvasTypedArrays +//#if !(FIREFOX || MOZCENTRAL || CHROME) +//// Lazy test if the userAgent support CanvasTypedArrays function hasCanvasTypedArrays() { var canvas = document.createElement('canvas'); canvas.width = canvas.height = 1; diff --git a/web/default_preferences.js b/web/default_preferences.js index 57fe8b9ddbe471..10474144a7dec5 100644 --- a/web/default_preferences.js +++ b/web/default_preferences.js @@ -31,11 +31,6 @@ var DEFAULT_PREFERENCES = { disableStream: false, disableAutoFetch: false, disableFontFace: false, -//#if B2G -//disableTextLayer: true, -//useOnlyCssZoom: true -//#else disableTextLayer: false, useOnlyCssZoom: false -//#endif }; diff --git a/web/preferences.js b/web/preferences.js index 88feabce2c79c8..967101d7f7e793 100644 --- a/web/preferences.js +++ b/web/preferences.js @@ -160,24 +160,6 @@ var Preferences = { } }; -//#if B2G -//Preferences._writeToStorage = function (prefObj) { -// return new Promise(function (resolve) { -// asyncStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj), -// resolve); -// }); -//}; -// -//Preferences._readFromStorage = function (prefObj) { -// return new Promise(function (resolve) { -// asyncStorage.getItem('pdfjs.preferences', function (prefStr) { -// var readPrefs = JSON.parse(prefStr); -// resolve(readPrefs); -// }); -// }); -//}; -//#endif - //#if CHROME //Preferences._writeToStorage = function (prefObj) { // return new Promise(function (resolve) { @@ -221,7 +203,7 @@ var Preferences = { //}; //#endif -//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME) +//#if !(FIREFOX || MOZCENTRAL || CHROME) Preferences._writeToStorage = function (prefObj) { return new Promise(function (resolve) { localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj)); diff --git a/web/view_history.js b/web/view_history.js index 6f2cce48c1deb2..cb21153b66a6f6 100644 --- a/web/view_history.js +++ b/web/view_history.js @@ -25,7 +25,6 @@ * The way that the view parameters are stored depends on how PDF.js is built, * for 'node make ' the following cases exist: * - FIREFOX or MOZCENTRAL - uses sessionStorage. - * - B2G - uses asyncStorage. * - GENERIC or CHROME - uses localStorage, if it is available. */ var ViewHistory = (function ViewHistoryClosure() { @@ -64,16 +63,12 @@ var ViewHistory = (function ViewHistoryClosure() { return new Promise(function (resolve) { var databaseStr = JSON.stringify(this.database); -//#if B2G -// asyncStorage.setItem('database', databaseStr, resolve); -//#endif - //#if FIREFOX || MOZCENTRAL // sessionStorage.setItem('pdfjsHistory', databaseStr); // resolve(); //#endif -//#if !(FIREFOX || MOZCENTRAL || B2G) +//#if !(FIREFOX || MOZCENTRAL) localStorage.setItem('database', databaseStr); resolve(); //#endif @@ -82,15 +77,11 @@ var ViewHistory = (function ViewHistoryClosure() { _readFromStorage: function ViewHistory_readFromStorage() { return new Promise(function (resolve) { -//#if B2G -// asyncStorage.getItem('database', resolve); -//#endif - //#if FIREFOX || MOZCENTRAL // resolve(sessionStorage.getItem('pdfjsHistory')); //#endif -//#if !(FIREFOX || MOZCENTRAL || B2G) +//#if !(FIREFOX || MOZCENTRAL) resolve(localStorage.getItem('database')); //#endif }); diff --git a/web/viewer.js b/web/viewer.js index fff17f46e91447..1588ad6059871f 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -36,13 +36,9 @@ var SCALE_SELECT_CONTAINER_PADDING = 8; var SCALE_SELECT_PADDING = 22; var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading'; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; -//#if B2G -//PDFJS.useOnlyCssZoom = true; -//PDFJS.disableTextLayer = true; -//#endif PDFJS.imageResourcesPath = './images/'; -//#if (FIREFOX || MOZCENTRAL || B2G || GENERIC || CHROME) +//#if (FIREFOX || MOZCENTRAL || GENERIC || CHROME) //PDFJS.workerSrc = '../build/pdf.worker.js'; //#endif //#if !PRODUCTION @@ -58,18 +54,13 @@ var mozL10n = document.mozL10n || document.webL10n; //#include ui_utils.js //#include preferences.js -//#if !(FIREFOX || MOZCENTRAL || B2G) +//#if !(FIREFOX || MOZCENTRAL) //#include mozPrintCallback_polyfill.js //#endif //#if GENERIC || CHROME //#include download_manager.js //#endif -//#if B2G -//var DownloadManager = (function DownloadManagerClosure() { -// return function DownloadManager() {}; -//})(); -//#endif //#if FIREFOX || MOZCENTRAL //#include firefoxcom.js @@ -475,9 +466,6 @@ var PDFViewerApplication = { return; } document.title = title; -//#if B2G -// document.getElementById('activityTitle').textContent = title; -//#endif }, close: function pdfViewClose() { @@ -560,10 +548,6 @@ var PDFViewerApplication = { loadingErrorMessage = mozL10n.get('unexpected_response_error', null, 'Unexpected server response.'); } -//#if B2G -// window.alert(loadingErrorMessage); -// return window.close(); -//#endif var moreInfo = { message: message @@ -757,7 +741,7 @@ var PDFViewerApplication = { var id = this.documentFingerprint = pdfDocument.fingerprint; var store = this.store = new ViewHistory(id); -//#if (GENERIC || B2G) +//#if GENERIC var baseDocumentUrl = null; //#endif //#if (FIREFOX || MOZCENTRAL) @@ -1253,7 +1237,7 @@ function webViewerLoad(evt) { } function webViewerInitialized() { -//#if (GENERIC || B2G) +//#if GENERIC var queryString = document.location.search.substring(1); var params = parseQueryString(queryString); var file = 'file' in params ? params.file : DEFAULT_URL; @@ -2106,24 +2090,3 @@ window.addEventListener('afterprint', function afterPrint(evt) { window.requestAnimationFrame(resolve); }); })(); - -//#if B2G -//window.navigator.mozSetMessageHandler('activity', function(activity) { -// var blob = activity.source.data.blob; -// PDFJS.maxImageSize = 1024 * 1024; -// var fileURL = activity.source.data.url || -// activity.source.data.filename || -// " "; // if no url or filename, use a non-empty string -// -// var url = URL.createObjectURL(blob); -// // We need to delay opening until all HTML is loaded. -// PDFViewerApplication.animationStartedPromise.then(function () { -// PDFViewerApplication.open({url : url, originalUrl: fileURL}); -// -// var header = document.getElementById('header'); -// header.addEventListener('action', function() { -// activity.postResult('close'); -// }); -// }); -//}); -//#endif