Bug 467680 - volumechange events are fired synchronously. r=doublec, sr=roc
authorJustin Dolske <dolske@mozilla.com>
Sat, 07 Feb 2009 13:43:43 -0800
changeset 24750 084c7bed387b9e8dc6a0a18d4f7ce8577b27869b
parent 24749 fa40e7c882fd60c1dc15d4a0b79641ef8da516d4
child 24751 dc047fe66164af90aae1833fc0f92eb4ed55fbcf
push idunknown
push userunknown
push dateunknown
reviewersdoublec, roc
bugs467680
milestone1.9.2a1pre
Bug 467680 - volumechange events are fired synchronously. r=doublec, sr=roc
content/html/content/src/nsHTMLMediaElement.cpp
toolkit/content/tests/widgets/test_videocontrols.html
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -455,17 +455,17 @@ NS_IMETHODIMP nsHTMLMediaElement::SetVol
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
   if (mMuted) 
     mMutedVolume = aVolume;
   else {
     if (mDecoder)
       mDecoder->SetVolume(aVolume);
 
-    DispatchSimpleEvent(NS_LITERAL_STRING("volumechange"));
+    DispatchAsyncSimpleEvent(NS_LITERAL_STRING("volumechange"));
   }
   return NS_OK;
 }
 
 /* attribute boolean muted; */
 NS_IMETHODIMP nsHTMLMediaElement::GetMuted(PRBool *aMuted)
 {
   *aMuted = mMuted;
@@ -485,17 +485,17 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMut
       mMutedVolume = mDecoder->GetVolume();
       mDecoder->SetVolume(0.0);
     }
   }
 
   mMuted = aMuted;
 
   if (oldMuted != mMuted) 
-    DispatchSimpleEvent(NS_LITERAL_STRING("volumechange"));
+    DispatchAsyncSimpleEvent(NS_LITERAL_STRING("volumechange"));
   return NS_OK;
 }
 
 nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
   : nsGenericHTMLElement(aNodeInfo),
     mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),
     mReadyState(nsIDOMHTMLMediaElement::HAVE_NOTHING),
     mMutedVolume(0.0),
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -41,28 +41,26 @@ function runTest(event) {
       break;
 
     case 3:
       is(event.type, "pause", "checking event type");
       is(video.paused, true,  "checking video play state");
       is(video.muted, false,  "checking video mute state");
 
       // Click the mute button
-      // XXX volume event is sent synchronously, so do this in a timeout
-      setTimeout("synthesizeMouse(video, 308, 228, { });", 0);
+      synthesizeMouse(video, 308, 228, { });
       break;
 
     case 4:
       is(event.type, "volumechange", "checking event type");
       is(video.paused, true,  "checking video play state");
       is(video.muted,  true,  "checking video mute state");
 
       // Click the unmute button
-      // XXX volume event is sent synchronously, so do this in a timeout
-      setTimeout("synthesizeMouse(video, 308, 228, { });", 0);
+      synthesizeMouse(video, 308, 228, { });
       break;
 
     case 5:
       is(event.type, "volumechange", "checking event type");
       is(video.paused, true,  "checking video play state");
       is(video.muted,  false, "checking video mute state");
 
       // Bug 470596: Make sure that having CSS border or padding doesn't
@@ -77,18 +75,17 @@ function runTest(event) {
       break;
 
     case 6:
       is(event.type, "play",  "checking event type");
       is(video.paused, false, "checking video play state");
       is(video.muted, false,  "checking video mute state");
 
       // Click the mute button
-      // XXX volume event is sent synchronously, so do this in a timeout
-      setTimeout("synthesizeMouse(video, 100 + 308, 40 + 228, { });", 0);
+      synthesizeMouse(video, 100 + 308, 40 + 228, { });
       break;
 
     case 7:
       is(event.type, "volumechange", "checking event type");
       is(video.paused, false,  "checking video play state");
       is(video.muted,  true,  "checking video mute state");
 
       SimpleTest.finish();