WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch 4 in this set
4.20090608.patch (text/plain), 34.15 KB, created by
Jeremy Orlow
on 2009-06-09 01:12:11 PDT
(
hide
)
Description:
Patch 4 in this set
Filename:
MIME Type:
Creator:
Jeremy Orlow
Created:
2009-06-09 01:12:11 PDT
Size:
34.15 KB
patch
obsolete
>diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj >index 0f99f8a..bb09d03 100644 >--- a/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -771,10 +771,6 @@ > 514185EF0CD65F0400763C99 /* ChangeVersionWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */; }; > 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; }; > 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; }; >- 514B49DB0DB6D6AD001C3770 /* LocalStorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */; }; >- 514B49DC0DB6D6AD001C3770 /* LocalStorageArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */; }; >- 514B49DF0DB6D6B6001C3770 /* SessionStorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */; }; >- 514B49E00DB6D6B6001C3770 /* SessionStorageArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */; }; > 514C76370CE9225E007EF3CD /* JSSQLError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76350CE9225E007EF3CD /* JSSQLError.cpp */; }; > 514C76380CE9225E007EF3CD /* JSSQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */; }; > 514C764C0CE9234E007EF3CD /* AuthenticationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76420CE9234E007EF3CD /* AuthenticationMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -5694,10 +5690,6 @@ > 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChangeVersionWrapper.cpp; sourceTree = "<group>"; }; > 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = "<group>"; }; > 514B3F750C722055000530DF /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = "<group>"; }; >- 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageArea.h; sourceTree = "<group>"; }; >- 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageArea.cpp; sourceTree = "<group>"; }; >- 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionStorageArea.h; sourceTree = "<group>"; }; >- 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionStorageArea.cpp; sourceTree = "<group>"; }; > 514C76350CE9225E007EF3CD /* JSSQLError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLError.cpp; sourceTree = "<group>"; }; > 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransaction.cpp; sourceTree = "<group>"; }; > 514C76420CE9234E007EF3CD /* AuthenticationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationMac.h; sourceTree = "<group>"; }; >@@ -9609,8 +9601,6 @@ > 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */, > 51BE38260DAEF7DA001085FC /* LocalStorage.cpp */, > 51BE38270DAEF7DA001085FC /* LocalStorage.h */, >- 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */, >- 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */, > 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */, > 511F23140DC160DA004F0032 /* LocalStorageTask.h */, > 511F23150DC160DA004F0032 /* LocalStorageThread.cpp */, >@@ -9638,8 +9628,6 @@ > 1A7CCB180CD9469A00B7B64E /* SQLTransactionErrorCallback.h */, > 51E0BB220DA572A600A9E417 /* SessionStorage.cpp */, > 51E0BB210DA572A600A9E417 /* SessionStorage.h */, >- 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */, >- 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */, > 51E3F9C50DA059DC00250911 /* Storage.cpp */, > 51E3F9C40DA059DC00250911 /* Storage.h */, > 51E3F9D10DA05D7100250911 /* Storage.idl */, >@@ -16076,7 +16064,6 @@ > 656D37320ADBA5DE00A4554D /* LoaderNSURLExtras.h in Headers */, > 06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */, > 51BE38290DAEF7DA001085FC /* LocalStorage.h in Headers */, >- 514B49DB0DB6D6AD001C3770 /* LocalStorageArea.h in Headers */, > 511F23180DC160DA004F0032 /* LocalStorageTask.h in Headers */, > 511F231A0DC160DA004F0032 /* LocalStorageThread.h in Headers */, > 935207BE09BD410A00F2038D /* LocalizedStrings.h in Headers */, >@@ -16517,7 +16504,6 @@ > 93309E0E099E64920056E581 /* SelectionController.h in Headers */, > BC7FA6810D1F167900DB22A9 /* SelectorNodeList.h in Headers */, > 51E0BB230DA572A600A9E417 /* SessionStorage.h in Headers */, >- 514B49DF0DB6D6B6001C3770 /* SessionStorageArea.h in Headers */, > 93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */, > 93F1994F08245E59001E9ABC /* Settings.h in Headers */, > BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, >@@ -18141,7 +18127,6 @@ > 656D37330ADBA5DE00A4554D /* LoaderNSURLExtras.mm in Sources */, > 06E81EEC0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm in Sources */, > 51BE38280DAEF7DA001085FC /* LocalStorage.cpp in Sources */, >- 514B49DC0DB6D6AD001C3770 /* LocalStorageArea.cpp in Sources */, > 511F23170DC160DA004F0032 /* LocalStorageTask.cpp in Sources */, > 511F23190DC160DA004F0032 /* LocalStorageThread.cpp in Sources */, > 935207C009BD412100F2038D /* LocalizedStringsMac.mm in Sources */, >@@ -18542,7 +18527,6 @@ > 4A8C96EB0BE69032004EEFF0 /* SelectionControllerMac.mm in Sources */, > BC7FA6820D1F167900DB22A9 /* SelectorNodeList.cpp in Sources */, > 51E0BB240DA572A600A9E417 /* SessionStorage.cpp in Sources */, >- 514B49E00DB6D6B6001C3770 /* SessionStorageArea.cpp in Sources */, > 93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */, > 14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */, > BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */, >diff --git a/WebCore/storage/LocalStorage.cpp b/WebCore/storage/LocalStorage.cpp >index c6f234a..0065eb6 100644 >--- a/WebCore/storage/LocalStorage.cpp >+++ b/WebCore/storage/LocalStorage.cpp >@@ -31,7 +31,6 @@ > #include "FileSystem.h" > #include "Frame.h" > #include "FrameTree.h" >-#include "LocalStorageArea.h" > #include "Page.h" > #include "PageGroup.h" > #include "StorageArea.h" >@@ -89,11 +88,11 @@ PassRefPtr<StorageArea> LocalStorage::storageArea(SecurityOrigin* origin) > // FIXME: If the storage area is being established for the first time here, we need to > // sync its existance and quota out to disk via an task of type AreaSync > >- RefPtr<LocalStorageArea> storageArea; >+ RefPtr<StorageArea> storageArea; > if (storageArea = m_storageAreaMap.get(origin)) > return storageArea.release(); > >- storageArea = LocalStorageArea::create(origin, m_syncManager); >+ storageArea = StorageArea::createLocalStorage(origin, m_syncManager); > m_storageAreaMap.set(origin, storageArea); > return storageArea.release(); > } >diff --git a/WebCore/storage/LocalStorage.h b/WebCore/storage/LocalStorage.h >index 727ec27..3191c8e 100644 >--- a/WebCore/storage/LocalStorage.h >+++ b/WebCore/storage/LocalStorage.h >@@ -26,7 +26,6 @@ > #ifndef LocalStorage_h > #define LocalStorage_h > >-#include "LocalStorageArea.h" > #include "SecurityOriginHash.h" > > #include <wtf/HashMap.h> >@@ -50,7 +49,7 @@ namespace WebCore { > private: > LocalStorage(const String& path); > >- typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<LocalStorageArea>, SecurityOriginHash> LocalStorageAreaMap; >+ typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> LocalStorageAreaMap; > LocalStorageAreaMap m_storageAreaMap; > > String m_path; >diff --git a/WebCore/storage/LocalStorageArea.cpp b/WebCore/storage/LocalStorageArea.cpp >deleted file mode 100644 >index 7a2a305..0000000 >--- a/WebCore/storage/LocalStorageArea.cpp >+++ /dev/null >@@ -1,106 +0,0 @@ >-/* >- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. 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 APPLE INC. ``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 APPLE INC. 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 "LocalStorageArea.h" >- >-#include "CString.h" >-#include "EventNames.h" >-#include "Frame.h" >-#include "HTMLElement.h" >-#include "Page.h" >-#include "PageGroup.h" >-#include "StorageEvent.h" >-#include "StorageAreaSync.h" >-#include "StorageSyncManager.h" >- >-namespace WebCore { >- >-PassRefPtr<LocalStorageArea> LocalStorageArea::create(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager) >-{ >- return adoptRef(new LocalStorageArea(origin, syncManager)); >-} >- >-LocalStorageArea::LocalStorageArea(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager) >- : StorageArea(origin) >- , m_storageAreaSync(StorageAreaSync::create(syncManager, this)) >- , m_storageSyncManager(syncManager) >-{ >-} >- >-void LocalStorageArea::scheduleFinalSync() >-{ >- m_storageAreaSync->scheduleFinalSync(); >-} >- >-void LocalStorageArea::itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) >-{ >- m_storageAreaSync->scheduleItemForSync(key, newValue); >- dispatchStorageEvent(key, oldValue, newValue, sourceFrame); >-} >- >-void LocalStorageArea::itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) >-{ >- m_storageAreaSync->scheduleItemForSync(key, String()); >- dispatchStorageEvent(key, oldValue, String(), sourceFrame); >-} >- >-void LocalStorageArea::areaCleared(Frame* sourceFrame) >-{ >- m_storageAreaSync->scheduleClear(); >- dispatchStorageEvent(String(), String(), String(), sourceFrame); >-} >- >-void LocalStorageArea::blockUntilImportComplete() const >-{ >- m_storageAreaSync->blockUntilImportComplete(); >-} >- >-void LocalStorageArea::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) >-{ >- ASSERT(isMainThread()); >- >- Page* page = sourceFrame->page(); >- if (!page) >- return; >- >- // Need to copy all relevant frames from every page to a vector, since sending the event to one frame might mutate the frame tree >- // of any given page in the group, or mutate the page group itself >- Vector<RefPtr<Frame> > frames; >- const HashSet<Page*>& pages = page->group().pages(); >- >- HashSet<Page*>::const_iterator end = pages.end(); >- for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { >- for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { >- if (frame->document()->securityOrigin()->equal(securityOrigin())) >- frames.append(frame); >- } >- } >- >- for (unsigned i = 0; i < frames.size(); ++i) >- frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow())); >-} >- >-} // namespace WebCore >diff --git a/WebCore/storage/LocalStorageArea.h b/WebCore/storage/LocalStorageArea.h >deleted file mode 100644 >index 2fd7482..0000000 >--- a/WebCore/storage/LocalStorageArea.h >+++ /dev/null >@@ -1,58 +0,0 @@ >-/* >- * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. 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 APPLE INC. ``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 APPLE INC. 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 LocalStorageArea_h >-#define LocalStorageArea_h >- >-#include "StorageArea.h" >- >-namespace WebCore { >- >- class StorageAreaSync; >- class StorageSyncManager; >- >- class LocalStorageArea : public StorageArea { >- public: >- static PassRefPtr<LocalStorageArea> create(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager); >- >- void scheduleFinalSync(); >- >- private: >- LocalStorageArea(SecurityOrigin*, PassRefPtr<StorageSyncManager> syncManager); >- >- virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); >- virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame); >- virtual void areaCleared(Frame* sourceFrame); >- virtual void blockUntilImportComplete() const; >- >- void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); >- >- RefPtr<StorageAreaSync> m_storageAreaSync; >- RefPtr<StorageSyncManager> m_storageSyncManager; >- }; >- >-} // namespace WebCore >- >-#endif // LocalStorageArea_h >diff --git a/WebCore/storage/SessionStorage.cpp b/WebCore/storage/SessionStorage.cpp >index e70227a..0fc2712 100644 >--- a/WebCore/storage/SessionStorage.cpp >+++ b/WebCore/storage/SessionStorage.cpp >@@ -54,7 +54,7 @@ PassRefPtr<SessionStorage> SessionStorage::copy(Page* newPage) > > SessionStorageAreaMap::iterator end = m_storageAreaMap.end(); > for (SessionStorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i) { >- RefPtr<SessionStorageArea> areaCopy = i->second->copy(i->first.get(), newPage); >+ RefPtr<StorageArea> areaCopy = i->second->copy(i->first.get(), newPage); > newSession->m_storageAreaMap.set(i->first, areaCopy.release()); > } > >@@ -63,11 +63,11 @@ PassRefPtr<SessionStorage> SessionStorage::copy(Page* newPage) > > PassRefPtr<StorageArea> SessionStorage::storageArea(SecurityOrigin* origin) > { >- RefPtr<SessionStorageArea> storageArea; >+ RefPtr<StorageArea> storageArea; > if (storageArea = m_storageAreaMap.get(origin)) > return storageArea.release(); > >- storageArea = SessionStorageArea::create(origin, m_page); >+ storageArea = StorageArea::createSessionStorage(origin, m_page); > m_storageAreaMap.set(origin, storageArea); > return storageArea.release(); > } >diff --git a/WebCore/storage/SessionStorage.h b/WebCore/storage/SessionStorage.h >index 0d87e64..6e62c4c 100644 >--- a/WebCore/storage/SessionStorage.h >+++ b/WebCore/storage/SessionStorage.h >@@ -27,7 +27,7 @@ > #define SessionStorage_h > > #include "SecurityOriginHash.h" >-#include "SessionStorageArea.h" >+#include "StorageArea.h" > > #include <wtf/HashMap.h> > #include <wtf/RefCounted.h> >@@ -54,7 +54,7 @@ namespace WebCore { > > Page* m_page; > >- typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<SessionStorageArea>, SecurityOriginHash> SessionStorageAreaMap; >+ typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> SessionStorageAreaMap; > SessionStorageAreaMap m_storageAreaMap; > }; > >diff --git a/WebCore/storage/SessionStorageArea.cpp b/WebCore/storage/SessionStorageArea.cpp >deleted file mode 100644 >index b59e2a0..0000000 >--- a/WebCore/storage/SessionStorageArea.cpp >+++ /dev/null >@@ -1,92 +0,0 @@ >-/* >- * Copyright (C) 2008 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. 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 APPLE INC. ``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 APPLE INC. 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 "SessionStorageArea.h" >- >-#include "EventNames.h" >-#include "Frame.h" >-#include "FrameTree.h" >-#include "HTMLElement.h" >-#include "Page.h" >-#include "PlatformString.h" >-#include "SecurityOrigin.h" >-#include "StorageEvent.h" >-#include "StorageMap.h" >- >-namespace WebCore { >- >-PassRefPtr<SessionStorageArea> SessionStorageArea::copy(SecurityOrigin* origin, Page* page) >-{ >- return adoptRef(new SessionStorageArea(origin, page, this)); >-} >- >-SessionStorageArea::SessionStorageArea(SecurityOrigin* origin, Page* page) >- : StorageArea(origin) >- , m_page(page) >-{ >- ASSERT(page); >-} >- >-SessionStorageArea::SessionStorageArea(SecurityOrigin* origin, Page* page, SessionStorageArea* area) >- : StorageArea(origin, area) >- , m_page(page) >-{ >- ASSERT(page); >-} >- >-void SessionStorageArea::itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) >-{ >- dispatchStorageEvent(key, oldValue, newValue, sourceFrame); >-} >- >-void SessionStorageArea::itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) >-{ >- dispatchStorageEvent(key, oldValue, String(), sourceFrame); >-} >- >-void SessionStorageArea::areaCleared(Frame* sourceFrame) >-{ >- dispatchStorageEvent(String(), String(), String(), sourceFrame); >-} >- >-void SessionStorageArea::blockUntilImportComplete() const >-{ >-} >- >-void SessionStorageArea::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) >-{ >- // For SessionStorage events, each frame in the page's frametree with the same origin as this StorageArea needs to be notified of the change >- Vector<RefPtr<Frame> > frames; >- for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { >- if (frame->document()->securityOrigin()->equal(securityOrigin())) >- frames.append(frame); >- } >- >- for (unsigned i = 0; i < frames.size(); ++i) >- frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow())); >-} >- >-} // namespace WebCore >diff --git a/WebCore/storage/SessionStorageArea.h b/WebCore/storage/SessionStorageArea.h >deleted file mode 100644 >index 34d2f03..0000000 >--- a/WebCore/storage/SessionStorageArea.h >+++ /dev/null >@@ -1,56 +0,0 @@ >-/* >- * Copyright (C) 2008 Apple Inc. All Rights Reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. 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 APPLE INC. ``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 APPLE INC. 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 SessionStorageArea_h >-#define SessionStorageArea_h >- >-#include "StorageArea.h" >- >-namespace WebCore { >- >- class Page; >- >- class SessionStorageArea : public StorageArea { >- public: >- static PassRefPtr<SessionStorageArea> create(SecurityOrigin* origin, Page* page) { return adoptRef(new SessionStorageArea(origin, page)); } >- PassRefPtr<SessionStorageArea> copy(SecurityOrigin*, Page*); >- >- private: >- SessionStorageArea(SecurityOrigin*, Page*); >- SessionStorageArea(SecurityOrigin*, Page*, SessionStorageArea*); >- >- virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); >- virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame); >- virtual void areaCleared(Frame* sourceFrame); >- virtual void blockUntilImportComplete() const; >- >- void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); >- >- Page* m_page; >- }; >- >-} // namespace WebCore >- >-#endif // SessionStorageArea_h >diff --git a/WebCore/storage/StorageArea.cpp b/WebCore/storage/StorageArea.cpp >index 8eea971..9ca414e 100644 >--- a/WebCore/storage/StorageArea.cpp >+++ b/WebCore/storage/StorageArea.cpp >@@ -26,30 +26,68 @@ > #include "config.h" > #include "StorageArea.h" > >-#include "CString.h" >+#include "EventNames.h" > #include "ExceptionCode.h" > #include "Frame.h" > #include "Page.h" >+#include "PageGroup.h" > #include "SecurityOrigin.h" > #include "Settings.h" >+#include "StorageEvent.h" >+#include "StorageAreaSync.h" > #include "StorageMap.h" >+#include "StorageSyncManager.h" > > namespace WebCore { > >-StorageArea::StorageArea(SecurityOrigin* origin) >+PassRefPtr<StorageArea> StorageArea::createLocalStorage(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager) >+{ >+ return adoptRef(new StorageArea(origin, syncManager)); >+} >+ >+StorageArea::StorageArea(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager) > : m_securityOrigin(origin) > , m_storageMap(StorageMap::create()) >+ , m_storageAreaSync(0) >+ , m_storageSyncManager(syncManager) >+ , m_sessionStoragePage(0) > { >+ ASSERT(m_securityOrigin); >+ ASSERT(m_storageMap); >+ >+ // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing, >+ // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894 >+ if (syncManager) { >+ m_storageAreaSync = StorageAreaSync::create(syncManager, this); >+ ASSERT(m_storageAreaSync); >+ ASSERT(m_storageSyncManager); >+ } > } > >-StorageArea::StorageArea(SecurityOrigin* origin, StorageArea* area) >- : m_securityOrigin(origin) >- , m_storageMap(area->m_storageMap) >+PassRefPtr<StorageArea> StorageArea::createSessionStorage(SecurityOrigin* origin, Page* page) > { >+ return adoptRef(new StorageArea(origin, page, 0)); > } > >-StorageArea::~StorageArea() >+PassRefPtr<StorageArea> StorageArea::copy(SecurityOrigin* origin, Page* page) > { >+ return adoptRef(new StorageArea(origin, page, this)); >+} >+ >+StorageArea::StorageArea(SecurityOrigin* origin, Page* page, StorageArea* area) >+ : m_securityOrigin(origin) >+ , m_storageMap(area->m_storageMap) >+ , m_storageAreaSync(0) >+ , m_storageSyncManager(0) >+ , m_sessionStoragePage(page) >+{ >+ ASSERT(m_securityOrigin); >+ ASSERT(m_sessionStoragePage); >+ >+ if (!m_storageMap) { >+ m_storageMap = StorageMap::create(); >+ ASSERT(m_storageMap); >+ } > } > > unsigned StorageArea::length() const >@@ -102,8 +140,11 @@ void StorageArea::setItem(const String& key, const String& value, ExceptionCode& > m_storageMap = newMap.release(); > > // Only notify the client if an item was actually changed >- if (oldValue != value) >- itemChanged(key, oldValue, value, frame); >+ if (oldValue != value) { >+ if (m_storageAreaSync) >+ m_storageAreaSync->scheduleItemForSync(key, value); >+ dispatchStorageEvent(key, oldValue, value, frame); >+ } > } > > void StorageArea::removeItem(const String& key, Frame* frame) >@@ -119,8 +160,11 @@ void StorageArea::removeItem(const String& key, Frame* frame) > m_storageMap = newMap.release(); > > // Only notify the client if an item was actually removed >- if (!oldValue.isNull()) >- itemRemoved(key, oldValue, frame); >+ if (!oldValue.isNull()) { >+ if (m_storageAreaSync) >+ m_storageAreaSync->scheduleItemForSync(key, String()); >+ dispatchStorageEvent(key, oldValue, String(), frame); >+ } > } > > void StorageArea::clear(Frame* frame) >@@ -132,7 +176,9 @@ void StorageArea::clear(Frame* frame) > > m_storageMap = StorageMap::create(); > >- areaCleared(frame); >+ if (m_storageAreaSync) >+ m_storageAreaSync->scheduleClear(); >+ dispatchStorageEvent(String(), String(), String(), frame); > } > > bool StorageArea::contains(const String& key) const >@@ -147,4 +193,49 @@ void StorageArea::importItem(const String& key, const String& value) > m_storageMap->importItem(key, value); > } > >+void StorageArea::scheduleFinalSync() >+{ >+ if (m_storageAreaSync) >+ m_storageAreaSync->scheduleFinalSync(); >+} >+ >+void StorageArea::blockUntilImportComplete() const >+{ >+ if (m_storageAreaSync) >+ m_storageAreaSync->blockUntilImportComplete(); >+} >+ >+void StorageArea::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) >+{ >+ // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree >+ // of any given page in the group or mutate the page group itself. >+ Vector<RefPtr<Frame> > frames; >+ >+ if (m_sessionStoragePage) { >+ // Send events only to our page. >+ for (Frame* frame = m_sessionStoragePage->mainFrame(); frame; frame = frame->tree()->traverseNext()) { >+ if (frame->document()->securityOrigin()->equal(securityOrigin())) >+ frames.append(frame); >+ } >+ } else { >+ // FIXME: When can this occur? >+ Page* page = sourceFrame->page(); >+ if (!page) >+ return; >+ >+ // Send events to every page. >+ const HashSet<Page*>& pages = page->group().pages(); >+ HashSet<Page*>::const_iterator end = pages.end(); >+ for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { >+ for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) { >+ if (frame->document()->securityOrigin()->equal(securityOrigin())) >+ frames.append(frame); >+ } >+ } >+ } >+ >+ for (unsigned i = 0; i < frames.size(); ++i) >+ frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow())); >+} >+ > } >diff --git a/WebCore/storage/StorageArea.h b/WebCore/storage/StorageArea.h >index b342263..2f17e83 100644 >--- a/WebCore/storage/StorageArea.h >+++ b/WebCore/storage/StorageArea.h >@@ -27,6 +27,10 @@ > #define StorageArea_h > > #include "PlatformString.h" >+#include "SecurityOrigin.h" >+#include "StorageAreaSync.h" >+#include "StorageMap.h" >+#include "StorageSyncManager.h" > > #include <wtf/Forward.h> > #include <wtf/PassRefPtr.h> >@@ -36,13 +40,18 @@ > namespace WebCore { > > class Frame; >+ class Page; > class SecurityOrigin; >+ class StorageAreaSync; > class StorageMap; >+ class StorageSyncManager; > typedef int ExceptionCode; > > class StorageArea : public ThreadSafeShared<StorageArea> { > public: >- virtual ~StorageArea(); >+ static PassRefPtr<StorageArea> createLocalStorage(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager); >+ static PassRefPtr<StorageArea> createSessionStorage(SecurityOrigin* origin, Page* page); >+ PassRefPtr<StorageArea> copy(SecurityOrigin*, Page*); > > // The HTML5 DOM Storage API > unsigned length() const; >@@ -53,23 +62,28 @@ namespace WebCore { > void clear(Frame* sourceFrame); > > bool contains(const String& key) const; >+ void scheduleFinalSync(); > > // Could be called from a background thread. > void importItem(const String& key, const String& value); > SecurityOrigin* securityOrigin() { return m_securityOrigin.get(); } > > protected: >- StorageArea(SecurityOrigin*); >- StorageArea(SecurityOrigin*, StorageArea*); >+ StorageArea(SecurityOrigin*, PassRefPtr<StorageSyncManager>); >+ StorageArea(SecurityOrigin*, Page*); >+ StorageArea(SecurityOrigin*, Page*, StorageArea*); > > private: >- virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) = 0; >- virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) = 0; >- virtual void areaCleared(Frame* sourceFrame) = 0; >- virtual void blockUntilImportComplete() const = 0; >- >+ void blockUntilImportComplete() const; >+ >+ void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); >+ > RefPtr<SecurityOrigin> m_securityOrigin; > RefPtr<StorageMap> m_storageMap; >+ >+ RefPtr<StorageAreaSync> m_storageAreaSync; >+ RefPtr<StorageSyncManager> m_storageSyncManager; >+ Page* m_sessionStoragePage; // NULL iff it's LocalStorage > }; > > } // namespace WebCore >diff --git a/WebCore/storage/StorageAreaSync.cpp b/WebCore/storage/StorageAreaSync.cpp >index 0aeb9e7..e2ffd9d 100644 >--- a/WebCore/storage/StorageAreaSync.cpp >+++ b/WebCore/storage/StorageAreaSync.cpp >@@ -55,7 +55,11 @@ StorageAreaSync::StorageAreaSync(PassRefPtr<StorageSyncManager> storageSyncManag > , m_importComplete(false) > { > ASSERT(m_storageArea); >- if (!m_syncManager || !m_syncManager->scheduleImport(this)) >+ ASSERT(m_syncManager); >+ >+ // FIXME: If it can't import, then the default WebKit behavior should be that of private browsing, >+ // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894 >+ if (!m_syncManager->scheduleImport(this)) > m_importComplete = true; > } > >@@ -69,8 +73,6 @@ StorageAreaSync::~StorageAreaSync() > void StorageAreaSync::scheduleFinalSync() > { > ASSERT(isMainThread()); >- if (!m_syncManager) >- return; > > if (m_syncTimer.isActive()) > m_syncTimer.stop(); >@@ -119,8 +121,6 @@ void StorageAreaSync::scheduleClear() > void StorageAreaSync::syncTimerFired(Timer<StorageAreaSync>*) > { > ASSERT(isMainThread()); >- if (!m_syncManager) >- return; > > HashMap<String, String>::iterator it = m_changedItems.begin(); > HashMap<String, String>::iterator end = m_changedItems.end(); >@@ -159,8 +159,6 @@ void StorageAreaSync::performImport() > { > ASSERT(!isMainThread()); > ASSERT(!m_database.isOpen()); >- if (!m_syncManager) >- return; > > String databaseFilename = m_syncManager->fullDatabaseFilename(m_storageArea->securityOrigin()); > >diff --git a/WebCore/storage/StorageAreaSync.h b/WebCore/storage/StorageAreaSync.h >index 8d887fc..b41bdcc 100644 >--- a/WebCore/storage/StorageAreaSync.h >+++ b/WebCore/storage/StorageAreaSync.h >@@ -34,6 +34,7 @@ > > namespace WebCore { > >+ class Frame; > class StorageArea; > class StorageSyncManager; > >diff --git a/WebCore/storage/StorageSyncManager.h b/WebCore/storage/StorageSyncManager.h >index ec72d79..a1a93c6 100644 >--- a/WebCore/storage/StorageSyncManager.h >+++ b/WebCore/storage/StorageSyncManager.h >@@ -26,9 +26,9 @@ > #ifndef StorageSyncManager_h > #define StorageSyncManager_h > >-#include "LocalStorageArea.h" > #include "LocalStorageTask.h" > #include "LocalStorageThread.h" >+#include "StorageArea.h" > #include "StorageAreaSync.h" > > #include <wtf/Threading.h>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 25376
:
30936
|
30978
|
31014
|
31016
|
31024
|
31085
|
31193
|
31389
|
31395
|
31504
|
31571
|
31685