void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef protocol, JSStringRef host, bool includeSubdomains) { WebCore::KURL kurl; kurl.setProtocol(String(protocol->characters(), protocol->length())); kurl.setHost(String(host->characters(), host->length())); ewk_security_policy_whitelist_origin_del(sourceOrigin->ustring().utf8().data(), kurl.string().utf8().data(), includeSubdomains); }
void JavaBridge::setCookies(WebCore::KURL const& url, WebCore::String const& value) { JNIEnv* env = JSC::Bindings::getJNIEnv(); const WebCore::String& urlStr = url.string(); jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length()); jstring jValueStr = env->NewString(value.characters(), value.length()); AutoJObject obj = getRealObject(env, mJavaObject); env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr); env->DeleteLocalRef(jUrlStr); env->DeleteLocalRef(jValueStr); }
/* * This static method is called to check to see if a POST response is in * the cache. This may be slow, but is only used during a navigation to * a POST response. */ bool WebCoreResourceLoader::willLoadFromCache(const WebCore::KURL& url, int64_t identifier) { JNIEnv* env = JSC::Bindings::getJNIEnv(); WebCore::String urlStr = url.string(); jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length()); jclass resourceLoader = env->FindClass("android/webkit/LoadListener"); bool val = env->CallStaticBooleanMethod(resourceLoader, gResourceLoader.mWillLoadFromCacheMethodID, jUrlStr, identifier); checkException(env); env->DeleteLocalRef(jUrlStr); return val; }
void WebDebugListenerImpl::sourceParsed(ExecState* execState, const SourceCode& source, int errorLine, const UString& errorMsg) { if (m_listener && !m_inDebug) { m_inDebug = true; WebCore::String coreSourceURL = WebCore::ustringToString(source.provider()->url()); WebCore::Frame *frame = static_cast<WebCore::JSDOMWindow*>(execState->lexicalGlobalObject())->impl()->frame(); if (!(coreSourceURL.isNull() || coreSourceURL.isEmpty())) { WebCore::KURL sourceURL(WebCore::ParsedURLString, coreSourceURL); WebCore::KURL mappedURL; if(WebCore::FrameLoaderClientApollo::mapFrameUrl(frame, sourceURL, &mappedURL)) { coreSourceURL = mappedURL.string(); } } WebCore::String coreErrorMsg = WebCore::ustringToString(errorMsg); WebCore::String coreSource(source.data(), source.length()); m_listener->m_pVTable->sourceParsed(m_listener, source.provider()->asID(), coreSourceURL.webString(), coreSource.webString(), source.firstLine(), errorLine, coreErrorMsg.webString()); m_inDebug = false; } }
WebCore::String JavaBridge::cookies(WebCore::KURL const& url) { JNIEnv* env = JSC::Bindings::getJNIEnv(); const WebCore::String& urlStr = url.string(); jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length()); AutoJObject obj = getRealObject(env, mJavaObject); jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr)); WebCore::String ret = to_string(env, string); env->DeleteLocalRef(jUrlStr); env->DeleteLocalRef(string); return ret; }
void JavaBridge::setCookies(WebCore::KURL const& url, WTF::String const& value) { JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject obj = javaObject(env); if (!obj.get()) return; const WTF::String& urlStr = url.string(); jstring jUrlStr = wtfStringToJstring(env, urlStr); jstring jValueStr = wtfStringToJstring(env, value); env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr); env->DeleteLocalRef(jUrlStr); env->DeleteLocalRef(jValueStr); }
WebCore::String JavaBridge::getSignedPublicKeyAndChallengeString(unsigned index, const WebCore::String& challenge, const WebCore::KURL& url) { JNIEnv* env = JSC::Bindings::getJNIEnv(); jstring jChallenge = env->NewString(challenge.characters(), challenge.length()); const WebCore::String& urlStr = url.string(); jstring jUrl = env->NewString(urlStr.characters(), urlStr.length()); AutoJObject obj = getRealObject(env, mJavaObject); jstring key = (jstring) env->CallObjectMethod(obj.get(), mGetSignedPublicKey, index, jChallenge, jUrl); WebCore::String ret = to_string(env, key); env->DeleteLocalRef(jChallenge); env->DeleteLocalRef(jUrl); env->DeleteLocalRef(key); return ret; }
WTF::String JavaBridge::getSignedPublicKeyAndChallengeString(unsigned index, const WTF::String& challenge, const WebCore::KURL& url) { JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject obj = javaObject(env); if (!obj.get()) return String(); jstring jChallenge = wtfStringToJstring(env, challenge); const WTF::String& urlStr = url.string(); jstring jUrl = wtfStringToJstring(env, urlStr); jstring key = (jstring) env->CallObjectMethod(obj.get(), mGetSignedPublicKey, index, jChallenge, jUrl); WTF::String ret = jstringToWtfString(env, key); env->DeleteLocalRef(jChallenge); env->DeleteLocalRef(jUrl); env->DeleteLocalRef(key); return ret; }
WTF::String JavaBridge::cookies(WebCore::KURL const& url) { JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject obj = javaObject(env); if (!obj.get()) return String(); const WTF::String& urlStr = url.string(); jstring jUrlStr = wtfStringToJstring(env, urlStr); jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr)); WTF::String ret = jstringToWtfString(env, string); env->DeleteLocalRef(jUrlStr); env->DeleteLocalRef(string); return ret; }
bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url) { #if USE(CFNETWORK) RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL()); RetainPtr<CFMutableURLRequestRef> request(AdoptCF, CFURLRequestCreateMutable(0, cfURL.get(), kCFURLRequestCachePolicyReloadIgnoringCache, 60, 0)); RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString()); CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get()); RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache()); RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get())); return response; #else return false; #endif }
void wxWebFrame::LoadURL(const wxString& url) { if (m_impl->frame && m_impl->frame->loader()) { WebCore::KURL kurl = WebCore::KURL(WebCore::KURL(), static_cast<const char*>(url.mb_str(wxConvUTF8)), WebCore::UTF8Encoding()); // NB: This is an ugly fix, but CURL won't load sub-resources if the // protocol is omitted; sadly, it will not emit an error, either, so // there's no way for us to catch this problem the correct way yet. if (kurl.protocol().isEmpty()) { // is it a file on disk? if (wxFileExists(url)) { kurl.setProtocol("file"); kurl.setPath("//" + kurl.path()); } else { kurl.setProtocol("http"); kurl.setPath("//" + kurl.path()); } } m_impl->frame->loader()->load(kurl, false); } }
WebURL::WebURL(const WebCore::KURL& url) : m_spec(url.string().utf8()) , m_parsed(url.parsed()) , m_isValid(url.isValid()) { }
void FrameLoaderClientQt::updateGlobalHistory(const WebCore::KURL& url) { QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface(); if (history) history->addHistoryEntry(url.prettyURL()); }
void NetworkResourceLoadScheduler::receivedRedirect(SchedulableLoader* loader, const WebCore::KURL& redirectURL) { ASSERT(isMainThread()); LOG(NetworkScheduling, "(NetworkProcess) NetworkResourceLoadScheduler::receivedRedirect loader originally for '%s' redirected to '%s'", loader->request().url().string().utf8().data(), redirectURL.string().utf8().data()); HostRecord* oldHost = loader->hostRecord(); // The load may have been cancelled while the message was in flight from network thread to main thread. if (!oldHost) return; HostRecord* newHost = hostForURL(redirectURL, CreateIfNotFound); if (oldHost->name() == newHost->name()) return; oldHost->removeLoader(loader); newHost->addLoaderInProgress(loader); }