Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp

Issue 2274883005: Fix ScriptCustomElementDefinition::createElementSync to use the given document (Closed)
Patch Set: Remove #if DCHECK_IS_ON() due to failure on CrOS Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {

Powered by Google App Engine
This is Rietveld 408576698