toolkit/components/console/tests/test_hugeURIs.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/console/tests/test_hugeURIs.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,64 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
     1.6 +<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=796179
     1.9 +-->
    1.10 +<window title="Mozilla Bug 796179"
    1.11 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.12 +        onload="RunTest();">
    1.13 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.14 +
    1.15 +  <!-- Detect severe performance and memory issues when large amounts of errors
    1.16 +       are reported from CSS embedded in a file with a long data URI. Addressed
    1.17 +       by 786108 for issues internal to the style system and by 796179 for issues
    1.18 +       related to the error console. This error console test should finish quickly
    1.19 +       with those patches and run for a very long time or OOM otherwise. -->
    1.20 +
    1.21 +  <!-- test results are displayed in the html:body -->
    1.22 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.23 +    <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=796179"
    1.24 +      target="_blank">Mozilla Bug 796179</a>
    1.25 +    <div id="badSVG" style="max-width: 1; max-height: 1; overflow: hidden"></div>
    1.26 +  </body>
    1.27 +
    1.28 +  <!-- display the error console so we can test its reaction to the test -->
    1.29 +  <iframe id="errorConsoleFrame"  height="400" src="chrome://global/content/console.xul"></iframe>
    1.30 +
    1.31 +  <!-- test code -->
    1.32 +  <script type="application/javascript">
    1.33 +  <![CDATA[
    1.34 +    function RunTest()
    1.35 +    {
    1.36 +      // Create the bad SVG and add it to the document.
    1.37 +      var img = new Array;
    1.38 +      img.push('<img src="data:image/svg+xml,');
    1.39 +      img.push(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="300px" height="300px">'));
    1.40 +
    1.41 +      for (var i = 0 ; i < 10000 ; i++)
    1.42 +        img.push(encodeURIComponent('<circle cx="0" cy="0" r="1" style="xxx-invalid-property: 0;"/>'));
    1.43 +
    1.44 +      img.push(encodeURIComponent('</svg>'));
    1.45 +      img.push('" />');
    1.46 +
    1.47 +      document.getElementById('badSVG').innerHTML = img.join('');
    1.48 +
    1.49 +      // We yield control of the thread, allowing the error console to render.
    1.50 +      // If we get control back without timing out or OOMing then the test passed.
    1.51 +      SimpleTest.waitForExplicitFinish();
    1.52 +      SimpleTest.executeSoon(function() {
    1.53 +                               // Clean up.
    1.54 +                               var elem = document.getElementById('errorConsoleFrame');
    1.55 +                               elem.parentNode.removeChild(elem);
    1.56 +                               elem = document.getElementById('badSVG');
    1.57 +                               elem.parentNode.removeChild(elem);
    1.58 +                               elem = null;
    1.59 +
    1.60 +                               // Finish the test with a pass.
    1.61 +                               ok(true, 'Error console rendered OK.');
    1.62 +                               SimpleTest.finish();
    1.63 +                             }, 0);
    1.64 +    }
    1.65 +  ]]>
    1.66 +  </script>
    1.67 +</window>

mercurial