Bug 633058 - Satchel should not stop events propagations. r=dolske
authorMounir Lamouri <mounir.lamouri@gmail.com>
Fri, 25 Mar 2011 12:30:36 +0100
changeset 63875 f01a7a6670dbde9e1048cf2486817e27a01b8e4e
parent 63874 48a752f312fc03b6f135b07cafcd06845ace6266
child 63876 9f5a4c820913992bfc9fa07c1a9d29429ac05d0f
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs633058
milestone2.2a1pre
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 633058 - Satchel should not stop events propagations. r=dolske
content/html/content/test/Makefile.in
content/html/content/test/test_bug633058.html
toolkit/components/satchel/nsFormFillController.cpp
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -252,12 +252,13 @@ include $(topsrcdir)/config/rules.mk
 		test_bug618948.html \
 		test_bug623291.html \
 		test_bug619278.html \
 		test_bug622558.html \
 		test_bug622597.html \
 		test_bug636336.html \
 		test_bug630889.html \
 		test_bug610212.html \
+		test_bug633058.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/test_bug633058.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=633058
+-->
+<head>
+  <title>Test for Bug 633058</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <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=633058">Mozilla Bug 633058</a>
+<p id="display"></p>
+<div id="content">
+  <input>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 633058 **/
+
+SimpleTest.waitForExplicitFinish();
+
+SimpleTest.waitForFocus(function() {
+  var nbExpectedKeyPress = 8;
+  var inputGotKeyPress = 0;
+  var divGotKeyPress = 0;
+
+  var input = document.getElementsByTagName('input')[0];
+  var content = document.getElementById('content');
+
+  content.addEventListener('keypress', function() {
+    divGotKeyPress++;
+
+    if (divGotKeyPress == nbExpectedKeyPress) {
+      is(inputGotKeyPress, nbExpectedKeyPress, "input got all keypress events");
+      is(divGotKeyPress, nbExpectedKeyPress, "div got all keypress events");
+      SimpleTest.finish();
+    }
+  }, false);
+
+  input.addEventListener('keypress', function() {
+    inputGotKeyPress++;
+  }, false);
+
+  input.addEventListener('focus', function() {
+    input.removeEventListener('focus', arguments.callee, false);
+
+    synthesizeKey('VK_UP', {});
+    synthesizeKey('VK_LEFT', {});
+    synthesizeKey('VK_RIGHT', {});
+    synthesizeKey('VK_DOWN', {});
+    synthesizeKey('VK_BACK_SPACE', {});
+    synthesizeKey('VK_DELETE', {});
+    synthesizeKey('VK_ESCAPE', {});
+    synthesizeKey('VK_RETURN', {});
+  }, false);
+  input.focus();
+});
+
+</script>
+</pre>
+</body>
+</html>
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -895,17 +895,16 @@ nsFormFillController::KeyPress(nsIDOMEve
     cancel = PR_FALSE;
     break;
   case nsIDOMKeyEvent::DOM_VK_RETURN:
     mController->HandleEnter(PR_FALSE, &cancel);
     break;
   }
   
   if (cancel) {
-    aEvent->StopPropagation();
     aEvent->PreventDefault();
   }
   
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIDOMCompositionListener