Bug 906511 - Correctly initialize .bubbles and .cancelable; r=smaug
authorAryeh Gregor <ayg@aryeh.name>
Mon, 07 Apr 2014 19:24:01 +0300
changeset 179935 0db7896686a02d030077812bf7bc4230c551561c
parent 179934 b9abacaf54532d22e4a6c726a6786e982f9420aa
child 179936 58ec5153323748263df58027db13bb4b2c83aba8
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerssmaug
bugs906511
milestone31.0a1
Bug 906511 - Correctly initialize .bubbles and .cancelable; r=smaug
content/base/src/nsDocument.cpp
dom/imptests/failures/html/dom/nodes/mochitest.ini
dom/imptests/failures/html/dom/nodes/test_Document-createEvent.html.json
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -7745,17 +7745,23 @@ nsIDocument::CreateEvent(const nsAString
     presContext = shell->GetPresContext();
   }
 
   // Create event even without presContext.
   nsCOMPtr<nsIDOMEvent> ev;
   rv = EventDispatcher::CreateEvent(const_cast<nsIDocument*>(this),
                                     presContext, nullptr, aEventType,
                                     getter_AddRefs(ev));
-  return ev ? dont_AddRef(ev.forget().take()->InternalDOMEvent()) : nullptr;
+  if (!ev) {
+    return nullptr;
+  }
+  WidgetEvent* e = ev->GetInternalNSEvent();
+  e->mFlags.mBubbles = false;
+  e->mFlags.mCancelable = false;
+  return dont_AddRef(ev.forget().take()->InternalDOMEvent());
 }
 
 void
 nsDocument::FlushPendingNotifications(mozFlushType aType)
 {
   nsDocumentOnStack dos(this);
 
   // We need to flush the sink for non-HTML documents (because the XML
--- a/dom/imptests/failures/html/dom/nodes/mochitest.ini
+++ b/dom/imptests/failures/html/dom/nodes/mochitest.ini
@@ -1,15 +1,14 @@
 # THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
 [DEFAULT]
 support-files =
 
 
 [test_Document-createElement-namespace.html.json]
 [test_Document-createElementNS.html.json]
-[test_Document-createEvent.html.json]
 [test_Document-getElementsByTagName.html.json]
 [test_Node-isEqualNode.xhtml.json]
 [test_Node-properties.html.json]
 [test_attributes.html.json]
 [test_case.html.json]
 [test_getElementsByClassName-10.xml.json]
 [test_getElementsByClassName-11.xml.json]
deleted file mode 100644
--- a/dom/imptests/failures/html/dom/nodes/test_Document-createEvent.html.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-  "createEvent('CustomEvent') should be initialized correctly.": true,
-  "createEvent('customevent') should be initialized correctly.": true,
-  "createEvent('CUSTOMEVENT') should be initialized correctly.": true,
-  "createEvent('Event') should be initialized correctly.": true,
-  "createEvent('event') should be initialized correctly.": true,
-  "createEvent('EVENT') should be initialized correctly.": true,
-  "createEvent('Events') should be initialized correctly.": true,
-  "createEvent('events') should be initialized correctly.": true,
-  "createEvent('EVENTS') should be initialized correctly.": true,
-  "createEvent('HTMLEvents') should be initialized correctly.": true,
-  "createEvent('htmlevents') should be initialized correctly.": true,
-  "createEvent('HTMLEVENTS') should be initialized correctly.": true,
-  "createEvent('MouseEvent') should be initialized correctly.": true,
-  "createEvent('mouseevent') should be initialized correctly.": true,
-  "createEvent('MOUSEEVENT') should be initialized correctly.": true,
-  "createEvent('MouseEvents') should be initialized correctly.": true,
-  "createEvent('mouseevents') should be initialized correctly.": true,
-  "createEvent('MOUSEEVENTS') should be initialized correctly.": true,
-  "createEvent('UIEvent') should be initialized correctly.": true,
-  "createEvent('uievent') should be initialized correctly.": true,
-  "createEvent('UIEVENT') should be initialized correctly.": true,
-  "createEvent('UIEvents') should be initialized correctly.": true,
-  "createEvent('uievents') should be initialized correctly.": true,
-  "createEvent('UIEVENTS') should be initialized correctly.": true
-}