Removes B2G preprocessing directives.
This commit is contained in:
parent
1b847df2f3
commit
f3c3b1fc2d
6
make.js
6
make.js
@ -70,7 +70,6 @@ var DEFINES = {
|
|||||||
GENERIC: false,
|
GENERIC: false,
|
||||||
FIREFOX: false,
|
FIREFOX: false,
|
||||||
MOZCENTRAL: false,
|
MOZCENTRAL: false,
|
||||||
B2G: false,
|
|
||||||
CHROME: false,
|
CHROME: false,
|
||||||
MINIFIED: false,
|
MINIFIED: false,
|
||||||
SINGLE_FILE: false,
|
SINGLE_FILE: false,
|
||||||
@ -985,8 +984,7 @@ target.b2g = function() {
|
|||||||
echo();
|
echo();
|
||||||
echo('### Building B2G (Firefox OS App)');
|
echo('### Building B2G (Firefox OS App)');
|
||||||
var B2G_BUILD_CONTENT_DIR = B2G_BUILD_DIR + '/content/';
|
var B2G_BUILD_CONTENT_DIR = B2G_BUILD_DIR + '/content/';
|
||||||
var defines = builder.merge(DEFINES, { B2G: true });
|
target.bundle();
|
||||||
target.bundle({ defines: defines });
|
|
||||||
|
|
||||||
// Clear out everything in the b2g build directory
|
// Clear out everything in the b2g build directory
|
||||||
cd(ROOT_DIR);
|
cd(ROOT_DIR);
|
||||||
@ -999,7 +997,7 @@ target.b2g = function() {
|
|||||||
mkdir('-p', B2G_BUILD_CONTENT_DIR + '/pdfjs-components/cmaps');
|
mkdir('-p', B2G_BUILD_CONTENT_DIR + '/pdfjs-components/cmaps');
|
||||||
|
|
||||||
var setup = {
|
var setup = {
|
||||||
defines: defines,
|
defines: DEFINES,
|
||||||
copy: [
|
copy: [
|
||||||
['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'],
|
['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'],
|
||||||
['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'],
|
['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'],
|
||||||
|
@ -287,11 +287,7 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
var getXhr = function getXhr() {
|
var getXhr = function getXhr() {
|
||||||
//#if B2G
|
|
||||||
// return new XMLHttpRequest({ mozSystem: true });
|
|
||||||
//#else
|
|
||||||
return new XMLHttpRequest();
|
return new XMLHttpRequest();
|
||||||
//#endif
|
|
||||||
};
|
};
|
||||||
this.networkManager = new NetworkManager(this.url, {
|
this.networkManager = new NetworkManager(this.url, {
|
||||||
getXhr: getXhr,
|
getXhr: getXhr,
|
||||||
|
@ -35,7 +35,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var alwaysUseUint32ArrayView = false;
|
var alwaysUseUint32ArrayView = false;
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME)
|
//#if !(FIREFOX || MOZCENTRAL || CHROME)
|
||||||
// old webkits have issues with non-aligned arrays
|
// old webkits have issues with non-aligned arrays
|
||||||
try {
|
try {
|
||||||
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
|
new Uint32Array(new Uint8Array(5).buffer, 0, 1);
|
||||||
|
@ -50,11 +50,7 @@ var NetworkManager = (function NetworkManagerClosure() {
|
|||||||
this.withCredentials = args.withCredentials || false;
|
this.withCredentials = args.withCredentials || false;
|
||||||
this.getXhr = args.getXhr ||
|
this.getXhr = args.getXhr ||
|
||||||
function NetworkManager_getXhr() {
|
function NetworkManager_getXhr() {
|
||||||
//#if B2G
|
|
||||||
// return new XMLHttpRequest({ mozSystem: true });
|
|
||||||
//#else
|
|
||||||
return new XMLHttpRequest();
|
return new XMLHttpRequest();
|
||||||
//#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.currXhrId = 0;
|
this.currXhrId = 0;
|
||||||
|
@ -503,8 +503,8 @@ Object.defineProperty(PDFJS, 'isLittleEndian', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME)
|
//#if !(FIREFOX || MOZCENTRAL || CHROME)
|
||||||
//// Lazy test if the userAgant support CanvasTypedArrays
|
//// Lazy test if the userAgent support CanvasTypedArrays
|
||||||
function hasCanvasTypedArrays() {
|
function hasCanvasTypedArrays() {
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
canvas.width = canvas.height = 1;
|
canvas.width = canvas.height = 1;
|
||||||
|
@ -31,11 +31,6 @@ var DEFAULT_PREFERENCES = {
|
|||||||
disableStream: false,
|
disableStream: false,
|
||||||
disableAutoFetch: false,
|
disableAutoFetch: false,
|
||||||
disableFontFace: false,
|
disableFontFace: false,
|
||||||
//#if B2G
|
|
||||||
//disableTextLayer: true,
|
|
||||||
//useOnlyCssZoom: true
|
|
||||||
//#else
|
|
||||||
disableTextLayer: false,
|
disableTextLayer: false,
|
||||||
useOnlyCssZoom: false
|
useOnlyCssZoom: false
|
||||||
//#endif
|
|
||||||
};
|
};
|
||||||
|
@ -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
|
//#if CHROME
|
||||||
//Preferences._writeToStorage = function (prefObj) {
|
//Preferences._writeToStorage = function (prefObj) {
|
||||||
// return new Promise(function (resolve) {
|
// return new Promise(function (resolve) {
|
||||||
@ -221,7 +203,7 @@ var Preferences = {
|
|||||||
//};
|
//};
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G || CHROME)
|
//#if !(FIREFOX || MOZCENTRAL || CHROME)
|
||||||
Preferences._writeToStorage = function (prefObj) {
|
Preferences._writeToStorage = function (prefObj) {
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
* The way that the view parameters are stored depends on how PDF.js is built,
|
* The way that the view parameters are stored depends on how PDF.js is built,
|
||||||
* for 'node make <flag>' the following cases exist:
|
* for 'node make <flag>' the following cases exist:
|
||||||
* - FIREFOX or MOZCENTRAL - uses sessionStorage.
|
* - FIREFOX or MOZCENTRAL - uses sessionStorage.
|
||||||
* - B2G - uses asyncStorage.
|
|
||||||
* - GENERIC or CHROME - uses localStorage, if it is available.
|
* - GENERIC or CHROME - uses localStorage, if it is available.
|
||||||
*/
|
*/
|
||||||
var ViewHistory = (function ViewHistoryClosure() {
|
var ViewHistory = (function ViewHistoryClosure() {
|
||||||
@ -64,16 +63,12 @@ var ViewHistory = (function ViewHistoryClosure() {
|
|||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
var databaseStr = JSON.stringify(this.database);
|
var databaseStr = JSON.stringify(this.database);
|
||||||
|
|
||||||
//#if B2G
|
|
||||||
// asyncStorage.setItem('database', databaseStr, resolve);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if FIREFOX || MOZCENTRAL
|
//#if FIREFOX || MOZCENTRAL
|
||||||
// sessionStorage.setItem('pdfjsHistory', databaseStr);
|
// sessionStorage.setItem('pdfjsHistory', databaseStr);
|
||||||
// resolve();
|
// resolve();
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G)
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
localStorage.setItem('database', databaseStr);
|
localStorage.setItem('database', databaseStr);
|
||||||
resolve();
|
resolve();
|
||||||
//#endif
|
//#endif
|
||||||
@ -82,15 +77,11 @@ var ViewHistory = (function ViewHistoryClosure() {
|
|||||||
|
|
||||||
_readFromStorage: function ViewHistory_readFromStorage() {
|
_readFromStorage: function ViewHistory_readFromStorage() {
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
//#if B2G
|
|
||||||
// asyncStorage.getItem('database', resolve);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if FIREFOX || MOZCENTRAL
|
//#if FIREFOX || MOZCENTRAL
|
||||||
// resolve(sessionStorage.getItem('pdfjsHistory'));
|
// resolve(sessionStorage.getItem('pdfjsHistory'));
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G)
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
resolve(localStorage.getItem('database'));
|
resolve(localStorage.getItem('database'));
|
||||||
//#endif
|
//#endif
|
||||||
});
|
});
|
||||||
|
@ -36,13 +36,9 @@ var SCALE_SELECT_CONTAINER_PADDING = 8;
|
|||||||
var SCALE_SELECT_PADDING = 22;
|
var SCALE_SELECT_PADDING = 22;
|
||||||
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
|
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
|
||||||
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
|
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
|
||||||
//#if B2G
|
|
||||||
//PDFJS.useOnlyCssZoom = true;
|
|
||||||
//PDFJS.disableTextLayer = true;
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
PDFJS.imageResourcesPath = './images/';
|
PDFJS.imageResourcesPath = './images/';
|
||||||
//#if (FIREFOX || MOZCENTRAL || B2G || GENERIC || CHROME)
|
//#if (FIREFOX || MOZCENTRAL || GENERIC || CHROME)
|
||||||
//PDFJS.workerSrc = '../build/pdf.worker.js';
|
//PDFJS.workerSrc = '../build/pdf.worker.js';
|
||||||
//#endif
|
//#endif
|
||||||
//#if !PRODUCTION
|
//#if !PRODUCTION
|
||||||
@ -58,18 +54,13 @@ var mozL10n = document.mozL10n || document.webL10n;
|
|||||||
//#include ui_utils.js
|
//#include ui_utils.js
|
||||||
//#include preferences.js
|
//#include preferences.js
|
||||||
|
|
||||||
//#if !(FIREFOX || MOZCENTRAL || B2G)
|
//#if !(FIREFOX || MOZCENTRAL)
|
||||||
//#include mozPrintCallback_polyfill.js
|
//#include mozPrintCallback_polyfill.js
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
//#if GENERIC || CHROME
|
//#if GENERIC || CHROME
|
||||||
//#include download_manager.js
|
//#include download_manager.js
|
||||||
//#endif
|
//#endif
|
||||||
//#if B2G
|
|
||||||
//var DownloadManager = (function DownloadManagerClosure() {
|
|
||||||
// return function DownloadManager() {};
|
|
||||||
//})();
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
//#if FIREFOX || MOZCENTRAL
|
//#if FIREFOX || MOZCENTRAL
|
||||||
//#include firefoxcom.js
|
//#include firefoxcom.js
|
||||||
@ -475,9 +466,6 @@ var PDFViewerApplication = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
document.title = title;
|
document.title = title;
|
||||||
//#if B2G
|
|
||||||
// document.getElementById('activityTitle').textContent = title;
|
|
||||||
//#endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function pdfViewClose() {
|
close: function pdfViewClose() {
|
||||||
@ -560,10 +548,6 @@ var PDFViewerApplication = {
|
|||||||
loadingErrorMessage = mozL10n.get('unexpected_response_error', null,
|
loadingErrorMessage = mozL10n.get('unexpected_response_error', null,
|
||||||
'Unexpected server response.');
|
'Unexpected server response.');
|
||||||
}
|
}
|
||||||
//#if B2G
|
|
||||||
// window.alert(loadingErrorMessage);
|
|
||||||
// return window.close();
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
var moreInfo = {
|
var moreInfo = {
|
||||||
message: message
|
message: message
|
||||||
@ -757,7 +741,7 @@ var PDFViewerApplication = {
|
|||||||
var id = this.documentFingerprint = pdfDocument.fingerprint;
|
var id = this.documentFingerprint = pdfDocument.fingerprint;
|
||||||
var store = this.store = new ViewHistory(id);
|
var store = this.store = new ViewHistory(id);
|
||||||
|
|
||||||
//#if (GENERIC || B2G)
|
//#if GENERIC
|
||||||
var baseDocumentUrl = null;
|
var baseDocumentUrl = null;
|
||||||
//#endif
|
//#endif
|
||||||
//#if (FIREFOX || MOZCENTRAL)
|
//#if (FIREFOX || MOZCENTRAL)
|
||||||
@ -1253,7 +1237,7 @@ function webViewerLoad(evt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function webViewerInitialized() {
|
function webViewerInitialized() {
|
||||||
//#if (GENERIC || B2G)
|
//#if GENERIC
|
||||||
var queryString = document.location.search.substring(1);
|
var queryString = document.location.search.substring(1);
|
||||||
var params = parseQueryString(queryString);
|
var params = parseQueryString(queryString);
|
||||||
var file = 'file' in params ? params.file : DEFAULT_URL;
|
var file = 'file' in params ? params.file : DEFAULT_URL;
|
||||||
@ -2106,24 +2090,3 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
|||||||
window.requestAnimationFrame(resolve);
|
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user