| Index: Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
|
| diff --git a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
|
| index 3f8a2c571d3a8351b981d23ae313d035dbdc5095..f31a3bdb130e69a0f420329a4c38d9d2fb146a30 100644
|
| --- a/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
|
| +++ b/Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp
|
| @@ -92,14 +92,13 @@ static void weakCallback(const v8::WeakCallbackData<T, ScopedPersistent<T> >& da
|
| V8CustomElementLifecycleCallbacks::V8CustomElementLifecycleCallbacks(ExecutionContext* executionContext, v8::Handle<v8::Object> prototype, v8::Handle<v8::Function> created, v8::Handle<v8::Function> attached, v8::Handle<v8::Function> detached, v8::Handle<v8::Function> attributeChanged)
|
| : CustomElementLifecycleCallbacks(flagSet(attached, detached, attributeChanged))
|
| , ContextLifecycleObserver(executionContext)
|
| - , m_isolate(toIsolate(executionContext))
|
| , m_owner(0)
|
| - , m_world(DOMWrapperWorld::current(m_isolate))
|
| - , m_prototype(m_isolate, prototype)
|
| - , m_created(m_isolate, created)
|
| - , m_attached(m_isolate, attached)
|
| - , m_detached(m_isolate, detached)
|
| - , m_attributeChanged(m_isolate, attributeChanged)
|
| + , m_scriptState(NewScriptState::current(toIsolate(executionContext)))
|
| + , m_prototype(m_scriptState->isolate(), prototype)
|
| + , m_created(m_scriptState->isolate(), created)
|
| + , m_attached(m_scriptState->isolate(), attached)
|
| + , m_detached(m_scriptState->isolate(), detached)
|
| + , m_attributeChanged(m_scriptState->isolate(), attributeChanged)
|
| {
|
| m_prototype.setWeak(&m_prototype, weakCallback<v8::Object>);
|
|
|
| @@ -116,7 +115,7 @@ V8PerContextData* V8CustomElementLifecycleCallbacks::creationContextData()
|
| if (!executionContext())
|
| return 0;
|
|
|
| - v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
|
| + v8::Handle<v8::Context> context = m_scriptState->context();
|
| if (context.IsEmpty())
|
| return 0;
|
|
|
| @@ -128,7 +127,7 @@ V8CustomElementLifecycleCallbacks::~V8CustomElementLifecycleCallbacks()
|
| if (!m_owner)
|
| return;
|
|
|
| - v8::HandleScope handleScope(m_isolate);
|
| + v8::HandleScope handleScope(m_scriptState->isolate());
|
| if (V8PerContextData* perContextData = creationContextData())
|
| perContextData->clearCustomElementBinding(m_owner);
|
| }
|
| @@ -159,30 +158,31 @@ void V8CustomElementLifecycleCallbacks::created(Element* element)
|
|
|
| element->setCustomElementState(Element::Upgraded);
|
|
|
| - v8::HandleScope handleScope(m_isolate);
|
| - v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
|
| + v8::Isolate* isolate = m_scriptState->isolate();
|
| + v8::HandleScope handleScope(isolate);
|
| + v8::Handle<v8::Context> context = m_scriptState->context();
|
| if (context.IsEmpty())
|
| return;
|
|
|
| v8::Context::Scope scope(context);
|
|
|
| - v8::Handle<v8::Object> receiver = DOMDataStore::current(m_isolate).get<V8Element>(element, m_isolate);
|
| + v8::Handle<v8::Object> receiver = DOMDataStore::current(isolate).get<V8Element>(element, isolate);
|
| if (!receiver.IsEmpty()) {
|
| // Swizzle the prototype of the existing wrapper. We don't need to
|
| // worry about non-existent wrappers; they will get the right
|
| // prototype when wrapped.
|
| - v8::Handle<v8::Object> prototype = m_prototype.newLocal(m_isolate);
|
| + v8::Handle<v8::Object> prototype = m_prototype.newLocal(isolate);
|
| if (prototype.IsEmpty())
|
| return;
|
| receiver->SetPrototype(prototype);
|
| }
|
|
|
| - v8::Handle<v8::Function> callback = m_created.newLocal(m_isolate);
|
| + v8::Handle<v8::Function> callback = m_created.newLocal(isolate);
|
| if (callback.IsEmpty())
|
| return;
|
|
|
| if (receiver.IsEmpty())
|
| - receiver = toV8(element, context->Global(), m_isolate).As<v8::Object>();
|
| + receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
|
|
|
| ASSERT(!receiver.IsEmpty());
|
|
|
| @@ -190,7 +190,7 @@ void V8CustomElementLifecycleCallbacks::created(Element* element)
|
|
|
| v8::TryCatch exceptionCatcher;
|
| exceptionCatcher.SetVerbose(true);
|
| - ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, m_isolate);
|
| + ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, isolate);
|
| }
|
|
|
| void V8CustomElementLifecycleCallbacks::attached(Element* element)
|
| @@ -211,31 +211,32 @@ void V8CustomElementLifecycleCallbacks::attributeChanged(Element* element, const
|
| if (!executionContext() || executionContext()->activeDOMObjectsAreStopped())
|
| return;
|
|
|
| - v8::HandleScope handleScope(m_isolate);
|
| - v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
|
| + v8::Isolate* isolate = m_scriptState->isolate();
|
| + v8::HandleScope handleScope(isolate);
|
| + v8::Handle<v8::Context> context = m_scriptState->context();
|
| if (context.IsEmpty())
|
| return;
|
|
|
| v8::Context::Scope scope(context);
|
|
|
| - v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate).As<v8::Object>();
|
| + v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
|
| ASSERT(!receiver.IsEmpty());
|
|
|
| - v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(m_isolate);
|
| + v8::Handle<v8::Function> callback = m_attributeChanged.newLocal(isolate);
|
| if (callback.IsEmpty())
|
| return;
|
|
|
| v8::Handle<v8::Value> argv[] = {
|
| - v8String(m_isolate, name),
|
| - oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(m_isolate)) : v8::Handle<v8::Value>(v8String(m_isolate, oldValue)),
|
| - newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(m_isolate)) : v8::Handle<v8::Value>(v8String(m_isolate, newValue))
|
| + v8String(isolate, name),
|
| + oldValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(isolate, oldValue)),
|
| + newValue.isNull() ? v8::Handle<v8::Value>(v8::Null(isolate)) : v8::Handle<v8::Value>(v8String(isolate, newValue))
|
| };
|
|
|
| InspectorInstrumentation::willExecuteCustomElementCallback(element);
|
|
|
| v8::TryCatch exceptionCatcher;
|
| exceptionCatcher.SetVerbose(true);
|
| - ScriptController::callFunction(executionContext(), callback, receiver, WTF_ARRAY_LENGTH(argv), argv, m_isolate);
|
| + ScriptController::callFunction(executionContext(), callback, receiver, WTF_ARRAY_LENGTH(argv), argv, isolate);
|
| }
|
|
|
| void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function>& weakCallback, Element* element)
|
| @@ -246,25 +247,26 @@ void V8CustomElementLifecycleCallbacks::call(const ScopedPersistent<v8::Function
|
| if (!executionContext() || executionContext()->activeDOMObjectsAreStopped())
|
| return;
|
|
|
| - v8::HandleScope handleScope(m_isolate);
|
| - v8::Handle<v8::Context> context = toV8Context(executionContext(), *m_world);
|
| + v8::Isolate* isolate = m_scriptState->isolate();
|
| + v8::HandleScope handleScope(isolate);
|
| + v8::Handle<v8::Context> context = m_scriptState->context();
|
| if (context.IsEmpty())
|
| return;
|
|
|
| v8::Context::Scope scope(context);
|
|
|
| - v8::Handle<v8::Function> callback = weakCallback.newLocal(m_isolate);
|
| + v8::Handle<v8::Function> callback = weakCallback.newLocal(isolate);
|
| if (callback.IsEmpty())
|
| return;
|
|
|
| - v8::Handle<v8::Object> receiver = toV8(element, context->Global(), m_isolate).As<v8::Object>();
|
| + v8::Handle<v8::Object> receiver = toV8(element, context->Global(), isolate).As<v8::Object>();
|
| ASSERT(!receiver.IsEmpty());
|
|
|
| InspectorInstrumentation::willExecuteCustomElementCallback(element);
|
|
|
| v8::TryCatch exceptionCatcher;
|
| exceptionCatcher.SetVerbose(true);
|
| - ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, m_isolate);
|
| + ScriptController::callFunction(executionContext(), callback, receiver, 0, 0, isolate);
|
| }
|
|
|
| } // namespace WebCore
|
|
|