Changeset 148585 in webkit
- Timestamp:
- Apr 16, 2013 5:38:50 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148584 r148585 1 2013-04-16 Anders Carlsson <andersca@apple.com> 2 3 Clone storage namespaces for window.open 4 https://bugs.webkit.org/show_bug.cgi?id=114703 5 6 Reviewed by Sam Weinig. 7 8 Pass the new page to StorageNamespace::copy. 9 10 * page/Chrome.cpp: 11 (WebCore::Chrome::createWindow): 12 * storage/StorageNamespace.h: 13 (StorageNamespace): 14 * storage/StorageNamespaceImpl.cpp: 15 (WebCore::StorageNamespaceImpl::copy): 16 * storage/StorageNamespaceImpl.h: 17 (WebCore): 18 (StorageNamespaceImpl): 19 1 20 2013-04-16 Sam Weinig <sam@webkit.org> 2 21 -
trunk/Source/WebCore/page/Chrome.cpp
r141555 r148585 191 191 { 192 192 Page* newPage = m_client->createWindow(frame, request, features, action); 193 194 if (newPage) {195 if (StorageNamespace* oldSessionStorage = m_page->sessionStorage(false)) 196 newPage->setSessionStorage(oldSessionStorage->copy());197 }193 if (!newPage) 194 return 0; 195 196 if (StorageNamespace* oldSessionStorage = m_page->sessionStorage(false)) 197 newPage->setSessionStorage(oldSessionStorage->copy(newPage)); 198 198 199 199 return newPage; -
trunk/Source/WebCore/storage/StorageNamespace.h
r140498 r148585 44 44 virtual ~StorageNamespace() { } 45 45 virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) = 0; 46 virtual PassRefPtr<StorageNamespace> copy( ) = 0;46 virtual PassRefPtr<StorageNamespace> copy(Page* newPage) = 0; 47 47 virtual void close() = 0; 48 48 virtual void clearOriginForDeletion(SecurityOrigin*) = 0; -
trunk/Source/WebCore/storage/StorageNamespaceImpl.cpp
r136323 r148585 88 88 } 89 89 90 PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy( )90 PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy(Page*) 91 91 { 92 92 ASSERT(isMainThread()); -
trunk/Source/WebCore/storage/StorageNamespaceImpl.h
r143287 r148585 36 36 namespace WebCore { 37 37 38 38 class StorageAreaImpl; 39 39 40 class StorageNamespaceImpl : public StorageNamespace { 41 public: 42 static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path, unsigned quota); 43 static PassRefPtr<StorageNamespace> sessionStorageNamespace(unsigned quota); 40 class StorageNamespaceImpl : public StorageNamespace { 41 public: 42 static PassRefPtr<StorageNamespace> localStorageNamespace(const String& path, unsigned quota); 43 static PassRefPtr<StorageNamespace> sessionStorageNamespace(unsigned quota); 44 virtual ~StorageNamespaceImpl(); 44 45 45 virtual ~StorageNamespaceImpl(); 46 virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>); 47 virtual PassRefPtr<StorageNamespace> copy(); 48 virtual void close(); 46 virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>) OVERRIDE; 47 virtual PassRefPtr<StorageNamespace> copy(Page* newPage) OVERRIDE; 48 virtual void close() OVERRIDE; 49 49 50 51 52 53 54 virtual void clearOriginForDeletion(SecurityOrigin*);55 virtual void clearAllOriginsForDeletion();56 virtual void sync();57 virtual void closeIdleLocalStorageDatabases();50 // Not removing the origin's StorageArea from m_storageAreaMap because 51 // we're just deleting the underlying db file. If an item is added immediately 52 // after file deletion, we want the same StorageArea to eventually trigger 53 // a sync and for StorageAreaSync to recreate the backing db file. 54 virtual void clearOriginForDeletion(SecurityOrigin*) OVERRIDE; 55 virtual void clearAllOriginsForDeletion() OVERRIDE; 56 virtual void sync() OVERRIDE; 57 virtual void closeIdleLocalStorageDatabases() OVERRIDE; 58 58 59 60 59 private: 60 StorageNamespaceImpl(StorageType, const String& path, unsigned quota); 61 61 62 63 62 typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl> > StorageAreaMap; 63 StorageAreaMap m_storageAreaMap; 64 64 65 65 StorageType m_storageType; 66 66 67 68 69 67 // Only used if m_storageType == LocalStorage and the path was not "" in our constructor. 68 String m_path; 69 RefPtr<StorageSyncManager> m_syncManager; 70 70 71 unsigned m_quota; // The default quota for each new storage area. 72 bool m_isShutdown; 73 }; 71 // The default quota for each new storage area. 72 unsigned m_quota; 73 74 bool m_isShutdown; 75 }; 74 76 75 77 } // namespace WebCore -
trunk/Source/WebKit2/ChangeLog
r148564 r148585 1 2013-04-16 Anders Carlsson <andersca@apple.com> 2 3 Clone storage namespaces for window.open 4 https://bugs.webkit.org/show_bug.cgi?id=114703 5 6 Reviewed by Sam Weinig. 7 8 * UIProcess/Storage/StorageManager.cpp: 9 (WebKit::StorageManager::StorageArea::clone): 10 New helper function for cloning a storage area. 11 12 (WebKit::StorageManager::StorageArea::setItem): 13 Correctly handle the copy-on-write feature of StorageMap if it has multiple storage areas pointing to it. 14 15 (WebKit::StorageManager::StorageArea::removeItem): 16 Ditto. 17 18 (WebKit::StorageManager::SessionStorageNamespace::cloneTo): 19 Add cloned storage areas. 20 21 * WebProcess/Storage/StorageNamespaceImpl.cpp: 22 (WebKit::StorageNamespaceImpl::copy): 23 Create a new session storage namespace for the new page. 24 1 25 2013-04-16 Beth Dakin <bdakin@apple.com> 2 26 -
trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp
r148250 r148585 47 47 void removeListener(CoreIPC::Connection*, uint64_t storageMapID); 48 48 49 PassRefPtr<StorageArea> clone() const; 50 49 51 void setItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException); 50 52 void removeItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& urlString); … … 91 93 } 92 94 95 PassRefPtr<StorageManager::StorageArea> StorageManager::StorageArea::clone() const 96 { 97 RefPtr<StorageArea> storageArea = StorageArea::create(m_quotaInBytes); 98 storageArea->m_storageMap = m_storageMap; 99 100 return storageArea.release(); 101 } 102 93 103 void StorageManager::StorageArea::setItem(CoreIPC::Connection* sourceConnection, uint64_t sourceStorageAreaID, const String& key, const String& value, const String& urlString, bool& quotaException) 94 104 { 95 ASSERT(m_storageMap->hasOneRef());96 97 105 String oldValue; 98 m_storageMap->setItem(key, value, oldValue, quotaException); 106 107 RefPtr<StorageMap> newStorageMap = m_storageMap->setItem(key, value, oldValue, quotaException); 108 if (newStorageMap) 109 m_storageMap = newStorageMap.release(); 99 110 100 111 if (!quotaException) … … 105 116 { 106 117 String oldValue; 107 m_storageMap->removeItem(key, oldValue); 118 RefPtr<StorageMap> newStorageMap = m_storageMap->removeItem(key, oldValue); 119 if (newStorageMap) 120 m_storageMap = newStorageMap.release(); 108 121 109 122 if (oldValue.isNull()) … … 189 202 ASSERT_UNUSED(newSessionStorageNamespace, newSessionStorageNamespace.isEmpty()); 190 203 191 // FIXME: Implement. 204 for (HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea> >::const_iterator it = m_storageAreaMap.begin(), end = m_storageAreaMap.end(); it != end; ++it) 205 newSessionStorageNamespace.m_storageAreaMap.add(it->key, it->value->clone()); 192 206 } 193 207 -
trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.cpp
r148161 r148585 61 61 } 62 62 63 PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy( )63 PassRefPtr<StorageNamespace> StorageNamespaceImpl::copy(Page* newPage) 64 64 { 65 // FIXME: Implement this.66 ASSERT_NOT_REACHED(); 67 return 0;65 ASSERT(m_storageNamespaceID); 66 67 return createSessionStorageNamespace(WebPage::fromCorePage(newPage)); 68 68 } 69 69 -
trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceImpl.h
r148161 r148585 49 49 50 50 virtual PassRefPtr<WebCore::StorageArea> storageArea(PassRefPtr<WebCore::SecurityOrigin>) OVERRIDE; 51 virtual PassRefPtr<WebCore::StorageNamespace> copy( ) OVERRIDE;51 virtual PassRefPtr<WebCore::StorageNamespace> copy(WebCore::Page*) OVERRIDE; 52 52 virtual void close() OVERRIDE; 53 53 virtual void clearOriginForDeletion(WebCore::SecurityOrigin*) OVERRIDE;
Note: See TracChangeset
for help on using the changeset viewer.