Bug 104284 - EME v0.1: Report defaultURL in KeyMessage.
Summary: EME v0.1: Report defaultURL in KeyMessage.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Dorwin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-06 11:54 PST by David Dorwin
Modified: 2012-12-14 09:22 PST (History)
12 users (show)

See Also:


Attachments
Patch (11.10 KB, patch)
2012-12-06 12:00 PST, David Dorwin
no flags Details | Formatted Diff | Diff
Patch (12.80 KB, patch)
2012-12-07 15:51 PST, 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-12-06 11:54:19 PST
EME v0.1: Report defaultURL in KeyMessage.
Comment 1 David Dorwin 2012-12-06 12:00:05 PST
Created attachment 178051 [details]
Patch
Comment 2 WebKit Review Bot 2012-12-06 12:03:34 PST
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 Darin Fisher (:fishd, Google) 2012-12-07 00:02:31 PST
Comment on attachment 178051 [details]
Patch

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

> Source/WebCore/html/HTMLMediaElement.cpp:1883
> +    initializer.defaultURL = defaultURL; 

do you need to possibly resolve defaultURL against the document's URL?  can defaultURL be a relative URL?  if so, consider using document's completeURL method, which conveniently returns KURL.

> Source/WebKit/chromium/public/WebMediaPlayerClient.h:78
> +    virtual void keyMessage(const WebString&, const WebString&, const unsigned char*, unsigned, const WebString&) = 0;

nit: these parameters really should have names.  parameters should have names if their names wouldn't be redundant with their typename.  otherwise, it is very unclear what these parameters refer to.

> Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:254
> +void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength, const WebString& defaultURL)

URLs are usually passed as WebURL in the API and KURL internally within WebCore.
Comment 4 David Dorwin 2012-12-07 10:56:17 PST
Comment on attachment 178051 [details]
Patch

Thanks. I think we need to decide whether the spec should say that the URL should be validated, which I believe will determine the type.

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

>> Source/WebCore/html/HTMLMediaElement.cpp:1883
>> +    initializer.defaultURL = defaultURL; 
> 
> do you need to possibly resolve defaultURL against the document's URL?  can defaultURL be a relative URL?  if so, consider using document's completeURL method, which conveniently returns KURL.

This is a URL from the media data (container) [1] or the license. So, it must be absolute and is unrelated to the document. This is just a pass-through from the media to the app. In the spec, it is just a DOMString [2]. I assume that using WebURL/KURL would mean we would only pass valid URLs to the app.
The spec doesn't say anything about validating it (or even that it must be a valid URL). Maybe it should. What are your thoughts from a spec point of view? I'll post this question, but I'm interested in your thoughts.

[1] http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#dom-defaulturl
[2] http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#dom-mediakeymessageevent

>> Source/WebKit/chromium/public/WebMediaPlayerClient.h:78
>> +    virtual void keyMessage(const WebString&, const WebString&, const unsigned char*, unsigned, const WebString&) = 0;
> 
> nit: these parameters really should have names.  parameters should have names if their names wouldn't be redundant with their typename.  otherwise, it is very unclear what these parameters refer to.

Will fix.

>> Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:254
>> +void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength, const WebString& defaultURL)
> 
> URLs are usually passed as WebURL in the API and KURL internally within WebCore.

See discussion above. Will change here if we decide to use KURL.
Comment 5 Darin Fisher (:fishd, Google) 2012-12-07 14:11:38 PST
(In reply to comment #4)
> (From update of attachment 178051 [details])
> Thanks. I think we need to decide whether the spec should say that the URL should be validated, which I believe will determine the type.
> 
> View in context: https://bugs.webkit.org/attachment.cgi?id=178051&action=review
> 
> >> Source/WebCore/html/HTMLMediaElement.cpp:1883
> >> +    initializer.defaultURL = defaultURL; 
> > 
> > do you need to possibly resolve defaultURL against the document's URL?  can defaultURL be a relative URL?  if so, consider using document's completeURL method, which conveniently returns KURL.
> 
> This is a URL from the media data (container) [1] or the license. So, it must be absolute and is unrelated to the document. This is just a pass-through from the media to the app. In the spec, it is just a DOMString [2]. I assume that using WebURL/KURL would mean we would only pass valid URLs to the app.
> The spec doesn't say anything about validating it (or even that it must be a valid URL). Maybe it should. What are your thoughts from a spec point of view? I'll post this question, but I'm interested in your thoughts.

My thoughts are simple:  It should only be called an URL if it is an URL.  If it is an URL, then it is subject to URL canonicalization, etc.  It should be represented using KURL / WebURL / GURL, etc.

If it is just an opaque string, then it needs a different name.
Comment 6 David Dorwin 2012-12-07 15:51:20 PST
Created attachment 178296 [details]
Patch
Comment 7 David Dorwin 2012-12-07 15:53:20 PST
Comment on attachment 178051 [details]
Patch

I confirmed that this works and only valid URLs get passed from Chromium, which uses GURL to convert the string.

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

>>>> Source/WebCore/html/HTMLMediaElement.cpp:1883
>>>> +    initializer.defaultURL = defaultURL; 
>>> 
>>> do you need to possibly resolve defaultURL against the document's URL?  can defaultURL be a relative URL?  if so, consider using document's completeURL method, which conveniently returns KURL.
>> 
>> This is a URL from the media data (container) [1] or the license. So, it must be absolute and is unrelated to the document. This is just a pass-through from the media to the app. In the spec, it is just a DOMString [2]. I assume that using WebURL/KURL would mean we would only pass valid URLs to the app.
>> The spec doesn't say anything about validating it (or even that it must be a valid URL). Maybe it should. What are your thoughts from a spec point of view? I'll post this question, but I'm interested in your thoughts.
>> 
>> [1] http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#dom-defaulturl
>> [2] http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#dom-mediakeymessageevent
> 
> My thoughts are simple:  It should only be called an URL if it is an URL.  If it is an URL, then it is subject to URL canonicalization, etc.  It should be represented using KURL / WebURL / GURL, etc.
> 
> If it is just an opaque string, then it needs a different name.

Done.

>>> Source/WebKit/chromium/public/WebMediaPlayerClient.h:78
>>> +    virtual void keyMessage(const WebString&, const WebString&, const unsigned char*, unsigned, const WebString&) = 0;
>> 
>> nit: these parameters really should have names.  parameters should have names if their names wouldn't be redundant with their typename.  otherwise, it is very unclear what these parameters refer to.
> 
> Will fix.

Done.

>>> Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp:254
>>> +void WebMediaPlayerClientImpl::keyMessage(const WebString& keySystem, const WebString& sessionId, const unsigned char* message, unsigned messageLength, const WebString& defaultURL)
>> 
>> URLs are usually passed as WebURL in the API and KURL internally within WebCore.
> 
> See discussion above. Will change here if we decide to use KURL.

Done.
Comment 8 WebKit Review Bot 2012-12-14 00:26:03 PST
Comment on attachment 178296 [details]
Patch

Clearing flags on attachment: 178296

Committed r137724: <http://trac.webkit.org/changeset/137724>
Comment 9 WebKit Review Bot 2012-12-14 00:26:07 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Jer Noble 2012-12-14 09:18:33 PST
This patch caused numerous build errors in one of our internal mac build bots.  In the future, please avoid adding unused parameter names to empty functions without an accompanying UNUSED_PARAM() macro.
Comment 11 Jer Noble 2012-12-14 09:21:01 PST
For reference, here are the build errors which were seen after r137724:

OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:189:66: error: unused parameter 'keySystem' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:189:91: error: unused parameter 'sessionId' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:190:66: error: unused parameter 'keySystem' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:190:91: error: unused parameter 'sessionId' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:190:136: error: unused parameter 'systemCode' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:191:68: error: unused parameter 'keySystem' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:191:93: error: unused parameter 'sessionId' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:191:125: error: unused parameter 'message' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:191:143: error: unused parameter 'messageLength' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:191:170: error: unused parameter 'defaultURL' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:192:67: error: unused parameter 'keySystem' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:192:92: error: unused parameter 'sessionId' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:192:124: error: unused parameter 'initData' [-Werror,-Wunused-parameter]
OpenSource/Source/WebCore/platform/graphics/MediaPlayer.h:192:143: error: unused parameter 'initDataLength' [-Werror,-Wunused-parameter]

We'll fix these in an upcoming changeset.
Comment 12 Jessie Berlin 2012-12-14 09:22:34 PST
Fixed the unused parameters issue and not modifying MediaPlayerPrivateAVFoundationObjC.mm's use of keyMessage in http://trac.webkit.org/changeset/137750