test_bug616590.xhtml (2743B)
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=616590 8 --> 9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 10 title="Mozilla Bug 616590" onload="runTest();"> 11 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 12 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 13 14 <body xmlns="http://www.w3.org/1999/xhtml"> 15 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=616590" 16 target="_blank">Mozilla Bug 616590</a> 17 <p/> 18 <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 19 id="editor" 20 type="content" 21 editortype="htmlmail" 22 style="width: 400px; height: 100px;"/> 23 <p/> 24 <pre id="test"> 25 </pre> 26 </body> 27 <script class="testbody" type="application/javascript"> 28 <![CDATA[ 29 30 SimpleTest.waitForExplicitFinish(); 31 32 function EditorContentListener(aEditor) 33 { 34 this.init(aEditor); 35 } 36 37 EditorContentListener.prototype = { 38 init(aEditor) 39 { 40 this.mEditor = aEditor; 41 }, 42 43 QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener", 44 "nsISupportsWeakReference"]), 45 46 onStateChange(aWebProgress, aRequest, aStateFlags) 47 { 48 if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) 49 { 50 var editor = this.mEditor.getEditor(this.mEditor.contentWindow); 51 if (editor) { 52 editor.QueryInterface(Ci.nsIEditorMailSupport); 53 editor.insertAsCitedQuotation("<html><body><div contenteditable>foo</div></body></html>", "", true); 54 document.documentElement.clientWidth; 55 progress.removeProgressListener(this); 56 ok(true, "Test complete"); 57 SimpleTest.finish(); 58 } 59 } 60 }, 61 62 63 onProgressChange() 64 { 65 }, 66 67 onLocationChange() 68 { 69 }, 70 71 onStatusChange() 72 { 73 }, 74 75 onSecurityChange() 76 { 77 }, 78 79 onContentBlockingEvent() 80 { 81 }, 82 83 mEditor: null 84 }; 85 86 var progress, progressListener; 87 88 function runTest() { 89 var editorElement = document.getElementById("editor"); 90 editorElement.makeEditable("htmlmail", true); 91 var docShell = editorElement.docShell; 92 progress = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress); 93 progressListener = new EditorContentListener(editorElement); 94 progress.addProgressListener(progressListener, Ci.nsIWebProgress.NOTIFY_ALL); 95 editorElement.setAttribute("src", "data:text/html,"); 96 } 97 ]]> 98 </script> 99 </window>