Ejemplo n.º 1
0
/**
 * webkit_security_origin_get_port:
 * @security_origin: a #WebKitSecurityOrigin
 *
 * Returns the port for the security origin.
 *
 * Returns: the port for the security origin
 *
 * Since: 1.1.14
 **/
guint webkit_security_origin_get_port(WebKitSecurityOrigin* securityOrigin)
{
    g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(securityOrigin), 0);

    WebCore::SecurityOrigin* coreOrigin = core(securityOrigin);
    return coreOrigin->port();
}
Ejemplo n.º 2
0
static jobject GetOrigins(JNIEnv* env, jobject obj)
{
    Vector<RefPtr<WebCore::SecurityOrigin> > coreOrigins;
    WebCore::DatabaseTracker::tracker().origins(coreOrigins);
    Vector<WebCore::KURL> manifestUrls;
    if (WebCore::cacheStorage().manifestURLs(&manifestUrls)) {
        int size = manifestUrls.size();
        for (int i = 0; i < size; ++i) {
            RefPtr<WebCore::SecurityOrigin> manifestOrigin = WebCore::SecurityOrigin::create(manifestUrls[i]);
            if (manifestOrigin.get() == 0)
                continue;
            coreOrigins.append(manifestOrigin);
        }
    }

    jclass setClass = env->FindClass("java/util/HashSet");
    jmethodID cid = env->GetMethodID(setClass, "<init>", "()V");
    jmethodID mid = env->GetMethodID(setClass, "add", "(Ljava/lang/Object;)Z");
    jobject set = env->NewObject(setClass, cid);

    for (unsigned i = 0; i < coreOrigins.size(); ++i) {
        WebCore::SecurityOrigin* origin = coreOrigins[i].get();
        WebCore::String url = origin->toString();
        jstring jUrl = env->NewString(url.characters(), url.length());
        env->CallBooleanMethod(set, mid, jUrl);
        env->DeleteLocalRef(jUrl);
    }

    return set;
}
static String combinedSecurityOriginIdentifier(const WebCore::SecurityOrigin& openingOrigin, const WebCore::SecurityOrigin& mainFrameOrigin)
{
    StringBuilder stringBuilder;

    String originString = openingOrigin.toString();
    if (originString == "null")
        return String();
    stringBuilder.append(originString);
    stringBuilder.append("_");

    originString = mainFrameOrigin.toString();
    if (originString == "null")
        return String();
    stringBuilder.append(originString);

    return stringBuilder.toString();
}
void MediaPlayerPrivate::load(const WTF::String& url)
{
    WTF::String modifiedUrl(url);

    if (modifiedUrl.startsWith("local://")) {
        KURL kurl = KURL(KURL(), modifiedUrl);
        kurl.setProtocol("file");
        WTF::String tempPath(BlackBerry::Platform::Settings::instance()->applicationLocalDirectory().c_str());
        tempPath.append(kurl.path());
        kurl.setPath(tempPath);
        modifiedUrl = kurl.string();
    }
    // 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://") || modifiedUrl.startsWith("data:")) {
        // The QNX Multimedia Framework cannot handle filenames or data containing URL escape sequences.
        modifiedUrl = decodeURLEscapeSequences(modifiedUrl);
    }

    void* tabId = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient();
    int playerID = m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->playerID();
    bool isVideo = m_webCorePlayer->mediaPlayerClient()->mediaPlayerIsVideo();

    deleteGuardedObject(m_platformPlayer);
#if USE(ACCELERATED_COMPOSITING)
    m_platformPlayer = PlatformPlayer::create(this, tabId, isVideo, true, modifiedUrl);
#else
    m_platformPlayer = PlatformPlayer::create(this, tabId, isVideo, false, modifiedUrl);
#endif

    WTF::String cookiePairs;
    if (!url.isEmpty())
        cookiePairs = cookieManager().getCookie(KURL(ParsedURLString, url), WithHttpOnlyCookies);
    m_platformPlayer->load(playerID, modifiedUrl, m_webCorePlayer->userAgent(), cookiePairs);
}