chromium/third_party/blink/web_tests/fast/css/stale-style-selector-crash-1.html

<html>
<head id="head">
    <style id="inlineRules">
        #foo { background-color: red; }
    </style>
</head>
<body>
    <p>
        Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13563">http://bugs.webkit.org/show_bug.cgi?id=13563</a>
        REGRESSION: Crash loading message in Yahoo! Mail</i>.
    </p>
    <p>
        The following line should say SUCCESS in green letters over a white background.
    </p>
    <div id="foo">SUCCESS</div>
    <script>
        function test()
        {
            var head = document.getElementById("head");
            var link = document.createElement("link");
            link.setAttribute("href", "data:text/css,");
            link.setAttribute("rel", "stylesheet");
            // This will increase the pending stylesheet count
            head.appendChild(link);
    
            var inline = document.getElementById("inlineRules");
            // This will delete the rule (duh) but since we have
            // pending stylesheets, will NOT update the style selector
            inline.sheet.deleteRule(0);
    
            // Make ourselves need a style recalc, so that
            // updateRendering() will do something when called soon
            document.getElementById("foo").style.color = "green";

            if (window.testRunner)
                testRunner.notifyDone();
        }

        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        setTimeout(test, 0);
    </script>
</body>
</html>