4 https://bugzilla.mozilla.org/show_bug.cgi?id=520182
7 <title>Test for Bug
520182</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=520182">Mozilla Bug
520182</a>
16 <iframe id=
"a" src=
"about:blank"></iframe>
17 <iframe id=
"b" src=
"about:blank"></iframe>
18 <iframe id=
"c" src=
"about:blank"></iframe>
19 <div id=
"d" contenteditable=
"true"></div>
20 <div id=
"e" contenteditable=
"true"></div>
21 <div id=
"f" contenteditable=
"true"></div>
22 <iframe id=
"g" src=
"about:blank"></iframe>
23 <iframe id=
"h" src=
"about:blank"></iframe>
24 <div id=
"i" contenteditable=
"true"></div>
25 <div id=
"j" contenteditable=
"true"></div>
26 <iframe id=
"k" src=
"about:blank"></iframe>
27 <div id=
"l" contenteditable=
"true"></div>
28 <iframe id=
"m" src=
"about:blank"></iframe>
29 <div id=
"n" contenteditable=
"true"></div>
30 <iframe id=
"o" src=
"about:blank"></iframe>
31 <div id=
"p" contenteditable=
"true"></div>
32 <iframe id=
"q" src=
"about:blank"></iframe>
33 <div id=
"r" contenteditable=
"true"></div>
34 <iframe id=
"s" src=
"about:blank"></iframe>
35 <div id=
"t" contenteditable=
"true"></div>
36 <iframe id=
"u" src=
"about:blank"></iframe>
37 <div id=
"v" contenteditable=
"true"></div>
38 <iframe id=
"w" src=
"about:blank"></iframe>
39 <div id=
"x" contenteditable=
"true"></div>
40 <iframe id=
"y" src=
"about:blank"></iframe>
41 <div id=
"z" contenteditable=
"true"></div>
42 <iframe id=
"aa" src=
"about:blank"></iframe>
43 <div id=
"bb" contenteditable=
"true"></div>
44 <iframe id=
"cc" src=
"about:blank"></iframe>
45 <div id=
"dd" contenteditable=
"true"></div>
46 <iframe id=
"ee" src=
"about:blank"></iframe>
47 <div id=
"ff" contenteditable=
"true"></div>
48 <iframe id=
"gg" src=
"about:blank"></iframe>
49 <div id=
"hh" contenteditable=
"true"></div>
50 <iframe id=
"ii" src=
"about:blank"></iframe>
51 <div id=
"jj" contenteditable=
"true"></div>
52 <iframe id=
"kk" src=
"about:blank"></iframe>
53 <div id=
"ll" contenteditable=
"true"></div>
54 <iframe id=
"mm" src=
"about:blank"></iframe>
55 <div id=
"nn" contenteditable=
"true"></div>
56 <iframe id=
"oo" src=
"about:blank"></iframe>
57 <div id=
"pp" contenteditable=
"true"></div>
58 <iframe id=
"qq" src=
"about:blank"></iframe>
59 <div id=
"rr" contenteditable=
"true"></div>
60 <iframe id=
"ss" src=
"about:blank"></iframe>
61 <div id=
"tt" contenteditable=
"true"></div>
62 <iframe id=
"uu" src=
"about:blank"></iframe>
63 <div id=
"vv" contenteditable=
"true"></div>
64 <div id=
"sss" contenteditable=
"true"></div>
65 <iframe id=
"ssss" src=
"about:blank"></iframe>
66 <div id=
"ttt" contenteditable=
"true"></div>
67 <iframe id=
"tttt" src=
"about:blank"></iframe>
68 <div id=
"uuu" contenteditable=
"true"></div>
69 <iframe id=
"uuuu" src=
"about:blank"></iframe>
70 <div id=
"vvv" contenteditable=
"true"></div>
71 <iframe id=
"vvvv" src=
"about:blank"></iframe>
72 <div id=
"www" contenteditable=
"true"></div>
73 <iframe id=
"wwww" src=
"about:blank"></iframe>
74 <div id=
"xxx" contenteditable=
"true"></div>
75 <iframe id=
"xxxx" src=
"about:blank"></iframe>
76 <div id=
"yyy" contenteditable=
"true"></div>
77 <iframe id=
"yyyy" src=
"about:blank"></iframe>
80 <script type=
"application/javascript">
82 /* eslint-disable no-useless-concat */
84 /** Test for Bug
520182 **/
86 const dataPayload =
"foo<iframe src=\"data:text/html,bar\
"></iframe>baz";
87 const jsPayload =
"foo<iframe src=\"javascript:void('bar');\
"></iframe>baz";
88 const httpPayload =
"foo<iframe src=\"http://mochi.test:
8888/\
"></iframe>baz";
89 const scriptPayload =
"foo<script>document.write(\"<iframe></iframe>\");</sc" + "ript>baz";
90 const scriptExternalPayload
= "foo<script src=\"data:text/javascript,document.write('<iframe></iframe>');\"></sc" + "ript>baz";
91 const validStyle1Payload
= "foo<style>#bar{color:red;}</style>baz";
92 const validStyle2Payload
= "foo<span style=\"color:red\">bar</span>baz";
93 const validStyle3Payload
= "foo<style>@font-face{font-family:xxx;src:'xxx.ttf';}</style>baz";
94 const validStyle4Payload
= "foo<style>@namespace xxx url(http://example.com/);</style>baz";
95 const invalidStyle1Payload
= "foo<style>#bar{-moz-binding:url('data:text/xml,<?xml version=\"1.0\"><binding xmlns=\"http://www.mozilla.org/xbl\"/>');}</style>baz";
96 const invalidStyle2Payload
= "foo<span style=\"-moz-binding:url('data:text/xml,<?xml version="1.0"><binding xmlns="http://www.mozilla.org/xbl"/>');\">bar</span>baz";
97 const invalidStyle3Payload
= "foo<style>@import 'xxx.css';</style>baz";
98 const invalidStyle4Payload
= "foo<span style=\"@import 'xxx.css';\">bar</span>baz";
99 const invalidStyle5Payload
= "foo<span style=\"@font-face{font-family:xxx;src:'xxx.ttf';}\">bar</span>baz";
100 const invalidStyle6Payload
= "foo<span style=\"@namespace xxx url(http://example.com/);\">bar</span>baz";
101 const invalidStyle7Payload
= "<html><head><title>xxx</title></head><body>foo</body></html>";
102 const invalidStyle8Payload
= "foo<style>@-moz-document url(http://example.com/) {};</style>baz";
103 const invalidStyle9Payload
= "foo<style>@-moz-keyframes bar {};</style>baz";
104 const nestedStylePayload
= "foo<style>#bar1{-moz-binding:url('data:text/xml,<?xml version="1.0"><binding xmlns="http://www.mozilla.org/xbl" id="binding-1"/>');<style></style>#bar2{-moz-binding:url('data:text/xml,<?xml version="1.0"><binding xmlns="http://www.mozilla.org/xbl" id="binding-2"/>');</style>baz";
105 const validImgSrc1Payload
= "foo<img src=\"data:image/png,bar\">baz";
106 const validImgSrc2Payload
= "foo<img src=\"javascript:void('bar');\">baz";
107 const validImgSrc3Payload
= "foo<img src=\"file:///bar.png\">baz";
108 const validDataFooPayload
= "foo<span data-bar=\"value\">baz</span>";
109 const validDataFoo2Payload
= "foo<span _bar=\"value\">baz</span>";
110 const svgPayload
= "foo<svg><title>svgtitle</title></svg>bar";
111 const svg2Payload
= "foo<svg><bogussvg/></svg>bar";
112 const mathPayload
= "foo<math><bogusmath/></math>bar";
113 const math2Payload
= "foo<math><style>@import \"yyy.css\";</style</math>bar";
114 const math3Payload
= "foo<math><mi></mi></math>bar";
115 const videoPayload
= "foo<video></video>bar";
116 const microdataPayload
= "<head><meta name=foo content=bar><link rel=stylesheet href=url></head><body><meta itemprop=foo content=bar><link itemprop=bar href=url></body>";
122 payload
: dataPayload
,
124 rootElement() { return document
.getElementById("a").contentDocument
.documentElement
; },
131 rootElement() { return document
.getElementById("b").contentDocument
.documentElement
; },
136 payload
: httpPayload
,
138 rootElement() { return document
.getElementById("c").contentDocument
.documentElement
; },
143 payload
: scriptPayload
,
144 rootElement() { return document
.getElementById("g").contentDocument
.documentElement
; },
150 payload
: scriptExternalPayload
,
151 rootElement() { return document
.getElementById("h").contentDocument
.documentElement
; },
156 payload
: dataPayload
,
158 rootElement() { return document
.getElementById("d"); },
164 rootElement() { return document
.getElementById("e"); },
168 payload
: httpPayload
,
170 rootElement() { return document
.getElementById("f"); },
174 payload
: scriptPayload
,
175 rootElement() { return document
.getElementById("i"); },
180 payload
: scriptExternalPayload
,
181 rootElement() { return document
.getElementById("j"); },
187 payload
: validStyle1Payload
,
188 rootElement() { return document
.getElementById("k").contentDocument
.documentElement
; },
189 checkResult(html
) { isnot(html
.indexOf("style"), -1, "Should have retained style"); },
193 payload
: validStyle1Payload
,
194 rootElement() { return document
.getElementById("l"); },
195 checkResult(html
) { isnot(html
.indexOf("style"), -1, "Should have retained style"); },
200 payload
: validStyle2Payload
,
201 rootElement() { return document
.getElementById("m").contentDocument
.documentElement
; },
202 checkResult(html
) { isnot(html
.indexOf("style"), -1, "Should have retained style"); },
206 payload
: validStyle2Payload
,
207 rootElement() { return document
.getElementById("n"); },
208 checkResult(html
) { isnot(html
.indexOf("style"), -1, "Should have retained style"); },
213 payload
: invalidStyle1Payload
,
214 rootElement() { return document
.getElementById("s").contentDocument
.documentElement
; },
215 checkResult(html
) { is(html
.indexOf("xxx"), -1, "Should not have retained the import style"); },
219 payload
: invalidStyle1Payload
,
220 rootElement() { return document
.getElementById("t"); },
221 checkResult(html
) { is(html
.indexOf("xxx"), -1, "Should not have retained the import style"); },
226 payload
: invalidStyle2Payload
,
227 rootElement() { return document
.getElementById("u").contentDocument
.documentElement
; },
228 checkResult(html
) { is(html
.indexOf("xxx"), -1, "Should not have retained the import style"); },
232 payload
: invalidStyle2Payload
,
233 rootElement() { return document
.getElementById("v"); },
234 checkResult(html
) { is(html
.indexOf("xxx"), -1, "Should not have retained the import style"); },
239 payload
: validStyle3Payload
,
240 rootElement() { return document
.getElementById("w").contentDocument
.documentElement
; },
241 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should have retained the font-face style"); },
245 payload
: validStyle3Payload
,
246 rootElement() { return document
.getElementById("x"); },
247 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should have retained the font-face style"); },
252 payload
: invalidStyle5Payload
,
253 rootElement() { return document
.getElementById("y").contentDocument
.documentElement
; },
254 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should not have retained the font-face style"); },
258 payload
: invalidStyle5Payload
,
259 rootElement() { return document
.getElementById("z"); },
260 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should not have retained the font-face style"); },
265 payload
: validStyle4Payload
,
266 rootElement() { return document
.getElementById("cc").contentDocument
.documentElement
; },
267 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should have retained the namespace style"); },
271 payload
: validStyle4Payload
,
272 rootElement() { return document
.getElementById("dd"); },
273 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should have retained the namespace style"); },
278 payload
: invalidStyle6Payload
,
279 rootElement() { return document
.getElementById("ee").contentDocument
.documentElement
; },
280 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should not have retained the namespace style"); },
284 payload
: invalidStyle6Payload
,
285 rootElement() { return document
.getElementById("ff"); },
286 checkResult(html
) { isnot(html
.indexOf("xxx"), -1, "Should not have retained the namespace style"); },
291 payload
: invalidStyle6Payload
,
292 rootElement() { return document
.getElementById("gg").contentDocument
.documentElement
; },
293 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
297 payload
: invalidStyle6Payload
,
298 rootElement() { return document
.getElementById("hh"); },
299 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
304 payload
: invalidStyle6Payload
,
305 rootElement() { return document
.getElementById("ii").contentDocument
.documentElement
; },
306 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
310 payload
: invalidStyle6Payload
,
311 rootElement() { return document
.getElementById("jj"); },
312 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
317 payload
: invalidStyle6Payload
,
318 rootElement() { return document
.getElementById("kk").contentDocument
.documentElement
; },
319 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
323 payload
: invalidStyle6Payload
,
324 rootElement() { return document
.getElementById("ll"); },
325 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the src attribute for the image"); },
331 payload
: invalidStyle7Payload
,
332 rootElement() { return document
.getElementById("mm").contentDocument
.documentElement
; },
334 is(html
.indexOf("xxx"), -1, "Should not have retained the title text");
335 isnot(html
.indexOf("foo"), -1, "Should have retained the body text");
341 payload
: invalidStyle7Payload
,
342 rootElement() { return document
.getElementById("nn"); },
344 is(html
.indexOf("xxx"), -1, "Should not have retained the title text");
345 isnot(html
.indexOf("foo"), -1, "Should have retained the body text");
351 payload
: validDataFooPayload
,
352 rootElement() { return document
.getElementById("oo").contentDocument
.documentElement
; },
353 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the data-bar attribute"); },
357 payload
: validDataFooPayload
,
358 rootElement() { return document
.getElementById("pp"); },
359 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the data-bar attribute"); },
364 payload
: validDataFoo2Payload
,
365 rootElement() { return document
.getElementById("qq").contentDocument
.documentElement
; },
366 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the _bar attribute"); },
370 payload
: validDataFoo2Payload
,
371 rootElement() { return document
.getElementById("rr"); },
372 checkResult(html
) { isnot(html
.indexOf("bar"), -1, "Should have retained the _bar attribute"); },
377 payload
: invalidStyle8Payload
,
378 rootElement() { return document
.getElementById("ss").contentDocument
.documentElement
; },
379 checkResult(html
) { is(html
.indexOf("@-moz-document"), -1, "Should not have retained the @-moz-document rule"); },
383 payload
: invalidStyle8Payload
,
384 rootElement() { return document
.getElementById("tt"); },
385 checkResult(html
) { is(html
.indexOf("@-moz-document"), -1, "Should not have retained the @-moz-document rule"); },
390 payload
: invalidStyle9Payload
,
391 rootElement() { return document
.getElementById("uu").contentDocument
.documentElement
; },
392 checkResult(html
) { is(html
.indexOf("@-moz-keyframes"), -1, "Should not have retained the @-moz-keyframes rule"); },
396 payload
: invalidStyle9Payload
,
397 rootElement() { return document
.getElementById("vv"); },
398 checkResult(html
) { is(html
.indexOf("@-moz-keyframes"), -1, "Should not have retained the @-moz-keyframes rule"); },
403 rootElement() { return document
.getElementById("sss"); },
404 checkResult(html
) { isnot(html
.indexOf("svgtitle"), -1, "Should have retained SVG title"); },
410 rootElement() { return document
.getElementById("ssss").contentDocument
.documentElement
; },
411 checkResult(html
) { isnot(html
.indexOf("svgtitle"), -1, "Should have retained SVG title"); },
415 payload
: svg2Payload
,
416 rootElement() { return document
.getElementById("ttt"); },
417 checkResult(html
) { is(html
.indexOf("bogussvg"), -1, "Should have dropped bogussvg element"); },
422 payload
: svg2Payload
,
423 rootElement() { return document
.getElementById("tttt").contentDocument
.documentElement
; },
424 checkResult(html
) { is(html
.indexOf("bogussvg"), -1, "Should have dropped bogussvg element"); },
428 payload
: mathPayload
,
429 rootElement() { return document
.getElementById("uuu"); },
430 checkResult(html
) { is(html
.indexOf("bogusmath"), -1, "Should have dropped bogusmath element"); },
435 payload
: mathPayload
,
436 rootElement() { return document
.getElementById("uuuu").contentDocument
.documentElement
; },
437 checkResult(html
) { is(html
.indexOf("bogusmath"), -1, "Should have dropped bogusmath element"); },
441 payload
: math2Payload
,
442 rootElement() { return document
.getElementById("vvv"); },
443 checkResult(html
) { is(html
.indexOf("yyy.css"), -1, "Should have dropped MathML style element"); },
448 payload
: math2Payload
,
449 rootElement() { return document
.getElementById("vvvv").contentDocument
.documentElement
; },
450 checkResult(html
) { is(html
.indexOf("yyy.css"), -1, "Should have dropped MathML style element"); },
454 payload
: math3Payload
,
455 rootElement() { return document
.getElementById("www"); },
456 checkResult(html
) { isnot(html
.indexOf("<mi"), -1, "Should not have dropped MathML mi element"); },
461 payload
: math3Payload
,
462 rootElement() { return document
.getElementById("wwww").contentDocument
.documentElement
; },
463 checkResult(html
) { isnot(html
.indexOf("<mi"), -1, "Should not have dropped MathML mi element"); },
467 payload
: videoPayload
,
468 rootElement() { return document
.getElementById("xxx"); },
469 checkResult(html
) { isnot(html
.indexOf("controls="), -1, "Should have added the controls attribute"); },
474 payload
: videoPayload
,
475 rootElement() { return document
.getElementById("xxxx").contentDocument
.documentElement
; },
476 checkResult(html
) { isnot(html
.indexOf("controls="), -1, "Should have added the controls attribute"); },
480 payload
: microdataPayload
,
481 rootElement() { return document
.getElementById("yyy"); },
482 checkResult(html
) { is(html
.indexOf("name"), -1, "Should have dropped name."); is(html
.indexOf("rel"), -1, "Should have dropped rel."); isnot(html
.indexOf("itemprop"), -1, "Should not have dropped itemprop."); },
487 payload
: microdataPayload
,
488 rootElement() { return document
.getElementById("yyyy").contentDocument
.documentElement
; },
489 checkResult(html
) { is(html
.indexOf("name"), -1, "Should have dropped name."); is(html
.indexOf("rel"), -1, "Should have dropped rel."); isnot(html
.indexOf("itemprop"), -1, "Should not have dropped itemprop."); },
493 function doNextTest() {
494 /* global testCounter:true */
495 if (typeof testCounter
== "undefined") {
497 } else if (++testCounter
== tests
.length
) {
502 runTest(tests
[testCounter
]);
507 function getLoadContext() {
508 const Ci
= SpecialPowers
.Ci
;
509 return SpecialPowers
.wrap(window
).docShell
.QueryInterface(Ci
.nsILoadContext
);
512 function runTest(test
) {
513 var elem
= document
.getElementById(test
.id
);
514 if ("isIFrame" in test
) {
515 elem
.contentDocument
.designMode
= "on";
516 elem
.contentWindow
.focus();
521 var trans
= SpecialPowers
.Cc
["@mozilla.org/widget/transferable;1"]
522 .createInstance(SpecialPowers
.Ci
.nsITransferable
);
523 trans
.init(getLoadContext());
524 var data
= SpecialPowers
.Cc
["@mozilla.org/supports-string;1"]
525 .createInstance(SpecialPowers
.Ci
.nsISupportsString
);
526 data
.data
= test
.payload
;
527 trans
.addDataFlavor("text/html");
528 trans
.setTransferData("text/html", data
);
530 if ("indirectPaste" in test
) {
532 if ("isIFrame" in test
) {
533 win
= elem
.contentDocument
.defaultView
;
535 getSelection().collapse(elem
, 0);
538 editor
= SpecialPowers
.wrap(win
).docShell
.editor
;
539 let beforeInputEvent
= null;
540 let inputEvent
= null;
541 let selectionRanges
= [];
542 win
.addEventListener("beforeinput", aEvent
=> {
543 beforeInputEvent
= aEvent
;
544 selectionRanges
= [];
545 let selection
= win
.getSelection();
546 for (let i
= 0; i
< selection
.rangeCount
; i
++) {
547 let range
= selection
.getRangeAt(i
);
548 selectionRanges
.push(
549 new win
.StaticRange({startContainer
: range
.startContainer
,
550 startOffset
: range
.startOffset
,
551 endContainer
: range
.endContainer
,
552 endOffset
: range
.endOffset
}));
555 win
.addEventListener("input", aEvent
=> { inputEvent
= aEvent
; }, {once
: true});
556 editor
.pasteTransferable(trans
);
557 isnot(beforeInputEvent
, null, '"beforeinput" event should be fired');
558 if (beforeInputEvent
) {
559 is(beforeInputEvent
.cancelable
, true, '"beforeinput" event for "insertFromPaste" should be cancelable');
560 is(beforeInputEvent
.inputType
, "insertFromPaste", `inputType of "beforeinput" event should be "insertFromPaste"`);
561 is(beforeInputEvent
.data
, null, 'data of "beforeinput" event should be null');
562 is(beforeInputEvent
.dataTransfer
.getData("text/html"), test
.payload
, 'dataTransfer of "beforeinput" event should have the HTML data');
563 is(beforeInputEvent
.dataTransfer
.getData("text/plain"), "", 'dataTransfer of "beforeinput" event should not have have plain text');
564 let targetRanges
= beforeInputEvent
.getTargetRanges();
565 is(targetRanges
.length
, selectionRanges
.length
, 'getTargetRanges() of "beforeinput" event should return selection ranges');
566 if (targetRanges
.length
=== selectionRanges
.length
) {
567 for (let i
= 0; i
< selectionRanges
.length
; i
++) {
568 is(targetRanges
[i
].startContainer
, selectionRanges
[i
].startContainer
,
569 `startContainer of getTargetRanges()[${i}] of "beforeinput" event does not match`);
570 is(targetRanges
[i
].startOffset
, selectionRanges
[i
].startOffset
,
571 `startOffset of getTargetRanges()[${i}] of "beforeinput" event does not match`);
572 is(targetRanges
[i
].endContainer
, selectionRanges
[i
].endContainer
,
573 `endContainer of getTargetRanges()[${i}] of "beforeinput" event does not match`);
574 is(targetRanges
[i
].endOffset
, selectionRanges
[i
].endOffset
,
575 `endOffset of getTargetRanges()[${i}] of "beforeinput" event does not match`);
579 is(inputEvent
.type
, "input", '"input" event should be fired');
580 is(inputEvent
.inputType
, "insertFromPaste", `inputType of "input" event should be "insertFromPaste"`);
581 is(inputEvent
.data
, null, 'data of "input" event should be null');
582 is(inputEvent
.dataTransfer
.getData("text/html"), test
.payload
, 'dataTransfer of "input" event should have the HTML data');
583 is(inputEvent
.dataTransfer
.getData("text/plain"), "", 'dataTransfer of "input" event should not have have plain text');
584 is(inputEvent
.getTargetRanges().length
, 0, 'getTargetRanges() of "input" event should return empty array');
586 var clipboard
= SpecialPowers
.Services
.clipboard
;
588 clipboard
.setData(trans
, null, SpecialPowers
.Ci
.nsIClipboard
.kGlobalClipboard
);
590 synthesizeKey("V", {accelKey
: true});
593 if ("checkResult" in test
) {
594 if ("isIFrame" in test
) {
595 test
.checkResult(elem
.contentDocument
.documentElement
.innerHTML
,
596 elem
.contentDocument
.documentElement
.textContent
);
598 test
.checkResult(elem
.innerHTML
, elem
.textContent
);
601 var iframes
= test
.rootElement().querySelectorAll("iframe");
602 var expectedIFrameCount
= ("iframeCount" in test
) ? test
.iframeCount
: 1;
603 is(iframes
.length
, expectedIFrameCount
, "Only " + expectedIFrameCount
+ " iframe should be pasted");
604 if (expectedIFrameCount
> 0) {
605 ok(!iframes
[0].hasAttribute("src"), "iframe should not have a src attrib");
610 SimpleTest
.waitForExplicitFinish();
612 addLoadEvent(function() {
613 SpecialPowers
.pushPrefEnv(
614 { "set": [["layout.css.moz-document.content.enabled", true]]},