| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (callback.IsEmpty()) | 176 if (callback.IsEmpty()) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 if (receiver.IsEmpty()) | 179 if (receiver.IsEmpty()) |
| 180 receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); | 180 receiver = toV8(element, context->Global(), isolate).As<v8::Object>(); |
| 181 | 181 |
| 182 ASSERT(!receiver.IsEmpty()); | 182 ASSERT(!receiver.IsEmpty()); |
| 183 | 183 |
| 184 v8::TryCatch exceptionCatcher; | 184 v8::TryCatch exceptionCatcher; |
| 185 exceptionCatcher.SetVerbose(true); | 185 exceptionCatcher.SetVerbose(true); |
| 186 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0); | 186 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void V8CustomElementLifecycleCallbacks::enteredDocument(Element* element) | 189 void V8CustomElementLifecycleCallbacks::enteredDocument(Element* element) |
| 190 { | 190 { |
| 191 call(m_enteredDocument, element); | 191 call(m_enteredDocument, element); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void V8CustomElementLifecycleCallbacks::leftDocument(Element* element) | 194 void V8CustomElementLifecycleCallbacks::leftDocument(Element* element) |
| 195 { | 195 { |
| 196 call(m_leftDocument, element); | 196 call(m_leftDocument, element); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 217 return; | 217 return; |
| 218 | 218 |
| 219 v8::Handle<v8::Value> argv[] = { | 219 v8::Handle<v8::Value> argv[] = { |
| 220 v8String(name, isolate), | 220 v8String(name, isolate), |
| 221 oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::V
alue>(v8String(oldValue, isolate)), | 221 oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::V
alue>(v8String(oldValue, isolate)), |
| 222 newValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::V
alue>(v8String(newValue, isolate)) | 222 newValue.isNull() ? v8::Handle<v8::Value>(v8::Null()) : v8::Handle<v8::V
alue>(v8String(newValue, isolate)) |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 v8::TryCatch exceptionCatcher; | 225 v8::TryCatch exceptionCatcher; |
| 226 exceptionCatcher.SetVerbose(true); | 226 exceptionCatcher.SetVerbose(true); |
| 227 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, WTF_ARRAY_LENGTH(argv), argv); | 227 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, WTF_ARRAY_LENGTH(argv), argv, isolate); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) | 230 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) |
| 231 { | 231 { |
| 232 if (!canInvokeCallback()) | 232 if (!canInvokeCallback()) |
| 233 return; | 233 return; |
| 234 | 234 |
| 235 v8::HandleScope handleScope(getIsolateFromScriptExecutionContext(scriptExecu
tionContext())); | 235 v8::HandleScope handleScope(getIsolateFromScriptExecutionContext(scriptExecu
tionContext())); |
| 236 v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_wo
rld.get()); | 236 v8::Handle<v8::Context> context = toV8Context(scriptExecutionContext(), m_wo
rld.get()); |
| 237 if (context.IsEmpty()) | 237 if (context.IsEmpty()) |
| 238 return; | 238 return; |
| 239 | 239 |
| 240 v8::Context::Scope scope(context); | 240 v8::Context::Scope scope(context); |
| 241 v8::Isolate* isolate = context->GetIsolate(); | 241 v8::Isolate* isolate = context->GetIsolate(); |
| 242 | 242 |
| 243 v8::Handle<v8::Function> callback = weakCallback.newLocal(isolate); | 243 v8::Handle<v8::Function> callback = weakCallback.newLocal(isolate); |
| 244 if (callback.IsEmpty()) | 244 if (callback.IsEmpty()) |
| 245 return; | 245 return; |
| 246 | 246 |
| 247 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).
As<v8::Object>(); | 247 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).
As<v8::Object>(); |
| 248 ASSERT(!receiver.IsEmpty()); | 248 ASSERT(!receiver.IsEmpty()); |
| 249 | 249 |
| 250 v8::TryCatch exceptionCatcher; | 250 v8::TryCatch exceptionCatcher; |
| 251 exceptionCatcher.SetVerbose(true); | 251 exceptionCatcher.SetVerbose(true); |
| 252 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0); | 252 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, receiver, 0, 0, isolate); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace WebCore | 255 } // namespace WebCore |
| OLD | NEW |