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