content/base/test/test_bug737612.html
author Margaret Leibovic <margaret.leibovic@gmail.com>
Mon, 25 Aug 2014 15:28:10 -0700
changeset 216776 8d7b3bfaf3ab9bb3c32afb51d9714246d7c854f4
parent 96579 bafdd54189eef35f1cb9ed4fc2cde2c5dccacaf7
permissions -rw-r--r--
Bug 996753 - Telemetry probes for settings pages. r=liuche, a=sledru

<!doctype html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=737612
-->
<title>Test for Bug 737612</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=737612">Mozilla Bug 737612</a>
<script>

/** Test for Bug 737612 **/
var text = document.createTextNode("abc");
var range = document.createRange();
range.setStart(text, 1);
var threw = false;
try {
  range.insertNode(document.head);
} catch(e) {
  var threw = true;
  is(e.name, "HierarchyRequestError",
     "Must throw HierarchyRequestError");
  is(Object.getPrototypeOf(e), DOMException.prototype,
     "Must throw DOMException");
  is(e.code, DOMException.HIERARCHY_REQUEST_ERR,
     "Must throw HIERARCHY_REQUEST_ERR");
}
ok(threw, "Must throw when insertNode()ing into detached text node");

</script>