mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Add new severity log info(). Change severity of some log messages. Trigger fallback on errors and warnings for extension.
This commit is contained in:
parent
fca6f352e4
commit
034583e1a1
11 changed files with 128 additions and 62 deletions
|
@ -11,10 +11,13 @@ function MessageHandler(name, comObj) {
|
|||
var ah = this.actionHandler = {};
|
||||
|
||||
ah['console_log'] = [function ahConsoleLog(data) {
|
||||
console.log.apply(console, data);
|
||||
console.log.apply(console, data);
|
||||
}];
|
||||
ah['console_error'] = [function ahConsoleError(data) {
|
||||
console.error.apply(console, data);
|
||||
console.error.apply(console, data);
|
||||
}];
|
||||
ah['_warn'] = [function ah_Warn(data) {
|
||||
warn(data);
|
||||
}];
|
||||
|
||||
comObj.onmessage = function messageHandlerComObjOnMessage(event) {
|
||||
|
@ -223,6 +226,17 @@ var workerConsole = {
|
|||
if (typeof window === 'undefined') {
|
||||
globalScope.console = workerConsole;
|
||||
|
||||
// Add a logger so we can pass warnings on to the main thread, errors will
|
||||
// throw an exception which will be forwarded on automatically.
|
||||
PDFJS.LogManager.addLogger({
|
||||
warn: function(msg) {
|
||||
postMessage({
|
||||
action: '_warn',
|
||||
data: msg
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var handler = new MessageHandler('worker_processor', this);
|
||||
WorkerMessageHandler.setup(handler);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue