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

Enable running the cmap unit-tests on Travis by utilizing a NodeCMapReaderFactory

This commit is contained in:
Jonas Jenwald 2017-02-17 13:44:49 +01:00
parent cfaa621a05
commit 9082f08e37
5 changed files with 108 additions and 20 deletions

View file

@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals process, __pdfjsdev_webpack__ */
'use strict';
@ -46,6 +45,7 @@ var error = sharedUtil.error;
var info = sharedUtil.info;
var warn = sharedUtil.warn;
var setVerbosityLevel = sharedUtil.setVerbosityLevel;
var isNodeJS = sharedUtil.isNodeJS;
var Ref = corePrimitives.Ref;
var LocalPdfManager = corePdfManager.LocalPdfManager;
var NetworkPdfManager = corePdfManager.NetworkPdfManager;
@ -1007,14 +1007,6 @@ function initializeWorker() {
handler.send('ready', null);
}
function isNodeJS() {
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
if (typeof __pdfjsdev_webpack__ === 'undefined') {
return typeof process === 'object' && process + '' === '[object process]';
}
return false;
}
// Worker thread (and not node.js)?
if (typeof window === 'undefined' && !isNodeJS()) {
initializeWorker();

View file

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals global */
/* globals global, process, __pdfjsdev_webpack__ */
'use strict';
@ -1136,6 +1136,14 @@ function isSpace(ch) {
return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A);
}
function isNodeJS() {
// The if below protected by __pdfjsdev_webpack__ check from webpack parsing.
if (typeof __pdfjsdev_webpack__ === 'undefined') {
return typeof process === 'object' && process + '' === '[object process]';
}
return false;
}
/**
* Promise Capability object.
*
@ -2454,6 +2462,7 @@ exports.isInt = isInt;
exports.isNum = isNum;
exports.isString = isString;
exports.isSpace = isSpace;
exports.isNodeJS = isNodeJS;
exports.isSameOrigin = isSameOrigin;
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
exports.isLittleEndian = isLittleEndian;