RESOLVED FIXED 81049
Allow AudioContext::create() to emit an ExceptionCode.
https://bugs.webkit.org/show_bug.cgi?id=81049
Summary Allow AudioContext::create() to emit an ExceptionCode.
Jer Noble
Reported 2012-03-13 15:49:44 PDT
Allow AudioContext::create() to emit an ExceptionCode.
Attachments
Patch (3.91 KB, patch)
2012-03-13 15:52 PDT, Jer Noble
no flags
Patch (3.60 KB, patch)
2012-03-13 15:58 PDT, Jer Noble
no flags
Patch (4.62 KB, patch)
2012-03-16 00:27 PDT, Jer Noble
no flags
Patch (4.61 KB, patch)
2012-03-16 09:50 PDT, Jer Noble
haraken: review+
Jer Noble
Comment 1 2012-03-13 15:52:24 PDT
Jer Noble
Comment 2 2012-03-13 15:58:05 PDT
Created attachment 131739 [details] Patch Remove extraneous includes.
WebKit Review Bot
Comment 3 2012-03-13 18:31:49 PDT
Comment on attachment 131739 [details] Patch Attachment 131739 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11944937
Chris Rogers
Comment 4 2012-03-14 12:19:59 PDT
looks like cr-linux breakage
Jer Noble
Comment 5 2012-03-14 12:59:15 PDT
(In reply to comment #4) > looks like cr-linux breakage Yep. I'll need to edit the V8 custom AudioContext code.
Hajime Morrita
Comment 6 2012-03-15 23:26:55 PDT
Comment on attachment 131739 [details] Patch r- for clearing the pending review queue.
Jer Noble
Comment 7 2012-03-16 00:27:17 PDT
Hajime Morrita
Comment 8 2012-03-16 00:30:25 PDT
Comment on attachment 132219 [details] Patch Looks sane. Please ensure bots get green before landing.
Jer Noble
Comment 9 2012-03-16 00:37:13 PDT
(In reply to comment #8) > (From update of attachment 132219 [details]) > Looks sane. Please ensure bots get green before landing. Sure thing. Thanks!
Kentaro Hara
Comment 10 2012-03-16 00:37:38 PDT
Comment on attachment 132219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=132219&action=review > Source/WebCore/bindings/js/JSAudioContextCustom.cpp:75 > + return throwVMError(exec, createSyntaxError(exec, "Error creating AudioContext")); Is it really intended (i.e. speced) to throw SYNTAX_ERROR when AudioContext::create() throws exception? Auto-generated existing JSC constructors return JSValue::encode(JSValue()) in such cases.
Kentaro Hara
Comment 11 2012-03-16 00:41:40 PDT
Comment on attachment 132219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=132219&action=review > Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp:67 > + return throwError(ec); On the other hand, this behavior is aligning with auto-generated existing V8 constructors. In other words, at present, auto-generated JSC constructors return undefined when create() throws exception, and auto-generated V8 constructors return TYPE_ERROR when create() throws exception. We need to fix these behaviors according to the spec anyway (in another bug).
Hajime Morrita
Comment 12 2012-03-16 00:55:43 PDT
Comment on attachment 132219 [details] Patch https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html The spec says nothing about the constructor. By the way, If the custom-constructor is replaced by auto-generated code using optional or overload parameter, it would be ideal.
Kentaro Hara
Comment 13 2012-03-16 00:58:41 PDT
(In reply to comment #12) > By the way, If the custom-constructor is replaced by auto-generated code using optional or overload parameter, it would be ideal. Yeah, I tried it before but gave up because the constructor needs to switch ::create() and ::createOfflineContext(), which is a "special" logic to AudioContext.
Kentaro Hara
Comment 14 2012-03-16 01:06:26 PDT
(In reply to comment #11) > (From update of attachment 132219 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=132219&action=review > > > Source/WebCore/bindings/v8/custom/V8AudioContextCustom.cpp:67 > > + return throwError(ec); > > On the other hand, this behavior is aligning with auto-generated existing V8 constructors. In other words, at present, auto-generated JSC constructors return undefined when create() throws exception, and auto-generated V8 constructors return TYPE_ERROR when create() throws exception. We need to fix these behaviors according to the spec anyway (in another bug). Sorry, I posted confusing comments. Please ignore my previous comments;-) Correction: - auto-generated JSC constructors: if (ec) { setDOMException(exec, ec); return JSValue::encode(JSValue()); } - auto-generated V8 constructors: if (ec) { return throwError(ec); } The above two both throws an exception indicated by 'ec', which makes sense. So I would recommend that you align the behavior of the AudioContext constructor with those existing constructors, unless you have a reason to make it behave differently from others.
Jer Noble
Comment 15 2012-03-16 09:50:45 PDT
Created attachment 132304 [details] Patch Makes sense. Updating patch with suggestions above.
Kentaro Hara
Comment 16 2012-03-16 09:51:49 PDT
Comment on attachment 132304 [details] Patch OK. Thanks for the patch!
Jer Noble
Comment 17 2012-03-16 10:08:33 PDT
Note You need to log in before you can comment on or make changes to this bug.