Bug 486502 - Dispatch test events only when running mochitest/chrome/browser-chrome, r+sr=roc
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 06 May 2009 07:30:39 +0300
changeset 28026 2da8cfc80e2aae6afc7b9e8ac40070bb42fedb25
parent 28025 71d2d6ae64f5559101640b61334e7e21b8ade5ed
child 28027 d64c39dcc52de418dc031291a56e9f7159c5aabb
push id6846
push useropettay@mozilla.com
push dateWed, 06 May 2009 04:31:48 +0000
treeherdermozilla-central@2da8cfc80e2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs486502
milestone1.9.2a1pre
Bug 486502 - Dispatch test events only when running mochitest/chrome/browser-chrome, r+sr=roc
build/automation.py.in
content/events/src/nsEventStateManager.cpp
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -241,16 +241,17 @@ user_pref("shell.checkDefaultClient", fa
 user_pref("browser.warnOnQuit", false);
 user_pref("accessibility.typeaheadfind.autostart", false);
 user_pref("javascript.options.showInConsole", true);
 user_pref("layout.debug.enable_data_xbl", true);
 user_pref("browser.EULA.override", true);
 user_pref("javascript.options.jit.content", true);
 user_pref("gfx.color_management.force_srgb", true);
 user_pref("network.manage-offline-status", false);
+user_pref("test.mousescroll", true);
 user_pref("security.default_personal_cert", "Select Automatically"); // Need to client auth test be w/o any dialogs
 user_pref("network.http.prompt-temp-redirect", false);
 user_pref("svg.smil.enabled", true); // Needed for SMIL mochitests until bug 482402 lands
 user_pref("media.cache_size", 100);
 user_pref("security.warn_viewing_mixed", false);
 
 user_pref("camino.warn_when_closing", false); // Camino-only, harmless to others
 """
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -604,22 +604,25 @@ nsMouseWheelTransaction::Shutdown()
 {
   NS_IF_RELEASE(sTimer);
 }
 
 void
 nsMouseWheelTransaction::OnFailToScrollTarget()
 {
   NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
-  // This event is used for automated tests, see bug 442774.
-  nsContentUtils::DispatchTrustedEvent(
-                    sTargetFrame->GetContent()->GetOwnerDoc(),
-                    sTargetFrame->GetContent(),
-                    NS_LITERAL_STRING("MozMouseScrollFailed"),
-                    PR_TRUE, PR_TRUE);
+
+  if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
+    // This event is used for automated tests, see bug 442774.
+    nsContentUtils::DispatchTrustedEvent(
+                      sTargetFrame->GetContent()->GetOwnerDoc(),
+                      sTargetFrame->GetContent(),
+                      NS_LITERAL_STRING("MozMouseScrollFailed"),
+                      PR_TRUE, PR_TRUE);
+  }
   // The target frame might be destroyed in the event handler, at that time,
   // we need to finish the current transaction
   if (!sTargetFrame)
     EndTransaction();
 }
 
 void
 nsMouseWheelTransaction::OnTimeout(nsITimer* aTimer, void* aClosure)
@@ -629,22 +632,25 @@ nsMouseWheelTransaction::OnTimeout(nsITi
     EndTransaction();
     return;
   }
   // Store the sTargetFrame, the variable becomes null in EndTransaction.
   nsIFrame* frame = sTargetFrame;
   // We need to finish current transaction before DOM event firing. Because
   // the next DOM event might create strange situation for us.
   EndTransaction();
-  // This event is used for automated tests, see bug 442774.
-  nsContentUtils::DispatchTrustedEvent(
-                    frame->GetContent()->GetOwnerDoc(),
-                    frame->GetContent(),
-                    NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
-                    PR_TRUE, PR_TRUE);
+
+  if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
+    // This event is used for automated tests, see bug 442774.
+    nsContentUtils::DispatchTrustedEvent(
+                      frame->GetContent()->GetOwnerDoc(),
+                      frame->GetContent(),
+                      NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
+                      PR_TRUE, PR_TRUE);
+  }
 }
 
 void
 nsMouseWheelTransaction::SetTimeout()
 {
   if (!sTimer) {
     nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
     if (!timer)