diff options
Diffstat (limited to 'WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp')
-rw-r--r-- | WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp index 06c6c1d..9b75db8 100644 --- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp @@ -14,7 +14,7 @@ * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -60,15 +60,14 @@ static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arg return throwError("Audio constructor associated document is unavailable", V8Proxy::ReferenceError); // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance - // may end up being the only node in the map and get garbage-ccollected prematurely. + // may end up being the only node in the map and get garbage-collected prematurely. toV8(document); - RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document); - audio->setAutobuffer(true); - if (args.Length() > 0) { - audio->setSrc(toWebCoreString(args[0])); - audio->scheduleLoad(); - } + + String src; + if (args.Length() > 0) + src = toWebCoreString(args[0]); + RefPtr<HTMLAudioElement> audio = HTMLAudioElement::createForJSConstructor(document, src); V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::AUDIO), audio.get()); audio->ref(); |