- Revision
- 118887
- Author
- [email protected]
- Date
- 2012-05-29 20:51:23 -0700 (Tue, 29 May 2012)
Log Message
[BlackBerry] Loading media data with http authentication
https://bugs.webkit.org/show_bug.cgi?id=84214
Patch by Jonathan Dong <[email protected]> on 2012-05-29
Reviewed by George Staikos.
.:
Added a manual test case which needs user to provide a HTTP server
with HTTP authentication support when loading the specified media
resource. The test case will test if the media resource is successfully
loaded.
* ManualTests/blackberry/video-load-with-authentication.html: Added.
Source/WebCore:
RIM PR: 117618
Implemented http authentication feature for media by implementing
two interface functions in class MediaPlayerPrivate:
onAuthenticationNeeded(): this function is triggered when MMR
engine requires http authentication. We search the CredentialStorage
to see if we have already stored existing credential information,
or challenge user to provide it.
OnAuthenticationAccepted(): this function is triggered when MMR
engine accepts the credential information, and we need to save
it in CredentialStorage for later use.
Internally reviewed by Max Feil <[email protected]>.
Manual test case: blackberry/video-load-with-authentication.html
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::generateProtectionSpaceFromMMRAuthChallenge):
(WebCore):
(WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
(WebCore::MediaPlayerPrivate::onAuthenticationAccepted):
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
(MediaPlayerPrivate):
Modified Paths
Added Paths
Diff
Modified: trunk/ChangeLog (118886 => 118887)
--- trunk/ChangeLog 2012-05-30 03:33:21 UTC (rev 118886)
+++ trunk/ChangeLog 2012-05-30 03:51:23 UTC (rev 118887)
@@ -1,3 +1,17 @@
+2012-05-29 Jonathan Dong <[email protected]>
+
+ [BlackBerry] Loading media data with http authentication
+ https://bugs.webkit.org/show_bug.cgi?id=84214
+
+ Reviewed by George Staikos.
+
+ Added a manual test case which needs user to provide a HTTP server
+ with HTTP authentication support when loading the specified media
+ resource. The test case will test if the media resource is successfully
+ loaded.
+
+ * ManualTests/blackberry/video-load-with-authentication.html: Added.
+
2012-05-29 Simon Fraser <[email protected]>
Incomplete repaint on twitter.com when replying to a tweet
Added: trunk/ManualTests/blackberry/video-load-with-authentication.html (0 => 118887)
--- trunk/ManualTests/blackberry/video-load-with-authentication.html (rev 0)
+++ trunk/ManualTests/blackberry/video-load-with-authentication.html 2012-05-30 03:51:23 UTC (rev 118887)
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>video-load-with-authentication</title>
+ <script src="" type="text/_javascript_"></script>
+</head>
+<body>
+<p>
+ This test case is for <a href=""
+ This test case is aming at testing video loading with http authentication challenge. To use this test case you should setup your apache2 http server
+ with http authentication support first.<br>
+ <p>
+ <h3>Ways to setup the apache2 http server with http authentication support</h3>
+ <ol>
+ <li>Add "AllowOverride AuthConfig" to <Directory> setting in your site configuration file;</li>
+ <li>Create the password file using command: <code>htpasswd -c <passord_filename> <username></code>, and put this file into <ServerRoot>;</li>
+ <li>Create a directory under your server <Directory>, and create the file .htaccess in this directory;</li>
+ <li>Configure the .htaccess file with the following content:
+ <pre>AuthType <Basic|Digest>
+AuthName "Video HTTP Authentication"
+AuthUserFile </path/to/the/password/file>
+Require user <username></pre>
+ </li>
+ <li>Put your test video file into this directory, and restart your apache2 http server.</li>
+ </ol>
+ <p>More information about configuring apache2 http authentication, please refer to apache 2.0 document: <a href="" Authorization and Access Control</a>.</p>
+ </p>
+ <p>
+ <h3>Ways to test</h3>
+ <ol>
+ <li>Setup your apache2 http server and prepare the video file as mentioned above;</li>
+ <li>Enter the link pointing to the video file in the "Video Source" text area below;</li>
+ <li>Then press load button, and fill the authentication challenge pop up dialog with the credential information created before, then wait for the result.</li>
+ </ol>
+ </p>
+</p>
+<hr />
+<div>
+ Video Source:
+ <input type="url" id="url" name="videoSrc" size="100"></input><br>
+ <input type="button" value="Load" _onclick_="load()" />
+</div>
+<video id="video" hidden="hidden"></video>
+<script type="text/_javascript_">
+ function onLoaded()
+ {
+ logResult(true, "Video file successfully loaded, test case passed.");
+ endTest();
+ }
+
+ function onError()
+ {
+ failTest("Load video file error, test case failed.");
+ }
+
+ function load()
+ {
+ findMediaElement();
+ waitForEvent("loadstart");
+ waitForEvent("loadeddata", onLoaded);
+ waitForEvent("error", onError);
+
+ mediaElement.src = ""
+ mediaElement.load();
+ }
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (118886 => 118887)
--- trunk/Source/WebCore/ChangeLog 2012-05-30 03:33:21 UTC (rev 118886)
+++ trunk/Source/WebCore/ChangeLog 2012-05-30 03:51:23 UTC (rev 118887)
@@ -1,3 +1,33 @@
+2012-05-29 Jonathan Dong <[email protected]>
+
+ [BlackBerry] Loading media data with http authentication
+ https://bugs.webkit.org/show_bug.cgi?id=84214
+
+ Reviewed by George Staikos.
+
+ RIM PR: 117618
+ Implemented http authentication feature for media by implementing
+ two interface functions in class MediaPlayerPrivate:
+ onAuthenticationNeeded(): this function is triggered when MMR
+ engine requires http authentication. We search the CredentialStorage
+ to see if we have already stored existing credential information,
+ or challenge user to provide it.
+ OnAuthenticationAccepted(): this function is triggered when MMR
+ engine accepts the credential information, and we need to save
+ it in CredentialStorage for later use.
+
+ Internally reviewed by Max Feil <[email protected]>.
+
+ Manual test case: blackberry/video-load-with-authentication.html
+
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+ (WebCore::generateProtectionSpaceFromMMRAuthChallenge):
+ (WebCore):
+ (WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
+ (WebCore::MediaPlayerPrivate::onAuthenticationAccepted):
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+ (MediaPlayerPrivate):
+
2012-05-29 MORITA Hajime <[email protected]>
[Shadow DOM] Node distribution should be orthogonal from node attachment
Modified: trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp (118886 => 118887)
--- trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp 2012-05-30 03:33:21 UTC (rev 118886)
+++ trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp 2012-05-30 03:51:23 UTC (rev 118887)
@@ -22,6 +22,8 @@
#include "MediaPlayerPrivateBlackBerry.h"
#include "CookieManager.h"
+#include "Credential.h"
+#include "CredentialStorage.h"
#include "Frame.h"
#include "FrameView.h"
#include "GraphicsContext.h"
@@ -30,6 +32,7 @@
#include "HostWindow.h"
#include "NotImplemented.h"
#include "PlatformContextSkia.h"
+#include "ProtectionSpace.h"
#include "RenderBox.h"
#include "TimeRanges.h"
#include "WebPageClient.h"
@@ -657,6 +660,50 @@
}
#endif
+static ProtectionSpace generateProtectionSpaceFromMMRAuthChallenge(const MMRAuthChallenge& authChallenge)
+{
+ KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+ ASSERT(url.isValid());
+
+ return ProtectionSpace(url.host(), url.port(),
+ static_cast<ProtectionSpaceServerType>(authChallenge.serverType()),
+ authChallenge.realm().c_str(),
+ static_cast<ProtectionSpaceAuthenticationScheme>(authChallenge.authScheme()));
+}
+
+bool MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
+{
+ KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+ if (!url.isValid())
+ return false;
+
+ ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
+ Credential credential = CredentialStorage::get(protectionSpace);
+ bool isConfirmed = false;
+ if (credential.isEmpty()) {
+ if (frameView() && frameView()->hostWindow())
+ isConfirmed = frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential);
+ } else
+ isConfirmed = true;
+
+ if (isConfirmed)
+ authChallenge.setCredential(credential.user().utf8().data(), credential.password().utf8().data(), static_cast<MMRAuthChallenge::CredentialPersistence>(credential.persistence()));
+
+ return isConfirmed;
+}
+
+void MediaPlayerPrivate::onAuthenticationAccepted(const MMRAuthChallenge& authChallenge) const
+{
+ KURL url(ParsedURLString, String(authChallenge.url().c_str()));
+ if (!url.isValid())
+ return;
+
+ ProtectionSpace protectionSpace = generateProtectionSpaceFromMMRAuthChallenge(authChallenge);
+ Credential savedCredential = CredentialStorage::get(protectionSpace);
+ if (savedCredential.isEmpty())
+ CredentialStorage::set(Credential(authChallenge.username().c_str(), authChallenge.password().c_str(), static_cast<CredentialPersistence>(authChallenge.persistence())), protectionSpace, url);
+}
+
int MediaPlayerPrivate::showErrorDialog(MMRPlayer::Error type)
{
using namespace BlackBerry::WebKit;
Modified: trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h (118886 => 118887)
--- trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h 2012-05-30 03:33:21 UTC (rev 118886)
+++ trunk/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h 2012-05-30 03:51:23 UTC (rev 118887)
@@ -130,6 +130,8 @@
#if USE(ACCELERATED_COMPOSITING)
virtual void onBuffering(bool);
#endif
+ virtual bool onAuthenticationNeeded(BlackBerry::Platform::MMRAuthChallenge&);
+ virtual void onAuthenticationAccepted(const BlackBerry::Platform::MMRAuthChallenge&) const;
virtual bool isFullscreen() const;
virtual bool isElementPaused() const;