summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LayoutTests/http/tests/ssl/referer-301-expected.txt1
-rw-r--r--LayoutTests/http/tests/ssl/referer-301.html14
-rw-r--r--LayoutTests/http/tests/ssl/referer-303-expected.txt1
-rw-r--r--LayoutTests/http/tests/ssl/referer-303.html14
-rwxr-xr-xLayoutTests/http/tests/ssl/resources/no-http-referer.cgi18
-rw-r--r--LayoutTests/http/tests/ssl/resources/referer-301-redir.php5
-rw-r--r--LayoutTests/http/tests/ssl/resources/referer-303-redir.php5
-rw-r--r--LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt1
-rw-r--r--LayoutTests/http/tests/ssl/verify-ssl-enabled.php6
-rwxr-xr-xLayoutTests/platform/android/layout_test_directories.txt1
-rw-r--r--WebCore/platform/graphics/android/FontAndroid.cpp89
-rw-r--r--WebCore/platform/network/android/ResourceRequestAndroid.cpp7
-rw-r--r--WebKit/Android.mk1
-rw-r--r--WebKit/android/WebCoreSupport/ChromiumLogging.cpp68
-rw-r--r--WebKit/android/WebCoreSupport/ChromiumLogging.h38
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp12
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h3
-rw-r--r--WebKit/android/WebCoreSupport/WebRequestContext.cpp6
-rw-r--r--WebKit/android/WebCoreSupport/WebResourceRequest.cpp33
-rw-r--r--WebKit/android/WebCoreSupport/WebResourceRequest.h11
-rw-r--r--WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp55
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp12
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.h2
23 files changed, 293 insertions, 110 deletions
diff --git a/LayoutTests/http/tests/ssl/referer-301-expected.txt b/LayoutTests/http/tests/ssl/referer-301-expected.txt
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/referer-301-expected.txt
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/http/tests/ssl/referer-301.html b/LayoutTests/http/tests/ssl/referer-301.html
new file mode 100644
index 0000000..2764a7e
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/referer-301.html
@@ -0,0 +1,14 @@
+<body>
+<a href="redir.php">Click me.<a/> The resulting request (as dumped on screen) should not have a Referer header.
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+if (location.protocol != "https:")
+ location = "https://127.0.0.1:8443/ssl/referer-301.html";
+else
+ location = "resources/referer-301-redir.php";
+</script>
+</body>
diff --git a/LayoutTests/http/tests/ssl/referer-303-expected.txt b/LayoutTests/http/tests/ssl/referer-303-expected.txt
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/referer-303-expected.txt
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/http/tests/ssl/referer-303.html b/LayoutTests/http/tests/ssl/referer-303.html
new file mode 100644
index 0000000..b6a3c2e
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/referer-303.html
@@ -0,0 +1,14 @@
+<body>
+<a href="redir.php">Click me.<a/> The resulting request (as dumped on screen) should not have a Referer header.
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+if (location.protocol != "https:")
+ location = "https://127.0.0.1:8443/ssl/referer-303.html";
+else
+ location = "resources/referer-303-redir.php";
+</script>
+</body>
diff --git a/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi b/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi
new file mode 100755
index 0000000..273d03c
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/resources/no-http-referer.cgi
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -wT
+use strict;
+
+print "Content-Type: text/html\n";
+print "Cache-Control: no-store\n\n";
+
+my $failed = 0;
+foreach (keys %ENV) {
+ if ($_ =~ "HTTP_REFERER") {
+ print "FAIL. " . $_ . ": " . $ENV{$_} . "\n";
+ $failed = 1;
+ }
+}
+if (!$failed) {
+ print "PASS\n";
+}
+
+print "<script>if (window.layoutTestController) layoutTestController.notifyDone()</script>";
diff --git a/LayoutTests/http/tests/ssl/resources/referer-301-redir.php b/LayoutTests/http/tests/ssl/resources/referer-301-redir.php
new file mode 100644
index 0000000..d93dc7a
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/resources/referer-301-redir.php
@@ -0,0 +1,5 @@
+<?php
+header("HTTP/1.1 301 Moved Permanently");
+header("Location: http://127.0.0.1:8000/ssl/resources/no-http-referer.cgi");
+header("Cache-Control: no-cache,no-store");
+?>
diff --git a/LayoutTests/http/tests/ssl/resources/referer-303-redir.php b/LayoutTests/http/tests/ssl/resources/referer-303-redir.php
new file mode 100644
index 0000000..63f859d
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/resources/referer-303-redir.php
@@ -0,0 +1,5 @@
+<?php
+header("HTTP/1.1 303 See Other");
+header("Location: http://127.0.0.1:8000/ssl/resources/no-http-referer.cgi");
+header("Cache-Control: no-cache,no-store");
+?>
diff --git a/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt b/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt
new file mode 100644
index 0000000..20c6407
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/verify-ssl-enabled-expected.txt
@@ -0,0 +1 @@
+HTTPS is on!
diff --git a/LayoutTests/http/tests/ssl/verify-ssl-enabled.php b/LayoutTests/http/tests/ssl/verify-ssl-enabled.php
new file mode 100644
index 0000000..de1158b
--- /dev/null
+++ b/LayoutTests/http/tests/ssl/verify-ssl-enabled.php
@@ -0,0 +1,6 @@
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+
+HTTPS is <?= $_SERVER['HTTPS'] ?>!
diff --git a/LayoutTests/platform/android/layout_test_directories.txt b/LayoutTests/platform/android/layout_test_directories.txt
index 3b63850..a6abb82 100755
--- a/LayoutTests/platform/android/layout_test_directories.txt
+++ b/LayoutTests/platform/android/layout_test_directories.txt
@@ -38,6 +38,7 @@ fast/xpath
http/conf
http/tests/appcache
http/tests/resources
+http/tests/ssl
platform/android
platform/android-v8
storage
diff --git a/WebCore/platform/graphics/android/FontAndroid.cpp b/WebCore/platform/graphics/android/FontAndroid.cpp
index 006bf7b..ec98af9 100644
--- a/WebCore/platform/graphics/android/FontAndroid.cpp
+++ b/WebCore/platform/graphics/android/FontAndroid.cpp
@@ -307,7 +307,7 @@ public:
TextRunWalker(const TextRun& run, unsigned startingX, const Font* font)
: m_font(font)
, m_startingX(startingX)
- , m_run(getTextRun(run))
+ , m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer))
, m_iterateBackwards(m_run.rtl())
, m_wordSpacingAdjustment(0)
, m_padding(0)
@@ -331,18 +331,8 @@ public:
m_item.item.bidiLevel = m_run.rtl();
- int length = m_run.length();
- m_item.stringLength = length;
-
- if (!m_item.item.bidiLevel)
- m_item.string = m_run.characters();
- else {
- // Assume mirrored character is in the same Unicode multilingual plane as the original one.
- UChar* string = new UChar[length];
- mirrorCharacters(string, m_run.characters(), length);
- m_item.string = string;
- }
-
+ m_item.string = m_run.characters();
+ m_item.stringLength = m_run.length();
reset();
}
@@ -351,8 +341,6 @@ public:
fastFree(m_item.font);
deleteGlyphArrays();
delete[] m_item.log_clusters;
- if (m_item.item.bidiLevel)
- delete[] m_item.string;
}
// setWordSpacingAdjustment sets a delta (in pixels) which is applied at
@@ -552,9 +540,10 @@ public:
}
private:
- const TextRun& getTextRun(const TextRun& originalRun)
+ const TextRun& getNormalizedTextRun(const TextRun& originalRun,
+ OwnPtr<TextRun>& normalizedRun, OwnArrayPtr<UChar>& normalizedBuffer)
{
- // Normalize the text run in two ways:
+ // Normalize the text run in three ways:
// 1) Convert the |originalRun| to NFC normalized form if combining diacritical marks
// (U+0300..) are used in the run. This conversion is necessary since most OpenType
// fonts (e.g., Arial) don't have substitution rules for the diacritical marks in
@@ -566,41 +555,43 @@ private:
// Harfbuzz will do the same thing for us using the GSUB table.
// 2) Convert spacing characters into plain spaces, as some fonts will provide glyphs
// for characters like '\n' otherwise.
+ // 3) Convert mirrored characters such as parenthesis for rtl text.
+
+ // Convert to NFC form if the text has diacritical marks.
+ icu::UnicodeString normalizedString;
+ UErrorCode error = U_ZERO_ERROR;
+
for (int16_t i = 0; i < originalRun.length(); ++i) {
UChar ch = originalRun[i];
- UBlockCode block = ::ublock_getCode(ch);
- if (block == UBLOCK_COMBINING_DIACRITICAL_MARKS ||
- (Font::treatAsSpace(ch) && ch != ' ')) {
- return getNormalizedTextRun(originalRun);
+ if (::ublock_getCode(ch) == UBLOCK_COMBINING_DIACRITICAL_MARKS) {
+ icu::Normalizer::normalize(icu::UnicodeString(originalRun.characters(),
+ originalRun.length()), UNORM_NFC, 0 /* no options */,
+ normalizedString, error);
+ if (U_FAILURE(error))
+ return originalRun;
+ break;
}
}
- return originalRun;
- }
- const TextRun& getNormalizedTextRun(const TextRun& originalRun)
- {
- icu::UnicodeString normalizedString;
- UErrorCode error = U_ZERO_ERROR;
- icu::Normalizer::normalize(icu::UnicodeString(originalRun.characters(),
- originalRun.length()), UNORM_NFC, 0 /* no options */,
- normalizedString, error);
- if (U_FAILURE(error))
- return originalRun;
-
- m_normalizedBuffer.set(new UChar[normalizedString.length() + 1]);
- normalizedString.extract(m_normalizedBuffer.get(),
- normalizedString.length() + 1, error);
- ASSERT(U_SUCCESS(error));
-
- for (int32_t i = 0; i < normalizedString.length(); ++i) {
- if (Font::treatAsSpace(m_normalizedBuffer[i]))
- m_normalizedBuffer[i] = ' ';
+ // Normalize space and mirror parenthesis for rtl text.
+ int normalizedBufferLength;
+ const UChar* sourceText;
+ if (normalizedString.isEmpty()) {
+ normalizedBufferLength = originalRun.length();
+ sourceText = originalRun.characters();
+ } else {
+ normalizedBufferLength = normalizedString.length();
+ sourceText = normalizedString.getBuffer();
}
- m_normalizedRun.set(new TextRun(originalRun));
- m_normalizedRun->setText(m_normalizedBuffer.get(),
- normalizedString.length());
- return *m_normalizedRun;
+ normalizedBuffer.set(new UChar[normalizedBufferLength + 1]);
+
+ normalizeSpacesAndMirrorChars(sourceText, originalRun.rtl(), normalizedBuffer.get(),
+ normalizedBufferLength);
+
+ normalizedRun.set(new TextRun(originalRun));
+ normalizedRun->setText(normalizedBuffer.get(), normalizedBufferLength);
+ return *normalizedRun;
}
void setupFontForScriptRun()
@@ -743,7 +734,8 @@ private:
m_offsetX += m_pixelWidth;
}
- void mirrorCharacters(UChar* destination, const UChar* source, int length) const
+ static void normalizeSpacesAndMirrorChars(const UChar* source, bool rtl,
+ UChar* destination, int length)
{
int position = 0;
bool error = false;
@@ -752,7 +744,10 @@ private:
UChar32 character;
int nextPosition = position;
U16_NEXT(source, nextPosition, length, character);
- character = u_charMirror(character);
+ if (Font::treatAsSpace(character))
+ character = ' ';
+ else if (rtl)
+ character = u_charMirror(character);
U16_APPEND(destination, position, length, character, error);
ASSERT(!error);
position = nextPosition;
diff --git a/WebCore/platform/network/android/ResourceRequestAndroid.cpp b/WebCore/platform/network/android/ResourceRequestAndroid.cpp
index 7f4bccb..00735f3 100644
--- a/WebCore/platform/network/android/ResourceRequestAndroid.cpp
+++ b/WebCore/platform/network/android/ResourceRequestAndroid.cpp
@@ -30,10 +30,17 @@ namespace WebCore {
unsigned initializeMaximumHTTPConnectionCountPerHost()
{
+#if USE(CHROME_NETWORK_STACK)
+ // The chromium network stack already handles limiting the number of
+ // parallel requests per host, so there's no need to do it here. Therefore,
+ // this is set to a high value that should never be hit in practice.
+ return 10000;
+#else
// This is used by the loader to control the number of parallel load
// requests. Our java framework has 4 threads that can each pipeline up to
// 5 requests. Use 20 as a maximum number.
return 20;
+#endif
}
} // namespace WebCore
diff --git a/WebKit/Android.mk b/WebKit/Android.mk
index 7906da3..038e3dc 100644
--- a/WebKit/Android.mk
+++ b/WebKit/Android.mk
@@ -32,6 +32,7 @@ LOCAL_SRC_FILES := \
ifeq ($(HTTP_STACK),chrome)
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
+ android/WebCoreSupport/ChromiumLogging.cpp \
android/WebCoreSupport/WebCache.cpp \
android/WebCoreSupport/WebUrlLoader.cpp \
android/WebCoreSupport/WebUrlLoaderClient.cpp \
diff --git a/WebKit/android/WebCoreSupport/ChromiumLogging.cpp b/WebKit/android/WebCoreSupport/ChromiumLogging.cpp
new file mode 100644
index 0000000..07fbeb8
--- /dev/null
+++ b/WebKit/android/WebCoreSupport/ChromiumLogging.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChromiumLogging.h"
+
+#include "ChromiumIncludes.h"
+
+#include <cutils/log.h>
+#include <string>
+
+namespace android {
+
+bool logMessageHandler(int severity, const std::string& str) {
+ int androidSeverity = ANDROID_LOG_VERBOSE;
+ switch(severity) {
+ case logging::LOG_FATAL:
+ androidSeverity = ANDROID_LOG_FATAL;
+ break;
+ case logging::LOG_ERROR_REPORT:
+ case logging::LOG_ERROR:
+ androidSeverity = ANDROID_LOG_ERROR;
+ break;
+ case logging::LOG_WARNING:
+ androidSeverity = ANDROID_LOG_WARN;
+ break;
+ default:
+ androidSeverity = ANDROID_LOG_VERBOSE;
+ break;
+ }
+ android_printLog(androidSeverity, "chromium", "%s", str.c_str());
+ return false;
+}
+
+void initChromiumLogging()
+{
+ static Lock loggingLock;
+ AutoLock aLock(loggingLock);
+ static bool loggingStarted = false;
+ if (!loggingStarted) {
+ logging::SetLogMessageHandler(logMessageHandler);
+ loggingStarted = true;
+ }
+}
+
+} // namespace android
diff --git a/WebKit/android/WebCoreSupport/ChromiumLogging.h b/WebKit/android/WebCoreSupport/ChromiumLogging.h
new file mode 100644
index 0000000..74b71b4
--- /dev/null
+++ b/WebKit/android/WebCoreSupport/ChromiumLogging.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ChromiumLogging_h
+#define ChromiumLogging_h
+
+namespace android {
+
+// Sends chromium logs to logcat
+//
+// This only calls into chromium once, but can be called multiple times.
+// It should be called before any other calls into external/chromium.
+void initChromiumLogging();
+}
+
+#endif
diff --git a/WebKit/android/WebCoreSupport/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index ef09ff7..f21c1a2 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -130,10 +130,18 @@ void WebRequest::finish(bool success)
m_urlLoader = 0;
}
-void WebRequest::AppendBytesToUpload(WTF::Vector<char>* data)
+void WebRequest::appendFileToUpload(std::string filename)
+{
+ // AppendFileToUpload is only valid before calling start
+ ASSERT(m_loadState == Created, "appendFileToUpload called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
+ FilePath filePath(filename);
+ m_request->AppendFileToUpload(filePath);
+}
+
+void WebRequest::appendBytesToUpload(WTF::Vector<char>* data)
{
// AppendBytesToUpload is only valid before calling start
- ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
+ ASSERT(m_loadState == Created, "appendBytesToUpload called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
m_request->AppendBytesToUpload(data->data(), data->size());
delete data;
}
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index 1f73d2a..c82096e 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -60,7 +60,8 @@ public:
WebRequest(WebUrlLoaderClient*, const WebResourceRequest&, int inputStream);
// Optional, but if used has to be called before start
- void AppendBytesToUpload(Vector<char>* data);
+ void appendBytesToUpload(Vector<char>* data);
+ void appendFileToUpload(std::string filename);
void start(bool isPrivateBrowsing);
void cancel();
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
index aa5311f..4b29f10 100644
--- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
@@ -27,6 +27,7 @@
#include "WebRequestContext.h"
#include "ChromiumIncludes.h"
+#include "ChromiumLogging.h"
#include "JNIUtility.h"
#include "WebCoreJni.h"
#include "WebUrlLoaderClient.h"
@@ -155,7 +156,7 @@ WebRequestContext* WebRequestContext::getContextForPath(const char* cookieFilena
// Todo: check if the context takes ownership of the cache
net::HttpCache::DefaultBackend* defaultBackend = new net::HttpCache::DefaultBackend(net::DISK_CACHE, cachePath, 20 * 1024 * 1024, cacheMessageLoopProxy);
- context->http_transaction_factory_ = new net::HttpCache(context->host_resolver(), net::ProxyService::CreateDirect(), net::SSLConfigService::CreateSystemSSLConfigService(), net::HttpAuthHandlerFactory::CreateDefault(context->host_resolver_), 0, 0, defaultBackend);
+ context->http_transaction_factory_ = new net::HttpCache(context->host_resolver(), context->dnsrr_resolver(), net::ProxyService::CreateDirect(), net::SSLConfigService::CreateSystemSSLConfigService(), net::HttpAuthHandlerFactory::CreateDefault(context->host_resolver_), 0, 0, defaultBackend);
scoped_refptr<SQLitePersistentCookieStore> cookieDb = new SQLitePersistentCookieStore(cookiePath);
@@ -193,6 +194,9 @@ WebRequestContext* WebRequestContext::getPrivateBrowsingContext()
WebRequestContext* WebRequestContext::get(bool isPrivateBrowsing)
{
+ // Initialize chromium logging, needs to be done before any chromium code is called
+ initChromiumLogging();
+
return isPrivateBrowsing ? getPrivateBrowsingContext() : getRegularContext();
}
diff --git a/WebKit/android/WebCoreSupport/WebResourceRequest.cpp b/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
index 8954887..e8fb520 100644
--- a/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebResourceRequest.cpp
@@ -30,17 +30,6 @@
#include <wtf/text/CString.h>
-namespace {
-const std::string android_asset("file:///android_asset/");
-const std::string android_res("file:///android_res/");
-const std::string android_content("content:");
-
-// Matched in BrowserFrame.java
-const int RESOURCE = 1;
-const int ASSET = 2;
-const int CONTENT = 3;
-}
-
namespace android {
WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceRequest)
@@ -77,28 +66,6 @@ WebResourceRequest::WebResourceRequest(const WebCore::ResourceRequest& resourceR
m_userAgent = resourceRequest.httpUserAgent().utf8().data();
m_url = resourceRequest.url().string().utf8().data();
-
- // Android has special file urls, resolve these
- m_specialAndroidFileType = 0;
- std::string::size_type loc = m_url.find(android_asset);
- if (loc != std::string::npos && loc == 0) {
- m_url = m_url.erase(0, android_asset.length());
- m_specialAndroidFileType = ASSET;
- return;
- }
-
- loc = m_url.find(android_res);
- if (loc != std::string::npos && loc == 0) {
- m_url = m_url.erase(0, android_res.length());
- m_specialAndroidFileType = RESOURCE;
- return;
- }
-
- loc = m_url.find(android_content);
- if (loc != std::string::npos && loc == 0) {
- m_specialAndroidFileType = CONTENT;
- return;
- }
}
} // namespace android
diff --git a/WebKit/android/WebCoreSupport/WebResourceRequest.h b/WebKit/android/WebCoreSupport/WebResourceRequest.h
index 6274624..d0c7f90 100644
--- a/WebKit/android/WebCoreSupport/WebResourceRequest.h
+++ b/WebKit/android/WebCoreSupport/WebResourceRequest.h
@@ -66,22 +66,11 @@ public:
return m_url;
}
- bool isAndroidUrl() const
- {
- return m_specialAndroidFileType != 0;
- }
-
- int androidFileType() const
- {
- return m_specialAndroidFileType;
- }
-
private:
std::string m_method;
std::string m_referrer;
std::string m_userAgent;
net::HttpRequestHeaders m_requestHeaders;
- int m_specialAndroidFileType;
std::string m_url;
};
diff --git a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
index 8925fbc..6d8e192 100644
--- a/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
+++ b/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
@@ -37,6 +37,31 @@
#include "WebRequest.h"
#include "WebResourceRequest.h"
+#include <wtf/text/CString.h>
+
+namespace {
+const char* androidAsset = "file:///android_asset/";
+const char* androidResource = "file:///android_res/";
+const char* androidContent = "content:";
+const int androidAssetLen = strlen(androidAsset);
+const int androidResourceLen = strlen(androidResource);
+const int androidContentLen = strlen(androidContent);
+
+bool isAndroidUrl(const std::string& url)
+{
+ if (!url.compare(0, androidAssetLen, androidAsset))
+ return true;
+
+ if (!url.compare(0, androidResourceLen, androidResource))
+ return true;
+
+ if (!url.compare(0, androidContentLen, androidContent))
+ return true;
+
+ return false;
+}
+}
+
namespace android {
base::Thread* WebUrlLoaderClient::ioThread()
@@ -93,8 +118,8 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
, m_finished(false)
{
WebResourceRequest webResourceRequest(resourceRequest);
- if (webResourceRequest.isAndroidUrl()) {
- int inputStream = webFrame->inputStreamForAndroidResource(webResourceRequest.url().c_str(), webResourceRequest.androidFileType());
+ if (isAndroidUrl(webResourceRequest.url())) {
+ int inputStream = webFrame->inputStreamForAndroidResource(webResourceRequest.url().c_str());
m_request = new WebRequest(this, webResourceRequest, inputStream);
return;
}
@@ -107,6 +132,7 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
Vector<FormDataElement> elements = resourceRequest.httpBody()->elements();
for (iter = elements.begin(); iter != elements.end(); iter++) {
FormDataElement element = *iter;
+
switch (element.m_type) {
case FormDataElement::data:
if (!element.m_data.isEmpty()) {
@@ -115,22 +141,29 @@ WebUrlLoaderClient::WebUrlLoaderClient(WebFrame* webFrame, WebCore::ResourceHand
base::Thread* thread = ioThread();
if (thread) {
Vector<char>* data = new Vector<char>(element.m_data);
- thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::AppendBytesToUpload, data));
+ thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::appendBytesToUpload, data));
}
}
break;
-#if ENABLE(BLOB)
case FormDataElement::encodedFile:
- if (element.m_fileLength == -1)
- continue; // TODO: Not supporting directories yet
- else {
- // TODO: Add fileuploads after Google log-in is fixed.
- // Chrome code is here: webkit/glue/weburlloader_impl.cc:391
+ {
+ // Chromium check if it is a directory by checking
+ // element.m_fileLength, that doesn't work in Android
+ std::string filename = element.m_filename.utf8().data();
+ if (filename.size() > 0) {
+ base::Thread* thread = ioThread();
+ if (thread)
+ thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(m_request.get(), &WebRequest::appendFileToUpload, filename));
+ }
}
break;
-#endif
+#if ENABLE(BLOB)
+ case FormDataElement::encodedBlob:
+ LOG_ASSERT(false, "Unexpected use of FormDataElement::encodedBlob");
+ break;
+#endif // ENABLE(BLOB)
default:
- // TODO: Add a warning/DCHECK/assert here, should never happen
+ LOG_ASSERT(false, "Unexpected default case in WebUrlLoaderClient.cpp");
break;
}
}
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 9cd5c79..04db4a9 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -33,6 +33,7 @@
#include "Cache.h"
#include "Chrome.h"
#include "ChromeClientAndroid.h"
+#include "ChromiumLogging.h"
#include "ContextMenuClientAndroid.h"
#include "DeviceMotionClientAndroid.h"
#include "DeviceOrientationClientAndroid.h"
@@ -234,7 +235,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
mJavaFrame = new JavaBrowserFrame;
mJavaFrame->mObj = env->NewWeakGlobalRef(obj);
mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList);
- mJavaFrame->mInputStreamForAndroidResource = env->GetMethodID(clazz, "inputStreamForAndroidResource", "(Ljava/lang/String;I)Ljava/io/InputStream;");
+ mJavaFrame->mInputStreamForAndroidResource = env->GetMethodID(clazz, "inputStreamForAndroidResource", "(Ljava/lang/String;)Ljava/io/InputStream;");
mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
"(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZLjava/lang/String;Ljava/lang/String;)Landroid/webkit/LoadListener;");
mJavaFrame->mLoadStarted = env->GetMethodID(clazz, "loadStarted",
@@ -382,13 +383,13 @@ private:
int m_size;
};
-int WebFrame::inputStreamForAndroidResource(const char* url, int type)
+int WebFrame::inputStreamForAndroidResource(const char* url)
{
JNIEnv* env = getJNIEnv();
AutoJObject obj = mJavaFrame->frame(env);
jstring jUrlStr = env->NewStringUTF(url);
- jobject jInputStream = env->CallObjectMethod(obj.get(), mJavaFrame->mInputStreamForAndroidResource, jUrlStr, type);
+ jobject jInputStream = env->CallObjectMethod(obj.get(), mJavaFrame->mInputStreamForAndroidResource, jUrlStr);
env->DeleteLocalRef(jUrlStr);
return (int)jInputStream;
@@ -960,6 +961,11 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
{
ScriptController::initializeThreading();
+#if USE(CHROME_NETWORK_STACK)
+ // Initialize chromium logging, needs to be done before any chromium code is called
+ initChromiumLogging();
+#endif
+
#ifdef ANDROID_INSTRUMENT
#if USE(V8)
V8Counters::initCounters();
diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h
index 9e3b5db..2d2b571 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/WebKit/android/jni/WebCoreFrameBridge.h
@@ -60,7 +60,7 @@ class WebFrame : public WebCoreRefObject {
// helper function
static WebFrame* getWebFrame(const WebCore::Frame* frame);
- int inputStreamForAndroidResource(const char* url, int type);
+ int inputStreamForAndroidResource(const char* url);
virtual PassRefPtr<WebCore::ResourceLoaderAndroid> startLoadingResource(WebCore::ResourceHandle*,
const WebCore::ResourceRequest& request, bool mainResource,