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 6c7b1e3de4e39b0513efb14349dddf12a81ff0b4..9a042a653e6306ded682a67afa30c2cf62be8766 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp |
@@ -202,16 +202,14 @@ HTMLElement* ScriptCustomElementDefinition::createElementSync( |
"CustomElement", constructor(), isolate); |
HTMLElement* element = createElementSync(document, tagName, exceptionState); |
- if (exceptionState.hadException() || !element) { |
+ if (exceptionState.hadException()) { |
+ DCHECK(!element); |
// 7. If this step throws an exception, then report the exception, ... |
- { |
- v8::TryCatch tryCatch(isolate); |
- tryCatch.SetVerbose(true); |
- exceptionState.throwIfNeeded(); |
- } |
- |
+ exceptionState.reportException(m_scriptState.get(), |
+ constructor().As<v8::Function>()); |
return CustomElement::createFailedElement(document, tagName); |
} |
+ DCHECK(element); |
return element; |
} |
@@ -238,12 +236,12 @@ bool ScriptCustomElementDefinition::runConstructor(Element* element) |
if (result != element) { |
const String& message = "custom element constructors must call super() first and must " |
"not return a different object"; |
- std::unique_ptr<SourceLocation> location = SourceLocation::fromFunction(constructor().As<v8::Function>()); |
v8::Local<v8::Value> exception = V8ThrowException::createDOMException( |
m_scriptState->isolate(), |
InvalidStateError, |
message); |
- fireErrorEvent(m_scriptState.get(), message, exception, std::move(location)); |
+ V8ThrowException::reportException(m_scriptState.get(), exception, |
+ message, constructor().As<v8::Function>()); |
return false; |
} |
@@ -268,14 +266,6 @@ Element* ScriptCustomElementDefinition::runConstructor() |
return V8Element::toImplWithTypeCheck(isolate, result); |
} |
-void ScriptCustomElementDefinition::fireErrorEvent(ScriptState* scriptState, const String& message, v8::Local<v8::Value> exception, std::unique_ptr<SourceLocation> location) |
-{ |
- ErrorEvent* event = ErrorEvent::create(message, std::move(location), &scriptState->world()); |
- V8ErrorHandler::storeExceptionOnErrorEventWrapper(scriptState, event, exception, scriptState->context()->Global()); |
- ExecutionContext* executionContext = scriptState->getExecutionContext(); |
- executionContext->reportException(event, NotSharableCrossOrigin); |
-} |
- |
v8::Local<v8::Object> ScriptCustomElementDefinition::constructor() const |
{ |
DCHECK(!m_constructor.isEmpty()); |