static_site/public/pdfjs/build/pdf.sandbox.js

414 lines
707 KiB
JavaScript
Raw Normal View History

2021-11-02 01:35:31 +08:00
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("pdfjs-dist/build/pdf.sandbox", [], factory);
else if(typeof exports === 'object')
exports["pdfjs-dist/build/pdf.sandbox"] = factory();
else
root["pdfjs-dist/build/pdf.sandbox"] = root.pdfjsSandbox = factory();
})(this, function() {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack_module, exports) => {
Object.defineProperty(exports, "__esModule", ({value:true}));exports.default=void 0;function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}var Module=function(){var _scriptDir=typeof document!=='undefined'&&document.currentScript?document.currentScript.src:undefined;return function(Module){Module=Module||{};var b;b||(b=typeof Module!=='undefined'?Module:{});var h,n;b.ready=new Promise(function(a,c){h=a;n=c;});var q={},r;for(r in b){b.hasOwnProperty(r)&&(q[r]=b[r]);}var t="";"undefined"!==typeof document&&document.currentScript&&(t=document.currentScript.src);_scriptDir&&(t=_scriptDir);0!==t.indexOf("blob:")?t=t.substr(0,t.lastIndexOf("/")+1):t="";var aa=b.print||console.log.bind(console),u=b.printErr||console.warn.bind(console);for(r in q){q.hasOwnProperty(r)&&(b[r]=q[r]);}q=null;var v;b.wasmBinary&&(v=b.wasmBinary);var noExitRuntime=b.noExitRuntime||!0;"object"!==(typeof WebAssembly==="undefined"?"undefined":_typeof(WebAssembly))&&w("no native wasm support detected");var x,z=!1;function A(a){var c=b["_"+a];c||w("Assertion failed: Cannot call unknown function "+(a+", make sure it is exported"));return c;}function B(a,c,d,e){var f={string:function string(l){var p=0;if(null!==l&&void 0!==l&&0!==l){var U=(l.length<<2)+1;p=C(U);D(l,E,p,U);}return p;},array:function array(l){var p=C(l.length);F.set(l,p);return p;}},g=A(a),k=[];a=0;if(e)for(var m=0;m<e.length;m++){var y=f[d[m]];y?(0===a&&(a=G()),k[m]=y(e[m])):k[m]=e[m];}d=g.apply(null,k);d=function(l){return"string"===c?H(l):"boolean"===c?!!l:l;}(d);0!==a&&I(a);return d;}var J="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;function K(a,c,d){var e=c+d;for(d=c;a[d]&&!(d>=e);){++d;}if(16<d-c&&a.subarray&&J)return J.decode(a.subarray(c,d));for(e="";c<d;){var f=a[c++];if(f&128){var g=a[c++]&63;if(192==(f&224))e+=String.fromCharCode((f&31)<<6|g);else{var k=a[c++]&63;f=224==(f&240)?(f&15)<<12|g<<6|k:(f&7)<<18|g<<12|k<<6|a[c++]&63;65536>f?e+=String.fromCharCode(f):(f-=65536,e+=String.fromCharCode(55296|f>>10,56320|f&1023));}}else e+=String.fromCharCode(f);}return e;}function H(a){return a?K(E,a,void 0):"";}function D(a,c,d,e){if(0<e){e=d+e-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023;}if(127>=g){if(d>=e)break;c[d++]=g;}else{if(2047>=g){if(d+1>=e)break;c[d++]=192|g>>6;}else{if(65535>=g){if(d+2>=e)break;c[d++]=224|g>>12;}else{if(d+3>=e)break;c[d++]=240|g>>18;c[d++]=128|g>>12&63;}c[d++]=128|g>>6&63;}c[d++]=128|g&63;}}c[d]=0;}}function L(a){for(var c=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++c:c=2047>=e?c+2:65535>=e?c+3:c+4;}return c;}function ba(a){var c=L(a)+1,d=M(c);d&&D(a,F,d,c);return d;}var ca,F,E,N;function da(){var a=x.buffer;ca=a;b.HEAP8=F=new Int8Array(a);b.HEAP16=new Int16Array(a);b.HEAP32=N=new Int32Array(a);b.HEAPU8=E=new Uint8Array(a);b.HEAPU16=new Uint16Array(a);b.HEAPU32=new Uint32Array(a);b.HEAPF32=new Float32Array(a);b.HEAPF64=new Float64Array(a);}var O,ea=[],fa=[],ha=[],ia=[];function ja(){var a=b.preRun.shift();ea.unshift(a);}var P=0,Q=null,R=null;b.preloadedImages={};b.preloadedAudios={};function w(a){if(b.onAbort)b.onAbort(a);u(a);z=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");n(a);throw a;}function S(a){return String.prototype.startsWith?a.startsWith("data:application/octet-stream;base64,"):0===a.indexOf("data:application/octet-stream;base64,");}var T="data:application/octet-stream;base64,AGFzbQEAAAABxQZsYAR/fn9/AX5gA39/fwF/YAJ/fwF/YAJ/fwBgAX8Bf2AFf35/f38BfmADf39/AGABfAF8YAF/AGACf34BfmACf34AYAR/f39/AX9gAn9/AX5gAn9+AX9gA39/fgF/YAN/fn8BfmABfgF/YAN/fn8AYAZ/fn9/f38BfmADf35/AX9gBX9/f39/AX9gBn9+fn9/fwF+YAN/fn4BfmAEf39+fwF/YAN/f38BfmAEf39/fwBgBn9/f39/fwF/YAR/f39/AX5gA39+fgF/Y
/***/ }),
/* 2 */
/***/ ((__unused_webpack_module, exports) => {
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var SandboxSupportBase = /*#__PURE__*/function () {
function SandboxSupportBase(win) {
_classCallCheck(this, SandboxSupportBase);
this.win = win;
this.timeoutIds = new Map();
this.commFun = null;
}
_createClass(SandboxSupportBase, [{
key: "destroy",
value: function destroy() {
var _this = this;
this.commFunc = null;
this.timeoutIds.forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),
_ = _ref2[0],
id = _ref2[1];
return _this.win.clearTimeout(id);
});
this.timeoutIds = null;
}
}, {
key: "exportValueToSandbox",
value: function exportValueToSandbox(val) {
throw new Error("Not implemented");
}
}, {
key: "importValueFromSandbox",
value: function importValueFromSandbox(val) {
throw new Error("Not implemented");
}
}, {
key: "createErrorForSandbox",
value: function createErrorForSandbox(errorMessage) {
throw new Error("Not implemented");
}
}, {
key: "callSandboxFunction",
value: function callSandboxFunction(name, args) {
try {
args = this.exportValueToSandbox(args);
this.commFun(name, args);
} catch (e) {
this.win.console.error(e);
}
}
}, {
key: "createSandboxExternals",
value: function createSandboxExternals() {
var _this2 = this;
var externals = {
setTimeout: function setTimeout(callbackId, nMilliseconds) {
if (typeof callbackId !== "number" || typeof nMilliseconds !== "number") {
return;
}
var id = _this2.win.setTimeout(function () {
_this2.timeoutIds["delete"](callbackId);
_this2.callSandboxFunction("timeoutCb", {
callbackId: callbackId,
interval: false
});
}, nMilliseconds);
_this2.timeoutIds.set(callbackId, id);
},
clearTimeout: function clearTimeout(id) {
_this2.win.clearTimeout(_this2.timeoutIds.get(id));
_this2.timeoutIds["delete"](id);
},
setInterval: function setInterval(callbackId, nMilliseconds) {
if (typeof callbackId !== "number" || typeof nMilliseconds !== "number") {
return;
}
var id = _this2.win.setInterval(function () {
_this2.callSandboxFunction("timeoutCb", {
callbackId: callbackId,
interval: true
});
}, nMilliseconds);
_this2.timeoutIds.set(callbackId, id);
},
clearInterval: function clearInterval(id) {
_this2.win.clearInterval(_this2.timeoutIds.get(id));
_this2.timeoutIds["delete"](id);
},
alert: function alert(cMsg) {
if (typeof cMsg !== "string") {
return;
}
_this2.win.alert(cMsg);
},
confirm: function confirm(cMsg) {
if (typeof cMsg !== "string") {
return false;
}
return _this2.win.confirm(cMsg);
},
prompt: function prompt(cQuestion, cDefault) {
if (typeof cQuestion !== "string" || typeof cDefault !== "string") {
return null;
}
return _this2.win.prompt(cQuestion, cDefault);
},
parseURL: function parseURL(cUrl) {
var url = new _this2.win.URL(cUrl);
var props = ["hash", "host", "hostname", "href", "origin", "password", "pathname", "port", "protocol", "search", "searchParams", "username"];
return Object.fromEntries(props.map(function (name) {
return [name, url[name].toString()];
}));
},
send: function send(data) {
if (!data) {
return;
}
var event = new _this2.win.CustomEvent("updatefromsandbox", {
detail: _this2.importValueFromSandbox(data)
});
_this2.win.dispatchEvent(event);
}
};
Object.setPrototypeOf(externals, null);
return function (name, args) {
try {
var result = externals[name].apply(externals, _toConsumableArray(args));
return _this2.exportValueToSandbox(result);
} catch (error) {
var _error$toString;
throw _this2.createErrorForSandbox((_error$toString = error === null || error === void 0 ? void 0 : error.toString()) !== null && _error$toString !== void 0 ? _error$toString : "");
}
};
}
}]);
return SandboxSupportBase;
}();
{
exports.SandboxSupportBase = SandboxSupportBase;
}
/***/ })
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __w_pdfjs_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.QuickJSSandbox = QuickJSSandbox;
var _quickjsEval = _interopRequireDefault(__w_pdfjs_require__(1));
var _pdfSandboxExternal = __w_pdfjs_require__(2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var pdfjsVersion = '2.10.377';
var pdfjsBuild = '156762c48';
var SandboxSupport = /*#__PURE__*/function (_SandboxSupportBase) {
_inherits(SandboxSupport, _SandboxSupportBase);
var _super = _createSuper(SandboxSupport);
function SandboxSupport() {
_classCallCheck(this, SandboxSupport);
return _super.apply(this, arguments);
}
_createClass(SandboxSupport, [{
key: "exportValueToSandbox",
value: function exportValueToSandbox(val) {
return JSON.stringify(val);
}
}, {
key: "importValueFromSandbox",
value: function importValueFromSandbox(val) {
return val;
}
}, {
key: "createErrorForSandbox",
value: function createErrorForSandbox(errorMessage) {
return new Error(errorMessage);
}
}]);
return SandboxSupport;
}(_pdfSandboxExternal.SandboxSupportBase);
var Sandbox = /*#__PURE__*/function () {
function Sandbox(win, module) {
_classCallCheck(this, Sandbox);
this.support = new SandboxSupport(win, this);
module.externalCall = this.support.createSandboxExternals();
this._module = module;
this._alertOnError = 0;
}
_createClass(Sandbox, [{
key: "create",
value: function create(data) {
var code = ['(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === \'object\' && typeof module === \'object\')\n\t\tmodule.exports = factory();\n\telse if(typeof define === \'function\' && define.amd)\n\t\tdefine("pdfjs-dist/build/pdf.scripting", [], factory);\n\telse if(typeof exports === \'object\')\n\t\texports["pdfjs-dist/build/pdf.scripting"] = factory();\n\telse\n\t\troot.pdfjsScripting = factory();\n})(this, function() {\nreturn /******/ (() => { // webpackBootstrap\n/******/ \t"use strict";\n/******/ \tvar __webpack_modules__ = ([\n/* 0 */,\n/* 1 */\n/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {\n\n\n\nObject.defineProperty(exports, "__esModule", ({\n value: true\n}));\nexports.initSandbox = initSandbox;\n\nvar _constants = __w_pdfjs_require__(2);\n\nvar _field = __w_pdfjs_require__(3);\n\nvar _aform = __w_pdfjs_require__(8);\n\nvar _app = __w_pdfjs_require__(9);\n\nvar _color = __w_pdfjs_require__(5);\n\nvar _console = __w_pdfjs_require__(13);\n\nvar _doc = __w_pdfjs_require__(14);\n\nvar _proxy = __w_pdfjs_require__(16);\n\nvar _util = __w_pdfjs_require__(17);\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(targe
code.push("delete dump;");
var success = false;
var buf = 0;
try {
var sandboxData = JSON.stringify(data);
code.push("pdfjsScripting.initSandbox({ data: ".concat(sandboxData, " })"));
buf = this._module.stringToNewUTF8(code.join("\n"));
success = !!this._module.ccall("init", "number", ["number", "number"], [buf, this._alertOnError]);
} catch (error) {
console.error(error);
} finally {
if (buf) {
this._module.ccall("free", "number", ["number"], [buf]);
}
}
if (success) {
this.support.commFun = this._module.cwrap("commFun", null, ["string", "string"]);
} else {
this.nukeSandbox();
throw new Error("Cannot start sandbox");
}
}
}, {
key: "dispatchEvent",
value: function dispatchEvent(event) {
this.support.callSandboxFunction("dispatchEvent", event);
}
}, {
key: "dumpMemoryUse",
value: function dumpMemoryUse() {
if (this._module) {
this._module.ccall("dumpMemoryUse", null, []);
}
}
}, {
key: "nukeSandbox",
value: function nukeSandbox() {
if (this._module !== null) {
this.support.destroy();
this.support = null;
this._module.ccall("nukeSandbox", null, []);
this._module = null;
}
}
}, {
key: "evalForTesting",
value: function evalForTesting(code, key) {
throw new Error("Not implemented: evalForTesting");
}
}]);
return Sandbox;
}();
function QuickJSSandbox() {
return (0, _quickjsEval["default"])().then(function (module) {
return new Sandbox(window, module);
});
}
})();
/******/ return __webpack_exports__;
/******/ })()
;
});
//# sourceMappingURL=pdf.sandbox.js.map