browser/devtools/profiler/test/browser_profiler_escape.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/profiler/test/browser_profiler_escape.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
     1.8 +
     1.9 +let gTab, gPanel;
    1.10 +
    1.11 +function test() {
    1.12 +  waitForExplicitFinish();
    1.13 +
    1.14 +  setUp(URL, function (tab, browser, panel) {
    1.15 +    gTab = tab;
    1.16 +    gPanel = panel;
    1.17 +
    1.18 +    let record = gPanel.controls.record;
    1.19 +
    1.20 +    gPanel.once("started", () => {
    1.21 +      gPanel.once("stopped", () => {
    1.22 +        let [ win, doc ] = getProfileInternals(gPanel.activeProfile.uid);
    1.23 +
    1.24 +        let expl = "<script>function f() {}</script></textarea><img/src='about:logo'>";
    1.25 +        let expl2 = "<script>function f() {}</script></pre><img/src='about:logo'>";
    1.26 +
    1.27 +        is(win.escapeHTML(expl),
    1.28 +          "&lt;script&gt;function f() {}&lt;/script&gt;&lt;/textarea&gt;&lt;img/src='about:logo'&gt;");
    1.29 +
    1.30 +        is(win.escapeHTML(expl2),
    1.31 +          "&lt;script&gt;function f() {}&lt;/script&gt;&lt;/pre&gt;&lt;img/src='about:logo'&gt;");
    1.32 +
    1.33 +        tearDown(gTab, () => {
    1.34 +          gTab = null;
    1.35 +          gPanel = null;
    1.36 +        });
    1.37 +      });
    1.38 +
    1.39 +      setTimeout(() => {
    1.40 +        record.click();
    1.41 +      }, 50);
    1.42 +    });
    1.43 +
    1.44 +    record.click();
    1.45 +  });
    1.46 +}
    1.47 \ No newline at end of file

mercurial