2 <?xml-stylesheet href=
"chrome://global/skin"
4 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css"
7 https://bugzilla.mozilla.org/show_bug.cgi?id=780908
9 adapted from test_bug607584.xhtml by Kent James <kent@caspia.com>
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>
20 <editor xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
25 style=
"width: 400px; height: 100px; border: thin solid black"/>
30 <script class=
"testbody" type=
"application/javascript">
33 SimpleTest.waitForExplicitFinish();
35 function EditorContentListener(aEditor)
40 EditorContentListener.prototype = {
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);
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");
65 progress.removeProgressListener(this);
88 onContentBlockingEvent()
95 var progress, progressListener;
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,");