The MediaSession constructor's "kind" argument is optional and had a default value.
<rdar://problem/22456091>
Created attachment 260058 [details] Proposed patch
Attachment 260058 [details] did not pass style-queue: ERROR: Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:30: You should not add a blank line before implementation file's own header. [build/include_order] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 260058 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=260058&action=review > Source/WebCore/Modules/mediasession/MediaSession.cpp:49 > + // 2. Set media sessionâs current media session type to the corresponding media session type of media session category. Unicode quotation mark? (By the way, this has to be the worst spec language since "boxes in boxes".) > Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:62 > + String kind; > + if (exec->argumentCount() > 0) { > + JSString* kindString = exec->argument(0).toString(exec); > + if (UNLIKELY(exec->hadException())) > + return JSValue::encode(jsUndefined()); > + kind = kindString->value(exec); > + if (kind != "content" && kind != "transient" && kind != "transient-solo" && kind != "ambient") > + return throwArgumentMustBeEnumError(*exec, 0, "kind", "MediaSession", nullptr, "\"content\", \"transient\", \"transient-solo\", \"ambient\""); > + } else > + kind = "content"; > + > + RefPtr<MediaSession> object = MediaSession::create(*context, kind); > + return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get()))); Ugh. I guess there's no way to do this in bindings?
(In reply to comment #4) > Comment on attachment 260058 [details] > Proposed patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=260058&action=review > > > Source/WebCore/Modules/mediasession/MediaSession.cpp:49 > > + // 2. Set media sessionâs current media session type to the corresponding media session type of media session category. > > Unicode quotation mark? (By the way, this has to be the worst spec language > since "boxes in boxes".) > Oops! > > Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:62 > > + String kind; > > + if (exec->argumentCount() > 0) { > > + JSString* kindString = exec->argument(0).toString(exec); > > + if (UNLIKELY(exec->hadException())) > > + return JSValue::encode(jsUndefined()); > > + kind = kindString->value(exec); > > + if (kind != "content" && kind != "transient" && kind != "transient-solo" && kind != "ambient") > > + return throwArgumentMustBeEnumError(*exec, 0, "kind", "MediaSession", nullptr, "\"content\", \"transient\", \"transient-solo\", \"ambient\""); > > + } else > > + kind = "content"; > > + > > + RefPtr<MediaSession> object = MediaSession::create(*context, kind); > > + return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get()))); > > Ugh. I guess there's no way to do this in bindings? Not for enum arguments, only "[Default=Undefined] optional" or "[Default=NullString] optional"
Created attachment 260059 [details] Patch for landing.
Attachment 260059 [details] did not pass style-queue: ERROR: Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:30: You should add a blank line after implementation file's own header. [build/include_order] [4] ERROR: Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:30: You should not add a blank line before implementation file's own header. [build/include_order] [4] Total errors found: 2 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 260061 [details] Patch for landing.
Attachment 260061 [details] did not pass style-queue: ERROR: Source/WebCore/bindings/js/JSMediaSessionCustom.cpp:30: You should not add a blank line before implementation file's own header. [build/include_order] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 260063 [details] YAPFL
Comment on attachment 260063 [details] YAPFL Clearing flags on attachment: 260063 Committed r189031: <http://trac.webkit.org/changeset/189031>