Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<title>Test import() should throw a TypeError for Worklets</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="common.js"></script>
<script type="application/javascript">
const WORKLET_SCRIPT = "dynamic_import.js";
function configureTest() {
const ConsoleAPIStorage = SpecialPowers.Cc[
// We use console API to check if a TypeError has been thrown, as worklets
// have limitations to post the result back to the main document:
// Worklets have a different global, and they don't have postMessage() APIs,
// and static import SimpleTest.js in worklets also don't work.
function consoleListener() {
this.observe = this.observe.bind(this);
ConsoleAPIStorage.addLogEventListener(this.observe, SpecialPowers.wrap(document).nodePrincipal);
consoleListener.prototype = {
observe(aSubject) {
var obj = aSubject.wrappedJSObject;
info("Got console message:" + obj.arguments[0]);
is( + ": Success", obj.arguments[0], "import() should throw");
var cl = new consoleListener();
// This function is called into an iframe.
function runTestInIframe() {
var audioContext = new AudioContext();