Skip to content

Commit

Permalink
2011-05-24 Philippe Normand <pnormand@igalia.com>
Browse files Browse the repository at this point in the history
        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 b25266c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 12 additions & 0 deletions Source/WebCore/ChangeLog
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/bindings/js/JSAudioContextCustom.cpp
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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())));
}
Expand Down

0 comments on commit b25266c

Please sign in to comment.