Bug 139400

Summary: [iOS] YouTube plug-in replacement should support partial urls
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Proposed patch.
ap: review-
Updated patch. none

Description Eric Carlson 2014-12-08 08:41:10 PST
Some sites use urls that begin with just "//" for YouTube iFrames, so the YouTube plug-in replacement should support them.
Comment 1 Eric Carlson 2014-12-08 08:57:31 PST
Created attachment 242816 [details]
Proposed patch.
Comment 2 Alexey Proskuryakov 2014-12-08 09:24:44 PST
Comment on attachment 242816 [details]
Proposed patch.

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

> Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp:289
> +    if (srcString.startsWith("//"))
> +        srcURL = URL(URL(), "http:" + srcString);
> +    else
> +        srcURL = URL(URL(), srcString);

This does not look right, because for https pages, it should almost certainly use https, too.

I'm only guessing about what and Flash/YouTube do, my instinct is that we should use Document::completeURL to handle any relative URLs, not just those without a scheme.
Comment 3 Eric Carlson 2014-12-08 13:44:20 PST
(In reply to comment #2)
> Comment on attachment 242816 [details]
> Proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=242816&action=review
> 
> > Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp:289
> > +    if (srcString.startsWith("//"))
> > +        srcURL = URL(URL(), "http:" + srcString);
> > +    else
> > +        srcURL = URL(URL(), srcString);
> 
> This does not look right, because for https pages, it should almost
> certainly use https, too.
> 
> I'm only guessing about what and Flash/YouTube do, my instinct is that we
> should use Document::completeURL to handle any relative URLs, not just those
> without a scheme.

This is an excellent suggestion, thanks!
Comment 4 Eric Carlson 2014-12-08 13:45:11 PST
Created attachment 242845 [details]
Updated patch.
Comment 5 WebKit Commit Bot 2014-12-08 14:55:31 PST
Comment on attachment 242845 [details]
Updated patch.

Clearing flags on attachment: 242845

Committed r176977: <http://trac.webkit.org/changeset/176977>
Comment 6 WebKit Commit Bot 2014-12-08 14:55:34 PST
All reviewed patches have been landed.  Closing bug.