| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2009, 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 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 22 matching lines...) Expand all Loading... |
| 33 #include "bindings/modules/v8/V8SQLError.h" | 33 #include "bindings/modules/v8/V8SQLError.h" |
| 34 #include "bindings/modules/v8/V8SQLStatementErrorCallback.h" | 34 #include "bindings/modules/v8/V8SQLStatementErrorCallback.h" |
| 35 #include "bindings/modules/v8/V8SQLTransaction.h" | 35 #include "bindings/modules/v8/V8SQLTransaction.h" |
| 36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
| 37 #include "wtf/Assertions.h" | 37 #include "wtf/Assertions.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, | 41 bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, |
| 42 SQLError* error) { | 42 SQLError* error) { |
| 43 if (!canInvokeCallback()) | 43 v8::Isolate* isolate = m_scriptState->isolate(); |
| 44 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
| 45 if (!executionContext || executionContext->isContextSuspended() || |
| 46 executionContext->isContextDestroyed()) |
| 44 return true; | 47 return true; |
| 45 | |
| 46 v8::Isolate* isolate = m_scriptState->isolate(); | |
| 47 if (!m_scriptState->contextIsValid()) | 48 if (!m_scriptState->contextIsValid()) |
| 48 return true; | 49 return true; |
| 49 | |
| 50 ScriptState::Scope scope(m_scriptState.get()); | 50 ScriptState::Scope scope(m_scriptState.get()); |
| 51 | 51 |
| 52 v8::Local<v8::Value> transactionHandle = | 52 v8::Local<v8::Value> transactionHandle = |
| 53 toV8(transaction, m_scriptState->context()->Global(), isolate); | 53 toV8(transaction, m_scriptState->context()->Global(), isolate); |
| 54 v8::Local<v8::Value> errorHandle = | 54 v8::Local<v8::Value> errorHandle = |
| 55 toV8(error, m_scriptState->context()->Global(), isolate); | 55 toV8(error, m_scriptState->context()->Global(), isolate); |
| 56 ASSERT(transactionHandle->IsObject()); | 56 ASSERT(transactionHandle->IsObject()); |
| 57 | 57 |
| 58 v8::Local<v8::Value> argv[] = {transactionHandle, errorHandle}; | 58 v8::Local<v8::Value> argv[] = {transactionHandle, errorHandle}; |
| 59 | 59 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 WTF_ARRAY_LENGTH(argv), argv, isolate) | 74 WTF_ARRAY_LENGTH(argv), argv, isolate) |
| 75 .ToLocal(&result)) | 75 .ToLocal(&result)) |
| 76 return true; | 76 return true; |
| 77 bool value; | 77 bool value; |
| 78 if (!result->BooleanValue(isolate->GetCurrentContext()).To(&value)) | 78 if (!result->BooleanValue(isolate->GetCurrentContext()).To(&value)) |
| 79 return true; | 79 return true; |
| 80 return value; | 80 return value; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |