1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/libeditor/html/tests/test_bug616590.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,105 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" 1.6 + type="text/css"?> 1.7 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.8 + type="text/css"?> 1.9 +<!-- 1.10 +https://bugzilla.mozilla.org/show_bug.cgi?id=616590 1.11 +--> 1.12 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.13 + title="Mozilla Bug 616590" onload="runTest();"> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 1.16 + <script type="application/javascript" 1.17 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 1.18 + 1.19 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.20 + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=616590" 1.21 + target="_blank">Mozilla Bug 616590</a> 1.22 + <p/> 1.23 + <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.24 + id="editor" 1.25 + type="content" 1.26 + editortype="htmlmail" 1.27 + style="width: 400px; height: 100px;"/> 1.28 + <p/> 1.29 + <pre id="test"> 1.30 + </pre> 1.31 + </body> 1.32 + <script class="testbody" type="application/javascript"> 1.33 + <![CDATA[ 1.34 + 1.35 + SimpleTest.waitForExplicitFinish(); 1.36 + 1.37 + function EditorContentListener(aEditor) 1.38 + { 1.39 + this.init(aEditor); 1.40 + } 1.41 + 1.42 + EditorContentListener.prototype = { 1.43 + init : function(aEditor) 1.44 + { 1.45 + this.mEditor = aEditor; 1.46 + }, 1.47 + 1.48 + QueryInterface : function(aIID) 1.49 + { 1.50 + if (aIID.equals(Components.interfaces.nsIWebProgressListener) || 1.51 + aIID.equals(Components.interfaces.nsISupportsWeakReference) || 1.52 + aIID.equals(Components.interfaces.nsISupports)) 1.53 + return this; 1.54 + throw Components.results.NS_NOINTERFACE; 1.55 + }, 1.56 + 1.57 + onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) 1.58 + { 1.59 + if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) 1.60 + { 1.61 + var editor = this.mEditor.getEditor(this.mEditor.contentWindow); 1.62 + if (editor) { 1.63 + editor.QueryInterface(Components.interfaces.nsIEditorMailSupport); 1.64 + editor.insertAsCitedQuotation("<html><body><div contenteditable>foo</div></body></html>", "", true); 1.65 + document.documentElement.clientWidth; 1.66 + progress.removeProgressListener(this); 1.67 + ok(true, "Test complete"); 1.68 + SimpleTest.finish(); 1.69 + } 1.70 + } 1.71 + }, 1.72 + 1.73 + 1.74 + onProgressChange : function(aWebProgress, aRequest, 1.75 + aCurSelfProgress, aMaxSelfProgress, 1.76 + aCurTotalProgress, aMaxTotalProgress) 1.77 + { 1.78 + }, 1.79 + 1.80 + onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) 1.81 + { 1.82 + }, 1.83 + 1.84 + onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) 1.85 + { 1.86 + }, 1.87 + 1.88 + onSecurityChange : function(aWebProgress, aRequest, aState) 1.89 + { 1.90 + }, 1.91 + 1.92 + mEditor: null 1.93 + }; 1.94 + 1.95 + var progress, progressListener; 1.96 + 1.97 + function runTest() { 1.98 + var editorElement = document.getElementById("editor"); 1.99 + editorElement.makeEditable("htmlmail", true); 1.100 + var docShell = editorElement.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell; 1.101 + progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress); 1.102 + progressListener = new EditorContentListener(editorElement); 1.103 + progress.addProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); 1.104 + editorElement.setAttribute("src", "data:text/html,"); 1.105 + } 1.106 +]]> 1.107 +</script> 1.108 +</window>