From 9e46c1efb24652cdda5b51c451183fe72ea1eee1 Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 28 Feb 2011 16:17:28 -0800 Subject: Only support saveWebArchive for (X)HTML 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 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'WebKit/android/jni/WebCoreFrameBridge.cpp') diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index c187d92..f800e2d 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -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); -- cgit v1.1