Closed Bug 1547869 Opened 7 months ago Closed 7 months ago

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

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox-esr60 --- unaffected
firefox67 --- unaffected
firefox68 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Regression)

Details

(Keywords: regression)

Attachments

(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 masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/dfce0c346eeb
Make IsCommandEnabled() of HTML editor command classes return false if given editor is TextEditor r=smaug
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16702 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.