Diff
Modified: trunk/Source/WebCore/ChangeLog (99438 => 99439)
--- trunk/Source/WebCore/ChangeLog 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/ChangeLog 2011-11-07 18:16:33 UTC (rev 99439)
@@ -1,3 +1,60 @@
+2011-11-07 Jessie Berlin <jber...@apple.com>
+
+ Need a way to allow a scheme access to Local Storage and Databases while Private Browsing is
+ enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=71631
+
+ Reviewed by Jon Honeycutt.
+
+ Check the SchemeRegistry before preventing read/write access to Local Storage and Databases
+ in Private Browsing.
+
+ * WebCore.exp.in:
+ Export the symbols for registering the schemes as allowing Local Storage and Database access
+ in Private Browsing.
+
+ * dom/Document.cpp:
+ (WebCore::Document::allowDatabaseAccess):
+ Check if the scheme allows Database access in Private Browsing.
+
+ * platform/SchemeRegistry.cpp:
+ (WebCore::schemesAllowingLocalStorageAccessInPrivateBrowsing):
+ (WebCore::schemesAllowingDatabaseAccessInPrivateBrowsing):
+ (WebCore::SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing):
+ (WebCore::SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing):
+ (WebCore::SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing):
+ (WebCore::SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing):
+ * platform/SchemeRegistry.h:
+
+ * storage/Storage.cpp:
+ (WebCore::Storage::length):
+ Ask the storage area if it is disabled by Private Browsing in the frame instead of just
+ checking if Private Browsing is enabled for that frame because the answer might depend on
+ what type of storage that storage area is.
+ (WebCore::Storage::key):
+ Ditto.
+ (WebCore::Storage::getItem):
+ Ditto.
+ (WebCore::Storage::contains):
+ Ditto.
+
+ * storage/StorageArea.h:
+ Make it possible to query a StorageArea for whether it is disabled by Private Browsing in a
+ Frame.
+ * storage/StorageAreaImpl.cpp:
+ (WebCore::StorageAreaImpl::disabledByPrivateBrowsingInFrame):
+ Renamed from privateBrowsingEnabled.
+ Check not only if Private Browsing is enabled for the Frame, but also if the storage type is
+ Local Storage and if there is an exception for the scheme of the resource currently loaded
+ into the Frame.
+ (WebCore::StorageAreaImpl::setItem):
+ Renamed privateBrowsingEnabled -> disabledByPrivateBrowsingInFrame.
+ (WebCore::StorageAreaImpl::removeItem):
+ Ditto.
+ (WebCore::StorageAreaImpl::clear):
+ Ditto.
+ * storage/StorageAreaImpl.h:
+
2011-11-07 Dominic Cooney <domin...@chromium.org>
Remove initCloseEvent method
Modified: trunk/Source/WebCore/WebCore.exp.in (99438 => 99439)
--- trunk/Source/WebCore/WebCore.exp.in 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/WebCore.exp.in 2011-11-07 18:16:33 UTC (rev 99439)
@@ -366,6 +366,8 @@
__ZN7WebCore14SchemeRegistry25registerURLSchemeAsSecureERKN3WTF6StringE
__ZN7WebCore14SchemeRegistry32registerURLSchemeAsEmptyDocumentERKN3WTF6StringE
__ZN7WebCore14SchemeRegistry34shouldLoadURLSchemeAsEmptyDocumentERKN3WTF6StringE
+__ZN7WebCore14SchemeRegistry62registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsingERKN3WTF6StringE
+__ZN7WebCore14SchemeRegistry58registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsingERKN3WTF6StringE
__ZN7WebCore14ScrollableArea16handleWheelEventERKNS_18PlatformWheelEventE
__ZN7WebCore14ScrollableArea17willEndLiveResizeEv
__ZN7WebCore14ScrollableArea19willStartLiveResizeEv
Modified: trunk/Source/WebCore/dom/Document.cpp (99438 => 99439)
--- trunk/Source/WebCore/dom/Document.cpp 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-11-07 18:16:33 UTC (rev 99439)
@@ -122,6 +122,7 @@
#include "RenderTextControl.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "SchemeRegistry.h"
#include "ScopedEventQueue.h"
#include "ScriptCallStack.h"
#include "ScriptController.h"
@@ -4467,7 +4468,7 @@
bool Document::allowDatabaseAccess() const
{
- if (!page() || page()->settings()->privateBrowsingEnabled())
+ if (!page() || (page()->settings()->privateBrowsingEnabled() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(securityOrigin()->protocol())))
return false;
return true;
}
Modified: trunk/Source/WebCore/platform/SchemeRegistry.cpp (99438 => 99439)
--- trunk/Source/WebCore/platform/SchemeRegistry.cpp 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/platform/SchemeRegistry.cpp 2011-11-07 18:16:33 UTC (rev 99439)
@@ -131,6 +131,18 @@
return localURLSchemes();
}
+static URLSchemesMap& schemesAllowingLocalStorageAccessInPrivateBrowsing()
+{
+ DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingLocalStorageAccessInPrivateBrowsing, ());
+ return schemesAllowingLocalStorageAccessInPrivateBrowsing;
+}
+
+static URLSchemesMap& schemesAllowingDatabaseAccessInPrivateBrowsing()
+{
+ DEFINE_STATIC_LOCAL(URLSchemesMap, schemesAllowingDatabaseAccessInPrivateBrowsing, ());
+ return schemesAllowingDatabaseAccessInPrivateBrowsing;
+}
+
bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme)
{
if (scheme.isEmpty())
@@ -210,4 +222,28 @@
return notAllowingJavascriptURLsSchemes().contains(scheme);
}
+void SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing(const String& scheme)
+{
+ schemesAllowingLocalStorageAccessInPrivateBrowsing().add(scheme);
+}
+
+bool SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return false;
+ return schemesAllowingLocalStorageAccessInPrivateBrowsing().contains(scheme);
+}
+
+void SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing(const String& scheme)
+{
+ schemesAllowingDatabaseAccessInPrivateBrowsing().add(scheme);
+}
+
+bool SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return false;
+ return schemesAllowingDatabaseAccessInPrivateBrowsing().contains(scheme);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/SchemeRegistry.h (99438 => 99439)
--- trunk/Source/WebCore/platform/SchemeRegistry.h 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/platform/SchemeRegistry.h 2011-11-07 18:16:33 UTC (rev 99439)
@@ -68,6 +68,13 @@
// bookmarklets from running on sensitive pages).
static void registerURLSchemeAsNotAllowingJavascriptURLs(const String& scheme);
static bool shouldTreatURLSchemeAsNotAllowingJavascriptURLs(const String& scheme);
+
+ // Let some schemes opt-out of Private Browsing's default behavior of prohibiting read/write
+ // access to Local Storage and Databases.
+ static void registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing(const String& scheme);
+ static bool allowsLocalStorageAccessInPrivateBrowsing(const String& scheme);
+ static void registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing(const String& scheme);
+ static bool allowsDatabaseAccessInPrivateBrowsing(const String& scheme);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/storage/Storage.cpp (99438 => 99439)
--- trunk/Source/WebCore/storage/Storage.cpp 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/storage/Storage.cpp 2011-11-07 18:16:33 UTC (rev 99439)
@@ -54,7 +54,7 @@
unsigned Storage::length() const
{
- if (!m_frame || !m_frame->page() || m_frame->page()->settings()->privateBrowsingEnabled())
+ if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame))
return 0;
return m_storageArea->length(m_frame);
@@ -62,7 +62,7 @@
String Storage::key(unsigned index) const
{
- if (!m_frame || !m_frame->page() || m_frame->page()->settings()->privateBrowsingEnabled())
+ if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame))
return String();
return m_storageArea->key(index, m_frame);
@@ -70,7 +70,7 @@
String Storage::getItem(const String& key) const
{
- if (!m_frame || !m_frame->page() || m_frame->page()->settings()->privateBrowsingEnabled())
+ if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame))
return String();
return m_storageArea->getItem(key, m_frame);
@@ -103,7 +103,7 @@
bool Storage::contains(const String& key) const
{
- if (!m_frame || !m_frame->page() || m_frame->page()->settings()->privateBrowsingEnabled())
+ if (!m_frame || !m_frame->page() || m_storageArea->disabledByPrivateBrowsingInFrame(m_frame))
return false;
return m_storageArea->contains(key, m_frame);
Modified: trunk/Source/WebCore/storage/StorageArea.h (99438 => 99439)
--- trunk/Source/WebCore/storage/StorageArea.h 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/storage/StorageArea.h 2011-11-07 18:16:33 UTC (rev 99439)
@@ -53,6 +53,8 @@
virtual String removeItem(const String& key, Frame* sourceFrame) = 0;
virtual bool clear(Frame* sourceFrame) = 0;
virtual bool contains(const String& key, Frame* sourceFrame) const = 0;
+
+ virtual bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/storage/StorageAreaImpl.cpp (99438 => 99439)
--- trunk/Source/WebCore/storage/StorageAreaImpl.cpp 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.cpp 2011-11-07 18:16:33 UTC (rev 99439)
@@ -29,6 +29,7 @@
#include "ExceptionCode.h"
#include "Frame.h"
#include "Page.h"
+#include "SchemeRegistry.h"
#include "SecurityOrigin.h"
#include "Settings.h"
#include "StorageAreaSync.h"
@@ -98,7 +99,7 @@
ASSERT(!m_isShutdown);
}
-static bool privateBrowsingEnabled(Frame* frame)
+bool StorageAreaImpl::disabledByPrivateBrowsingInFrame(const Frame* frame) const
{
#if PLATFORM(CHROMIUM)
// The frame pointer can be NULL in Chromium since this call is made in a different
@@ -107,7 +108,11 @@
ASSERT(!frame);
return false;
#else
- return frame->page() && frame->page()->settings()->privateBrowsingEnabled();
+ if (!frame->page() || !frame->page()->settings()->privateBrowsingEnabled())
+ return false;
+ if (m_storageType != LocalStorage)
+ return true;
+ return !SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing(frame->document()->securityOrigin()->protocol());
#endif
}
@@ -141,7 +146,7 @@
ASSERT(!value.isNull());
blockUntilImportComplete();
- if (privateBrowsingEnabled(frame)) {
+ if (disabledByPrivateBrowsingInFrame(frame)) {
ec = QUOTA_EXCEEDED_ERR;
return String();
}
@@ -171,7 +176,7 @@
ASSERT(!m_isShutdown);
blockUntilImportComplete();
- if (privateBrowsingEnabled(frame))
+ if (disabledByPrivateBrowsingInFrame(frame))
return String();
String oldValue;
@@ -193,7 +198,7 @@
ASSERT(!m_isShutdown);
blockUntilImportComplete();
- if (privateBrowsingEnabled(frame))
+ if (disabledByPrivateBrowsingInFrame(frame))
return false;
if (!m_storageMap->length())
Modified: trunk/Source/WebCore/storage/StorageAreaImpl.h (99438 => 99439)
--- trunk/Source/WebCore/storage/StorageAreaImpl.h 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebCore/storage/StorageAreaImpl.h 2011-11-07 18:16:33 UTC (rev 99439)
@@ -51,6 +51,8 @@
virtual bool clear(Frame* sourceFrame);
virtual bool contains(const String& key, Frame* sourceFrame) const;
+ virtual bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
+
PassRefPtr<StorageAreaImpl> copy();
void close();
Modified: trunk/Source/WebKit/chromium/ChangeLog (99438 => 99439)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-11-07 18:16:33 UTC (rev 99439)
@@ -1,3 +1,15 @@
+2011-11-07 Jessie Berlin <jber...@apple.com>
+
+ Need a way to allow a scheme access to Local Storage and Databases while Private Browsing is
+ enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=71631
+
+ Reviewed by Jon Honeycutt.
+
+ * src/StorageAreaProxy.h:
+ (WebCore::StorageAreaProxy::disabledByPrivateBrowsingInFrame):
+ Chromium uses a different method to track its icognito mode, so always return false.
+
2011-11-07 Yury Semikhatsky <yu...@chromium.org>
[Chromium] Web Inspector: use native worker inspector instead of fake workers
Modified: trunk/Source/WebKit/chromium/src/StorageAreaProxy.h (99438 => 99439)
--- trunk/Source/WebKit/chromium/src/StorageAreaProxy.h 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebKit/chromium/src/StorageAreaProxy.h 2011-11-07 18:16:33 UTC (rev 99439)
@@ -49,6 +49,8 @@
virtual bool clear(Frame* sourceFrame);
virtual bool contains(const String& key, Frame* sourceFrame) const;
+ virtual bool disabledByPrivateBrowsingInFrame(const Frame*) const { return false; }
+
private:
void storageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Frame* sourceFrame);
bool canAccessStorage(Frame*) const;
Modified: trunk/Source/WebKit/mac/ChangeLog (99438 => 99439)
--- trunk/Source/WebKit/mac/ChangeLog 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-11-07 18:16:33 UTC (rev 99439)
@@ -1,3 +1,21 @@
+2011-11-07 Jessie Berlin <jber...@apple.com>
+
+ Need a way to allow a scheme access to Local Storage and Databases while Private Browsing is
+ enabled.
+ https://bugs.webkit.org/show_bug.cgi?id=71631
+
+ Reviewed by Jon Honeycutt.
+
+ Add WebKit1 API to register a scheme as ignoring Private Browsing for Local Storage and
+ Databases.
+
+ * WebView/WebView.mm:
+ (+[WebView _registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:]):
+ Call through to the SchemeRegistry function.
+ (+[WebView _registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing:]):
+ Ditto.
+ * WebView/WebViewPrivate.h:
+
2011-11-03 Mark Hahnenberg <mhahnenb...@apple.com>
De-virtualize JSObject::getPropertyNames
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (99438 => 99439)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2011-11-07 18:16:33 UTC (rev 99439)
@@ -2641,6 +2641,16 @@
SchemeRegistry::registerURLSchemeAsSecure(scheme);
}
++ (void)_registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:(NSString *)scheme
+{
+ SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing(scheme);
+}
+
++ (void)_registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing:(NSString *)scheme
+{
+ SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing(scheme);
+}
+
- (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin
{
_private->page->setPageScaleFactor(scale, IntPoint(origin));
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (99438 => 99439)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-11-07 18:04:51 UTC (rev 99438)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-11-07 18:16:33 UTC (rev 99439)
@@ -543,6 +543,8 @@
+ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
+ (void)_registerURLSchemeAsSecure:(NSString *)scheme;
++ (void)_registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:(NSString *)scheme;
++ (void)_registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing:(NSString *)scheme;
- (void)_scaleWebView:(float)scale atOrigin:(NSPoint)origin;
- (float)_viewScaleFactor;