|
@@ -1001,14 +1001,37 @@ var createObjectURL = function createObjectURLClosure() {
|
|
return buffer;
|
|
return buffer;
|
|
};
|
|
};
|
|
}();
|
|
}();
|
|
|
|
+function resolveCall(fn, args) {
|
|
|
|
+ var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
|
|
+
|
|
|
|
+ if (!fn) {
|
|
|
|
+ return Promise.resolve(undefined);
|
|
|
|
+ }
|
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
|
+ resolve(fn.apply(thisArg, args));
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+function resolveOrReject(capability, success, reason) {
|
|
|
|
+ if (success) {
|
|
|
|
+ capability.resolve();
|
|
|
|
+ } else {
|
|
|
|
+ capability.reject(reason);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+function finalize(promise) {
|
|
|
|
+ return Promise.resolve(promise).catch(function () {});
|
|
|
|
+}
|
|
function MessageHandler(sourceName, targetName, comObj) {
|
|
function MessageHandler(sourceName, targetName, comObj) {
|
|
var _this = this;
|
|
var _this = this;
|
|
|
|
|
|
this.sourceName = sourceName;
|
|
this.sourceName = sourceName;
|
|
this.targetName = targetName;
|
|
this.targetName = targetName;
|
|
this.comObj = comObj;
|
|
this.comObj = comObj;
|
|
- this.callbackIndex = 1;
|
|
|
|
|
|
+ this.callbackId = 1;
|
|
|
|
+ this.streamId = 1;
|
|
this.postMessageTransfers = true;
|
|
this.postMessageTransfers = true;
|
|
|
|
+ this.streamSinks = Object.create(null);
|
|
|
|
+ this.streamControllers = Object.create(null);
|
|
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
|
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
|
var ah = this.actionHandler = Object.create(null);
|
|
var ah = this.actionHandler = Object.create(null);
|
|
this._onComObjOnMessage = function (event) {
|
|
this._onComObjOnMessage = function (event) {
|
|
@@ -1016,7 +1039,9 @@ function MessageHandler(sourceName, targetName, comObj) {
|
|
if (data.targetName !== _this.sourceName) {
|
|
if (data.targetName !== _this.sourceName) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (data.isReply) {
|
|
|
|
|
|
+ if (data.stream) {
|
|
|
|
+ _this._processStreamMessage(data);
|
|
|
|
+ } else if (data.isReply) {
|
|
var callbackId = data.callbackId;
|
|
var callbackId = data.callbackId;
|
|
if (data.callbackId in callbacksCapabilities) {
|
|
if (data.callbackId in callbacksCapabilities) {
|
|
var callback = callbacksCapabilities[callbackId];
|
|
var callback = callbacksCapabilities[callbackId];
|
|
@@ -1032,14 +1057,14 @@ function MessageHandler(sourceName, targetName, comObj) {
|
|
} else if (data.action in ah) {
|
|
} else if (data.action in ah) {
|
|
var action = ah[data.action];
|
|
var action = ah[data.action];
|
|
if (data.callbackId) {
|
|
if (data.callbackId) {
|
|
- var sourceName = _this.sourceName;
|
|
|
|
- var targetName = data.sourceName;
|
|
|
|
|
|
+ var _sourceName = _this.sourceName;
|
|
|
|
+ var _targetName = data.sourceName;
|
|
Promise.resolve().then(function () {
|
|
Promise.resolve().then(function () {
|
|
return action[0].call(action[1], data.data);
|
|
return action[0].call(action[1], data.data);
|
|
}).then(function (result) {
|
|
}).then(function (result) {
|
|
comObj.postMessage({
|
|
comObj.postMessage({
|
|
- sourceName: sourceName,
|
|
|
|
- targetName: targetName,
|
|
|
|
|
|
+ sourceName: _sourceName,
|
|
|
|
+ targetName: _targetName,
|
|
isReply: true,
|
|
isReply: true,
|
|
callbackId: data.callbackId,
|
|
callbackId: data.callbackId,
|
|
data: result
|
|
data: result
|
|
@@ -1049,13 +1074,15 @@ function MessageHandler(sourceName, targetName, comObj) {
|
|
reason = reason + '';
|
|
reason = reason + '';
|
|
}
|
|
}
|
|
comObj.postMessage({
|
|
comObj.postMessage({
|
|
- sourceName: sourceName,
|
|
|
|
- targetName: targetName,
|
|
|
|
|
|
+ sourceName: _sourceName,
|
|
|
|
+ targetName: _targetName,
|
|
isReply: true,
|
|
isReply: true,
|
|
callbackId: data.callbackId,
|
|
callbackId: data.callbackId,
|
|
error: reason
|
|
error: reason
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ } else if (data.streamId) {
|
|
|
|
+ _this._createStreamSink(data);
|
|
} else {
|
|
} else {
|
|
action[0].call(action[1], data.data);
|
|
action[0].call(action[1], data.data);
|
|
}
|
|
}
|
|
@@ -1083,7 +1110,7 @@ MessageHandler.prototype = {
|
|
this.postMessage(message, transfers);
|
|
this.postMessage(message, transfers);
|
|
},
|
|
},
|
|
sendWithPromise: function sendWithPromise(actionName, data, transfers) {
|
|
sendWithPromise: function sendWithPromise(actionName, data, transfers) {
|
|
- var callbackId = this.callbackIndex++;
|
|
|
|
|
|
+ var callbackId = this.callbackId++;
|
|
var message = {
|
|
var message = {
|
|
sourceName: this.sourceName,
|
|
sourceName: this.sourceName,
|
|
targetName: this.targetName,
|
|
targetName: this.targetName,
|
|
@@ -1100,6 +1127,222 @@ MessageHandler.prototype = {
|
|
}
|
|
}
|
|
return capability.promise;
|
|
return capability.promise;
|
|
},
|
|
},
|
|
|
|
+ sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) {
|
|
|
|
+ var _this2 = this;
|
|
|
|
+
|
|
|
|
+ var streamId = this.streamId++;
|
|
|
|
+ var sourceName = this.sourceName;
|
|
|
|
+ var targetName = this.targetName;
|
|
|
|
+ return new _streamsLib.ReadableStream({
|
|
|
|
+ start: function start(controller) {
|
|
|
|
+ var startCapability = createPromiseCapability();
|
|
|
|
+ _this2.streamControllers[streamId] = {
|
|
|
|
+ controller: controller,
|
|
|
|
+ startCall: startCapability
|
|
|
|
+ };
|
|
|
|
+ _this2.postMessage({
|
|
|
|
+ sourceName: sourceName,
|
|
|
|
+ targetName: targetName,
|
|
|
|
+ action: actionName,
|
|
|
|
+ streamId: streamId,
|
|
|
|
+ data: data,
|
|
|
|
+ desiredSize: controller.desiredSize
|
|
|
|
+ });
|
|
|
|
+ return startCapability.promise;
|
|
|
|
+ },
|
|
|
|
+ pull: function pull(controller) {
|
|
|
|
+ var pullCapability = createPromiseCapability();
|
|
|
|
+ _this2.streamControllers[streamId].pullCall = pullCapability;
|
|
|
|
+ _this2.postMessage({
|
|
|
|
+ sourceName: sourceName,
|
|
|
|
+ targetName: targetName,
|
|
|
|
+ stream: 'pull',
|
|
|
|
+ streamId: streamId,
|
|
|
|
+ desiredSize: controller.desiredSize
|
|
|
|
+ });
|
|
|
|
+ return pullCapability.promise;
|
|
|
|
+ },
|
|
|
|
+ cancel: function cancel(reason) {
|
|
|
|
+ var cancelCapability = createPromiseCapability();
|
|
|
|
+ _this2.streamControllers[streamId].cancelCall = cancelCapability;
|
|
|
|
+ _this2.postMessage({
|
|
|
|
+ sourceName: sourceName,
|
|
|
|
+ targetName: targetName,
|
|
|
|
+ stream: 'cancel',
|
|
|
|
+ reason: reason,
|
|
|
|
+ streamId: streamId
|
|
|
|
+ });
|
|
|
|
+ return cancelCapability.promise;
|
|
|
|
+ }
|
|
|
|
+ }, queueingStrategy);
|
|
|
|
+ },
|
|
|
|
+ _createStreamSink: function _createStreamSink(data) {
|
|
|
|
+ var _this3 = this;
|
|
|
|
+
|
|
|
|
+ var self = this;
|
|
|
|
+ var action = this.actionHandler[data.action];
|
|
|
|
+ var streamId = data.streamId;
|
|
|
|
+ var desiredSize = data.desiredSize;
|
|
|
|
+ var sourceName = this.sourceName;
|
|
|
|
+ var targetName = data.sourceName;
|
|
|
|
+ var capability = createPromiseCapability();
|
|
|
|
+ var sendStreamRequest = function sendStreamRequest(_ref) {
|
|
|
|
+ var stream = _ref.stream,
|
|
|
|
+ chunk = _ref.chunk,
|
|
|
|
+ success = _ref.success,
|
|
|
|
+ reason = _ref.reason;
|
|
|
|
+
|
|
|
|
+ _this3.comObj.postMessage({
|
|
|
|
+ sourceName: sourceName,
|
|
|
|
+ targetName: targetName,
|
|
|
|
+ stream: stream,
|
|
|
|
+ streamId: streamId,
|
|
|
|
+ chunk: chunk,
|
|
|
|
+ success: success,
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ var streamSink = {
|
|
|
|
+ enqueue: function enqueue(chunk) {
|
|
|
|
+ var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
|
|
+
|
|
|
|
+ var lastDesiredSize = this.desiredSize;
|
|
|
|
+ this.desiredSize -= size;
|
|
|
|
+ if (lastDesiredSize > 0 && this.desiredSize <= 0) {
|
|
|
|
+ this.sinkCapability = createPromiseCapability();
|
|
|
|
+ this.ready = this.sinkCapability.promise;
|
|
|
|
+ }
|
|
|
|
+ sendStreamRequest({
|
|
|
|
+ stream: 'enqueue',
|
|
|
|
+ chunk: chunk
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ close: function close() {
|
|
|
|
+ sendStreamRequest({ stream: 'close' });
|
|
|
|
+ delete self.streamSinks[streamId];
|
|
|
|
+ },
|
|
|
|
+ error: function error(reason) {
|
|
|
|
+ sendStreamRequest({
|
|
|
|
+ stream: 'error',
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ sinkCapability: capability,
|
|
|
|
+ onPull: null,
|
|
|
|
+ onCancel: null,
|
|
|
|
+ desiredSize: desiredSize,
|
|
|
|
+ ready: null
|
|
|
|
+ };
|
|
|
|
+ streamSink.sinkCapability.resolve();
|
|
|
|
+ streamSink.ready = streamSink.sinkCapability.promise;
|
|
|
|
+ this.streamSinks[streamId] = streamSink;
|
|
|
|
+ resolveCall(action[0], [data.data, streamSink], action[1]).then(function () {
|
|
|
|
+ sendStreamRequest({
|
|
|
|
+ stream: 'start_complete',
|
|
|
|
+ success: true
|
|
|
|
+ });
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ sendStreamRequest({
|
|
|
|
+ stream: 'start_complete',
|
|
|
|
+ success: false,
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ _processStreamMessage: function _processStreamMessage(data) {
|
|
|
|
+ var _this4 = this;
|
|
|
|
+
|
|
|
|
+ var sourceName = this.sourceName;
|
|
|
|
+ var targetName = data.sourceName;
|
|
|
|
+ var streamId = data.streamId;
|
|
|
|
+ var sendStreamResponse = function sendStreamResponse(_ref2) {
|
|
|
|
+ var stream = _ref2.stream,
|
|
|
|
+ success = _ref2.success,
|
|
|
|
+ reason = _ref2.reason;
|
|
|
|
+
|
|
|
|
+ _this4.comObj.postMessage({
|
|
|
|
+ sourceName: sourceName,
|
|
|
|
+ targetName: targetName,
|
|
|
|
+ stream: stream,
|
|
|
|
+ success: success,
|
|
|
|
+ streamId: streamId,
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ var deleteStreamController = function deleteStreamController() {
|
|
|
|
+ Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) {
|
|
|
|
+ return capability && finalize(capability.promise);
|
|
|
|
+ })).then(function () {
|
|
|
|
+ delete _this4.streamControllers[data.streamId];
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ switch (data.stream) {
|
|
|
|
+ case 'start_complete':
|
|
|
|
+ resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, data.reason);
|
|
|
|
+ break;
|
|
|
|
+ case 'pull_complete':
|
|
|
|
+ resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, data.reason);
|
|
|
|
+ break;
|
|
|
|
+ case 'pull':
|
|
|
|
+ if (!this.streamSinks[data.streamId]) {
|
|
|
|
+ sendStreamResponse({
|
|
|
|
+ stream: 'pull_complete',
|
|
|
|
+ success: true
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
|
|
|
|
+ this.streamSinks[data.streamId].sinkCapability.resolve();
|
|
|
|
+ }
|
|
|
|
+ this.streamSinks[data.streamId].desiredSize = data.desiredSize;
|
|
|
|
+ resolveCall(this.streamSinks[data.streamId].onPull).then(function () {
|
|
|
|
+ sendStreamResponse({
|
|
|
|
+ stream: 'pull_complete',
|
|
|
|
+ success: true
|
|
|
|
+ });
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ sendStreamResponse({
|
|
|
|
+ stream: 'pull_complete',
|
|
|
|
+ success: false,
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ case 'enqueue':
|
|
|
|
+ this.streamControllers[data.streamId].controller.enqueue(data.chunk);
|
|
|
|
+ break;
|
|
|
|
+ case 'close':
|
|
|
|
+ this.streamControllers[data.streamId].controller.close();
|
|
|
|
+ deleteStreamController();
|
|
|
|
+ break;
|
|
|
|
+ case 'error':
|
|
|
|
+ this.streamControllers[data.streamId].controller.error(data.reason);
|
|
|
|
+ deleteStreamController();
|
|
|
|
+ break;
|
|
|
|
+ case 'cancel_complete':
|
|
|
|
+ resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, data.reason);
|
|
|
|
+ deleteStreamController();
|
|
|
|
+ break;
|
|
|
|
+ case 'cancel':
|
|
|
|
+ resolveCall(this.streamSinks[data.streamId].onCancel, [data.reason]).then(function () {
|
|
|
|
+ sendStreamResponse({
|
|
|
|
+ stream: 'cancel_complete',
|
|
|
|
+ success: true
|
|
|
|
+ });
|
|
|
|
+ }, function (reason) {
|
|
|
|
+ sendStreamResponse({
|
|
|
|
+ stream: 'cancel_complete',
|
|
|
|
+ success: false,
|
|
|
|
+ reason: reason
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ delete this.streamSinks[data.streamId];
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ throw new Error('Unexpected stream case');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
postMessage: function postMessage(message, transfers) {
|
|
postMessage: function postMessage(message, transfers) {
|
|
if (transfers && this.postMessageTransfers) {
|
|
if (transfers && this.postMessageTransfers) {
|
|
this.comObj.postMessage(message, transfers);
|
|
this.comObj.postMessage(message, transfers);
|
|
@@ -12809,8 +13052,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
|
|
}();
|
|
}();
|
|
var version, build;
|
|
var version, build;
|
|
{
|
|
{
|
|
- exports.version = version = '1.8.430';
|
|
|
|
- exports.build = build = 'e6f5b3e3';
|
|
|
|
|
|
+ exports.version = version = '1.8.432';
|
|
|
|
+ exports.build = build = '93420545';
|
|
}
|
|
}
|
|
exports.getDocument = getDocument;
|
|
exports.getDocument = getDocument;
|
|
exports.LoopbackPort = LoopbackPort;
|
|
exports.LoopbackPort = LoopbackPort;
|
|
@@ -28147,8 +28390,8 @@ if (!_util.globalScope.PDFJS) {
|
|
}
|
|
}
|
|
var PDFJS = _util.globalScope.PDFJS;
|
|
var PDFJS = _util.globalScope.PDFJS;
|
|
{
|
|
{
|
|
- PDFJS.version = '1.8.430';
|
|
|
|
- PDFJS.build = 'e6f5b3e3';
|
|
|
|
|
|
+ PDFJS.version = '1.8.432';
|
|
|
|
+ PDFJS.build = '93420545';
|
|
}
|
|
}
|
|
PDFJS.pdfBug = false;
|
|
PDFJS.pdfBug = false;
|
|
if (PDFJS.verbosity !== undefined) {
|
|
if (PDFJS.verbosity !== undefined) {
|
|
@@ -29793,7 +30036,7 @@ var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbo
|
|
}
|
|
}
|
|
if (IsReadableStreamDefaultReader(reader) === true) {
|
|
if (IsReadableStreamDefaultReader(reader) === true) {
|
|
for (var i = 0; i < reader._readRequests.length; i++) {
|
|
for (var i = 0; i < reader._readRequests.length; i++) {
|
|
- var _resolve = reader._readRequests[i];
|
|
|
|
|
|
+ var _resolve = reader._readRequests[i]._resolve;
|
|
_resolve(CreateIterResultObject(undefined, true));
|
|
_resolve(CreateIterResultObject(undefined, true));
|
|
}
|
|
}
|
|
reader._readRequests = [];
|
|
reader._readRequests = [];
|
|
@@ -46762,8 +47005,8 @@ exports.TilingPattern = TilingPattern;
|
|
"use strict";
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
-var pdfjsVersion = '1.8.430';
|
|
|
|
-var pdfjsBuild = 'e6f5b3e3';
|
|
|
|
|
|
+var pdfjsVersion = '1.8.432';
|
|
|
|
+var pdfjsBuild = '93420545';
|
|
var pdfjsSharedUtil = __w_pdfjs_require__(0);
|
|
var pdfjsSharedUtil = __w_pdfjs_require__(0);
|
|
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
|
|
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
|
|
var pdfjsDisplayAPI = __w_pdfjs_require__(10);
|
|
var pdfjsDisplayAPI = __w_pdfjs_require__(10);
|