diff options
Diffstat (limited to 'WebCore/bindings/js/JSAudioConstructor.cpp')
-rw-r--r-- | WebCore/bindings/js/JSAudioConstructor.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp index f0bdbe8..1231271 100644 --- a/WebCore/bindings/js/JSAudioConstructor.cpp +++ b/WebCore/bindings/js/JSAudioConstructor.cpp @@ -54,7 +54,11 @@ static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const Ar { // FIXME: Why doesn't this need the call toJS on the document like JSImageConstructor? - RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, static_cast<JSAudioConstructor*>(constructor)->document()); + Document* document = static_cast<JSAudioConstructor*>(constructor)->document(); + if (!document) + return throwError(exec, ReferenceError, "Audio constructor associated document is unavailable"); + + RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document); if (args.size() > 0) { audio->setSrc(args.at(exec, 0).toString(exec)); audio->scheduleLoad(); |