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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptCustomElementDefinition.h" 5 #include "bindings/core/v8/ScriptCustomElementDefinition.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8BindingMacros.h" 9 #include "bindings/core/v8/V8BindingMacros.h"
10 #include "bindings/core/v8/V8CustomElementRegistry.h" 10 #include "bindings/core/v8/V8CustomElementRegistry.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 Document& document, const QualifiedName& tagName, 163 Document& document, const QualifiedName& tagName,
164 ExceptionState& exceptionState) 164 ExceptionState& exceptionState)
165 { 165 {
166 DCHECK(ScriptState::current(m_scriptState->isolate()) == m_scriptState); 166 DCHECK(ScriptState::current(m_scriptState->isolate()) == m_scriptState);
167 167
168 // Create an element 168 // Create an element
169 // https://dom.spec.whatwg.org/#concept-create-element 169 // https://dom.spec.whatwg.org/#concept-create-element
170 // 6. If definition is non-null 170 // 6. If definition is non-null
171 // 6.1. If the synchronous custom elements flag is set: 171 // 6.1. If the synchronous custom elements flag is set:
172 // 6.1.2. Set result to Construct(C). Rethrow any exceptions. 172 // 6.1.2. Set result to Construct(C). Rethrow any exceptions.
173 Element* element = nullptr; 173
174 // Create an element and push to the construction stack.
175 // V8HTMLElement::constructorCustom() can only refer to
176 // window.document(), but it is different from the document here
177 // when it is an import document. This is not exactly what the
178 // spec defines, but the public behavior matches to the spec.
179 Element* element = createElementForConstructor(document);
174 { 180 {
181 ConstructionStackScope constructionStackScope(this, element);
175 v8::TryCatch tryCatch(m_scriptState->isolate()); 182 v8::TryCatch tryCatch(m_scriptState->isolate());
176 element = runConstructor(); 183 element = runConstructor();
177 if (tryCatch.HasCaught()) { 184 if (tryCatch.HasCaught()) {
178 exceptionState.rethrowV8Exception(tryCatch.Exception()); 185 exceptionState.rethrowV8Exception(tryCatch.Exception());
179 return nullptr; 186 return nullptr;
180 } 187 }
181 } 188 }
182 189
183 // 6.1.3. through 6.1.9. 190 // 6.1.3. through 6.1.9.
184 checkConstructorResult(element, document, tagName, exceptionState); 191 checkConstructorResult(element, document, tagName, exceptionState);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 v8String(isolate, name.localName()), 378 v8String(isolate, name.localName()),
372 v8StringOrNull(isolate, oldValue), 379 v8StringOrNull(isolate, oldValue),
373 v8StringOrNull(isolate, newValue), 380 v8StringOrNull(isolate, newValue),
374 v8String(isolate, name.namespaceURI()), 381 v8String(isolate, name.namespaceURI()),
375 }; 382 };
376 runCallback(m_attributeChangedCallback.newLocal(isolate), element, 383 runCallback(m_attributeChangedCallback.newLocal(isolate), element,
377 argc, argv); 384 argc, argv);
378 } 385 }
379 386
380 } // namespace blink 387 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698