| Index: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp
|
| index 6163dced4530d47532ca1639222c3e9ac9f85fd2..1cbe50abf428da29f086dea6dcc97e3db4ddf1e8 100644
|
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.cpp
|
| @@ -24,30 +24,18 @@
|
| namespace blink {
|
|
|
| CustomElementsRegistry* CustomElementsRegistry::create(
|
| - ScriptState* scriptState,
|
| V0CustomElementRegistrationContext* v0)
|
| {
|
| - DCHECK(scriptState->world().isMainWorld());
|
| CustomElementsRegistry* registry = new CustomElementsRegistry(v0);
|
| if (v0)
|
| v0->setV1(registry);
|
| -
|
| - v8::Isolate* isolate = scriptState->isolate();
|
| - v8::Local<v8::Object> wrapper =
|
| - toV8(registry, scriptState).As<v8::Object>();
|
| - v8::Local<v8::String> name =
|
| - V8HiddenValue::customElementsRegistryMap(isolate);
|
| - v8::Local<v8::Map> map = v8::Map::New(isolate);
|
| - bool didSetPrototype =
|
| - V8HiddenValue::setHiddenValue(scriptState, wrapper, name, map);
|
| - DCHECK(didSetPrototype);
|
| -
|
| return registry;
|
| }
|
|
|
| CustomElementsRegistry::CustomElementsRegistry(
|
| const V0CustomElementRegistrationContext* v0)
|
| - : m_v0(v0)
|
| + : m_state(State::ScriptNotInitialized)
|
| + , m_v0(v0)
|
| {
|
| }
|
|
|
| @@ -170,11 +158,24 @@ bool CustomElementsRegistry::nameIsDefined(const AtomicString& name) const
|
| return m_names.contains(name);
|
| }
|
|
|
| +void CustomElementsRegistry::initializeScript(ScriptState* scriptState)
|
| +{
|
| + CHECK(State::ScriptNotInitialized == m_state);
|
| + CHECK(scriptState->world().isMainWorld());
|
| + v8::Local<v8::Object> wrapper = toV8(this, scriptState).As<v8::Object>();
|
| + v8::Isolate* isolate = scriptState->isolate();
|
| + v8::Local<v8::String> name =
|
| + V8HiddenValue::customElementsRegistryMap(isolate);
|
| + v8::Local<v8::Map> map = v8::Map::New(isolate);
|
| + V8HiddenValue::setHiddenValue(scriptState, wrapper, name, map);
|
| + m_state = State::ScriptInitialized;
|
| +}
|
| +
|
| v8::Local<v8::Map> CustomElementsRegistry::idMap(ScriptState* scriptState)
|
| {
|
| - DCHECK(scriptState->world().isMainWorld());
|
| - v8::Local<v8::Object> wrapper =
|
| - toV8(this, scriptState).As<v8::Object>();
|
| + CHECK(scriptState->world().isMainWorld());
|
| + ensureScriptInitialized(scriptState);
|
| + v8::Local<v8::Object> wrapper = toV8(this, scriptState).As<v8::Object>();
|
| v8::Local<v8::String> name = V8HiddenValue::customElementsRegistryMap(
|
| scriptState->isolate());
|
| return V8HiddenValue::getHiddenValue(scriptState, wrapper, name)
|
|
|