| 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 "platform/wtf/Assertions.h" | 37 #include "platform/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 v8::Isolate* isolate = m_scriptState->GetIsolate(); | 43 v8::Isolate* isolate = script_state_->GetIsolate(); |
| 44 ExecutionContext* execution_context = | 44 ExecutionContext* execution_context = |
| 45 ExecutionContext::From(m_scriptState.Get()); | 45 ExecutionContext::From(script_state_.Get()); |
| 46 if (!execution_context || execution_context->IsContextSuspended() || | 46 if (!execution_context || execution_context->IsContextSuspended() || |
| 47 execution_context->IsContextDestroyed()) | 47 execution_context->IsContextDestroyed()) |
| 48 return true; | 48 return true; |
| 49 if (!m_scriptState->ContextIsValid()) | 49 if (!script_state_->ContextIsValid()) |
| 50 return true; | 50 return true; |
| 51 ScriptState::Scope scope(m_scriptState.Get()); | 51 ScriptState::Scope scope(script_state_.Get()); |
| 52 | 52 |
| 53 v8::Local<v8::Value> transaction_handle = | 53 v8::Local<v8::Value> transaction_handle = |
| 54 ToV8(transaction, m_scriptState->GetContext()->Global(), isolate); | 54 ToV8(transaction, script_state_->GetContext()->Global(), isolate); |
| 55 v8::Local<v8::Value> error_handle = | 55 v8::Local<v8::Value> error_handle = |
| 56 ToV8(error, m_scriptState->GetContext()->Global(), isolate); | 56 ToV8(error, script_state_->GetContext()->Global(), isolate); |
| 57 DCHECK(transaction_handle->IsObject()); | 57 DCHECK(transaction_handle->IsObject()); |
| 58 | 58 |
| 59 v8::Local<v8::Value> argv[] = {transaction_handle, error_handle}; | 59 v8::Local<v8::Value> argv[] = {transaction_handle, error_handle}; |
| 60 | 60 |
| 61 v8::TryCatch exception_catcher(isolate); | 61 v8::TryCatch exception_catcher(isolate); |
| 62 exception_catcher.SetVerbose(true); | 62 exception_catcher.SetVerbose(true); |
| 63 | 63 |
| 64 v8::Local<v8::Value> result; | 64 v8::Local<v8::Value> result; |
| 65 // FIXME: This comment doesn't make much sense given what the code is actually | 65 // FIXME: This comment doesn't make much sense given what the code is actually |
| 66 // doing. | 66 // doing. |
| 67 // | 67 // |
| 68 // Step 6: If the error callback returns false, then move on to the next | 68 // Step 6: If the error callback returns false, then move on to the next |
| 69 // statement, if any, or onto the next overall step otherwise. Otherwise, | 69 // statement, if any, or onto the next overall step otherwise. Otherwise, |
| 70 // the error callback did not return false, or there was no error callback. | 70 // the error callback did not return false, or there was no error callback. |
| 71 // Jump to the last step in the overall steps. | 71 // Jump to the last step in the overall steps. |
| 72 if (!V8ScriptRunner::CallFunction(m_callback.NewLocal(isolate), | 72 if (!V8ScriptRunner::CallFunction(m_callback.NewLocal(isolate), |
| 73 ExecutionContext::From(m_scriptState.Get()), | 73 ExecutionContext::From(script_state_.Get()), |
| 74 m_scriptState->GetContext()->Global(), | 74 script_state_->GetContext()->Global(), |
| 75 WTF_ARRAY_LENGTH(argv), argv, isolate) | 75 WTF_ARRAY_LENGTH(argv), argv, isolate) |
| 76 .ToLocal(&result)) | 76 .ToLocal(&result)) |
| 77 return true; | 77 return true; |
| 78 bool value; | 78 bool value; |
| 79 if (!result->BooleanValue(isolate->GetCurrentContext()).To(&value)) | 79 if (!result->BooleanValue(isolate->GetCurrentContext()).To(&value)) |
| 80 return true; | 80 return true; |
| 81 return value; | 81 return value; |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |