OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 Persistent<IDBRequest> request = IDBRequest::create( | 87 Persistent<IDBRequest> request = IDBRequest::create( |
88 scope.getScriptState(), IDBAny::createUndefined(), transaction.get()); | 88 scope.getScriptState(), IDBAny::createUndefined(), transaction.get()); |
89 deactivateNewTransactions(scope.isolate()); | 89 deactivateNewTransactions(scope.isolate()); |
90 | 90 |
91 ThreadState::current()->collectAllGarbage(); | 91 ThreadState::current()->collectAllGarbage(); |
92 EXPECT_EQ(1u, set.size()); | 92 EXPECT_EQ(1u, set.size()); |
93 | 93 |
94 // This will generate an abort() call to the back end which is dropped by the
fake proxy, | 94 // This will generate an abort() call to the back end which is dropped by the
fake proxy, |
95 // so an explicit onAbort call is made. | 95 // so an explicit onAbort call is made. |
96 scope.getExecutionContext()->stopActiveDOMObjects(); | 96 scope.getExecutionContext()->notifyContextDestroyed(); |
97 transaction->onAbort(DOMException::create(AbortError, "Aborted")); | 97 transaction->onAbort(DOMException::create(AbortError, "Aborted")); |
98 transaction.clear(); | 98 transaction.clear(); |
99 | 99 |
100 ThreadState::current()->collectAllGarbage(); | 100 ThreadState::current()->collectAllGarbage(); |
101 EXPECT_EQ(0u, set.size()); | 101 EXPECT_EQ(0u, set.size()); |
102 } | 102 } |
103 | 103 |
104 TEST(IDBTransactionTest, TransactionFinish) { | 104 TEST(IDBTransactionTest, TransactionFinish) { |
105 V8TestingScope scope; | 105 V8TestingScope scope; |
106 const int64_t transactionId = 1234; | 106 const int64_t transactionId = 1234; |
(...skipping 21 matching lines...) Expand all Loading... |
128 | 128 |
129 ThreadState::current()->collectAllGarbage(); | 129 ThreadState::current()->collectAllGarbage(); |
130 EXPECT_EQ(1u, set.size()); | 130 EXPECT_EQ(1u, set.size()); |
131 | 131 |
132 transaction.clear(); | 132 transaction.clear(); |
133 | 133 |
134 ThreadState::current()->collectAllGarbage(); | 134 ThreadState::current()->collectAllGarbage(); |
135 EXPECT_EQ(1u, set.size()); | 135 EXPECT_EQ(1u, set.size()); |
136 | 136 |
137 // Stop the context, so events don't get queued (which would keep the transact
ion alive). | 137 // Stop the context, so events don't get queued (which would keep the transact
ion alive). |
138 scope.getExecutionContext()->stopActiveDOMObjects(); | 138 scope.getExecutionContext()->notifyContextDestroyed(); |
139 | 139 |
140 // Fire an abort to make sure this doesn't free the transaction during use. Th
e test | 140 // Fire an abort to make sure this doesn't free the transaction during use. Th
e test |
141 // will not fail if it is, but ASAN would notice the error. | 141 // will not fail if it is, but ASAN would notice the error. |
142 db->onAbort(transactionId, DOMException::create(AbortError, "Aborted")); | 142 db->onAbort(transactionId, DOMException::create(AbortError, "Aborted")); |
143 | 143 |
144 // onAbort() should have cleared the transaction's reference to the database. | 144 // onAbort() should have cleared the transaction's reference to the database. |
145 ThreadState::current()->collectAllGarbage(); | 145 ThreadState::current()->collectAllGarbage(); |
146 EXPECT_EQ(0u, set.size()); | 146 EXPECT_EQ(0u, set.size()); |
147 } | 147 } |
148 | 148 |
149 } // namespace | 149 } // namespace |
150 } // namespace blink | 150 } // namespace blink |
OLD | NEW |