Bug 502818 - Property access on DOMMouseScroll events does not propagate to Event.prototype, r+sr=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 20 Aug 2009 13:13:06 +0300
changeset 31681 d4e5fa9e2e914cd8221f5a146afadf70cd6b213e
parent 31680 9f8181d17a140deae97c34e9d85870c68b1771db
child 31682 873809032158d19f0189fea2f3b6a129141ee82a
push id8665
push useropettay@mozilla.com
push dateThu, 20 Aug 2009 10:47:05 +0000
treeherdermozilla-central@d4e5fa9e2e91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs502818
milestone1.9.3a1pre
Bug 502818 - Property access on DOMMouseScroll events does not propagate to Event.prototype, r+sr=jst
content/events/test/Makefile.in
content/events/test/test_bug502818.html
dom/interfaces/events/nsIDOMMouseScrollEvent.idl
--- a/content/events/test/Makefile.in
+++ b/content/events/test/Makefile.in
@@ -71,16 +71,17 @@ include $(topsrcdir)/config/rules.mk
 		test_bug456273.html \
 		test_bug457672.html \
 		test_bug428988.html \
 		bug457672.html \
 		test_draggableprop.html \
 		test_dragstart.html \
 		test_bug489671.html \
 		test_bug493251.html \
+		test_bug502818.html \
 		$(NULL)
 
 _CHROME_FILES = \
 		test_bug415498.xul \
 		bug415498-doc1.html \
 		bug415498-doc2.html \
 		$(NULL)
 
new file mode 100644
--- /dev/null
+++ b/content/events/test/test_bug502818.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=502818
+-->
+<head>
+  <title>Test for Bug 502818</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=502818">Mozilla Bug 502818</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 502818 **/
+
+  var count = 0;
+
+  function listener(evt) {
+    ++count;
+    is(evt.foo, 'bar', "Event.prototype should be accessible from " + evt.type);
+  }
+
+  Event.prototype.foo = 'bar';
+  window.addEventListener('DOMMouseScroll', listener, false);
+  window.addEventListener('MozMousePixelScroll', listener, false);
+  window.addEventListener('foobar', listener, false);
+
+  var e = document.createEvent("mousescrollevents");
+  e.initMouseScrollEvent("DOMMouseScroll", true, true, window,
+                         0, 0, 0, 0, 0, false, false, false, false,
+                         0, null, 1);
+  window.dispatchEvent(e);
+
+  e.initMouseScrollEvent("MozMousePixelScroll", true, true, window,
+                         0, 0, 0, 0, 0, false, false, false, false,
+                         0, null, 1);
+  window.dispatchEvent(e);
+
+  e.initMouseScrollEvent("foobar", true, true, window,
+                         0, 0, 0, 0, 0, false, false, false, false,
+                         0, null, 1);
+  window.dispatchEvent(e);
+
+  is(count, 3, "Wrong number tests run!");
+</script>
+</pre>
+</body>
+</html>
--- a/dom/interfaces/events/nsIDOMMouseScrollEvent.idl
+++ b/dom/interfaces/events/nsIDOMMouseScrollEvent.idl
@@ -31,20 +31,20 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "domstubs.idl"
+#include "nsIDOMMouseEvent.idl"
 
-[scriptable, uuid(f172af88-48c3-4989-b814-60449823fc7d)]
-interface nsIDOMMouseScrollEvent : nsISupports
+[scriptable, uuid(ba8d1a7e-b475-4542-8d32-01e7ea7b8091)]
+interface nsIDOMMouseScrollEvent : nsIDOMMouseEvent
 {
   const long HORIZONTAL_AXIS = 1;
   const long VERTICAL_AXIS = 2;
 
   readonly attribute long axis;
 
   void                initMouseScrollEvent(in DOMString typeArg,
                                            in boolean canBubbleArg,