diff --git a/src/display/api.js b/src/display/api.js index 43326ee4b..bd4d404b8 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1360,13 +1360,6 @@ var PDFWorker = (function PDFWorkerClosure() { } }); - messageHandler.on('console_log', function (data) { - console.log.apply(console, data); - }); - messageHandler.on('console_error', function (data) { - console.error.apply(console, data); - }); - messageHandler.on('ready', (data) => { worker.removeEventListener('error', onWorkerError); if (this.destroyed) { diff --git a/src/shared/compatibility.js b/src/shared/compatibility.js index f8e70ef4b..c8fbb523b 100644 --- a/src/shared/compatibility.js +++ b/src/shared/compatibility.js @@ -347,87 +347,6 @@ PDFJS.compatibilityChecked = true; }); })(); -// Checking if worker has console support. Forwarding all messages to the main -// thread if console object is absent. -(function checkWorkerConsoleCompatibility() { - if (typeof importScripts === 'undefined' || 'console' in globalScope) { - return; - } - - var consoleTimer = {}; - - var workerConsole = { - log: function log() { - var args = Array.prototype.slice.call(arguments); - globalScope.postMessage({ - targetName: 'main', - action: 'console_log', - data: args, - }); - }, - - error: function error() { - var args = Array.prototype.slice.call(arguments); - globalScope.postMessage({ - targetName: 'main', - action: 'console_error', - data: args, - }); - }, - - time: function time(name) { - consoleTimer[name] = Date.now(); - }, - - timeEnd: function timeEnd(name) { - var time = consoleTimer[name]; - if (!time) { - throw new Error('Unknown timer name ' + name); - } - this.log('Timer:', name, Date.now() - time); - }, - }; - - globalScope.console = workerConsole; -})(); - -// Check console compatibility -// In older IE versions the console object is not available -// unless console is open. -// Support: IE<10 -(function checkConsoleCompatibility() { - if (!hasDOM) { - return; - } - if (!('console' in window)) { - window.console = { - log() {}, - error() {}, - warn() {}, - }; - return; - } - if (!('bind' in console.log)) { - // native functions in IE9 might not have bind - console.log = (function(fn) { - return function(msg) { - return fn(msg); - }; - })(console.log); - console.error = (function(fn) { - return function(msg) { - return fn(msg); - }; - })(console.error); - console.warn = (function(fn) { - return function(msg) { - return fn(msg); - }; - })(console.warn); - return; - } -})(); - // Check onclick compatibility in Opera // Support: Opera<15 (function checkOnClickCompatibility() {