diff options
author | Kristian Monsen <kristianm@google.com> | 2011-01-24 11:11:57 +0000 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2011-01-24 16:20:48 +0000 |
commit | 0d22ca3d36328ab53f67cd4ab162f425b1f4d1e7 (patch) | |
tree | d2b30f264764c3ef9eb10807ef9411e0fbbbc791 /WebKit/android/jni/WebViewCore.cpp | |
parent | 5cd48bb81a0acf1f841e9fd78cae14de7112e070 (diff) | |
download | external_webkit-0d22ca3d36328ab53f67cd4ab162f425b1f4d1e7.zip external_webkit-0d22ca3d36328ab53f67cd4ab162f425b1f4d1e7.tar.gz external_webkit-0d22ca3d36328ab53f67cd4ab162f425b1f4d1e7.tar.bz2 |
Fix for bug 3380288
Cannot create a WebRequestContext before we know if
we should use private mode or not.
Change-Id: I82b0dd67342a381ea1764c4d0457386ff7980be4
Diffstat (limited to 'WebKit/android/jni/WebViewCore.cpp')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 6fd7b9c..c4a0c33 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -3493,12 +3493,19 @@ bool WebViewCore::drawIsPaused() const #if USE(CHROME_NETWORK_STACK) void WebViewCore::setWebRequestContextUserAgent() { - webRequestContext()->setUserAgent(WebFrame::getWebFrame(m_mainFrame)->userAgentForURL(0)); // URL not used + // We cannot create a WebRequestContext, because we might not know it this is a private tab or not yet + if (m_webRequestContext) + m_webRequestContext->setUserAgent(WebFrame::getWebFrame(m_mainFrame)->userAgentForURL(0)); // URL not used } -void WebViewCore::setWebRequestContextCacheMode(int mode) +void WebViewCore::setWebRequestContextCacheMode(int cacheMode) { - webRequestContext()->setCacheMode(mode); + m_cacheMode = cacheMode; + // We cannot create a WebRequestContext, because we might not know it this is a private tab or not yet + if (!m_webRequestContext) + return; + + m_webRequestContext->setCacheMode(cacheMode); } WebRequestContext* WebViewCore::webRequestContext() @@ -3506,6 +3513,8 @@ WebRequestContext* WebViewCore::webRequestContext() if (!m_webRequestContext) { Settings* settings = mainFrame()->settings(); m_webRequestContext = new WebRequestContext(settings && settings->privateBrowsingEnabled()); + setWebRequestContextUserAgent(); + setWebRequestContextCacheMode(m_cacheMode); } return m_webRequestContext.get(); } |