[BlackBerry] Add support for filesystem: URLs to BlackBerry Media Player.

https://bugs.webkit.org/show_bug.cgi?id=114686
https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=314865

Patch by John Griggs <jgriggs@blackberry.com> on 2013-04-17
Reviewed by Rob Buis.

Translate filesystem: URLs to file:// URLs for use by the media player, but only after the filesystem: URL has been checked for security, etc.

* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::load):
(WebCore::MediaPlayerPrivate::onError):
(WebCore::MediaPlayerPrivate::onDurationChanged):
(WebCore::MediaPlayerPrivate::notifyChallengeResult):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 726f318f
2013-04-17 John Griggs <jgriggs@blackberry.com>
[BlackBerry] Add support for filesystem: URLs to BlackBerry Media Player.
https://bugs.webkit.org/show_bug.cgi?id=114686
https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=314865
Reviewed by Rob Buis.
Translate filesystem: URLs to file:// URLs for use by the media player, but only after the filesystem: URL has been checked for security, etc.
* platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
(WebCore::MediaPlayerPrivate::load):
(WebCore::MediaPlayerPrivate::onError):
(WebCore::MediaPlayerPrivate::onDurationChanged):
(WebCore::MediaPlayerPrivate::notifyChallengeResult):
2013-04-17 Brendan Long <b.long@cablelabs.com>
[GStreamer] Eclipse warnings in MediaPlayerPrivateGStreamer
......@@ -23,13 +23,16 @@
#include "CookieManager.h"
#include "CredentialStorage.h"
#include "DOMFileSystemBase.h"
#include "HostWindow.h"
#include "MediaStreamDescriptor.h"
#include "MediaStreamRegistry.h"
#include "SecurityOrigin.h"
#include <BlackBerryPlatformDeviceInfo.h>
#include <BlackBerryPlatformPrimitives.h>
#include <BlackBerryPlatformSettings.h>
#include <BlackBerryPlatformWebFileSystem.h>
#include <FrameLoaderClientBlackBerry.h>
#if USE(ACCELERATED_COMPOSITING)
......@@ -146,7 +149,41 @@ void MediaPlayerPrivate::load(const WTF::String& url)
kurl.setPath(tempPath);
modifiedUrl = kurl.string();
}
if (modifiedUrl.startsWith("file://")) {
// filesystem: URLs refer to entities in the Web File System (WFS) and are
// intended to be useable by HTML 5 media elements directly. Unfortunately
// the loader for our media player is implemented in a separate process and
// does not have access to WFS, so we translate to a file:// URL. Normally
// this would be a security violation, but since the MediaElement has
// already done a security check on the filesystem: URL as part of the
// media resource selection algorithm, we should be OK here.
if (modifiedUrl.startsWith("filesystem:")) {
KURL kurl = KURL(KURL(), modifiedUrl);
KURL mediaURL;
WTF::String fsPath;
FileSystemType fsType;
WebFileSystem::Type type;
// Extract the root and file paths from WFS
DOMFileSystemBase::crackFileSystemURL(kurl, fsType, fsPath);
if (fsType == FileSystemTypeTemporary)
type = WebFileSystem::Temporary;
else
type = WebFileSystem::Persistent;
WTF::String fsRoot = BlackBerry::Platform::WebFileSystem::rootPathForWebFileSystem(type);
// Build a BlackBerry::Platform::SecurityOrigin from the document's
// WebCore::SecurityOrigin and serialize it to build the last
// path component
WebCore::SecurityOrigin* wkOrigin = m_webCorePlayer->mediaPlayerClient()->mediaPlayerOwningDocument()->securityOrigin();
BlackBerry::Platform::SecurityOrigin bbOrigin(wkOrigin->protocol(), wkOrigin->host(), wkOrigin->port());
WTF::String secOrigin(bbOrigin.serialize('_'));
// Build a file:// URL from the path components and extract it to
// a string for further processing
mediaURL.setProtocol("file");
mediaURL.setPath(fsRoot + "/" + secOrigin + "/" + fsPath);
modifiedUrl = mediaURL.string();
} else if (modifiedUrl.startsWith("file://")) {
// The QNX Multimedia Framework cannot handle filenames containing URL escape sequences.
modifiedUrl = decodeURLEscapeSequences(modifiedUrl);
}
......@@ -576,12 +613,12 @@ void MediaPlayerPrivate::onMediaStatusChanged(PlatformPlayer::MMRPlayState)
updateStates();
}
void MediaPlayerPrivate::onError(PlatformPlayer::Error type)
void MediaPlayerPrivate::onError(PlatformPlayer::Error)
{
updateStates();
}
void MediaPlayerPrivate::onDurationChanged(float duration)
void MediaPlayerPrivate::onDurationChanged(float)
{
updateStates();
m_webCorePlayer->durationChanged();
......@@ -722,7 +759,7 @@ void MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
this, m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient());
}
void MediaPlayerPrivate::notifyChallengeResult(const KURL& url, const ProtectionSpace& protectionSpace, AuthenticationChallengeResult result, const Credential& credential)
void MediaPlayerPrivate::notifyChallengeResult(const KURL& url, const ProtectionSpace&, AuthenticationChallengeResult result, const Credential& credential)
{
m_isAuthenticationChallenging = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment