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

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

Issue 2209203002: binding: Always throws an exception in the current realm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. 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 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/V8CustomElementsRegistry.h" 10 #include "bindings/core/v8/V8CustomElementsRegistry.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 return false; 235 return false;
236 236
237 // To report InvalidStateError Exception, when the constructor returns some different object 237 // To report InvalidStateError Exception, when the constructor returns some different object
238 if (result != element) { 238 if (result != element) {
239 const String& message = "custom element constructors must call super() f irst and must " 239 const String& message = "custom element constructors must call super() f irst and must "
240 "not return a different object"; 240 "not return a different object";
241 std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction( constructor().As<v8::Function>()); 241 std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction( constructor().As<v8::Function>());
242 v8::Local<v8::Value> exception = V8ThrowException::createDOMException( 242 v8::Local<v8::Value> exception = V8ThrowException::createDOMException(
243 m_scriptState->isolate(), 243 m_scriptState->isolate(),
244 InvalidStateError, 244 InvalidStateError,
245 message, 245 message);
246 constructor());
247 fireErrorEvent(m_scriptState.get(), message, exception, std::move(locati on)); 246 fireErrorEvent(m_scriptState.get(), message, exception, std::move(locati on));
248 return false; 247 return false;
249 } 248 }
250 249
251 return true; 250 return true;
252 } 251 }
253 252
254 Element* ScriptCustomElementDefinition::runConstructor() 253 Element* ScriptCustomElementDefinition::runConstructor()
255 { 254 {
256 v8::Isolate* isolate = m_scriptState->isolate(); 255 v8::Isolate* isolate = m_scriptState->isolate();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 v8String(isolate, name.localName()), 372 v8String(isolate, name.localName()),
374 v8StringOrNull(isolate, oldValue), 373 v8StringOrNull(isolate, oldValue),
375 v8StringOrNull(isolate, newValue), 374 v8StringOrNull(isolate, newValue),
376 v8String(isolate, name.namespaceURI()), 375 v8String(isolate, name.namespaceURI()),
377 }; 376 };
378 runCallback(m_attributeChangedCallback.newLocal(isolate), element, 377 runCallback(m_attributeChangedCallback.newLocal(isolate), element,
379 argc, argv); 378 argc, argv);
380 } 379 }
381 380
382 } // namespace blink 381 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698