dom/worklet/tests/file_basic.html
author Michael Layzell <michael@thelayzells.com>
Tue, 13 Dec 2016 16:32:54 +0800
changeset 325804 44a95445e11d8eff6ca5c10f1b2b913a9f44eeb0
parent 321314 1946c5517376329c66b51e7ec943e841f7a5e348
child 325820 ed5c93dfd7dd4e1a751a5b99db7ca8fd9c6280ce
permissions -rw-r--r--
Bug 1318767 - Part 3: Use SessionStore to recover from missing GroupedSHistory segments, r=ehsan, r=mconley MozReview-Commit-ID: FDmQIjiHox7

<!DOCTYPE HTML>
<html>
<head>
  <title>Test for Worklet</title>
  <script type="application/javascript" src="common.js"></script>
</head>
<body>

<script type="application/javascript">

setupTest();

var worklet = window.createWorklet();
ok(!!worklet, "We have a Worklet");

// First loading
worklet.import("common.js")
.then(() => {
  ok(true, "Import should load a resource.");
})

// Second loading - same file
.then(() => {
  return worklet.import("common.js")
})
.then(() => {
  ok(true, "Import should load a resource.");
})

// 3rd loading - a network error
.then(() => {
  return worklet.import("404.js");
})
.then(() => {
  ok(false, "The loading should fail.");
}, () => {
  ok(true, "The loading should fail.");
})

// 4th loading - a network error
.then(() => {
  return worklet.import("404.js");
})
.then(() => {
  ok(false, "The loading should fail.");
}, () => {
  ok(true, "The loading should fail.");
})

// done
.then(() => {
  SimpleTest.finish();
});

</script>
</body>
</html>