Chromium Code Reviews| 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 342dff7dd84a2ae37a3408aa7e3997b9d989dd25..3bacdefd5ff9de2bdb91edee14ac44fd60984f0c 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
| @@ -9,10 +9,12 @@ |
| #include "bindings/core/v8/V8BindingMacros.h" |
| #include "bindings/core/v8/V8CustomElementsRegistry.h" |
| #include "bindings/core/v8/V8Element.h" |
| +#include "bindings/core/v8/V8ErrorHandler.h" |
| #include "bindings/core/v8/V8HiddenValue.h" |
| #include "bindings/core/v8/V8ScriptRunner.h" |
| #include "bindings/core/v8/V8ThrowException.h" |
| #include "core/dom/ExceptionCode.h" |
| +#include "core/events/ErrorEvent.h" |
| #include "core/html/HTMLElement.h" |
| #include "core/html/HTMLUnknownElement.h" |
| #include "v8.h" |
| @@ -229,7 +231,7 @@ bool ScriptCustomElementDefinition::runConstructor(Element* element) |
| tryCatch.SetVerbose(true); |
| Element* result = runConstructor(); |
| - if (!result) |
| + if (tryCatch.HasCaught()) |
| return false; |
| if (result != element) { |
| @@ -241,6 +243,19 @@ bool ScriptCustomElementDefinition::runConstructor(Element* element) |
| "not return a different object", |
| constructor()), |
| m_scriptState->isolate()); |
| + |
| + ExecutionContext* executionContext = m_scriptState->getExecutionContext(); |
|
dominicc (has gone to gerrit)
2016/07/22 07:34:08
Could you move this line closer to where it is use
|
| + v8::Local<v8::Function> function = constructor().As<v8::Function>(); |
| + ErrorEvent* event = ErrorEvent::create( |
| + "custom element constructors must call super() first and must" |
| + "not return a different object", |
| + SourceLocation::fromFunction(function), |
| + &m_scriptState->world()); |
| + v8::Local<v8::Value> data = tryCatch.Exception(); |
|
dominicc (has gone to gerrit)
2016/07/22 07:34:08
I don't think "data" is a very descriptive name. M
|
| + |
| + V8ErrorHandler::storeExceptionOnErrorEventWrapper(m_scriptState.get(), event, data, m_scriptState->context()->Global()); |
| + executionContext->reportException(event, NotSharableCrossOrigin); |
| + |
| return false; |
| } |