| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 CALLBACK_LIST(MAKE_WEAK) | 110 CALLBACK_LIST(MAKE_WEAK) |
| 111 #undef MAKE_WEAK | 111 #undef MAKE_WEAK |
| 112 } | 112 } |
| 113 | 113 |
| 114 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData() | 114 V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData() |
| 115 { | 115 { |
| 116 if (!executionContext()) | 116 if (!executionContext()) |
| 117 return 0; | 117 return 0; |
| 118 | 118 |
| 119 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 119 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world); |
| 120 if (context.IsEmpty()) | 120 if (context.IsEmpty()) |
| 121 return 0; | 121 return 0; |
| 122 | 122 |
| 123 return V8PerContextData::from(context); | 123 return V8PerContextData::from(context); |
| 124 } | 124 } |
| 125 | 125 |
| 126 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks() | 126 V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks() |
| 127 { | 127 { |
| 128 if (!m_owner) | 128 if (!m_owner) |
| 129 return; | 129 return; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 153 { | 153 { |
| 154 // FIXME: callbacks while paused should be queued up for execution to | 154 // FIXME: callbacks while paused should be queued up for execution to |
| 155 // continue then be delivered in order rather than delivered immediately. | 155 // continue then be delivered in order rather than delivered immediately. |
| 156 // Bug 329665 tracks similar behavior for other synchronous events. | 156 // Bug 329665 tracks similar behavior for other synchronous events. |
| 157 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 157 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
| 158 return; | 158 return; |
| 159 | 159 |
| 160 element->setCustomElementState(Element::Upgraded); | 160 element->setCustomElementState(Element::Upgraded); |
| 161 | 161 |
| 162 v8::HandleScope handleScope(m_isolate); | 162 v8::HandleScope handleScope(m_isolate); |
| 163 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 163 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world); |
| 164 if (context.IsEmpty()) | 164 if (context.IsEmpty()) |
| 165 return; | 165 return; |
| 166 | 166 |
| 167 v8::Context::Scope scope(context); | 167 v8::Context::Scope scope(context); |
| 168 | 168 |
| 169 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele
ment>(element, m_isolate); | 169 v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Ele
ment>(element, m_isolate); |
| 170 if (!receiver.IsEmpty()) { | 170 if (!receiver.IsEmpty()) { |
| 171 // Swizzle the prototype of the existing wrapper. We don't need to | 171 // Swizzle the prototype of the existing wrapper. We don't need to |
| 172 // worry about non-existent wrappers; they will get the right | 172 // worry about non-existent wrappers; they will get the right |
| 173 // prototype when wrapped. | 173 // prototype when wrapped. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) | 206 void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) |
| 207 { | 207 { |
| 208 // FIXME: callbacks while paused should be queued up for execution to | 208 // FIXME: callbacks while paused should be queued up for execution to |
| 209 // continue then be delivered in order rather than delivered immediately. | 209 // continue then be delivered in order rather than delivered immediately. |
| 210 // Bug 329665 tracks similar behavior for other synchronous events. | 210 // Bug 329665 tracks similar behavior for other synchronous events. |
| 211 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 211 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
| 212 return; | 212 return; |
| 213 | 213 |
| 214 v8::HandleScope handleScope(m_isolate); | 214 v8::HandleScope handleScope(m_isolate); |
| 215 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 215 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world); |
| 216 if (context.IsEmpty()) | 216 if (context.IsEmpty()) |
| 217 return; | 217 return; |
| 218 | 218 |
| 219 v8::Context::Scope scope(context); | 219 v8::Context::Scope scope(context); |
| 220 | 220 |
| 221 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); | 221 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); |
| 222 ASSERT(!receiver.IsEmpty()); | 222 ASSERT(!receiver.IsEmpty()); |
| 223 | 223 |
| 224 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate); | 224 v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate); |
| 225 if (callback.IsEmpty()) | 225 if (callback.IsEmpty()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 240 | 240 |
| 241 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) | 241 void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
>& weakCallback, Element* element) |
| 242 { | 242 { |
| 243 // FIXME: callbacks while paused should be queued up for execution to | 243 // FIXME: callbacks while paused should be queued up for execution to |
| 244 // continue then be delivered in order rather than delivered immediately. | 244 // continue then be delivered in order rather than delivered immediately. |
| 245 // Bug 329665 tracks similar behavior for other synchronous events. | 245 // Bug 329665 tracks similar behavior for other synchronous events. |
| 246 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) | 246 if (!executionContext() || executionContext()->activeDOMObjectsAreStopped()) |
| 247 return; | 247 return; |
| 248 | 248 |
| 249 v8::HandleScope handleScope(m_isolate); | 249 v8::HandleScope handleScope(m_isolate); |
| 250 v8::Handle<v8::Context> context = toV8Context(executionContext(), m_world.ge
t()); | 250 v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world); |
| 251 if (context.IsEmpty()) | 251 if (context.IsEmpty()) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 v8::Context::Scope scope(context); | 254 v8::Context::Scope scope(context); |
| 255 | 255 |
| 256 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate); | 256 v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate); |
| 257 if (callback.IsEmpty()) | 257 if (callback.IsEmpty()) |
| 258 return; | 258 return; |
| 259 | 259 |
| 260 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); | 260 v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate
).As<v8::Object>(); |
| 261 ASSERT(!receiver.IsEmpty()); | 261 ASSERT(!receiver.IsEmpty()); |
| 262 | 262 |
| 263 InspectorInstrumentation::willExecuteCustomElementCallback(element); | 263 InspectorInstrumentation::willExecuteCustomElementCallback(element); |
| 264 | 264 |
| 265 v8::TryCatch exceptionCatcher; | 265 v8::TryCatch exceptionCatcher; |
| 266 exceptionCatcher.SetVerbose(true); | 266 exceptionCatcher.SetVerbose(true); |
| 267 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
m_isolate); | 267 ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
m_isolate); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace WebCore | 270 } // namespace WebCore |
| OLD | NEW |