Closed Bug 1547869 Opened 7 months ago Closed 7 months ago

HTMLEditor only commands should check whether given editor is an HTML editor


(Core :: DOM: Editor, defect, P1)




Tracking Status
firefox-esr60 --- unaffected
firefox67 --- unaffected
firefox68 --- fixed


(Reporter: masayuki, Assigned: masayuki)




(Keywords: regression)


(1 file)

Currently, editor command classes are accessed only with pointer to HTMLEditor because they are registered only into command table for HTMLEditor.

However, starting from bug 1529884, IsCommandEnabled() is called even with TextEditor. In such case, it should return false to avoid calling DoCommand() etc with TextEditor.

Priority: -- → P1

Currently, this bug does not occur actually because nobody has not accessed
these command classes directly and they are registered only in command table
for HTML editor. However, once rewriting nsHTMLDocument::ExecCommand() with
these classes, its IsCommandEnabled() should return false if given editor
is TextEditor. The reason why we need this fix is, when we make
ExecCommand() call IsCommandEnabled() and it returns true, ExecCommand()
needs to call DoCommand(). Then, it throws exception if given editor is not
an HTMLEditor but the command class is only for HTMLEditor.

This patch adds new WPT for testing whether document.execCommand() works
with <input> and <textarea>. The behavior has not been standardized, but
Chromium handles some commands even in it. So, I write the expectations from
the point of view of web developers. (Chrome fails in "cut", "copy" and
"removeformat" cases.)

Pushed by
Make IsCommandEnabled() of HTML editor command classes return false if given editor is TextEditor r=smaug
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Created web-platform-tests PR for changes under testing/web-platform/tests
Upstream PR merged
You need to log in before you can comment on or make changes to this bug.