diff options
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 14 |
2 files changed, 15 insertions, 9 deletions
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 04db4a9..85314cc 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -585,7 +585,7 @@ WebFrame::loadStarted(WebCore::Frame* frame) return; JNIEnv* env = getJNIEnv(); - WTF::String urlString(url.string()); + const WTF::String& urlString = url.string(); // If this is the main frame and we already have a favicon in the database, // send it along with the page started notification. jobject favicon = NULL; @@ -650,7 +650,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame) bool isMainFrame = (!frame->tree() || !frame->tree()->parent()); WebCore::FrameLoadType loadType = loader->loadType(); - WTF::String urlString(url.string()); + const WTF::String& urlString = url.string(); jstring urlStr = WtfStringToJstring(env, urlString); env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadFinished, urlStr, (int)loadType, isMainFrame); @@ -784,7 +784,7 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload) #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter); #endif - WTF::String urlStr(url.string()); + const WTF::String& urlStr = url.string(); JNIEnv* env = getJNIEnv(); jstring jUrlStr = WtfStringToJstring(env, urlStr); @@ -802,14 +802,14 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request) // always handle "POST" in place if (equalIgnoringCase(request.httpMethod(), "POST")) return true; - WebCore::KURL requestUrl = request.url(); + const WebCore::KURL& requestUrl = request.url(); bool isUserGesture = UserGestureIndicator::processingUserGesture(); if (!mUserInitiatedAction && !isUserGesture && (requestUrl.protocolIs("http") || requestUrl.protocolIs("https") || requestUrl.protocolIs("file") || requestUrl.protocolIs("about") || WebCore::protocolIsJavaScript(requestUrl.string()))) return true; - WTF::String url(request.url().string()); + const WTF::String& url = requestUrl.string(); // Empty urls should not be sent to java if (url.isEmpty()) return true; diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index a7015e7..1643a0d 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -2835,9 +2835,11 @@ tryNextCheckType: while ((index = exported->find(',', index)) >= 0) exported->replace(index, 1, escapedComma); } break; - case EMAIL_CACHEDNODETYPE: + case EMAIL_CACHEDNODETYPE: { + String encoded = WebCore::encodeWithURLEscapeSequences(*exported); + exported->swap(encoded); exported->insert(WTF::String("mailto:"), 0); - break; + } break; case PHONE_CACHEDNODETYPE: exported->insert(WTF::String("tel:"), 0); break; @@ -2853,9 +2855,13 @@ noTextMatch: bool CacheBuilder::IsMailboxChar(UChar ch) { - static const unsigned body[] = {0x03ff6000, 0x87fffffe, 0x07fffffe}; // 0-9 . - A-Z _ a-z + // According to http://en.wikipedia.org/wiki/Email_address + // ! # $ % & ' * + - . / 0-9 = ? + // A-Z ^ _ + // ` a-z { | } ~ + static const unsigned body[] = {0xa3ffecfa, 0xc7fffffe, 0x7fffffff}; ch -= 0x20; - if (ch > 'z' - 0x20) + if (ch > '~' - 0x20) return false; return (body[ch >> 5] & 1 << (ch & 0x1f)) != 0; } |