mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 505150. 'new Audio' constructors should set autobuffer automatically. r=doublec
--HG-- extra : rebase_source : 418f3c2ad918ae729857363041273c95230dfd2c
This commit is contained in:
parent
7f80aa5dd5
commit
93cecdc075
@ -117,8 +117,15 @@ NS_IMETHODIMP
|
||||
nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
|
||||
JSObject *aObj, PRUint32 argc, jsval *argv)
|
||||
{
|
||||
// Audio elements created using "new Audio(...)" should have
|
||||
// 'autobuffer' set (since the script must intend to play the audio)
|
||||
nsresult rv = SetAttr(kNameSpaceID_None, nsGkAtoms::autobuffer,
|
||||
NS_LITERAL_STRING("autobuffer"), PR_TRUE);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (argc <= 0) {
|
||||
// Nothing to do here if we don't get any arguments.
|
||||
// Nothing more to do here if we don't get any arguments.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ for (var i = 0; i < gAudioTests.length; ++i) {
|
||||
if (!a1.canPlayType(test.type))
|
||||
continue;
|
||||
|
||||
a1.setAttribute("autobuffer", "");
|
||||
is(a1.getAttribute("autobuffer"), "autobuffer", "Autobuffer automatically set");
|
||||
a1.addEventListener('load', function(event) {
|
||||
is(event.target.networkState, HTMLMediaElement.NETWORK_LOADED,
|
||||
"Audio " + event.target.currentSrc + " loaded");
|
||||
|
@ -20,7 +20,7 @@ for (var i = 0; i < gAudioTests.length; ++i) {
|
||||
continue;
|
||||
|
||||
var a1 = new Audio(test.name);
|
||||
a1.setAttribute("autobuffer", "");
|
||||
is(a1.getAttribute("autobuffer"), "autobuffer", "Autobuffer automatically set");
|
||||
a1.addEventListener('load', function(event) {
|
||||
is(event.target.networkState, HTMLMediaElement.NETWORK_LOADED,
|
||||
"Audio " + event.target.currentSrc + " loaded");
|
||||
|
Loading…
Reference in New Issue
Block a user