Bug 735059 - Second and third execCommand() parameters should be optional; r=ehsan

This commit is contained in:
Aryeh Gregor 2012-03-12 18:12:19 -04:00
parent cca9cd3b56
commit 6516ccca87
3 changed files with 25 additions and 2 deletions

View File

@ -91,8 +91,8 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
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);

View File

@ -93,6 +93,7 @@ _TEST_FILES = \
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 \

View File

@ -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>