OLD | NEW |
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if (m_readyState == DONE) | 479 if (m_readyState == DONE) |
480 m_transaction->unregisterRequest(this); | 480 m_transaction->unregisterRequest(this); |
481 | 481 |
482 // Possibly abort the transaction. This must occur after unregistering (so | 482 // Possibly abort the transaction. This must occur after unregistering (so |
483 // this request doesn't receive a second error) and before deactivating | 483 // this request doesn't receive a second error) and before deactivating |
484 // (which might trigger commit). | 484 // (which might trigger commit). |
485 if (event->type() == EventTypeNames::error && | 485 if (event->type() == EventTypeNames::error && |
486 dispatchResult == DispatchEventResult::NotCanceled && | 486 dispatchResult == DispatchEventResult::NotCanceled && |
487 !m_requestAborted) { | 487 !m_requestAborted) { |
488 m_transaction->setError(m_error); | 488 m_transaction->setError(m_error); |
489 m_transaction->abort(IGNORE_EXCEPTION); | 489 m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING); |
490 } | 490 } |
491 | 491 |
492 // If this was the last request in the transaction's list, it may commit | 492 // If this was the last request in the transaction's list, it may commit |
493 // here. | 493 // here. |
494 if (setTransactionActive) | 494 if (setTransactionActive) |
495 m_transaction->setActive(false); | 495 m_transaction->setActive(false); |
496 } | 496 } |
497 | 497 |
498 if (cursorToNotify) | 498 if (cursorToNotify) |
499 cursorToNotify->postSuccessHandlerCallback(); | 499 cursorToNotify->postSuccessHandlerCallback(); |
500 | 500 |
501 // An upgradeneeded event will always be followed by a success or error event, | 501 // An upgradeneeded event will always be followed by a success or error event, |
502 // so must be kept alive. | 502 // so must be kept alive. |
503 if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded) | 503 if (m_readyState == DONE && event->type() != EventTypeNames::upgradeneeded) |
504 m_hasPendingActivity = false; | 504 m_hasPendingActivity = false; |
505 | 505 |
506 return dispatchResult; | 506 return dispatchResult; |
507 } | 507 } |
508 | 508 |
509 void IDBRequest::uncaughtExceptionInEventHandler() { | 509 void IDBRequest::uncaughtExceptionInEventHandler() { |
510 if (m_transaction && !m_requestAborted) { | 510 if (m_transaction && !m_requestAborted) { |
511 m_transaction->setError(DOMException::create( | 511 m_transaction->setError(DOMException::create( |
512 AbortError, "Uncaught exception in event handler.")); | 512 AbortError, "Uncaught exception in event handler.")); |
513 m_transaction->abort(IGNORE_EXCEPTION); | 513 m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 void IDBRequest::transactionDidFinishAndDispatch() { | 517 void IDBRequest::transactionDidFinishAndDispatch() { |
518 DCHECK(m_transaction); | 518 DCHECK(m_transaction); |
519 DCHECK(m_transaction->isVersionChange()); | 519 DCHECK(m_transaction->isVersionChange()); |
520 DCHECK(m_didFireUpgradeNeededEvent); | 520 DCHECK(m_didFireUpgradeNeededEvent); |
521 DCHECK_EQ(m_readyState, DONE); | 521 DCHECK_EQ(m_readyState, DONE); |
522 DCHECK(getExecutionContext()); | 522 DCHECK(getExecutionContext()); |
523 m_transaction.clear(); | 523 m_transaction.clear(); |
(...skipping 25 matching lines...) Expand all Loading... |
549 } | 549 } |
550 | 550 |
551 void IDBRequest::dequeueEvent(Event* event) { | 551 void IDBRequest::dequeueEvent(Event* event) { |
552 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { | 552 for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) { |
553 if (m_enqueuedEvents[i].get() == event) | 553 if (m_enqueuedEvents[i].get() == event) |
554 m_enqueuedEvents.remove(i); | 554 m_enqueuedEvents.remove(i); |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 } // namespace blink | 558 } // namespace blink |
OLD | NEW |