diff options
author | Ben Murdoch <benm@google.com> | 2009-06-01 17:47:54 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-06-15 13:04:46 +0100 |
commit | b679b2a6c810dd2f9e8d7072e542b884a4e7060f (patch) | |
tree | 39174505f250d830633ab6ade3ecaab1de56f2e0 /WebCore | |
parent | 194315e5a908cc8ed67d597010544803eef1ac59 (diff) | |
download | external_webkit-b679b2a6c810dd2f9e8d7072e542b884a4e7060f.zip external_webkit-b679b2a6c810dd2f9e8d7072e542b884a4e7060f.tar.gz external_webkit-b679b2a6c810dd2f9e8d7072e542b884a4e7060f.tar.bz2 |
Enable DOM Storage in master with JSC bindings.
Diffstat (limited to 'WebCore')
28 files changed, 147 insertions, 18 deletions
diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk index 24c271f..6e8b51f 100644 --- a/WebCore/Android.derived.mk +++ b/WebCore/Android.derived.mk @@ -62,7 +62,6 @@ # If an entry starts with '/', any subdirectory may match # If an entry starts with '^', the first directory must match # LOCAL_DIR_WILDCARD_EXCLUDED := \ -# ^storage/* \ # ^workers/* \ # This comment block is read by tools/webkitsync/diff.cpp @@ -217,7 +216,7 @@ js_binding_scripts := $(addprefix $(LOCAL_PATH)/,\ bindings/scripts/generate-bindings.pl \ ) -FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 +FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 GEN := \ $(intermediates)/css/JSCSSCharsetRule.h \ @@ -500,6 +499,21 @@ LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) # above rules. Specifying this explicitly makes -j2 work. $(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h +# new section for DOM Storage APIs +GEN := \ + $(intermediates)/storage/JSStorage.h \ + $(intermediates)/storage/JSStorageEvent.h + +$(GEN): PRIVATE_PATH := $(LOCAL_PATH) +$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< +$(GEN): $(intermediates)/storage/JS%.h : $(LOCAL_PATH)/storage/%.idl $(js_binding_scripts) + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) + +# We also need the .cpp files, which are generated as side effects of the +# above rules. Specifying this explicitly makes -j2 work. +$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h + #new section for svg ifeq ($(ENABLE_SVG), true) GEN := \ diff --git a/WebCore/Android.mk b/WebCore/Android.mk index d1f0930..f9b6aa3 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -22,12 +22,7 @@ # LOCAL_SRC_FILES_EXCLUDED := \ # DerivedSources.cpp \ # WebCorePrefix.cpp \ -# bindings/js/JSCustomSQL*.cpp \ -# bindings/js/JSCustomVersionChangeCallback.cpp \ -# bindings/js/JSDatabaseCustom.cpp \ # bindings/js/JSHTMLAudioElementConstructor.cpp \ -# bindings/js/JSSQL*.cpp \ -# bindings/js/JSStorageCustom.cpp \ # bindings/js/JSXSLTProcessor*.cpp \ # bindings/js/JSWorker*.cpp \ # bindings/js/Worker*.cpp \ @@ -190,6 +185,7 @@ LOCAL_SRC_FILES := \ bindings/js/JSRGBColor.cpp \ bindings/js/JSSQLResultSetRowListCustom.cpp \ bindings/js/JSSQLTransactionCustom.cpp \ + bindings/js/JSStorageCustom.cpp \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ @@ -948,12 +944,22 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/DatabaseTask.cpp \ storage/DatabaseThread.cpp \ storage/DatabaseTracker.cpp \ + storage/LocalStorage.cpp \ + storage/LocalStorageArea.cpp \ + storage/LocalStorageTask.cpp \ + storage/LocalStorageThread.cpp \ storage/OriginQuotaManager.cpp \ + storage/SessionStorage.cpp \ + storage/SessionStorageArea.cpp \ storage/OriginUsageRecord.cpp \ storage/SQLResultSet.cpp \ storage/SQLResultSetRowList.cpp \ storage/SQLStatement.cpp \ storage/SQLTransaction.cpp \ + storage/Storage.cpp \ + storage/StorageArea.cpp \ + storage/StorageEvent.cpp \ + storage/StorageMap.cpp \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/config.h b/WebCore/config.h index 8a4cf56..171743e 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -81,6 +81,8 @@ // center place to handle which option feature ANDROID will enable #undef ENABLE_DATABASE #define ENABLE_DATABASE 1 +#undef ENABLE_DOM_STORAGE +#define ENABLE_DOM_STORAGE 1 #undef ENABLE_FTPDIR #define ENABLE_FTPDIR 0 #ifndef ENABLE_SVG diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index f0951eb..f098211 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -97,8 +97,8 @@ void PageGroup::closeLocalStorage() PageGroupMap::iterator end = pageGroups->end(); for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { - if (LocalStorage* localStorage = it->second->localStorage()) - localStorage->close(); + if (it->second->hasLocalStorage()) + it->second->localStorage()->close(); } #endif } @@ -108,10 +108,6 @@ void PageGroup::addPage(Page* page) ASSERT(page); ASSERT(!m_pages.contains(page)); m_pages.add(page); -#if ENABLE(DOM_STORAGE) - if (!m_localStorage) - m_localStorage = LocalStorage::localStorage(page->settings()->localStorageDatabasePath()); -#endif } void PageGroup::removePage(Page* page) @@ -187,6 +183,13 @@ void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack) #if ENABLE(DOM_STORAGE) LocalStorage* PageGroup::localStorage() { + if (!m_localStorage) { + // Need a page in this page group to query the settings for the local storage database path. + Page* page = *m_pages.begin(); + ASSERT(page); + m_localStorage = LocalStorage::localStorage(page->settings()->localStorageDatabasePath()); + } + return m_localStorage.get(); } #endif diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h index 097fb87..d9ffabd 100644 --- a/WebCore/page/PageGroup.h +++ b/WebCore/page/PageGroup.h @@ -44,7 +44,7 @@ namespace WebCore { static PageGroup* pageGroup(const String& groupName); static void closeLocalStorage(); - + const HashSet<Page*>& pages() const { return m_pages; } void addPage(Page*); @@ -68,7 +68,9 @@ namespace WebCore { private: void addVisitedLink(LinkHash stringHash); - +#if ENABLE(DOM_STORAGE) + bool hasLocalStorage() { return m_localStorage; } +#endif String m_name; HashSet<Page*> m_pages; diff --git a/WebCore/page/android/InspectorControllerAndroid.cpp b/WebCore/page/android/InspectorControllerAndroid.cpp index c480e94..3c9e4b9 100644 --- a/WebCore/page/android/InspectorControllerAndroid.cpp +++ b/WebCore/page/android/InspectorControllerAndroid.cpp @@ -61,8 +61,15 @@ namespace WebCore { struct InspectorResource : public RefCounted<InspectorResource> { }; +#if ENABLE(DATABASE) struct InspectorDatabaseResource : public RefCounted<InspectorDatabaseResource> { }; +#endif + +#if ENABLE(DOM_STORAGE) +struct InspectorDOMStorageResource : public RefCounted<InspectorDatabaseResource> { +}; +#endif InspectorController::InspectorController(Page*, InspectorClient* client) : m_startProfiling(this, 0) @@ -87,6 +94,9 @@ void InspectorController::addMessageToConsole(MessageSource, MessageLevel, const #if ENABLE(DATABASE) void InspectorController::didOpenDatabase(Database*, String const&, String const&, String const&) {} #endif +#if ENABLE(DOM_STORAGE) + void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame) {} +#endif bool InspectorController::enabled() const { return false; } void InspectorController::inspect(Node*) {} bool InspectorController::windowVisible() { return false; } diff --git a/WebCore/storage/LocalStorage.cpp b/WebCore/storage/LocalStorage.cpp index 8b84e17..8c4cce9 100644 --- a/WebCore/storage/LocalStorage.cpp +++ b/WebCore/storage/LocalStorage.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "LocalStorage.h" +#if ENABLE(DOM_STORAGE) + #include "CString.h" #include "EventNames.h" #include "FileSystem.h" @@ -97,7 +99,7 @@ PassRefPtr<StorageArea> LocalStorage::storageArea(SecurityOrigin* origin) RefPtr<LocalStorageArea> storageArea; if (storageArea = m_storageAreaMap.get(origin)) return storageArea.release(); - + storageArea = LocalStorageArea::create(origin, this); m_storageAreaMap.set(origin, storageArea); return storageArea.release(); @@ -170,3 +172,6 @@ void LocalStorage::scheduleSync(PassRefPtr<LocalStorageArea> area) } } // namespace WebCore + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/LocalStorage.h b/WebCore/storage/LocalStorage.h index 1fd1f7a..393edf0 100644 --- a/WebCore/storage/LocalStorage.h +++ b/WebCore/storage/LocalStorage.h @@ -26,6 +26,8 @@ #ifndef LocalStorage_h #define LocalStorage_h +#if ENABLE(DOM_STORAGE) + #include "LocalStorageArea.h" #include "LocalStorageTask.h" #include "LocalStorageThread.h" @@ -78,4 +80,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // LocalStorage_h diff --git a/WebCore/storage/LocalStorageArea.cpp b/WebCore/storage/LocalStorageArea.cpp index e0900e6..bcc261c 100644 --- a/WebCore/storage/LocalStorageArea.cpp +++ b/WebCore/storage/LocalStorageArea.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "LocalStorageArea.h" +#if ENABLE(DOM_STORAGE) + #include "CString.h" #include "EventNames.h" #include "Frame.h" @@ -413,3 +415,6 @@ void LocalStorageArea::performSync() } } // namespace WebCore + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/LocalStorageArea.h b/WebCore/storage/LocalStorageArea.h index c6e7015..0ca5ab8 100644 --- a/WebCore/storage/LocalStorageArea.h +++ b/WebCore/storage/LocalStorageArea.h @@ -26,6 +26,8 @@ #ifndef LocalStorageArea_h #define LocalStorageArea_h +#if ENABLE(DOM_STORAGE) + #include "LocalStorageTask.h" #include "LocalStorageThread.h" @@ -102,4 +104,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // LocalStorageArea_h diff --git a/WebCore/storage/LocalStorageTask.cpp b/WebCore/storage/LocalStorageTask.cpp index 3d5b987..e5c42fd 100644 --- a/WebCore/storage/LocalStorageTask.cpp +++ b/WebCore/storage/LocalStorageTask.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "LocalStorageTask.h" +#if ENABLE(DOM_STORAGE) + #include "LocalStorage.h" #include "LocalStorageArea.h" #include "LocalStorageThread.h" @@ -82,3 +84,6 @@ void LocalStorageTask::performTask() } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/LocalStorageTask.h b/WebCore/storage/LocalStorageTask.h index 79063d0..d3ec315 100644 --- a/WebCore/storage/LocalStorageTask.h +++ b/WebCore/storage/LocalStorageTask.h @@ -26,6 +26,8 @@ #ifndef LocalStorageTask_h #define LocalStorageTask_h +#if ENABLE(DOM_STORAGE) + #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> @@ -61,4 +63,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // LocalStorageTask_h diff --git a/WebCore/storage/LocalStorageThread.cpp b/WebCore/storage/LocalStorageThread.cpp index da50c90..f35d44f 100644 --- a/WebCore/storage/LocalStorageThread.cpp +++ b/WebCore/storage/LocalStorageThread.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "LocalStorageThread.h" +#if ENABLE(DOM_STORAGE) + #include "LocalStorage.h" #include "LocalStorageArea.h" #include "LocalStorageTask.h" @@ -137,3 +139,6 @@ void LocalStorageThread::performTerminate() } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/LocalStorageThread.h b/WebCore/storage/LocalStorageThread.h index eb7d1ef..36f14cc 100644 --- a/WebCore/storage/LocalStorageThread.h +++ b/WebCore/storage/LocalStorageThread.h @@ -26,6 +26,8 @@ #ifndef LocalStorageThread_h #define LocalStorageThread_h +#if ENABLE(DOM_STORAGE) + #include <wtf/HashSet.h> #include <wtf/MessageQueue.h> #include <wtf/PassRefPtr.h> @@ -71,4 +73,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // LocalStorageThread_h diff --git a/WebCore/storage/SessionStorage.cpp b/WebCore/storage/SessionStorage.cpp index e70227a..c10a1be 100644 --- a/WebCore/storage/SessionStorage.cpp +++ b/WebCore/storage/SessionStorage.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "SessionStorage.h" +#if ENABLE(DOM_STORAGE) + #include "EventNames.h" #include "Frame.h" #include "FrameTree.h" @@ -73,3 +75,6 @@ PassRefPtr<StorageArea> SessionStorage::storageArea(SecurityOrigin* origin) } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/SessionStorage.h b/WebCore/storage/SessionStorage.h index 7b59aeb..13de203 100644 --- a/WebCore/storage/SessionStorage.h +++ b/WebCore/storage/SessionStorage.h @@ -26,6 +26,8 @@ #ifndef SessionStorage_h #define SessionStorage_h +#if ENABLE(DOM_STORAGE) + #include "SecurityOriginHash.h" #include "SessionStorageArea.h" @@ -61,4 +63,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // SessionStorage_h diff --git a/WebCore/storage/SessionStorageArea.cpp b/WebCore/storage/SessionStorageArea.cpp index 285922e..884208e 100644 --- a/WebCore/storage/SessionStorageArea.cpp +++ b/WebCore/storage/SessionStorageArea.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "SessionStorageArea.h" +#if ENABLE(DOM_STORAGE) + #include "EventNames.h" #include "Frame.h" #include "FrameTree.h" @@ -86,3 +88,6 @@ void SessionStorageArea::dispatchStorageEvent(const String& key, const String& o } } // namespace WebCore + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/SessionStorageArea.h b/WebCore/storage/SessionStorageArea.h index 3dad1af..95f425e 100644 --- a/WebCore/storage/SessionStorageArea.h +++ b/WebCore/storage/SessionStorageArea.h @@ -26,6 +26,8 @@ #ifndef SessionStorageArea_h #define SessionStorageArea_h +#if ENABLE(DOM_STORAGE) + #include "StorageArea.h" namespace WebCore { @@ -54,4 +56,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // SessionStorageArea_h diff --git a/WebCore/storage/Storage.cpp b/WebCore/storage/Storage.cpp index cf4413a..e228971 100644 --- a/WebCore/storage/Storage.cpp +++ b/WebCore/storage/Storage.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "Storage.h" +#if ENABLE(DOM_STORAGE) + #include "StorageArea.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> @@ -104,3 +106,6 @@ bool Storage::contains(const String& key) const } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/Storage.h b/WebCore/storage/Storage.h index 061f7c4..ca7a32e 100644 --- a/WebCore/storage/Storage.h +++ b/WebCore/storage/Storage.h @@ -26,6 +26,8 @@ #ifndef Storage_h #define Storage_h +#if ENABLE(DOM_STORAGE) + #include "StorageArea.h" #include <wtf/Forward.h> @@ -62,4 +64,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // Storage_h diff --git a/WebCore/storage/Storage.idl b/WebCore/storage/Storage.idl index 8ff9cd9..f2a7e9d 100644 --- a/WebCore/storage/Storage.idl +++ b/WebCore/storage/Storage.idl @@ -30,7 +30,8 @@ module storage { HasNameGetter, CustomDeleteProperty, CustomGetPropertyNames, - CustomPutFunction + CustomPutFunction, + Conditional=DOM_STORAGE ] Storage { readonly attribute [DontEnum] unsigned long length; [DontEnum] DOMString key(in unsigned long index) diff --git a/WebCore/storage/StorageArea.cpp b/WebCore/storage/StorageArea.cpp index 78b25c1..a98576d 100644 --- a/WebCore/storage/StorageArea.cpp +++ b/WebCore/storage/StorageArea.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "StorageArea.h" +#if ENABLE(DOM_STORAGE) + #include "CString.h" #include "ExceptionCode.h" #include "SecurityOrigin.h" @@ -123,3 +125,6 @@ void StorageArea::importItem(const String& key, const String& value) } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/StorageArea.h b/WebCore/storage/StorageArea.h index 2163287..9f0b83d 100644 --- a/WebCore/storage/StorageArea.h +++ b/WebCore/storage/StorageArea.h @@ -26,6 +26,8 @@ #ifndef StorageArea_h #define StorageArea_h +#if ENABLE(DOM_STORAGE) + #include "PlatformString.h" #include <wtf/Forward.h> @@ -80,4 +82,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // StorageArea_h diff --git a/WebCore/storage/StorageEvent.cpp b/WebCore/storage/StorageEvent.cpp index 54fd9ad..8600d3c 100644 --- a/WebCore/storage/StorageEvent.cpp +++ b/WebCore/storage/StorageEvent.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "StorageEvent.h" +#if ENABLE(DOM_STORAGE) + #include "DOMWindow.h" namespace WebCore { @@ -55,3 +57,6 @@ void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bo } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/StorageEvent.h b/WebCore/storage/StorageEvent.h index 1cd87c6..f523442 100644 --- a/WebCore/storage/StorageEvent.h +++ b/WebCore/storage/StorageEvent.h @@ -26,6 +26,8 @@ #ifndef StorageEvent_h #define StorageEvent_h +#if ENABLE(DOM_STORAGE) + #include "Event.h" namespace WebCore { @@ -69,4 +71,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // StorageEvent_h diff --git a/WebCore/storage/StorageEvent.idl b/WebCore/storage/StorageEvent.idl index 47ef67d..b5b3be5 100644 --- a/WebCore/storage/StorageEvent.idl +++ b/WebCore/storage/StorageEvent.idl @@ -26,7 +26,8 @@ module storage { interface [ - GenerateConstructor + GenerateConstructor, + Conditional=DOM_STORAGE ] StorageEvent : Event { readonly attribute DOMString key; readonly attribute [ConvertNullStringTo=Null] DOMString oldValue; diff --git a/WebCore/storage/StorageMap.cpp b/WebCore/storage/StorageMap.cpp index 880fc93..4c350c8 100644 --- a/WebCore/storage/StorageMap.cpp +++ b/WebCore/storage/StorageMap.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "StorageMap.h" +#if ENABLE(DOM_STORAGE) + namespace WebCore { PassRefPtr<StorageMap> StorageMap::create() @@ -156,3 +158,6 @@ void StorageMap::importItem(const String& key, const String& value) const } } + +#endif // ENABLE(DOM_STORAGE) + diff --git a/WebCore/storage/StorageMap.h b/WebCore/storage/StorageMap.h index d5d00a9..c6f3bc9 100644 --- a/WebCore/storage/StorageMap.h +++ b/WebCore/storage/StorageMap.h @@ -26,6 +26,8 @@ #ifndef StorageMap_h #define StorageMap_h +#if ENABLE(DOM_STORAGE) + #include "PlatformString.h" #include "StringHash.h" @@ -62,4 +64,6 @@ namespace WebCore { } // namespace WebCore +#endif // ENABLE(DOM_STORAGE) + #endif // StorageMap_h |