Bug 704423 mousemove event should be cancelable r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 24 Apr 2014 23:19:54 +0900
changeset 198475 36f02c47f4be7a98953649d4cc051bc4a578c42b
parent 198474 570a6e27b76ee5b9fc689ba1b53a1de522e952a9
child 198476 5fa1fb55300723c08e5106e2d39871a330650949
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs704423
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 704423 mousemove event should be cancelable r=smaug
dom/events/test/mochitest.ini
dom/events/test/test_bug704423.html
widget/MouseEvents.h
--- a/dom/events/test/mochitest.ini
+++ b/dom/events/test/mochitest.ini
@@ -109,16 +109,17 @@ skip-if = toolkit == 'android' #CRASH_DU
 [test_bug667612.html]
 skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
 [test_bug667919-1.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #CRASH_DUMP, RANDOM # b2g(bug 900969, 5 tests) b2g-debug(bug 900969, 5 tests) b2g-desktop(bug 900969, 5 tests)
 [test_bug689564.html]
 skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
 [test_bug698929.html]
 skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
+[test_bug704423.html]
 [test_bug741666.html]
 skip-if = toolkit == 'android'
 [test_bug742376.html]
 [test_bug812744.html]
 [test_bug855741.html]
 [test_bug864040.html]
 skip-if = buildapp == 'b2g' # b2g(failing when the test gets moved around, and on debug) b2g-debug(failing when the test gets moved around, and on debug) b2g-desktop(failing when the test gets moved around, and on debug)
 [test_bug930374-content.html]
new file mode 100644
--- /dev/null
+++ b/dom/events/test/test_bug704423.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=704423
+-->
+<head>
+  <title>Test for Bug 704423</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.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=704423">Mozilla Bug 704423</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 704423 **/
+
+function doTest()
+{
+  function handler(aEvent) {
+    aEvent.preventDefault();
+    ok(aEvent.defaultPrevented,
+       "mousemove event should be cancelable");
+  }
+  window.addEventListener("mousemove", handler, true);
+  synthesizeMouseAtCenter(document.body, { type: "mousemove" });
+  window.removeEventListener("mousemove", handler, true);
+
+  SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(doTest);
+
+</script>
+</pre>
+</body>
+</html>
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -183,19 +183,16 @@ protected:
 
   WidgetMouseEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
                    nsEventStructType aStructType, reasonType aReason) :
     WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aStructType),
     acceptActivation(false), ignoreRootScrollFrame(false),
     reason(aReason), context(eNormal), exit(eChild), clickCount(0)
   {
     switch (aMessage) {
-      case NS_MOUSE_MOVE:
-        mFlags.mCancelable = false;
-        break;
       case NS_MOUSEENTER:
       case NS_MOUSELEAVE:
         mFlags.mBubbles = false;
         mFlags.mCancelable = false;
         break;
       default:
         break;
     }
@@ -206,19 +203,16 @@ public:
 
   WidgetMouseEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
                    reasonType aReason, contextType aContext = eNormal) :
     WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, NS_MOUSE_EVENT),
     acceptActivation(false), ignoreRootScrollFrame(false),
     reason(aReason), context(aContext), exit(eChild), clickCount(0)
   {
     switch (aMessage) {
-      case NS_MOUSE_MOVE:
-        mFlags.mCancelable = false;
-        break;
       case NS_MOUSEENTER:
       case NS_MOUSELEAVE:
         mFlags.mBubbles = false;
         mFlags.mCancelable = false;
         break;
       case NS_CONTEXTMENU:
         button = (context == eNormal) ? eRightButton : eLeftButton;
         break;