Bug 735059 - Second and third execCommand() parameters should be optional; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Mon, 12 Mar 2012 18:12:19 -0400
changeset 89401 5217bbf42aa71da726a40175975a13880ee519e8
parent 89400 292f15267c3f7fef6107a9a0cc503090b1033496
child 89402 caf297562dcb9fb59619b7b2db7977587f73b2e0
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs735059
milestone14.0a1
Bug 735059 - Second and third execCommand() parameters should be optional; r=ehsan
dom/interfaces/html/nsIDOMHTMLDocument.idl
editor/libeditor/html/tests/Makefile.in
editor/libeditor/html/tests/test_bug735059.html
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -86,18 +86,18 @@ interface nsIDOMHTMLDocument : nsIDOMDoc
   void                      writeln([optional, Null(Stringify)] in DOMString text);
 
   /**
    * Midas additions
    */
   attribute DOMString       designMode;
 
   boolean                   execCommand(in DOMString commandID,
-                                        in boolean doShowUI,
-                                        in DOMString value);
+                                        [optional] in boolean doShowUI,
+                                        [optional] in DOMString value);
 
   // returns true if the help is being shown for command (false if not)
   boolean                   execCommandShowHelp(in DOMString commandID);
 
   // returns true if the command is enabled (false otherwise)
   boolean                   queryCommandEnabled(in DOMString commandID);
   
   // returns true if the command is in a indeterminate state (false otherwise)
--- a/editor/libeditor/html/tests/Makefile.in
+++ b/editor/libeditor/html/tests/Makefile.in
@@ -88,16 +88,17 @@ include $(topsrcdir)/config/rules.mk
 		test_bug674770-1.html \
 		file_bug674770-1.html \
 		test_bug674770-2.html \
 		test_bug674861.html \
 		test_bug676401.html \
 		test_bug677752.html \
 		test_bug697842.html \
 		test_bug725069.html \
+		test_bug735059.html \
 		test_CF_HTML_clipboard.html \
 		test_contenteditable_focus.html \
 		test_htmleditor_keyevent_handling.html \
 		test_keypress_untrusted_event.html \
 		test_select_all_without_body.html \
 		file_select_all_without_body.html \
 		test_root_element_replacement.html \
 		$(NULL)
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/html/tests/test_bug735059.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=735059
+-->
+<title>Test for Bug 735059</title>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=735059">Mozilla Bug 735059</a>
+<div id="display" contenteditable>foo</div>
+<pre id="test">
+<script>
+/** Test for Bug 735059 **/
+
+// Value defaults to the empty string, which evaluates to true, so this
+// disables CSS styling
+document.execCommand("usecss");
+getSelection().selectAllChildren(document.getElementById("display"));
+document.execCommand("bold");
+is(document.getElementById("display").innerHTML, "<b>foo</b>",
+   "execCommand() needs to work with only one parameter");
+</script>
+</pre>