Skip to content

Commit

Permalink
Removes B2G preprocessing directives.
Browse files Browse the repository at this point in the history
  • Loading branch information
yurydelendik committed Jun 30, 2015
1 parent 8c8972d commit 3560f0f
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 91 deletions.
6 changes: 2 additions & 4 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ var DEFINES = {
GENERIC: false,
FIREFOX: false,
MOZCENTRAL: false,
B2G: false,
CHROME: false,
MINIFIED: false,
SINGLE_FILE: false,
Expand Down Expand Up @@ -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);
Expand All @@ -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'],
Expand Down
4 changes: 0 additions & 4 deletions src/core/chunked_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/core/murmurhash3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions src/core/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/shared/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions web/default_preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
20 changes: 1 addition & 19 deletions web/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
Expand Down
13 changes: 2 additions & 11 deletions web/view_history.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* The way that the view parameters are stored depends on how PDF.js is built,
* for 'node make <flag>' 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() {
Expand Down Expand Up @@ -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
Expand All @@ -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
});
Expand Down
45 changes: 4 additions & 41 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -475,9 +466,6 @@ var PDFViewerApplication = {
return;
}
document.title = title;
//#if B2G
// document.getElementById('activityTitle').textContent = title;
//#endif
},

close: function pdfViewClose() {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

0 comments on commit 3560f0f

Please sign in to comment.