OSDN Git Service

Only support saveWebArchive for (X)HTML
authorJohn Reck <jreck@google.com>
Tue, 1 Mar 2011 00:17:28 +0000 (16:17 -0800)
committerJohn Reck <jreck@google.com>
Tue, 1 Mar 2011 00:33:45 +0000 (16:33 -0800)
 Bug: 3492152
 If the mimetype is not text/html or application/xhtml+xml, don't
 try to save the page as a web archive and instead return NULL

Change-Id: Ieb9d65efd72392bedec41ba33ae2aeb1a0954bb4

WebKit/android/jni/WebCoreFrameBridge.cpp

index c187d92..f800e2d 100644 (file)
@@ -1417,6 +1417,9 @@ static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboole
 #if ENABLE(ARCHIVE)
     WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj);
     LOG_ASSERT(pFrame, "nativeSaveWebArchive must take a valid frame pointer!");
+    String mimeType = pFrame->loader()->documentLoader()->mainResource()->mimeType();
+    if ((mimeType != "text/html") && (mimeType != "application/xhtml+xml"))
+        return NULL;
 
     const char* basenameNative = getCharactersFromJStringInEnv(env, basename);
     String basenameString = String::fromUTF8(basenameNative);