Bug 735059 - Second and third execCommand() parameters should be optional; r=ehsan
--- 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>