Diff
Modified: trunk/LayoutTests/ChangeLog (161454 => 161455)
--- trunk/LayoutTests/ChangeLog 2014-01-07 22:06:08 UTC (rev 161454)
+++ trunk/LayoutTests/ChangeLog 2014-01-07 22:24:37 UTC (rev 161455)
@@ -1,3 +1,15 @@
+2014-01-06 Jer Noble <jer.no...@apple.com>
+
+ 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:
+
2014-01-07 Brent Fulgham <bfulg...@apple.com>
Unreviewed test expectation update.
Added: trunk/LayoutTests/http/tests/media/resources/video-auth.php (0 => 161455)
--- 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)
@@ -0,0 +1,20 @@
+<?php
+
+ $ua = $_SERVER["HTTP_USER_AGENT"];
+
+ header("Cache-Control: no-store");
+ header("Connection: close");
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
+ header("WWW-authenticate: Basic realm=\"" . $_SERVER['REQUEST_URI'] . "\"");
+ header('HTTP/1.0 401 Unauthorized');
+ exit;
+ }
+
+ $fileName = $_GET["name"];
+ $type = $_GET["type"];
+
+ $_GET = array();
+ $_GET['name'] = $fileName;
+ $_GET['type'] = $type;
+ @include("./serve-video.php");
+?>
Added: trunk/LayoutTests/http/tests/media/video-auth-expected.txt (0 => 161455)
--- 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)
@@ -0,0 +1,6 @@
+http://127.0.0.1:8000/media/resources/video-auth.php?name=test.mp4&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
+
Added: trunk/LayoutTests/http/tests/media/video-auth.html (0 => 161455)
--- 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)
@@ -0,0 +1,45 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ <script>
+
+ if (window.testRunner) {
+ testRunner.setHandlesAuthenticationChallenges(true);
+ testRunner.setAuthenticationUsername("username");
+ testRunner.setAuthenticationPassword("password");
+ }
+
+ 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 = '' + movie + '&type=' + type;
+ source.type = type;
+
+ waitForEventAndFail('error');
+ waitForEventAndEnd('canplay');
+ video.load();
+ });
+
+ frame.src = ""
+ document.body.appendChild(frame);
+ }
+ </script>
+ </head>
+
+ <body _onload_="loadMediaFrame()">
+ <video id="video">
+ <source id="source">
+ </video>
+ <br>
+ Tests that the media player sends authorization credentials when requesting a media file.
+ </body>
+</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (161454 => 161455)
--- 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)
@@ -1313,3 +1313,6 @@
# GL Scissors don't work properly in Mountain Lion.
webkit.org/b/126455 [ MountainLion ] webgl/1.0.2/conformance/rendering/gl-scissor-test.html [ Failure ]
webkit.org/b/126586 [ Mavericks Debug] webgl/1.0.2/conformance/rendering/gl-scissor-test.html [ Pass Failure ]
+
+# HTTP Auth in Media is not supported in Mavericks and Mountain Lion
+webkit.org/b/40382 http/tests/media/video-auth.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (161454 => 161455)
--- 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)
@@ -1,3 +1,39 @@
+2014-01-06 Jer Noble <jer.no...@apple.com>
+
+ 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:]):
+
2014-01-07 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r161447.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (161454 => 161455)
--- 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)
@@ -62,6 +62,7 @@
#include "MIMETypeRegistry.h"
#include "PageActivityAssertionToken.h"
#include "PageGroup.h"
+#include "ProgressTracker.h"
#include "RenderVideo.h"
#include "RenderView.h"
#include "ScriptController.h"
@@ -5577,6 +5578,27 @@
return mediaPlayerOwningDocument()->cachedResourceLoader();
}
+bool HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge& challenge)
+{
+ Frame* frame = document().frame();
+ if (!frame)
+ return false;
+
+ Page* page = frame->page();
+ if (!page)
+ return false;
+
+ ResourceRequest request(m_currentSrc);
+ ResourceLoadNotifier& notifier = frame->loader().notifier();
+ DocumentLoader* documentLoader = document().loader();
+ unsigned long identifier = page->progress().createUniqueIdentifier();
+
+ notifier.assignIdentifierToInitialRequest(identifier, documentLoader, request);
+ notifier.didReceiveAuthenticationChallenge(identifier, documentLoader, challenge);
+
+ return true;
+}
+
void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
{
m_restrictions = NoRestrictions;
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (161454 => 161455)
--- 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)
@@ -584,6 +584,8 @@
virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE;
#endif
+ virtual bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&) OVERRIDE;
+
void loadTimerFired(Timer<HTMLMediaElement>*);
void progressEventTimerFired(Timer<HTMLMediaElement>*);
void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp (161454 => 161455)
--- 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)
@@ -53,14 +53,24 @@
void ResourceLoadNotifier::didReceiveAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
{
- m_frame.loader().client().dispatchDidReceiveAuthenticationChallenge(loader->documentLoader(), loader->identifier(), currentWebChallenge);
+ didReceiveAuthenticationChallenge(loader->identifier(), loader->documentLoader(), currentWebChallenge);
}
+void ResourceLoadNotifier::didReceiveAuthenticationChallenge(unsigned long identifier, DocumentLoader* loader, const AuthenticationChallenge& currentWebChallenge)
+{
+ m_frame.loader().client().dispatchDidReceiveAuthenticationChallenge(loader, identifier, currentWebChallenge);
+}
+
void ResourceLoadNotifier::didCancelAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
{
- m_frame.loader().client().dispatchDidCancelAuthenticationChallenge(loader->documentLoader(), loader->identifier(), currentWebChallenge);
+ didCancelAuthenticationChallenge(loader->identifier(), loader->documentLoader(), currentWebChallenge);
}
+void ResourceLoadNotifier::didCancelAuthenticationChallenge(unsigned long identifier, DocumentLoader* loader, const AuthenticationChallenge& currentWebChallenge)
+{
+ m_frame.loader().client().dispatchDidCancelAuthenticationChallenge(loader, identifier, currentWebChallenge);
+}
+
void ResourceLoadNotifier::willSendRequest(ResourceLoader* loader, ResourceRequest& clientRequest, const ResourceResponse& redirectResponse)
{
m_frame.loader().applyUserAgent(clientRequest);
Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.h (161454 => 161455)
--- 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)
@@ -49,7 +49,9 @@
explicit ResourceLoadNotifier(Frame&);
void didReceiveAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+ void didReceiveAuthenticationChallenge(unsigned long identifier, DocumentLoader*, const AuthenticationChallenge&);
void didCancelAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+ void didCancelAuthenticationChallenge(unsigned long identifier, DocumentLoader*, const AuthenticationChallenge&);
void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
void didReceiveResponse(ResourceLoader*, const ResourceResponse&);
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (161454 => 161455)
--- 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)
@@ -1271,6 +1271,14 @@
}
#endif
+bool MediaPlayer::shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge& challenge)
+{
+ if (!m_mediaPlayerClient)
+ return false;
+
+ return m_mediaPlayerClient->mediaPlayerShouldWaitForResponseToAuthenticationChallenge(challenge);
+}
+
void MediaPlayerFactorySupport::callRegisterMediaEngine(MediaEngineRegister registerMediaEngine)
{
registerMediaEngine(addMediaEngine);
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (161454 => 161455)
--- 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)
@@ -68,6 +68,7 @@
namespace WebCore {
class AudioSourceProvider;
+class AuthenticationChallenge;
class Document;
#if ENABLE(MEDIA_SOURCE)
class HTMLMediaSource;
@@ -252,6 +253,8 @@
virtual void textTrackRepresentationBoundsChanged(const IntRect&) { }
#endif
+
+ virtual bool mediaPlayerShouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&) { return false; }
};
class MediaPlayerSupportsTypeClient {
@@ -521,6 +524,8 @@
double totalFrameDelay();
#endif
+ bool shouldWaitForResponseToAuthenticationChallenge(const AuthenticationChallenge&);
+
private:
MediaPlayer(MediaPlayerClient*);
MediaPlayerFactory* nextBestMediaEngine(MediaPlayerFactory*) const;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (161454 => 161455)
--- 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)
@@ -42,6 +42,7 @@
OBJC_CLASS AVPlayerLayer;
OBJC_CLASS AVURLAsset;
OBJC_CLASS NSArray;
+OBJC_CLASS NSURLAuthenticationChallenge;
OBJC_CLASS WebCoreAVFMovieObserver;
OBJC_CLASS WebCoreAVFPullDelegate;
@@ -80,6 +81,7 @@
#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
bool shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest*);
+ bool shouldWaitForResponseToAuthenticationChallenge(NSURLAuthenticationChallenge*);
void didCancelLoadingRequest(AVAssetResourceLoadingRequest*);
void didStopLoadingRequest(AVAssetResourceLoadingRequest *);
#endif
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (161454 => 161455)
--- 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)
@@ -29,8 +29,9 @@
#import "MediaPlayerPrivateAVFoundationObjC.h"
+#import "AVTrackPrivateAVFObjCImpl.h"
#import "AudioTrackPrivateAVFObjC.h"
-#import "AVTrackPrivateAVFObjCImpl.h"
+#import "AuthenticationChallenge.h"
#import "BlockExceptions.h"
#import "ExceptionCodePlaceholder.h"
#import "FloatConversion.h"
@@ -1017,6 +1018,13 @@
return true;
}
+bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge(NSURLAuthenticationChallenge* nsChallenge)
+{
+ AuthenticationChallenge challenge(nsChallenge);
+
+ return player()->shouldWaitForResponseToAuthenticationChallenge(challenge);
+}
+
void MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest(AVAssetResourceLoadingRequest* avRequest)
{
String scheme = [[[avRequest request] URL] scheme];
@@ -2049,6 +2057,25 @@
return YES;
}
+- (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->shouldWaitForResponseToAuthenticationChallenge(challenge))
+ [[challenge sender] cancelAuthenticationChallenge:challenge];
+ });
+
+ return YES;
+}
+
- (void)resourceLoader:(AVAssetResourceLoader *)resourceLoader didCancelLoadingRequest:(AVAssetResourceLoadingRequest *)loadingRequest
{
UNUSED_PARAM(resourceLoader);