Skip to content
Permalink
Browse files
2011-05-24 Philippe Normand <pnormand@igalia.com>
        Reviewed by Andres Kling.

        JSAudioContextCustom doesn't encode errors
        https://bugs.webkit.org/show_bug.cgi?id=61357

        Fix AudioContext return values

        * bindings/js/JSAudioContextCustom.cpp:
        (WebCore::JSAudioContextConstructor::constructJSAudioContext):

Canonical link: https://commits.webkit.org/76743@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@87163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
philn committed May 24, 2011
1 parent 88d25bb commit b25266ca764800e09b2cb030ae02aa85db4d3efb
Showing with 17 additions and 5 deletions.
  1. +12 −0 Source/WebCore/ChangeLog
  2. +5 −5 Source/WebCore/bindings/js/JSAudioContextCustom.cpp
@@ -1,3 +1,15 @@
2011-05-24 Philippe Normand <pnormand@igalia.com>

Reviewed by Andres Kling.

JSAudioContextCustom doesn't encode errors
https://bugs.webkit.org/show_bug.cgi?id=61357

Fix AudioContext return values

* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContextConstructor::constructJSAudioContext):

2011-05-24 Rob Buis <rbuis@rim.com>

Rubber-stamped by Dirk Schulze.
@@ -52,14 +52,14 @@ EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(
{
JSAudioContextConstructor* jsConstructor = static_cast<JSAudioContextConstructor*>(exec->callee());
if (!jsConstructor)
return throwError(exec, createReferenceError(exec, "AudioContext constructor callee is unavailable"));
return throwVMError(exec, createReferenceError(exec, "AudioContext constructor callee is unavailable"));

ScriptExecutionContext* scriptExecutionContext = jsConstructor->scriptExecutionContext();
if (!scriptExecutionContext)
return throwError(exec, createReferenceError(exec, "AudioContext constructor script execution context is unavailable"));
return throwVMError(exec, createReferenceError(exec, "AudioContext constructor script execution context is unavailable"));

if (!scriptExecutionContext->isDocument())
return throwError(exec, createReferenceError(exec, "AudioContext constructor called in a script execution context which is not a document"));
return throwVMError(exec, createReferenceError(exec, "AudioContext constructor called in a script execution context which is not a document"));

Document* document = static_cast<Document*>(scriptExecutionContext);

@@ -72,7 +72,7 @@ EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(
// Constructor for offline (render-target) AudioContext which renders into an AudioBuffer.
// new AudioContext(in unsigned long numberOfChannels, in unsigned long numberOfFrames, in float sampleRate);
if (exec->argumentCount() < 3)
return throwError(exec, createSyntaxError(exec, "Not enough arguments"));
return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));

unsigned numberOfChannels = exec->argument(0).toInt32(exec);
unsigned numberOfFrames = exec->argument(1).toInt32(exec);
@@ -82,7 +82,7 @@ EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(
}

if (!audioContext.get())
return throwError(exec, createReferenceError(exec, "Error creating AudioContext"));
return throwVMError(exec, createReferenceError(exec, "Error creating AudioContext"));

return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), audioContext.get())));
}

0 comments on commit b25266c

Please sign in to comment.