browser/devtools/profiler/test/browser_profiler_escape.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 const URL = "data:text/html;charset=utf8,<p>JavaScript Profiler test</p>";
     6 let gTab, gPanel;
     8 function test() {
     9   waitForExplicitFinish();
    11   setUp(URL, function (tab, browser, panel) {
    12     gTab = tab;
    13     gPanel = panel;
    15     let record = gPanel.controls.record;
    17     gPanel.once("started", () => {
    18       gPanel.once("stopped", () => {
    19         let [ win, doc ] = getProfileInternals(gPanel.activeProfile.uid);
    21         let expl = "<script>function f() {}</script></textarea><img/src='about:logo'>";
    22         let expl2 = "<script>function f() {}</script></pre><img/src='about:logo'>";
    24         is(win.escapeHTML(expl),
    25           "&lt;script&gt;function f() {}&lt;/script&gt;&lt;/textarea&gt;&lt;img/src='about:logo'&gt;");
    27         is(win.escapeHTML(expl2),
    28           "&lt;script&gt;function f() {}&lt;/script&gt;&lt;/pre&gt;&lt;img/src='about:logo'&gt;");
    30         tearDown(gTab, () => {
    31           gTab = null;
    32           gPanel = null;
    33         });
    34       });
    36       setTimeout(() => {
    37         record.click();
    38       }, 50);
    39     });
    41     record.click();
    42   });
    43 }

mercurial