Commit 7a8e3acb authored by Yuki Yamada's avatar Yuki Yamada Committed by Commit Bot

Remove the private property "ErrorEventError"

This CL removes a private property.
We do not have to have both of the private property of
"ErrorEventError" and |error_|, the
TraceWrapperV8Reference<v8::Value> in blink::ErrorEvent.

Also, the error attribute passed to listener should be initialized to
null for dedicated workers.
https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2
This CL modifies some tests regarding this too.

Bug: 872138
Change-Id: I497434d04c30f222ea8847239edf4e9a0ee97b19
Reviewed-on: https://chromium-review.googlesource.com/1233080
Commit-Queue: Yuki Yamada <yukiy@google.com>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593824}
parent 06f028f7
...@@ -4,15 +4,26 @@ function stripURL(url) { ...@@ -4,15 +4,26 @@ function stripURL(url) {
return url ? url.match( /[^\/]+\/?$/ )[0] : url; return url ? url.match( /[^\/]+\/?$/ )[0] : url;
} }
function checkErrorEvent(errorEvent, obj) { function checkWorkerLevelErrorEvent(errorEvent, obj) {
window.errorEvent = errorEvent;
shouldBeEqualToString('errorEvent.message', obj.message);
shouldBeEqualToString('stripURL(errorEvent.filename)', obj.filename);
shouldBe('errorEvent.lineno', '' + obj.lineno);
shouldBe('errorEvent.colno', '' + obj.colno);
}
function checkPageLevelErrorEvent(errorEvent, obj) {
window.errorEvent = errorEvent; window.errorEvent = errorEvent;
shouldBeEqualToString('errorEvent.message', obj.message); shouldBeEqualToString('errorEvent.message', obj.message);
shouldBeEqualToString('stripURL(errorEvent.filename)', obj.filename); shouldBeEqualToString('stripURL(errorEvent.filename)', obj.filename);
shouldBe('errorEvent.lineno', '' + obj.lineno); shouldBe('errorEvent.lineno', '' + obj.lineno);
shouldBe('errorEvent.colno', '' + obj.colno); shouldBe('errorEvent.colno', '' + obj.colno);
// The spec says the error property for worker-generated errors is always initialized to null // The spec says the error property for the errors generated for dedicated
// outside the worker: http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#runtime-script-errors-0 // workers (not DedicatedWorkerGlobalScope) should be initialized to null.
// This is because error property cannot always be passed to outside
// workers, since the value of |error| attribute is not always clonable.
// https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2
shouldBeNull('errorEvent.error'); shouldBeNull('errorEvent.error');
} }
...@@ -21,7 +32,7 @@ function checkPostMessage(obj) { ...@@ -21,7 +32,7 @@ function checkPostMessage(obj) {
if (e.data.done) if (e.data.done)
return; return;
debug("\nWorker-level onerror handler triggered:"); debug("\nWorker-level onerror handler triggered:");
checkErrorEvent(e.data, obj); checkWorkerLevelErrorEvent(e.data, obj);
}; };
} }
...@@ -35,7 +46,7 @@ function checkErrorEventInHandler(error, returnValue) { ...@@ -35,7 +46,7 @@ function checkErrorEventInHandler(error, returnValue) {
if (error.length) if (error.length)
obj = error[errorsSeen++]; obj = error[errorsSeen++];
checkErrorEvent(e, obj); checkPageLevelErrorEvent(e, obj);
if (!error.length || error.length == errorsSeen) if (!error.length || error.length == errorsSeen)
finishJSTest(); finishJSTest();
...@@ -52,7 +63,7 @@ function checkErrorEventInListener(error, preventDefault) { ...@@ -52,7 +63,7 @@ function checkErrorEventInListener(error, preventDefault) {
if (error.length) if (error.length)
obj = error[errorsSeen++]; obj = error[errorsSeen++];
checkErrorEvent(e, obj); checkPageLevelErrorEvent(e, obj);
if (!error.length || error.length == errorsSeen) if (!error.length || error.length == errorsSeen)
finishJSTest(); finishJSTest();
......
...@@ -7,14 +7,13 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -7,14 +7,13 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Worker-level onerror handler triggered: Worker-level onerror handler triggered:
PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined" PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined"
PASS stripURL(errorEvent.filename) is "[blob: URL]" PASS stripURL(errorEvent.filename) is "[blob: URL]"
PASS errorEvent.lineno is 13 PASS errorEvent.lineno is 12
PASS errorEvent.colno is 9 PASS errorEvent.colno is 9
PASS errorEvent.error is null
Page-level worker.onerror handler triggered: Page-level worker.onerror handler triggered:
PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined" PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined"
PASS stripURL(errorEvent.filename) is "[blob: URL]" PASS stripURL(errorEvent.filename) is "[blob: URL]"
PASS errorEvent.lineno is 13 PASS errorEvent.lineno is 12
PASS errorEvent.colno is 9 PASS errorEvent.colno is 9
PASS errorEvent.error is null PASS errorEvent.error is null
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
message: message, message: message,
filename: filename, filename: filename,
lineno: lineno, lineno: lineno,
colno: colno, colno: colno
error: error
}); });
return false; return false;
} }
...@@ -29,17 +28,16 @@ ...@@ -29,17 +28,16 @@
checkPostMessage({ checkPostMessage({
message: "Uncaught ReferenceError: foo is not defined", message: "Uncaught ReferenceError: foo is not defined",
filename: "[blob: URL]", filename: "[blob: URL]",
lineno: 13, lineno: 12,
colno: 9, colno: 9,
}); });
checkErrorEventInHandler({ checkErrorEventInHandler({
message: "Uncaught ReferenceError: foo is not defined", message: "Uncaught ReferenceError: foo is not defined",
filename: "[blob: URL]", filename: "[blob: URL]",
lineno: 13, lineno: 12,
colno: 9, colno: 9,
}); });
</script> </script>
</body> </body>
</html> </html>
...@@ -7,9 +7,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -7,9 +7,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Worker-level onerror handler triggered: Worker-level onerror handler triggered:
PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined" PASS errorEvent.message is "Uncaught ReferenceError: foo is not defined"
PASS stripURL(errorEvent.filename) is "[blob: URL]" PASS stripURL(errorEvent.filename) is "[blob: URL]"
PASS errorEvent.lineno is 14 PASS errorEvent.lineno is 13
PASS errorEvent.colno is 9 PASS errorEvent.colno is 9
PASS errorEvent.error is null
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
message: message, message: message,
filename: filename, filename: filename,
lineno: lineno, lineno: lineno,
colno: colno, colno: colno
error: error
}); });
setTimeout(function () { postMessage({ done: true }); }, 0); setTimeout(function () { postMessage({ done: true }); }, 0);
return true; return true;
...@@ -30,7 +29,7 @@ ...@@ -30,7 +29,7 @@
checkPostMessage({ checkPostMessage({
message: "Uncaught ReferenceError: foo is not defined", message: "Uncaught ReferenceError: foo is not defined",
filename: "[blob: URL]", filename: "[blob: URL]",
lineno: 14, lineno: 13,
colno: 9, colno: 9,
}); });
...@@ -38,4 +37,3 @@ ...@@ -38,4 +37,3 @@
</script> </script>
</body> </body>
</html> </html>
...@@ -31,29 +31,19 @@ ...@@ -31,29 +31,19 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_error_event.h" #include "third_party/blink/renderer/bindings/core/v8/v8_error_event.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
namespace blink { namespace blink {
void V8ErrorEvent::errorAttributeGetterCustom( void V8ErrorEvent::errorAttributeGetterCustom(
const v8::FunctionCallbackInfo<v8::Value>& info) { const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate(); v8::Isolate* isolate = info.GetIsolate();
auto private_error = V8PrivateProperty::GetErrorEventError(isolate);
v8::Local<v8::Value> cached_error;
if (private_error.GetOrUndefined(info.Holder()).ToLocal(&cached_error) &&
!cached_error->IsUndefined()) {
V8SetReturnValue(info, cached_error);
return;
}
ErrorEvent* event = V8ErrorEvent::ToImpl(info.Holder()); ErrorEvent* event = V8ErrorEvent::ToImpl(info.Holder());
ScriptState* script_state = ScriptState::From(isolate->GetCurrentContext()); ScriptState* script_state = ScriptState::From(isolate->GetCurrentContext());
ScriptValue error = event->error(script_state); ScriptValue error = event->error(script_state);
v8::Local<v8::Value> error_value = v8::Local<v8::Value> error_value =
error.IsEmpty() ? v8::Local<v8::Value>(v8::Null(isolate)) error.IsEmpty() ? v8::Local<v8::Value>(v8::Null(isolate))
: error.V8Value(); : error.V8Value();
private_error.Set(info.Holder(), error_value);
V8SetReturnValue(info, error_value); V8SetReturnValue(info, error_value);
} }
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer_view.h" #include "third_party/blink/renderer/bindings/core/v8/v8_array_buffer_view.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_element.h" #include "third_party/blink/renderer/bindings/core/v8/v8_element.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_error_event.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_event_target.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event_target.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_html_link_element.h" #include "third_party/blink/renderer/bindings/core/v8/v8_html_link_element.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_window.h" #include "third_party/blink/renderer/bindings/core/v8/v8_window.h"
...@@ -60,7 +59,6 @@ ...@@ -60,7 +59,6 @@
#include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h" #include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding_macros.h" #include "third_party/blink/renderer/platform/bindings/v8_binding_macros.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h" #include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
...@@ -903,40 +901,4 @@ Vector<String> GetOwnPropertyNames(v8::Isolate* isolate, ...@@ -903,40 +901,4 @@ Vector<String> GetOwnPropertyNames(v8::Isolate* isolate,
isolate, property_names, exception_state); isolate, property_names, exception_state);
} }
void StoreExceptionForInspector(ScriptState* script_state,
ErrorEvent* event,
v8::Local<v8::Value> data,
v8::Local<v8::Object> creation_context) {
v8::Local<v8::Value> wrapped_event =
ToV8(event, creation_context, script_state->GetIsolate());
if (wrapped_event.IsEmpty())
return;
DCHECK(wrapped_event->IsObject());
auto private_error =
V8PrivateProperty::GetErrorEventError(script_state->GetIsolate());
private_error.Set(wrapped_event.As<v8::Object>(), data);
}
v8::Local<v8::Value> LoadExceptionForInspector(
ScriptState* script_state,
ErrorEvent* event,
v8::Local<v8::Object> creation_context) {
v8::Local<v8::Value> wrapped_event =
ToV8(event, creation_context, script_state->GetIsolate());
if (wrapped_event.IsEmpty() || !wrapped_event->IsObject())
return v8::Local<v8::Value>();
DCHECK(wrapped_event->IsObject());
auto private_error =
V8PrivateProperty::GetErrorEventError(script_state->GetIsolate());
v8::Local<v8::Value> error;
if (!private_error.GetOrUndefined(wrapped_event.As<v8::Object>())
.ToLocal(&error) ||
error->IsUndefined()) {
return v8::Local<v8::Value>();
}
return error;
}
} // namespace blink } // namespace blink
...@@ -63,7 +63,6 @@ namespace blink { ...@@ -63,7 +63,6 @@ namespace blink {
// dependencies to core/. // dependencies to core/.
class DOMWindow; class DOMWindow;
class ErrorEvent;
class EventTarget; class EventTarget;
class ExceptionState; class ExceptionState;
class ExecutionContext; class ExecutionContext;
...@@ -565,26 +564,6 @@ CORE_EXPORT Vector<String> GetOwnPropertyNames(v8::Isolate*, ...@@ -565,26 +564,6 @@ CORE_EXPORT Vector<String> GetOwnPropertyNames(v8::Isolate*,
const v8::Local<v8::Object>&, const v8::Local<v8::Object>&,
ExceptionState&); ExceptionState&);
// Saves |exception| into given ErrorEvent.
// Wrapper object for given ErrorEvent can be created in association with
// |creation_context| on processing this method, so |creation_context| should
// be the relevant realm of event target as defined in standard.
// See: https://dom.spec.whatwg.org/#firing-events
void StoreExceptionForInspector(ScriptState*,
ErrorEvent*,
v8::Local<v8::Value> exception,
v8::Local<v8::Object> creation_context);
// Returns stored exception which is related to given ErrorEvent.
// Wrapper object for given ErrorEvent can be created in association with
// |creation_context| on processing this method, so |creation_context| should
// be the relevant realm of event target as defined in standard.
// See: https://dom.spec.whatwg.org/#firing-events
v8::Local<v8::Value> LoadExceptionForInspector(
ScriptState*,
ErrorEvent*,
v8::Local<v8::Object> creation_context);
} // namespace blink } // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_BINDING_FOR_CORE_H_ #endif // THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_BINDING_FOR_CORE_H_
...@@ -63,20 +63,20 @@ v8::Local<v8::Value> V8ErrorHandler::CallListenerFunction( ...@@ -63,20 +63,20 @@ v8::Local<v8::Value> V8ErrorHandler::CallListenerFunction(
v8::Local<v8::Function>::Cast(listener); v8::Local<v8::Function>::Cast(listener);
v8::Local<v8::Object> this_value = context->Global(); v8::Local<v8::Object> this_value = context->Global();
v8::Local<v8::Object> event_object; // The error attribute should be initialized to null for dedicated workers.
if (!js_event->ToObject(context).ToLocal(&event_object)) // https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2
return v8::Null(GetIsolate()); ScriptValue error = error_event->error(script_state);
auto private_error = V8PrivateProperty::GetErrorEventError(GetIsolate()); v8::Local<v8::Value> error_value =
v8::Local<v8::Value> error; (error.IsEmpty() ||
if (!private_error.GetOrUndefined(event_object).ToLocal(&error) || error_event->target()->InterfaceName() == EventTargetNames::Worker)
error->IsUndefined()) ? v8::Local<v8::Value>(v8::Null(GetIsolate()))
error = v8::Null(GetIsolate()); : error.V8Value();
v8::Local<v8::Value> parameters[5] = { v8::Local<v8::Value> parameters[5] = {
V8String(GetIsolate(), error_event->message()), V8String(GetIsolate(), error_event->message()),
V8String(GetIsolate(), error_event->filename()), V8String(GetIsolate(), error_event->filename()),
v8::Integer::New(GetIsolate(), error_event->lineno()), v8::Integer::New(GetIsolate(), error_event->lineno()),
v8::Integer::New(GetIsolate(), error_event->colno()), error}; v8::Integer::New(GetIsolate(), error_event->colno()), error_value};
v8::TryCatch try_catch(GetIsolate()); v8::TryCatch try_catch(GetIsolate());
try_catch.SetVerbose(true); try_catch.SetVerbose(true);
......
...@@ -268,16 +268,14 @@ void V8Initializer::MessageHandlerInMainThread(v8::Local<v8::Message> message, ...@@ -268,16 +268,14 @@ void V8Initializer::MessageHandlerInMainThread(v8::Local<v8::Message> message,
else if (message->IsSharedCrossOrigin()) else if (message->IsSharedCrossOrigin())
access_control_status = kSharableCrossOrigin; access_control_status = kSharableCrossOrigin;
ErrorEvent* event = ErrorEvent* event = ErrorEvent::Create(
ErrorEvent::Create(ToCoreStringWithNullCheck(message->Get()), ToCoreStringWithNullCheck(message->Get()), std::move(location),
std::move(location), &script_state->World()); ScriptValue::From(script_state, data), &script_state->World());
String message_for_console = ExtractMessageForConsole(isolate, data); String message_for_console = ExtractMessageForConsole(isolate, data);
if (!message_for_console.IsEmpty()) if (!message_for_console.IsEmpty())
event->SetUnsanitizedMessage("Uncaught " + message_for_console); event->SetUnsanitizedMessage("Uncaught " + message_for_console);
StoreExceptionForInspector(script_state, event, data,
script_state->GetContext()->Global());
context->DispatchErrorEvent(event, access_control_status); context->DispatchErrorEvent(event, access_control_status);
} }
...@@ -311,9 +309,9 @@ void V8Initializer::MessageHandlerInWorker(v8::Local<v8::Message> message, ...@@ -311,9 +309,9 @@ void V8Initializer::MessageHandlerInWorker(v8::Local<v8::Message> message,
return; return;
} }
ErrorEvent* event = ErrorEvent* event = ErrorEvent::Create(
ErrorEvent::Create(ToCoreStringWithNullCheck(message->Get()), ToCoreStringWithNullCheck(message->Get()), std::move(location),
std::move(location), &script_state->World()); ScriptValue::From(script_state, data), &script_state->World());
AccessControlStatus cors_status = message->IsSharedCrossOrigin() AccessControlStatus cors_status = message->IsSharedCrossOrigin()
? kSharableCrossOrigin ? kSharableCrossOrigin
...@@ -322,8 +320,6 @@ void V8Initializer::MessageHandlerInWorker(v8::Local<v8::Message> message, ...@@ -322,8 +320,6 @@ void V8Initializer::MessageHandlerInWorker(v8::Local<v8::Message> message,
// If execution termination has been triggered as part of constructing // If execution termination has been triggered as part of constructing
// the error event from the v8::Message, quietly leave. // the error event from the v8::Message, quietly leave.
if (!isolate->IsExecutionTerminating()) { if (!isolate->IsExecutionTerminating()) {
StoreExceptionForInspector(script_state, event, data,
script_state->GetContext()->Global());
ExecutionContext::From(script_state) ExecutionContext::From(script_state)
->DispatchErrorEvent(event, cors_status); ->DispatchErrorEvent(event, cors_status);
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h" #include "third_party/blink/renderer/bindings/core/v8/v8_code_cache.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h" #include "third_party/blink/renderer/bindings/core/v8/v8_initializer.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h"
...@@ -346,9 +345,6 @@ bool WorkerOrWorkletScriptController::Evaluate( ...@@ -346,9 +345,6 @@ bool WorkerOrWorkletScriptController::Evaluate(
*error_event = *error_event =
ErrorEvent::Create(state.error_message, state.location_->Clone(), ErrorEvent::Create(state.error_message, state.location_->Clone(),
state.exception, world_.get()); state.exception, world_.get());
StoreExceptionForInspector(script_state_, *error_event,
state.exception.V8Value(),
script_state_->GetContext()->Global());
} }
} else { } else {
DCHECK(!global_scope_->ShouldSanitizeScriptError(state.location_->Url(), DCHECK(!global_scope_->ShouldSanitizeScriptError(state.location_->Url(),
......
...@@ -196,8 +196,12 @@ void MainThreadDebugger::ExceptionThrown(ExecutionContext* context, ...@@ -196,8 +196,12 @@ void MainThreadDebugger::ExceptionThrown(ExecutionContext* context,
const String default_message = "Uncaught"; const String default_message = "Uncaught";
if (script_state && script_state->ContextIsValid()) { if (script_state && script_state->ContextIsValid()) {
ScriptState::Scope scope(script_state); ScriptState::Scope scope(script_state);
v8::Local<v8::Value> exception = LoadExceptionForInspector( ScriptValue error = event->error(script_state);
script_state, event, script_state->GetContext()->Global()); v8::Local<v8::Value> exception =
error.IsEmpty()
? v8::Local<v8::Value>(v8::Null(script_state->GetIsolate()))
: error.V8Value();
SourceLocation* location = event->Location(); SourceLocation* location = event->Location();
String message = event->MessageForConsole(); String message = event->MessageForConsole();
String url = location->Url(); String url = location->Url();
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "third_party/blink/renderer/core/inspector/worker_thread_debugger.h" #include "third_party/blink/renderer/core/inspector/worker_thread_debugger.h"
#include "third_party/blink/renderer/bindings/core/v8/source_location.h" #include "third_party/blink/renderer/bindings/core/v8/source_location.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h" #include "third_party/blink/renderer/bindings/core/v8/v8_script_runner.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/events/error_event.h" #include "third_party/blink/renderer/core/events/error_event.h"
...@@ -136,8 +135,11 @@ void WorkerThreadDebugger::ExceptionThrown(WorkerThread* worker_thread, ...@@ -136,8 +135,11 @@ void WorkerThreadDebugger::ExceptionThrown(WorkerThread* worker_thread,
worker_thread->GlobalScope()->ScriptController()->GetScriptState(); worker_thread->GlobalScope()->ScriptController()->GetScriptState();
if (script_state && script_state->ContextIsValid()) { if (script_state && script_state->ContextIsValid()) {
ScriptState::Scope scope(script_state); ScriptState::Scope scope(script_state);
v8::Local<v8::Value> exception = LoadExceptionForInspector( ScriptValue error = event->error(script_state);
script_state, event, script_state->GetContext()->Global()); v8::Local<v8::Value> exception =
error.IsEmpty()
? v8::Local<v8::Value>(v8::Null(script_state->GetIsolate()))
: error.V8Value();
SourceLocation* location = event->Location(); SourceLocation* location = event->Location();
String message = event->MessageForConsole(); String message = event->MessageForConsole();
String url = location->Url(); String url = location->Url();
......
...@@ -33,7 +33,6 @@ class ScriptWrappable; ...@@ -33,7 +33,6 @@ class ScriptWrappable;
X(CustomElementLifecycle, CreatedCallback) \ X(CustomElementLifecycle, CreatedCallback) \
X(CustomElementLifecycle, DetachedCallback) \ X(CustomElementLifecycle, DetachedCallback) \
X(DOMException, Error) \ X(DOMException, Error) \
X(ErrorEvent, Error) \
X(Global, Event) \ X(Global, Event) \
X(IDBCursor, Request) \ X(IDBCursor, Request) \
X(IntersectionObserver, Callback) \ X(IntersectionObserver, Callback) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment