dom/tests/mochitest/webcomponents/test_document_shared_registry.html
author Edgar Chen <echen@mozilla.com>
Fri, 13 Oct 2017 23:36:54 +0800
changeset 699463 4c3195e3e777805291a8a28c601a16b879d3de9e
parent 409254 1f2f37ec0fd3bd0156c504ccc6aeb05e0f973dc0
child 699581 c8df3c4848c5b6cd2465e004ca985b4c4d5db7e9
permissions -rw-r--r--
Bug 1396620 - Part 1: Remove created callback for custom elements; MozReview-Commit-ID: IDovq3OZwgy

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=783129
-->
<head>
  <title>Test shared registry for associated HTML documents.</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="container"></div>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=783129">Bug 783129</a>
<script>
var container = document.getElementById("container");

function registerNoRegistryDoc() {
  var assocDoc = document.implementation.createDocument(null, "html");
  try {
    assocDoc.registerElement("x-dummy", { prototype: Object.create(HTMLElement.prototype) });
    ok(false, "Registring element in document without registry should throw.");
  } catch (ex) {
    ok(true, "Registring element in document without registry should throw.");
  }

  runNextTest();
}

function runNextTest() {
  if (testFunctions.length > 0) {
    var nextTestFunction = testFunctions.shift();
    nextTestFunction();
  }
}

var testFunctions = [
  registerNoRegistryDoc,
  SimpleTest.finish
];

SimpleTest.waitForExplicitFinish();

runNextTest();
</script>
</body>
</html>