Index: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
index a46a60f2da69a0a832188d7034999e93bb7ea708..389e73138753f140bd984e14be476c85357406f1 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
@@ -170,8 +170,15 @@ HTMLElement* ScriptCustomElementDefinition::createElementSync( |
// 6. If definition is non-null |
// 6.1. If the synchronous custom elements flag is set: |
// 6.1.2. Set result to Construct(C). Rethrow any exceptions. |
- Element* element = nullptr; |
+ |
+ // Create an element and push to the construction stack. |
+ // V8HTMLElement::constructorCustom() can only refer to |
+ // window.document(), but it is different from the document here |
+ // when it is an import document. This is not exactly what the |
+ // spec defines, but the public behavior matches to the spec. |
+ Element* element = createElementForConstructor(document); |
{ |
+ ConstructionStackScope constructionStackScope(this, element); |
v8::TryCatch tryCatch(m_scriptState->isolate()); |
element = runConstructor(); |
if (tryCatch.HasCaught()) { |