Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/WebCore/storage/IDBRequest.cpp

Issue 7488021: Merge 91571 - Fix crash in IDBRequest::abort (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 , m_cursorType(IDBCursorBackendInterface::InvalidCursorType) 59 , m_cursorType(IDBCursorBackendInterface::InvalidCursorType)
60 { 60 {
61 if (m_transaction) { 61 if (m_transaction) {
62 m_transaction->registerRequest(this); 62 m_transaction->registerRequest(this);
63 IDBPendingTransactionMonitor::removePendingTransaction(m_transaction->ba ckend()); 63 IDBPendingTransactionMonitor::removePendingTransaction(m_transaction->ba ckend());
64 } 64 }
65 } 65 }
66 66
67 IDBRequest::~IDBRequest() 67 IDBRequest::~IDBRequest()
68 { 68 {
69 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath); 69 ASSERT(m_readyState == DONE || m_readyState == EarlyDeath || !scriptExecutio nContext());
70 if (m_transaction) 70 if (m_transaction)
71 m_transaction->unregisterRequest(this); 71 m_transaction->unregisterRequest(this);
72 } 72 }
73 73
74 PassRefPtr<IDBAny> IDBRequest::result(ExceptionCode& ec) const 74 PassRefPtr<IDBAny> IDBRequest::result(ExceptionCode& ec) const
75 { 75 {
76 if (m_readyState != DONE) { 76 if (m_readyState != DONE) {
77 ec = IDBDatabaseException::NOT_ALLOWED_ERR; 77 ec = IDBDatabaseException::NOT_ALLOWED_ERR;
78 return 0; 78 return 0;
79 } 79 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 { 142 {
143 return m_source.get(); 143 return m_source.get();
144 } 144 }
145 145
146 void IDBRequest::abort() 146 void IDBRequest::abort()
147 { 147 {
148 if (m_readyState != LOADING) { 148 if (m_readyState != LOADING) {
149 ASSERT(m_readyState == DONE); 149 ASSERT(m_readyState == DONE);
150 return; 150 return;
151 } 151 }
152 // FIXME: Remove isDocument check when
153 // https://bugs.webkit.org/show_bug.cgi?id=57789 is resolved.
154 if (!scriptExecutionContext() || !scriptExecutionContext()->isDocument())
155 return;
152 156
153 ASSERT(scriptExecutionContext()->isDocument());
154 EventQueue* eventQueue = static_cast<Document*>(scriptExecutionContext())->e ventQueue(); 157 EventQueue* eventQueue = static_cast<Document*>(scriptExecutionContext())->e ventQueue();
155 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { 158 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
156 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get()); 159 bool removed = eventQueue->cancelEvent(m_enqueuedEvents[i].get());
157 ASSERT_UNUSED(removed, removed); 160 ASSERT_UNUSED(removed, removed);
158 } 161 }
159 m_enqueuedEvents.clear(); 162 m_enqueuedEvents.clear();
160 163
161 m_errorCode = 0; 164 m_errorCode = 0;
162 m_errorMessage = String(); 165 m_errorMessage = String();
163 m_result.clear(); 166 m_result.clear();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 328 }
326 329
327 EventTargetData* IDBRequest::ensureEventTargetData() 330 EventTargetData* IDBRequest::ensureEventTargetData()
328 { 331 {
329 return &m_eventTargetData; 332 return &m_eventTargetData;
330 } 333 }
331 334
332 } // namespace WebCore 335 } // namespace WebCore
333 336
334 #endif 337 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698