Replaces UnsupportedManager with callback.

This commit is contained in:
Yury Delendik 2015-11-30 14:42:47 -06:00
parent 84a47f8e53
commit c9cb6a3025
7 changed files with 66 additions and 47 deletions

View file

@ -13,7 +13,7 @@
* limitations under the License.
*/
/* globals PDFJS, createPromiseCapability, LocalPdfManager, NetworkPdfManager,
NetworkManager, isInt, MissingPDFException,
NetworkManager, isInt, MissingPDFException, UNSUPPORTED_FEATURES,
UnexpectedResponseException, PasswordException, Promise, warn,
PasswordResponses, InvalidPDFException, UnknownErrorException,
XRefParseException, Ref, info, globalScope, error, MessageHandler */
@ -482,6 +482,11 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
return; // ignoring errors from the terminated thread
}
// For compatibility with older behavior, generating unknown
// unsupported feature notification on errors.
handler.send('UnsupportedFeature',
{featureId: UNSUPPORTED_FEATURES.unknown});
var minimumStackMessage =
'worker.js: while trying to getPage() and getOperatorList()';
@ -616,15 +621,6 @@ if (typeof window === 'undefined') {
globalScope.console = workerConsole;
}
// Listen for unsupported features so we can pass them on to the main thread.
PDFJS.UnsupportedManager.listen(function (msg) {
globalScope.postMessage({
targetName: 'main',
action: '_unsupported_feature',
data: msg
});
});
var handler = new MessageHandler('worker', 'main', this);
WorkerMessageHandler.setup(handler, this);
}