Bug 656386 - nsUIEvent should generate nsDOMUIEvent, r=sicking
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 19 May 2011 16:40:52 +0300
changeset 69718 da3354021410b2dd04c371d5c4221f6db1528378
parent 69717 ed5162a1a8f2e92a4c2affc0214815a78fad2668
child 69719 4c2d31acc0203e40444603b1ea93e5885a2127ca
push idunknown
push userunknown
push dateunknown
reviewerssicking
bugs656386
milestone6.0a1
Bug 656386 - nsUIEvent should generate nsDOMUIEvent, r=sicking
content/events/src/nsEventDispatcher.cpp
content/html/content/test/test_bug500885.html
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -728,16 +728,17 @@ nsEventDispatcher::CreateEvent(nsPresCon
   if (aEvent) {
     switch(aEvent->eventStructType) {
     case NS_MUTATION_EVENT:
       return NS_NewDOMMutationEvent(aDOMEvent, aPresContext,
                                     static_cast<nsMutationEvent*>(aEvent));
     case NS_GUI_EVENT:
     case NS_COMPOSITION_EVENT:
     case NS_SCROLLPORT_EVENT:
+    case NS_UI_EVENT:
       return NS_NewDOMUIEvent(aDOMEvent, aPresContext,
                               static_cast<nsGUIEvent*>(aEvent));
     case NS_SCROLLAREA_EVENT:
       return NS_NewDOMScrollAreaEvent(aDOMEvent, aPresContext,
                                       static_cast<nsScrollAreaEvent *>(aEvent));
     case NS_KEY_EVENT:
       return NS_NewDOMKeyboardEvent(aDOMEvent, aPresContext,
                                     static_cast<nsKeyEvent*>(aEvent));
--- a/content/html/content/test/test_bug500885.html
+++ b/content/html/content/test/test_bug500885.html
@@ -54,17 +54,19 @@ function test() {
                   
 
   mockFilePickerRegisterer.register();
   try {
     var domActivateEvents;
     var fileInput = document.getElementById("file");
     var rect = fileInput.getBoundingClientRect();
 
-    fileInput.addEventListener ("DOMActivate", function () {
+    fileInput.addEventListener ("DOMActivate", function (e) {
+      ok("detail" in e, "DOMActivate should have .detail!");
+      is(e.detail, 1, "detail should be 1!");
       domActivateEvents++;
     }, false);
 
     domActivateEvents = 0;
     wu.sendMouseEvent("mousedown", rect.left + 5, rect.top + 5, 0, 1, 0);
     wu.sendMouseEvent("mouseup", rect.left + 5, rect.top + 5, 0, 1, 0);
     is(domActivateEvents, 1, "click on text field should only fire 1 DOMActivate event");