Fix worker message, better error handling
This commit is contained in:
parent
d9f1365b9c
commit
7f3d5ae6d3
@ -159,6 +159,10 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
// a Stream in the main thread.
|
// a Stream in the main thread.
|
||||||
if (translated.file)
|
if (translated.file)
|
||||||
translated.file = translated.file.getBytes();
|
translated.file = translated.file.getBytes();
|
||||||
|
if (translated.properties.file) {
|
||||||
|
translated.properties.file =
|
||||||
|
translated.properties.file.getBytes();
|
||||||
|
}
|
||||||
|
|
||||||
handler.send('obj', [
|
handler.send('obj', [
|
||||||
loadedName,
|
loadedName,
|
||||||
@ -779,12 +783,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
dict: baseDict,
|
dict: baseDict,
|
||||||
properties: properties
|
properties: properties
|
||||||
};
|
};
|
||||||
}
|
} // if (type.name == 'Type3')
|
||||||
|
} // if (!descriptor)
|
||||||
}
|
|
||||||
|
|
||||||
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',
|
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',
|
||||||
// 'LastChar' and 'Widths' should exists too, but some PDF encoders seems
|
// 'LastChar' and 'Widths' should exist too, but some PDF encoders seem
|
||||||
// to ignore this rule when a variant of a standart font is used.
|
// to ignore this rule when a variant of a standart font is used.
|
||||||
// TODO Fill the width array depending on which of the base font this is
|
// TODO Fill the width array depending on which of the base font this is
|
||||||
// a variant.
|
// a variant.
|
||||||
|
@ -109,11 +109,27 @@ var WorkerMessageHandler = {
|
|||||||
// Pre compile the pdf page and fetch the fonts/images.
|
// Pre compile the pdf page and fetch the fonts/images.
|
||||||
IRQueue = page.getIRQueue(handler, dependency);
|
IRQueue = page.getIRQueue(handler, dependency);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
var minimumStackMessage =
|
||||||
|
'worker.js: while trying to getPage() and getIRQueue()';
|
||||||
|
|
||||||
// Turn the error into an obj that can be serialized
|
// Turn the error into an obj that can be serialized
|
||||||
|
if (typeof e === 'string') {
|
||||||
e = {
|
e = {
|
||||||
message: typeof e === 'object' ? e.message : e,
|
message: e,
|
||||||
stack: typeof e === 'object' ? e.stack : null
|
stack: minimumStackMessage
|
||||||
};
|
};
|
||||||
|
} else if (typeof e === 'object') {
|
||||||
|
e = {
|
||||||
|
message: e.message || e.toString(),
|
||||||
|
stack: e.stack || minimumStackMessage
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
e = {
|
||||||
|
message: 'Unknown exception type: ' + (typeof e),
|
||||||
|
stack: minimumStackMessage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handler.send('page_error', {
|
handler.send('page_error', {
|
||||||
pageNum: pageNum,
|
pageNum: pageNum,
|
||||||
error: e
|
error: e
|
||||||
|
Loading…
Reference in New Issue
Block a user