Bug 135286 - highlight-insert-paragraph regression test mixing KeyEvent and KeyboardEvent
Summary: highlight-insert-paragraph regression test mixing KeyEvent and KeyboardEvent
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Linux
: P2 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-25 03:28 PDT by Fabien Vallée
Modified: 2014-07-29 00:36 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabien Vallée 2014-07-25 03:28:05 PDT
LayoutTests/editing/style/highlight-insert-paragraph.html is mixing 

- KeyEvent (e.g. defined in CEHTML, but seems firefox is using it too) 
and
- KeyboardEvent ( http://www.w3.org/TR/DOM-Level-3-Events/#widl-KeyboardEvent-shiftKey )

in pressKey function

if (window.KeyEvent) {
    var ev = document.createEvent("KeyboardEvent");
    ev.initKeyEvent("keypress", true, true, window,  0,0,0,0, 0, key.charCodeAt(0));
    document.body.dispatchEvent(ev);
}

I assume the test mean to use Keyboard event, so the code should be something like :

function pressKey( key ) {
-    if (window.KeyEvent) {
+    if (window.KeyboardEvent) {
         var ev = document.createEvent("KeyboardEvent");
-        ev.initKeyEvent("keypress", true, true, window,  0,0,0,0, 0, key.charCodeAt(0));
+        ev.initKeyboardEvent("keypress", true, true, window,  0,0,0,0, 0, key.charCodeAt(0));
         document.body.dispatchEvent(ev);
}
Comment 1 Fabien Vallée 2014-07-25 03:52:33 PDT
please note that window.KeyEvent is not defined, so the test is never using this code... Maybe it can just be removed.
Comment 2 Fabien Vallée 2014-07-25 03:56:52 PDT
Same issue can also be found in :

LayoutTests/editing/inserting/insert-paragraph-separator-in-blockquote.html   
LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html
LayoutTests/editing/execCommand/script-tests/break-out-of-empty-list-item.js