Bug 135286

Summary: highlight-insert-paragraph regression test mixing KeyEvent and KeyboardEvent
Product: WebKit Reporter: Fabien Vallée <fvallee>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Minor CC: rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Linux   

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