editor/libeditor/html/tests/test_bug616590.xul

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial