| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 IDBTransaction* transaction = nullptr; | 102 IDBTransaction* transaction = nullptr; |
| 103 IDBRequest* request = IDBRequest::create(scriptState(), IDBAny::createUndefi
ned(), transaction); | 103 IDBRequest* request = IDBRequest::create(scriptState(), IDBAny::createUndefi
ned(), transaction); |
| 104 EXPECT_EQ(request->readyState(), "pending"); | 104 EXPECT_EQ(request->readyState(), "pending"); |
| 105 | 105 |
| 106 // Simulate the IDBTransaction having received onAbort from back end and abo
rting the request: | 106 // Simulate the IDBTransaction having received onAbort from back end and abo
rting the request: |
| 107 request->abort(); | 107 request->abort(); |
| 108 | 108 |
| 109 // Now simulate the back end having fired an abort error at the request to c
lear up any intermediaries. | 109 // Now simulate the back end having fired an abort error at the request to c
lear up any intermediaries. |
| 110 // Ensure an assertion is not raised. | 110 // Ensure an assertion is not raised. |
| 111 request->onError(DOMError::create(AbortError, "Description goes here.")); | 111 request->onError(DOMError::create(AbortError, "Description goes here.")); |
| 112 |
| 113 // Stop the request lest it be GCed and its destructor |
| 114 // finds the object in a pending state (and asserts.) |
| 115 executionContext()->stopActiveDOMObjects(); |
| 112 } | 116 } |
| 113 | 117 |
| 114 class MockWebIDBDatabase : public WebIDBDatabase { | 118 class MockWebIDBDatabase : public WebIDBDatabase { |
| 115 public: | 119 public: |
| 116 static PassOwnPtr<MockWebIDBDatabase> create() | 120 static PassOwnPtr<MockWebIDBDatabase> create() |
| 117 { | 121 { |
| 118 return adoptPtr(new MockWebIDBDatabase()); | 122 return adoptPtr(new MockWebIDBDatabase()); |
| 119 } | 123 } |
| 120 virtual ~MockWebIDBDatabase() | 124 virtual ~MockWebIDBDatabase() |
| 121 { | 125 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); | 163 IDBOpenDBRequest* request = IDBOpenDBRequest::create(scriptState(), call
backs, transactionId, version); |
| 160 EXPECT_EQ(request->readyState(), "pending"); | 164 EXPECT_EQ(request->readyState(), "pending"); |
| 161 | 165 |
| 162 executionContext()->stopActiveDOMObjects(); | 166 executionContext()->stopActiveDOMObjects(); |
| 163 request->onSuccess(backend.release(), metadata); | 167 request->onSuccess(backend.release(), metadata); |
| 164 } | 168 } |
| 165 } | 169 } |
| 166 | 170 |
| 167 } // namespace | 171 } // namespace |
| 168 } // namespace blink | 172 } // namespace blink |
| OLD | NEW |