Changeset 46502 in webkit
- Timestamp:
- Jul 28, 2009 3:26:16 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r46501 r46502 1 2009-07-28 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Misc cleanup in DOM Storage. 6 https://bugs.webkit.org/show_bug.cgi?id=27517 7 8 The StorageAreaImpl changes are all for Chromium. Because the DOM Storage implementation 9 runs in a different process from where the Frame object lives, Chromium passes in NULL 10 for the sourceFrame. This affects events and handling privateBrowsing. Chromium's 11 incognito mode does not use the private browsing setting, so that's not a concern. As for 12 events, I've decided to simply disable them for now. 13 14 The StorageNamespaceImpl changes get rid of a stale comment (path is .copy'ed for thread- 15 safety) and to add an assert that .copy is only ever called on a SessionStorage namespace. 16 17 Also cleaned up tailing whitespace in several parts of StorageAreaImpl.cpp 18 19 * storage/StorageArea.cpp: Removed. (It was empty anyway.) 20 * storage/StorageAreaImpl.cpp: 21 (WebCore::privateBrowsingEnabled): Factored out the check. 22 (WebCore::StorageAreaImpl::setItem): Make frame optional. 23 (WebCore::StorageAreaImpl::removeItem): ditto 24 (WebCore::StorageAreaImpl::clear): ditto 25 (WebCore::StorageAreaImpl::dispatchStorageEvent): Disable in Chromium for now. 26 * storage/StorageNamespaceImpl.cpp: 27 (WebCore::StorageNamespaceImpl::StorageNamespaceImpl): Remove stale comment. 28 (WebCore::StorageNamespaceImpl::copy): Add assert that it's SessionStorage. 29 1 30 2009-07-28 Alpha Lam <hclam@google.com> 2 31 -
trunk/WebCore/storage/StorageAreaImpl.cpp
r46075 r46502 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 26 #include "config.h" 27 27 #include "StorageAreaImpl.h" … … 88 88 } 89 89 90 static bool privateBrowsingEnabled(Frame* frame) 91 { 92 #if PLATFORM(CHROMIUM) 93 // The frame pointer can be NULL in Chromium since this call is made in a different 94 // process from where the Frame object exists. Luckily, private browseing is 95 // implemented differently in Chromium, so it'd never return true anyway. 96 ASSERT(!frame); 97 return false; 98 #else 99 return frame->page()->settings()->privateBrowsingEnabled(); 100 #endif 101 } 102 90 103 unsigned StorageAreaImpl::length() const 91 104 { … … 98 111 ASSERT(!m_isShutdown); 99 112 blockUntilImportComplete(); 100 113 101 114 String key; 102 115 103 116 if (!m_storageMap->key(index, key)) { 104 117 ec = INDEX_SIZE_ERR; 105 118 return String(); 106 119 } 107 120 108 121 return key; 109 122 } … … 113 126 ASSERT(!m_isShutdown); 114 127 blockUntilImportComplete(); 115 128 116 129 return m_storageMap->getItem(key); 117 130 } … … 122 135 ASSERT(!value.isNull()); 123 136 blockUntilImportComplete(); 124 125 if ( frame->page()->settings()->privateBrowsingEnabled()) {137 138 if (privateBrowsingEnabled(frame)) { 126 139 ec = QUOTA_EXCEEDED_ERR; 127 140 return; … … 134 147 // return; 135 148 // } 136 137 String oldValue; 149 150 String oldValue; 138 151 RefPtr<StorageMap> newMap = m_storageMap->setItem(key, value, oldValue); 139 152 140 153 if (newMap) 141 154 m_storageMap = newMap.release(); … … 153 166 ASSERT(!m_isShutdown); 154 167 blockUntilImportComplete(); 155 156 if ( frame->page()->settings()->privateBrowsingEnabled())168 169 if (privateBrowsingEnabled(frame)) 157 170 return; 158 171 … … 174 187 ASSERT(!m_isShutdown); 175 188 blockUntilImportComplete(); 176 177 if ( frame->page()->settings()->privateBrowsingEnabled())178 return; 179 189 190 if (privateBrowsingEnabled(frame)) 191 return; 192 180 193 m_storageMap = StorageMap::create(); 181 194 182 195 if (m_storageAreaSync) 183 196 m_storageAreaSync->scheduleClear(); … … 189 202 ASSERT(!m_isShutdown); 190 203 blockUntilImportComplete(); 191 204 192 205 return m_storageMap->contains(key); 193 206 } … … 222 235 void StorageAreaImpl::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) 223 236 { 237 #if PLATFORM(CHROMIUM) 238 // FIXME: Events are currently broken in Chromium. 239 return; 240 #endif 241 242 Page* page = sourceFrame->page(); 243 if (!page) 244 return; 245 224 246 // 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 225 247 // of any given page in the group or mutate the page group itself. 226 248 Vector<RefPtr<Frame> > frames; 227 228 // FIXME: When can this occur?229 Page* page = sourceFrame->page();230 if (!page)231 return;232 233 249 if (m_storageType == SessionStorage) { 234 250 // Send events only to our page. … … 237 253 frames.append(frame); 238 254 } 239 255 240 256 for (unsigned i = 0; i < frames.size(); ++i) 241 257 frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->sessionStorage())); … … 250 266 } 251 267 } 252 268 253 269 for (unsigned i = 0; i < frames.size(); ++i) 254 270 frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->localStorage())); 255 } 271 } 256 272 } 257 273 -
trunk/WebCore/storage/StorageNamespaceImpl.cpp
r46075 r46502 65 65 StorageNamespaceImpl::StorageNamespaceImpl(StorageType storageType, const String& path) 66 66 : m_storageType(storageType) 67 , m_path(path.copy()) // FIXME: Is the .copy necessary?67 , m_path(path.copy()) // Copy makes it safe for our other thread to access the path. 68 68 , m_syncManager(0) 69 69 #ifndef NDEBUG … … 89 89 ASSERT(isMainThread()); 90 90 ASSERT(!m_isShutdown); 91 ASSERT(m_storageType == SessionStorage); 91 92 92 93 StorageNamespaceImpl* newNamespace = new StorageNamespaceImpl(m_storageType, m_path);
Note: See TracChangeset
for help on using the changeset viewer.