File: file_disabled_iframe.html

package info (click to toggle)
firefox 141.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,550,616 kB
  • sloc: cpp: 7,426,508; javascript: 6,367,238; ansic: 3,707,354; python: 1,368,984; xml: 623,983; asm: 426,916; java: 184,324; sh: 64,488; makefile: 19,203; objc: 13,059; perl: 12,955; yacc: 4,583; cs: 3,846; pascal: 3,352; lex: 1,720; ruby: 1,071; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (81 lines) | stat: -rw-r--r-- 3,107 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!doctype html>
<script>
  window.is = window.parent.is;
  window.SimpleTest = window.parent.SimpleTest;
</script>
<div id="testnodes"><span>hi</span> there <!-- mon ami --></div>
<script>
  let t = document.getElementById('testnodes');
  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"));
  t.firstChild.textContent = "<foo>";
  is(t.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");

  // This test crashes if the style tags are not handled correctly
  t.innerHTML = `<svg version="1.1">
    <style>
        circle {
            fill: currentColor;
        }
    </style>
    <g><circle cx="25.8" cy="9.3" r="1.5"/></g>
  </svg>
  `;
  is(t.firstChild.tagName.toLowerCase(), 'svg');

  // This test crashes if the script tags are not handled correctly
  t.innerHTML = `<svg version="1.1">
    <scri` + `pt>
      throw "badment, should never fire.";
    </scri` + `pt>
    <g><circle cx="25.8" cy="9.3" r="1.5"/></g>
  </svg>`;
  is(t.firstChild.tagName.toLowerCase(), 'svg');

  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
  is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
  t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "script"));
  is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
  t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
  is(t.innerHTML, '<svg><script>1&amp;2&lt;3&gt;4&nbsp;\u003C/script></svg>');

  t.innerHTML = null;
  t.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
  is(t.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
  t.firstChild.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "style"));
  is(t.firstChild.firstChild.namespaceURI, "http://www.w3.org/2000/svg");
  t.firstChild.firstChild.textContent = "1&2<3>4\xA0";
  is(t.innerHTML, '<svg><style>1&amp;2&lt;3&gt;4&nbsp;\u003C/style></svg>');

  //
  // Tests for Bug 1673237
  //

  // This test fails if about:blank renders SVGs
  t.innerHTML = null;
  var iframe = document.createElement("iframe");
  iframe.setAttribute("src", "about:blank")
  t.appendChild(iframe);
  iframe.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"));
  iframe.firstChild.textContent = "<foo>";
  is(iframe.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");

  // This test fails if about:blank renders SVGs
  var win = window.open("about:blank");
  win.document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg:svg"))
  win.document.body.firstChild.textContent = "<foo>";
  is(win.document.body.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");
  win.close();

  // This test fails if about:srcdoc renders SVGs
  t.innerHTML = null;
  iframe = document.createElement("iframe");
  iframe.srcdoc = "<svg:svg></svg:svg>";
  iframe.onload = function() {
    iframe.contentDocument.body.firstChild.textContent = "<foo>";
    is(iframe.contentDocument.body.innerHTML, "<svg:svg>&lt;foo&gt;</svg:svg>");
    SimpleTest.finish();
  }
  t.appendChild(iframe);
</script>