Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug780908.xhtml
blob6bfa306a714ef11f329f2911be04d27f94266868
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin"
3 type="text/css"?>
4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
5 type="text/css"?>
6 <!--
7 https://bugzilla.mozilla.org/show_bug.cgi?id=780908
9 adapted from test_bug607584.xhtml by Kent James <kent@caspia.com>
10 -->
11 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
12 title="Mozilla Bug 780908" onload="runTest();">
13 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
14 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
16 <body xmlns="http://www.w3.org/1999/xhtml">
17 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=780908"
18 target="_blank">Mozilla Bug 780908</a>
19 <p/>
20 <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
21 id="editor"
22 type="content"
23 primary="true"
24 editortype="html"
25 style="width: 400px; height: 100px; border: thin solid black"/>
26 <p/>
27 <pre id="test">
28 </pre>
29 </body>
30 <script class="testbody" type="application/javascript">
31 <![CDATA[
33 SimpleTest.waitForExplicitFinish();
35 function EditorContentListener(aEditor)
37 this.init(aEditor);
40 EditorContentListener.prototype = {
41 init(aEditor)
43 this.mEditor = aEditor;
46 QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
47 "nsISupportsWeakReference"]),
49 onStateChange(aWebProgress, aRequest, aStateFlags)
51 if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
53 var editor = this.mEditor.getEditor(this.mEditor.contentWindow);
54 if (editor) {
55 this.mEditor.focus();
56 editor instanceof Ci.nsIHTMLEditor;
57 editor.returnInParagraphCreatesNewParagraph = true;
58 let source = "<html><body><table><head></table></body></html>";
59 editor.rebuildDocumentFromSource(source);
60 ok(true, "Don't crash when head appears after body");
61 source = "<html></head><head><body></body></html>";
62 editor.rebuildDocumentFromSource(source);
63 ok(true, "Don't crash when /head appears before head");
64 SimpleTest.finish();
65 progress.removeProgressListener(this);
72 onProgressChange()
76 onLocationChange()
80 onStatusChange()
84 onSecurityChange()
88 onContentBlockingEvent()
92 mEditor: null
95 var progress, progressListener;
97 function runTest() {
98 var newEditorElement = document.getElementById("editor");
99 newEditorElement.makeEditable("html", true);
100 var docShell = newEditorElement.docShell;
101 progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
102 progressListener = new EditorContentListener(newEditorElement);
103 progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL);
104 newEditorElement.setAttribute("src", "data:text/html,");
107 </script>
108 </window>