Bug 82971 - Add Encrypted Media Extensions methods to HTMLMediaElement
Summary: Add Encrypted Media Extensions methods to HTMLMediaElement
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Dorwin
URL:
Keywords:
Depends on:
Blocks: 82968
  Show dependency treegraph
 
Reported: 2012-04-02 16:37 PDT by David Dorwin
Modified: 2012-04-10 10:48 PDT (History)
10 users (show)

See Also:


Attachments
Patch (47.83 KB, patch)
2012-04-03 10:26 PDT, David Dorwin
no flags Details | Formatted Diff | Diff
Patch (44.69 KB, patch)
2012-04-09 15:38 PDT, David Dorwin
no flags Details | Formatted Diff | Diff
Patch (44.68 KB, patch)
2012-04-09 16:40 PDT, David Dorwin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Dorwin 2012-04-02 16:37:03 PDT
Add the new methods as defined in http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#extensions.
Comment 1 David Dorwin 2012-04-03 10:26:23 PDT
Created attachment 135355 [details]
Patch
Comment 2 WebKit Review Bot 2012-04-03 10:31:54 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Adam Barth 2012-04-03 15:25:49 PDT
David, would you be willing to send an email to webkit-dev announcing this new feature?

http://www.webkit.org/coding/adding-features.html

Thanks.
Comment 4 David Dorwin 2012-04-03 15:48:23 PDT
@abarth: Workiing on it. Thanks.
Comment 5 Adam Barth 2012-04-09 10:27:29 PDT
Comment on attachment 135355 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135355&action=review

This patch looks pretty good.  A few minor comments below.

> Source/WebCore/ChangeLog:10
> +        Add Encrypted Media Extensions methods to HTMLMediaElement
> +        https://bugs.webkit.org/show_bug.cgi?id=82971
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Tests: media/encrypted-media/encrypted-media-not-loaded.html
> +               media/encrypted-media/encrypted-media-syntax.html
> +

Please add some more information to the ChangeLog.  For example, you might mention the ENABLE(ENCRYPTED_MEDIA) macro and reference the spec that you're implementing.

> Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h:210
> +    static bool webkitEncryptedMediaEnabled() { return isEncryptedMediaEnabled; }
> +    static void setWebkitEncryptedMediaEnabled(bool isEnabled) { isEncryptedMediaEnabled = isEnabled; }

We can drop the "webkit" prefix here.  (I know other features use the "webkit" prefix, but they shouldn't.)

> Source/WebCore/html/HTMLMediaElement.cpp:2241
> +ExceptionCode exceptionCodeForMediaKeyException(MediaPlayer::MediaKeyException exception)

Please mark this function as "static" so that it has internal linkage.  Also, we tend to put functions like this near the top of the file.

> Source/WebCore/html/HTMLMediaElement.cpp:2252
> +    default:
> +        ASSERT_NOT_REACHED();
> +        return INVALID_STATE_ERR;

WebKit tends to leave off the "default" case so that the compiler complains if we forget an enum value.

> Source/WebCore/html/HTMLMediaElement.cpp:2270
> +    if (initData.get()) {

There's no need to call ".get()" here.  There's an implicit conversion to bool.

> Source/WebCore/html/HTMLMediaElement.cpp:2303
> +    if (initData.get()) {

ditto

> Source/WebCore/html/HTMLMediaElement.cpp:2387
> -    
> +

Generally, we don't like to trim trailing whitespace on unrelated lines because it messes up "svn blame".  Would you be willing to remove these parts of the patch?

> Source/WebCore/html/HTMLMediaElement.idl:130
> +

This change seems unrelated.

> LayoutTests/platform/mac/Skipped:480
> +fast/events/constructors/media-key-event-constructor.html

I don't see this test in this patch...  Maybe it's in a later patch?
Comment 6 David Dorwin 2012-04-09 15:38:39 PDT
Created attachment 136320 [details]
Patch
Comment 7 David Dorwin 2012-04-09 15:41:40 PDT
Comment on attachment 135355 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135355&action=review

>> Source/WebCore/ChangeLog:10
>> +
> 
> Please add some more information to the ChangeLog.  For example, you might mention the ENABLE(ENCRYPTED_MEDIA) macro and reference the spec that you're implementing.

Added that information.

>> Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h:210
>> +    static void setWebkitEncryptedMediaEnabled(bool isEnabled) { isEncryptedMediaEnabled = isEnabled; }
> 
> We can drop the "webkit" prefix here.  (I know other features use the "webkit" prefix, but they shouldn't.)

Done

>> Source/WebCore/html/HTMLMediaElement.cpp:2241
>> +ExceptionCode exceptionCodeForMediaKeyException(MediaPlayer::MediaKeyException exception)
> 
> Please mark this function as "static" so that it has internal linkage.  Also, we tend to put functions like this near the top of the file.

Done

>> Source/WebCore/html/HTMLMediaElement.cpp:2252
>> +        return INVALID_STATE_ERR;
> 
> WebKit tends to leave off the "default" case so that the compiler complains if we forget an enum value.

Done

>> Source/WebCore/html/HTMLMediaElement.cpp:2270
>> +    if (initData.get()) {
> 
> There's no need to call ".get()" here.  There's an implicit conversion to bool.

Done

>> Source/WebCore/html/HTMLMediaElement.cpp:2303
>> +    if (initData.get()) {
> 
> ditto

Done

>> Source/WebCore/html/HTMLMediaElement.cpp:2387
>> +
> 
> Generally, we don't like to trim trailing whitespace on unrelated lines because it messes up "svn blame".  Would you be willing to remove these parts of the patch?

Done.

>> Source/WebCore/html/HTMLMediaElement.idl:130
>> +
> 
> This change seems unrelated.

Done

>> LayoutTests/platform/mac/Skipped:480
>> +fast/events/constructors/media-key-event-constructor.html
> 
> I don't see this test in this patch...  Maybe it's in a later patch?

Correct. It's added in https://bugs.webkit.org/show_bug.cgi?id=82974.
I was trying to avoid editing these same 6 files again, but I can remove it if you prefer.
Comment 8 David Dorwin 2012-04-09 16:40:47 PDT
Created attachment 136338 [details]
Patch
Comment 9 Adam Barth 2012-04-09 23:25:17 PDT
Comment on attachment 136338 [details]
Patch

Thanks.
Comment 10 WebKit Review Bot 2012-04-10 10:48:07 PDT
Comment on attachment 136338 [details]
Patch

Clearing flags on attachment: 136338

Committed r113736: <http://trac.webkit.org/changeset/113736>
Comment 11 WebKit Review Bot 2012-04-10 10:48:13 PDT
All reviewed patches have been landed.  Closing bug.