mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Syntax changed that will help minifiers/compilers (such as the Closure Compiler) in their processing. In particular, preventing said minifiers/compilers from making dangerous renames.
This commit is contained in:
parent
438e3c8f6d
commit
0fbbc5a840
5 changed files with 40 additions and 19 deletions
|
@ -11,11 +11,17 @@ function MessageHandler(name, comObj) {
|
|||
var ah = this.actionHandler = {};
|
||||
|
||||
ah['console_log'] = [function ahConsoleLog(data) {
|
||||
console.log.apply(console, data);
|
||||
}];
|
||||
ah['console_error'] = [function ahConsoleError(data) {
|
||||
console.error.apply(console, data);
|
||||
log.apply(null, data);
|
||||
}];
|
||||
// If there's no console available, console_error in the action handler will do nothing.
|
||||
if ('console' in globalScope) {
|
||||
ah['console_error'] = [function ahConsoleError(data) {
|
||||
globalScope['console'].error.apply(null, data);
|
||||
}];
|
||||
} else {
|
||||
ah['console_error'] = [function ahConsoleError(data) {
|
||||
}];
|
||||
}
|
||||
ah['_warn'] = [function ah_Warn(data) {
|
||||
warn(data);
|
||||
}];
|
||||
|
@ -263,7 +269,7 @@ var consoleTimer = {};
|
|||
var workerConsole = {
|
||||
log: function log() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
postMessage({
|
||||
globalScope.postMessage({
|
||||
action: 'console_log',
|
||||
data: args
|
||||
});
|
||||
|
@ -271,7 +277,7 @@ var workerConsole = {
|
|||
|
||||
error: function error() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
postMessage({
|
||||
globalScope.postMessage({
|
||||
action: 'console_error',
|
||||
data: args
|
||||
});
|
||||
|
@ -299,7 +305,7 @@ if (typeof window === 'undefined') {
|
|||
// throw an exception which will be forwarded on automatically.
|
||||
PDFJS.LogManager.addLogger({
|
||||
warn: function(msg) {
|
||||
postMessage({
|
||||
globalScope.postMessage({
|
||||
action: '_warn',
|
||||
data: msg
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue