blob: bc71012b8aaa2fd7c3fa2024bb23a528ad6fdcc9 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<script>
if (typeof testRunner !== 'undefined')
testRunner.dumpAsText();
// ES6 polyfill
if (!String.prototype.contains) {
String.prototype.contains = function(substring) {
var startIndex = arguments[1] || 0;
return this.indexOf(substring, startIndex) >= startIndex;
};
}
function innerFunction() {
document.appendChild(document);
}
function outerFunction() {
innerFunction();
}
var e;
try {
outerFunction();
} catch (ex) {
e = ex;
}
shouldBeTrue('"stack" in e');
shouldBeEqualToString('typeof e.stack', 'string');
shouldBeTrue('e.stack.contains("innerFunction")');
shouldBeTrue('e.stack.contains("outerFunction")');
shouldBeEqualToString('Object.prototype.toString.call(e)', '[object DOMException]');
shouldBeEqualToString('e.name', 'HierarchyRequestError');
shouldBeEqualToString('e.message', 'The operation would yield an incorrect node tree.');
shouldBe('e.code', '3');
e.stack = 42;
// Don't use shouldBe because the FAIL case still happens on JSC and we don't want the output
// to depend on the path.
shouldBeTrue('e.stack === 42');
</script>
<script src="../../../resources/js-test-post.js"></script>