1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "config.h"
6#include "bindings/modules/v8/ModuleBindingsInitializer.h"
7
8#include "bindings/core/v8/ModuleProxy.h"
9#include "bindings/core/v8/V8PerIsolateData.h"
10#include "core/dom/ExecutionContext.h"
11#include "modules/indexeddb/IDBPendingTransactionMonitor.h"
12
13namespace blink {
14
15static void didLeaveScriptContextForModule(v8::Isolate* isolate)
16{
17    // Indexed DB requires that transactions are created with an internal |active| flag
18    // set to true, but the flag becomes false when control returns to the event loop.
19    V8PerIsolateData::from(isolate)->ensureIDBPendingTransactionMonitor()->deactivateNewTransactions();
20}
21
22void ModuleBindingsInitializer::init()
23{
24    ModuleProxy::moduleProxy().registerDidLeaveScriptContextForRecursionScope(didLeaveScriptContextForModule);
25}
26
27} // namespace blink
28