browser/devtools/profiler/test/browser_profiler_escape.js

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

mercurial