Remove SystemJS usage from the font-tests

With these changes, SystemJS is now *only* used to load the worker-file in development mode (pending removal once https://bugzilla.mozilla.org/show_bug.cgi?id=1247687 is fixed).
This commit is contained in:
Jonas Jenwald 2020-10-26 12:26:37 +01:00
parent 15a5f66973
commit 939af08ee1
2 changed files with 31 additions and 20 deletions

View File

@ -5,12 +5,22 @@
<link rel="stylesheet" type="text/css" href="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.css">
<script src="../../node_modules/systemjs/dist/system.js"></script>
<script src="../../systemjs.config.js"></script>
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="../../node_modules/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="../unit/testreporter.js"></script>
<script src="jasmine-boot.js"></script>
<script defer src="../../node_modules/es-module-shims/dist/es-module-shims.js"></script>
<script type="importmap-shim">
{
"imports": {
"pdfjs/": "../../src/",
"pdfjs-lib": "../../src/pdf.js",
"pdfjs-web/": "../../web/",
"pdfjs-test/": "../"
}
}
</script>
<script src="jasmine-boot.js" type="module-shim"></script>
</head>
<body>
</body>

View File

@ -48,7 +48,8 @@ async function initializePDFJS(callback) {
"pdfjs-test/font/font_post_spec.js",
"pdfjs-test/font/font_fpgm_spec.js",
].map(function (moduleName) {
return SystemJS.import(moduleName);
// eslint-disable-next-line no-unsanitized/method
return import(moduleName);
})
);
@ -133,26 +134,26 @@ async function initializePDFJS(callback) {
// Sets longer timeout.
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
// Replace the browser window's `onload`, ensure it's called, and then run
// all of the loaded specs. This includes initializing the `HtmlReporter`
// instance and then executing the loaded Jasmine environment.
const currentWindowOnload = window.onload;
window.onload = function () {
if (currentWindowOnload) {
currentWindowOnload();
}
initializePDFJS(function () {
htmlReporter.initialize();
env.execute();
});
};
function extend(destination, source) {
for (const property in source) {
destination[property] = source[property];
}
return destination;
}
function fontTestInit() {
initializePDFJS(function () {
htmlReporter.initialize();
env.execute();
});
}
if (
document.readyState === "interactive" ||
document.readyState === "complete"
) {
fontTestInit();
} else {
document.addEventListener("DOMContentLoaded", fontTestInit, true);
}
})();