<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161455] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161455">161455</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2014-01-07 14:24:37 -0800 (Tue, 07 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>HTML5 video tag Does Not Load in Apache htaccess/htpasswd Protected Directory
https://bugs.webkit.org/show_bug.cgi?id=40382

Reviewed by Eric Carlson.

Source/WebCore:

Test: http/tests/media/video-auth.html

Adopt a new AVFoundation API to handle authentication challenge generated while loading
media through an AVAsset. The authentication request comes through as a
NSURLAuthenticationChallenge, and is wrapped in a WebCore::AuthenticationChallenge
by MediaPlayerPrivateAVFoundationObjC, and is sent up to the HTMLMediaElement to handle.
The HTMLMediaElement creates a ResourceRequest, and passes the challenge up to the
ResourceLoadNotifier.

To allow the HTMLMediaElement to initiate handling an AuthenticationChallenge without
actually creating a ResourceLoader, allow ResourceLoaderDelegate to accept a unique
identifier and a DocumentLoader in lieu of a ResourceLoader.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::didReceiveAuthenticationChallenge):
(WebCore::ResourceLoadNotifier::didCancelAuthenticationChallenge):
* loader/ResourceLoadNotifier.h:
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerShouldWaitForResponseToAuthenticationChallenge):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
(-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):

LayoutTests:

* http/tests/media/resources/video-auth.php: Added.
* http/tests/media/video-auth-expected.txt: Added.
* http/tests/media/video-auth.html: Added.
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadNotifiercpp">trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoadNotifierh">trunk/Source/WebCore/loader/ResourceLoadNotifier.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayercpp">trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayerh">trunk/Source/WebCore/platform/graphics/MediaPlayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsmediaresourcesvideoauthphp">trunk/LayoutTests/http/tests/media/resources/video-auth.php</a></li>
<li><a href="#trunkLayoutTestshttptestsmediavideoauthexpectedtxt">trunk/LayoutTests/http/tests/media/video-auth-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmediavideoauthhtml">trunk/LayoutTests/http/tests/media/video-auth.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/LayoutTests/ChangeLog        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-06  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        HTML5 video tag Does Not Load in Apache htaccess/htpasswd Protected Directory
+        https://bugs.webkit.org/show_bug.cgi?id=40382
+
+        Reviewed by Eric Carlson.
+
+        * http/tests/media/resources/video-auth.php: Added.
+        * http/tests/media/video-auth-expected.txt: Added.
+        * http/tests/media/video-auth.html: Added.
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2014-01-07  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed test expectation update.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmediaresourcesvideoauthphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/resources/video-auth.php (0 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/resources/video-auth.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/resources/video-auth.php        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+&lt;?php
+
+    $ua = $_SERVER[&quot;HTTP_USER_AGENT&quot;];
+
+        header(&quot;Cache-Control: no-store&quot;);
+        header(&quot;Connection: close&quot;);
+        if (!isset($_SERVER['PHP_AUTH_USER'])) {
+            header(&quot;WWW-authenticate: Basic realm=\&quot;&quot; . $_SERVER['REQUEST_URI'] . &quot;\&quot;&quot;);
+            header('HTTP/1.0 401 Unauthorized');
+            exit;
+        }
+
+    $fileName = $_GET[&quot;name&quot;];
+    $type = $_GET[&quot;type&quot;];
+
+    $_GET = array();
+    $_GET['name'] = $fileName;
+    $_GET['type'] = $type;
+    @include(&quot;./serve-video.php&quot;); 
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediavideoauthexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/video-auth-expected.txt (0 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/video-auth-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-auth-expected.txt        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+http://127.0.0.1:8000/media/resources/video-auth.php?name=test.mp4&amp;type=video/mp4 - didReceiveAuthenticationChallenge - Responding with username:password

+Tests that the media player sends authorization credentials when requesting a media file.  
+EVENT(canplay)
+END OF TEST
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmediavideoauthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/media/video-auth.html (0 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/media/video-auth.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/media/video-auth.html        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=../../media-resources/video-test.js&gt;&lt;/script&gt;
+        &lt;script src=../../media-resources/media-file.js&gt;&lt;/script&gt;
+        &lt;script&gt;
+
+            if (window.testRunner) {
+                testRunner.setHandlesAuthenticationChallenges(true);
+                testRunner.setAuthenticationUsername(&quot;username&quot;);
+                testRunner.setAuthenticationPassword(&quot;password&quot;);
+            }
+
+            function loadMediaFrame() 
+            {
+                findMediaElement();
+
+                var movie = findMediaFile('video', 'test');
+                var type = mimeTypeForExtension(movie.split('.').pop());
+                var frame = document.createElement('iframe');
+                frame.width = 0;
+                frame.height = 0;
+                frame.addEventListener('load', function () {
+                        source = document.getElementById('source');
+                        source.src = 'http://127.0.0.1:8000/media/resources/video-auth.php?name=' + movie + '&amp;type=' + type;
+                        source.type = type;
+        
+                        waitForEventAndFail('error');
+                        waitForEventAndEnd('canplay');
+                        video.load();
+                });
+        
+                frame.src = &quot;data:text/html,&lt;b&gt;test&lt;/b&gt;&quot;;
+                document.body.appendChild(frame);
+            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+
+    &lt;body onload=&quot;loadMediaFrame()&quot;&gt;
+        &lt;video id=&quot;video&quot;&gt;
+            &lt;source id=&quot;source&quot;&gt;
+        &lt;/video&gt;
+        &lt;br&gt;
+        Tests that the media player sends authorization credentials when requesting a media file.
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -1313,3 +1313,6 @@
</span><span class="cx"> # GL Scissors don't work properly in Mountain Lion.
</span><span class="cx"> webkit.org/b/126455 [ MountainLion ] webgl/1.0.2/conformance/rendering/gl-scissor-test.html [ Failure ]
</span><span class="cx"> webkit.org/b/126586 [ Mavericks Debug] webgl/1.0.2/conformance/rendering/gl-scissor-test.html [ Pass Failure ]
</span><ins>+
+# HTTP Auth in Media is not supported in Mavericks and Mountain Lion
+webkit.org/b/40382 http/tests/media/video-auth.html [ Skip ]
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/ChangeLog        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-01-06  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        HTML5 video tag Does Not Load in Apache htaccess/htpasswd Protected Directory
+        https://bugs.webkit.org/show_bug.cgi?id=40382
+
+        Reviewed by Eric Carlson.
+
+        Test: http/tests/media/video-auth.html
+
+        Adopt a new AVFoundation API to handle authentication challenge generated while loading
+        media through an AVAsset. The authentication request comes through as a
+        NSURLAuthenticationChallenge, and is wrapped in a WebCore::AuthenticationChallenge
+        by MediaPlayerPrivateAVFoundationObjC, and is sent up to the HTMLMediaElement to handle.
+        The HTMLMediaElement creates a ResourceRequest, and passes the challenge up to the
+        ResourceLoadNotifier.
+
+        To allow the HTMLMediaElement to initiate handling an AuthenticationChallenge without
+        actually creating a ResourceLoader, allow ResourceLoaderDelegate to accept a unique
+        identifier and a DocumentLoader in lieu of a ResourceLoader.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * html/HTMLMediaElement.h:
+        * loader/ResourceLoadNotifier.cpp:
+        (WebCore::ResourceLoadNotifier::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceLoadNotifier::didCancelAuthenticationChallenge):
+        * loader/ResourceLoadNotifier.h:
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge):
+        * platform/graphics/MediaPlayer.h:
+        (WebCore::MediaPlayerClient::mediaPlayerShouldWaitForResponseToAuthenticationChallenge):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
+        (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):
+
</ins><span class="cx"> 2014-01-07  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r161447.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> #include &quot;MIMETypeRegistry.h&quot;
</span><span class="cx"> #include &quot;PageActivityAssertionToken.h&quot;
</span><span class="cx"> #include &quot;PageGroup.h&quot;
</span><ins>+#include &quot;ProgressTracker.h&quot;
</ins><span class="cx"> #include &quot;RenderVideo.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;ScriptController.h&quot;
</span><span class="lines">@@ -5577,6 +5578,27 @@
</span><span class="cx">     return mediaPlayerOwningDocument()-&gt;cachedResourceLoader();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp; challenge)
+{
+    Frame* frame = document().frame();
+    if (!frame)
+        return false;
+
+    Page* page = frame-&gt;page();
+    if (!page)
+        return false;
+
+    ResourceRequest request(m_currentSrc);
+    ResourceLoadNotifier&amp; notifier = frame-&gt;loader().notifier();
+    DocumentLoader* documentLoader = document().loader();
+    unsigned long identifier = page-&gt;progress().createUniqueIdentifier();
+
+    notifier.assignIdentifierToInitialRequest(identifier, documentLoader, request);
+    notifier.didReceiveAuthenticationChallenge(identifier, documentLoader, challenge);
+
+    return true;
+}
+
</ins><span class="cx"> void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
</span><span class="cx"> {
</span><span class="cx">     m_restrictions = NoRestrictions;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -584,6 +584,8 @@
</span><span class="cx">     virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    virtual bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp;) OVERRIDE;
+
</ins><span class="cx">     void loadTimerFired(Timer&lt;HTMLMediaElement&gt;*);
</span><span class="cx">     void progressEventTimerFired(Timer&lt;HTMLMediaElement&gt;*);
</span><span class="cx">     void playbackProgressTimerFired(Timer&lt;HTMLMediaElement&gt;*);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadNotifiercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -53,14 +53,24 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceLoadNotifier::didReceiveAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge&amp; currentWebChallenge)
</span><span class="cx"> {
</span><del>-    m_frame.loader().client().dispatchDidReceiveAuthenticationChallenge(loader-&gt;documentLoader(), loader-&gt;identifier(), currentWebChallenge);
</del><ins>+    didReceiveAuthenticationChallenge(loader-&gt;identifier(), loader-&gt;documentLoader(), currentWebChallenge);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceLoadNotifier::didReceiveAuthenticationChallenge(unsigned long identifier, DocumentLoader* loader, const AuthenticationChallenge&amp; currentWebChallenge)
+{
+    m_frame.loader().client().dispatchDidReceiveAuthenticationChallenge(loader, identifier, currentWebChallenge);
+}
+
</ins><span class="cx"> void ResourceLoadNotifier::didCancelAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge&amp; currentWebChallenge)
</span><span class="cx"> {
</span><del>-    m_frame.loader().client().dispatchDidCancelAuthenticationChallenge(loader-&gt;documentLoader(), loader-&gt;identifier(), currentWebChallenge);
</del><ins>+    didCancelAuthenticationChallenge(loader-&gt;identifier(), loader-&gt;documentLoader(), currentWebChallenge);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceLoadNotifier::didCancelAuthenticationChallenge(unsigned long identifier, DocumentLoader* loader, const AuthenticationChallenge&amp; currentWebChallenge)
+{
+    m_frame.loader().client().dispatchDidCancelAuthenticationChallenge(loader, identifier, currentWebChallenge);
+}
+
</ins><span class="cx"> void ResourceLoadNotifier::willSendRequest(ResourceLoader* loader, ResourceRequest&amp; clientRequest, const ResourceResponse&amp; redirectResponse)
</span><span class="cx"> {
</span><span class="cx">     m_frame.loader().applyUserAgent(clientRequest);
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoadNotifierh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.h (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoadNotifier.h        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/loader/ResourceLoadNotifier.h        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -49,7 +49,9 @@
</span><span class="cx">     explicit ResourceLoadNotifier(Frame&amp;);
</span><span class="cx"> 
</span><span class="cx">     void didReceiveAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&amp;);
</span><ins>+    void didReceiveAuthenticationChallenge(unsigned long identifier, DocumentLoader*, const AuthenticationChallenge&amp;);
</ins><span class="cx">     void didCancelAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&amp;);
</span><ins>+    void didCancelAuthenticationChallenge(unsigned long identifier, DocumentLoader*, const AuthenticationChallenge&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void willSendRequest(ResourceLoader*, ResourceRequest&amp;, const ResourceResponse&amp; redirectResponse);
</span><span class="cx">     void didReceiveResponse(ResourceLoader*, const ResourceResponse&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -1271,6 +1271,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool MediaPlayer::shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp; challenge)
+{
+    if (!m_mediaPlayerClient)
+        return false;
+
+    return m_mediaPlayerClient-&gt;mediaPlayerShouldWaitForResponseToAuthenticationChallenge(challenge);
+}
+
</ins><span class="cx"> void MediaPlayerFactorySupport::callRegisterMediaEngine(MediaEngineRegister registerMediaEngine)
</span><span class="cx"> {
</span><span class="cx">     registerMediaEngine(addMediaEngine);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class AudioSourceProvider;
</span><ins>+class AuthenticationChallenge;
</ins><span class="cx"> class Document;
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="cx"> class HTMLMediaSource;
</span><span class="lines">@@ -252,6 +253,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void textTrackRepresentationBoundsChanged(const IntRect&amp;) { }
</span><span class="cx"> #endif
</span><ins>+
+    virtual bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp;) { return false; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class MediaPlayerSupportsTypeClient {
</span><span class="lines">@@ -521,6 +524,8 @@
</span><span class="cx">     double totalFrameDelay();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    bool shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     MediaPlayer(MediaPlayerClient*);
</span><span class="cx">     MediaPlayerFactory* nextBestMediaEngine(MediaPlayerFactory*) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> OBJC_CLASS AVPlayerLayer;
</span><span class="cx"> OBJC_CLASS AVURLAsset;
</span><span class="cx"> OBJC_CLASS NSArray;
</span><ins>+OBJC_CLASS NSURLAuthenticationChallenge;
</ins><span class="cx"> OBJC_CLASS WebCoreAVFMovieObserver;
</span><span class="cx"> OBJC_CLASS WebCoreAVFPullDelegate;
</span><span class="cx"> 
</span><span class="lines">@@ -80,6 +81,7 @@
</span><span class="cx">     
</span><span class="cx"> #if HAVE(AVFOUNDATION_LOADER_DELEGATE)
</span><span class="cx">     bool shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*);
</span><ins>+    bool shouldWaitForResponseToAuthenticationChallenge(NSURLAuthenticationChallenge*);
</ins><span class="cx">     void didCancelLoadingRequest(AVAssetResourceLoadingRequest*);
</span><span class="cx">     void didStopLoadingRequest(AVAssetResourceLoadingRequest *);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (161454 => 161455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2014-01-07 22:24:37 UTC (rev 161455)
</span><span class="lines">@@ -29,8 +29,9 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;MediaPlayerPrivateAVFoundationObjC.h&quot;
</span><span class="cx"> 
</span><ins>+#import &quot;AVTrackPrivateAVFObjCImpl.h&quot;
</ins><span class="cx"> #import &quot;AudioTrackPrivateAVFObjC.h&quot;
</span><del>-#import &quot;AVTrackPrivateAVFObjCImpl.h&quot;
</del><ins>+#import &quot;AuthenticationChallenge.h&quot;
</ins><span class="cx"> #import &quot;BlockExceptions.h&quot;
</span><span class="cx"> #import &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #import &quot;FloatConversion.h&quot;
</span><span class="lines">@@ -1017,6 +1018,13 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge(NSURLAuthenticationChallenge* nsChallenge)
+{
+    AuthenticationChallenge challenge(nsChallenge);
+
+    return player()-&gt;shouldWaitForResponseToAuthenticationChallenge(challenge);
+}
+
</ins><span class="cx"> void MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest(AVAssetResourceLoadingRequest* avRequest)
</span><span class="cx"> {
</span><span class="cx">     String scheme = [[[avRequest request] URL] scheme];
</span><span class="lines">@@ -2049,6 +2057,25 @@
</span><span class="cx">     return YES;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForResponseToAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
+{
+    UNUSED_PARAM(resourceLoader);
+    if (!m_callback)
+        return NO;
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if (!m_callback) {
+            [[challenge sender] cancelAuthenticationChallenge:challenge];
+            return;
+        }
+
+        if (!m_callback-&gt;shouldWaitForResponseToAuthenticationChallenge(challenge))
+            [[challenge sender] cancelAuthenticationChallenge:challenge];
+    });
+
+    return YES;
+}
+
</ins><span class="cx"> - (void)resourceLoader:(AVAssetResourceLoader *)resourceLoader didCancelLoadingRequest:(AVAssetResourceLoadingRequest *)loadingRequest
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(resourceLoader);
</span></span></pre>
</div>
</div>

</body>
</html>