Title: [142262] trunk/Source/WebCore
- Revision
- 142262
- Author
- [email protected]
- Date
- 2013-02-08 05:04:31 -0800 (Fri, 08 Feb 2013)
Log Message
Migrate ExceptionCode ASSERTs in IDB to ASSERT_NO_EXCEPTION.
https://bugs.webkit.org/show_bug.cgi?id=109266
Reviewed by Jochen Eisinger.
The pattern:
ExceptionCode ec = 0;
methodThatGeneratesException(ec);
ASSERT(!ec);
is more clearly and succinctly written as:
methodThatGeneratesException(ASSERT_NO_EXCEPTION);
This patch replaces the occurances of the former in IDB code that never
touch 'ec' again with the latter. No change in behavior should result
from this refactoring.
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::advance):
(WebCore::IDBCursor::continueFunction):
(WebCore::IDBCursor::deleteFunction):
These methods checked the value of the ExceptionCode without first
initializing it to 0. Now the ExceptionCode is explicitly set to 0
before doing potentially exception-generating work.
(WebCore::IDBCursor::direction):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::mode):
Replace the above pattern with ASSERT_NO_EXCEPTION.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (142261 => 142262)
--- trunk/Source/WebCore/ChangeLog 2013-02-08 12:54:55 UTC (rev 142261)
+++ trunk/Source/WebCore/ChangeLog 2013-02-08 13:04:31 UTC (rev 142262)
@@ -1,5 +1,40 @@
2013-02-08 Mike West <[email protected]>
+ Migrate ExceptionCode ASSERTs in IDB to ASSERT_NO_EXCEPTION.
+ https://bugs.webkit.org/show_bug.cgi?id=109266
+
+ Reviewed by Jochen Eisinger.
+
+ The pattern:
+
+ ExceptionCode ec = 0;
+ methodThatGeneratesException(ec);
+ ASSERT(!ec);
+
+ is more clearly and succinctly written as:
+
+ methodThatGeneratesException(ASSERT_NO_EXCEPTION);
+
+ This patch replaces the occurances of the former in IDB code that never
+ touch 'ec' again with the latter. No change in behavior should result
+ from this refactoring.
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::advance):
+ (WebCore::IDBCursor::continueFunction):
+ (WebCore::IDBCursor::deleteFunction):
+ These methods checked the value of the ExceptionCode without first
+ initializing it to 0. Now the ExceptionCode is explicitly set to 0
+ before doing potentially exception-generating work.
+ (WebCore::IDBCursor::direction):
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::mode):
+ Replace the above pattern with ASSERT_NO_EXCEPTION.
+
+2013-02-08 Mike West <[email protected]>
+
Migrate ExceptionCode ASSERTs in SVG to ASSERT_NO_EXCEPTION.
https://bugs.webkit.org/show_bug.cgi?id=109267
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (142261 => 142262)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2013-02-08 12:54:55 UTC (rev 142261)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2013-02-08 13:04:31 UTC (rev 142262)
@@ -95,10 +95,7 @@
const String& IDBCursor::direction() const
{
IDB_TRACE("IDBCursor::direction");
- ExceptionCode ec = 0;
- const AtomicString& direction = directionToString(m_direction, ec);
- ASSERT(!ec);
- return direction;
+ return directionToString(m_direction, ASSERT_NO_EXCEPTION);
}
const ScriptValue& IDBCursor::key() const
@@ -157,6 +154,7 @@
void IDBCursor::advance(long long count, ExceptionCode& ec)
{
+ ec = 0;
IDB_TRACE("IDBCursor::advance");
if (!m_gotValue) {
ec = IDBDatabaseException::InvalidStateError;
@@ -189,6 +187,7 @@
void IDBCursor::continueFunction(PassRefPtr<IDBKey> key, ExceptionCode& ec)
{
+ ec = 0;
IDB_TRACE("IDBCursor::continue");
if (key && !key->isValid()) {
ec = IDBDatabaseException::DataError;
@@ -230,6 +229,7 @@
PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context, ExceptionCode& ec)
{
+ ec = 0;
IDB_TRACE("IDBCursor::delete");
if (!m_transaction->isActive()) {
ec = IDBDatabaseException::TransactionInactiveError;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (142261 => 142262)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2013-02-08 12:54:55 UTC (rev 142261)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2013-02-08 13:04:31 UTC (rev 142262)
@@ -322,9 +322,7 @@
EventTarget* target = event->target();
IDBRequest* request = static_cast<IDBRequest*>(target);
- ExceptionCode ec = 0;
- RefPtr<IDBAny> cursorAny = request->result(ec);
- ASSERT(!ec);
+ RefPtr<IDBAny> cursorAny = request->result(ASSERT_NO_EXCEPTION);
RefPtr<IDBCursorWithValue> cursor;
if (cursorAny->type() == IDBAny::IDBCursorWithValueType)
cursor = cursorAny->idbCursorWithValue();
@@ -332,8 +330,7 @@
Vector<int64_t, 1> indexIds;
indexIds.append(m_indexMetadata.id);
if (cursor) {
- cursor->continueFunction(static_cast<IDBKey*>(0), ec);
- ASSERT(!ec);
+ cursor->continueFunction(static_cast<IDBKey*>(0), ASSERT_NO_EXCEPTION);
RefPtr<IDBKey> primaryKey = cursor->idbPrimaryKey();
ScriptValue value = cursor->value();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (142261 => 142262)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2013-02-08 12:54:55 UTC (rev 142261)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2013-02-08 13:04:31 UTC (rev 142262)
@@ -121,10 +121,7 @@
const String& IDBTransaction::mode() const
{
- ExceptionCode ec = 0;
- const AtomicString& mode = modeToString(m_mode, ec);
- ASSERT(!ec);
- return mode;
+ return modeToString(m_mode, ASSERT_NO_EXCEPTION);
}
void IDBTransaction::setError(PassRefPtr<DOMError> error, const String& errorMessage)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes