summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Scott <phanna@android.com>2010-11-08 11:07:07 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-11-08 11:07:07 -0800
commit31ee2547d67e901b5e9af790f1f4903ecf0faffa (patch)
treeeb198951513b363fbc8508ec20b660ca8337a511
parentf05ca1bf833d1ea7eb958ab68c97d1c97b369655 (diff)
parentc66ad0770a778012c9a4dd154234a4e553f03b96 (diff)
downloadexternal_webkit-31ee2547d67e901b5e9af790f1f4903ecf0faffa.zip
external_webkit-31ee2547d67e901b5e9af790f1f4903ecf0faffa.tar.gz
external_webkit-31ee2547d67e901b5e9af790f1f4903ecf0faffa.tar.bz2
Merge "Encode email addresses that are not mailto: links."
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp10
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp14
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;
}