toolkit/components/console/tests/test_hugeURIs.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <?xml version="1.0"?>
     2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     4 <!--
     5 https://bugzilla.mozilla.org/show_bug.cgi?id=796179
     6 -->
     7 <window title="Mozilla Bug 796179"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     9         onload="RunTest();">
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    12   <!-- Detect severe performance and memory issues when large amounts of errors
    13        are reported from CSS embedded in a file with a long data URI. Addressed
    14        by 786108 for issues internal to the style system and by 796179 for issues
    15        related to the error console. This error console test should finish quickly
    16        with those patches and run for a very long time or OOM otherwise. -->
    18   <!-- test results are displayed in the html:body -->
    19   <body xmlns="http://www.w3.org/1999/xhtml">
    20     <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=796179"
    21       target="_blank">Mozilla Bug 796179</a>
    22     <div id="badSVG" style="max-width: 1; max-height: 1; overflow: hidden"></div>
    23   </body>
    25   <!-- display the error console so we can test its reaction to the test -->
    26   <iframe id="errorConsoleFrame"  height="400" src="chrome://global/content/console.xul"></iframe>
    28   <!-- test code -->
    29   <script type="application/javascript">
    30   <![CDATA[
    31     function RunTest()
    32     {
    33       // Create the bad SVG and add it to the document.
    34       var img = new Array;
    35       img.push('<img src="data:image/svg+xml,');
    36       img.push(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="300px" height="300px">'));
    38       for (var i = 0 ; i < 10000 ; i++)
    39         img.push(encodeURIComponent('<circle cx="0" cy="0" r="1" style="xxx-invalid-property: 0;"/>'));
    41       img.push(encodeURIComponent('</svg>'));
    42       img.push('" />');
    44       document.getElementById('badSVG').innerHTML = img.join('');
    46       // We yield control of the thread, allowing the error console to render.
    47       // If we get control back without timing out or OOMing then the test passed.
    48       SimpleTest.waitForExplicitFinish();
    49       SimpleTest.executeSoon(function() {
    50                                // Clean up.
    51                                var elem = document.getElementById('errorConsoleFrame');
    52                                elem.parentNode.removeChild(elem);
    53                                elem = document.getElementById('badSVG');
    54                                elem.parentNode.removeChild(elem);
    55                                elem = null;
    57                                // Finish the test with a pass.
    58                                ok(true, 'Error console rendered OK.');
    59                                SimpleTest.finish();
    60                              }, 0);
    61     }
    62   ]]>
    63   </script>
    64 </window>

mercurial