chromium/third_party/blink/web_tests/fast/dom/MutationObserver/observe-exceptions.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../../resources/js-test.js"></script>
<title></title>
</head>
<body>
<p id=description></p>
<div id="console"></div>
<script>

function runTest() {
    window.observer = new MutationObserver(function(mutations) { });
    shouldThrow('observer.observe()');
    shouldThrow('observer.observe(null)');
    shouldThrow('observer.observe(undefined)');
    shouldThrow('observer.observe(document.body)');
    shouldThrow('observer.observe(document.body, null)');
    shouldThrow('observer.observe(document.body, undefined)');
    shouldThrow('observer.observe(null, {attributes: true})');
    shouldThrow('observer.observe(undefined, {attributes: true})');
    shouldThrow('observer.observe(document.body, {subtree: true})');

    shouldThrow('observer.observe(document.body, {attributes: false, attributeOldValue: true})');
    shouldThrow('observer.observe(document.body, {attributes: false, attributeFilter: ["id"]})');
    shouldThrow('observer.observe(document.body, {attributes: false, attributeOldValue: false})');

    shouldThrow('observer.observe(document.body, {characterData: false, characterDataOldValue: true})');
    shouldThrow('observer.observe(document.body, {characterData: false, characterDataOldValue: false})');
}

description('Test that WebKitMutationObserver.observe throws exceptions appropriately');

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