browser(webkit): fix crash when a worker is terminated while logging (#797)

This commit is contained in:
Joel Einbinder 2020-02-02 14:20:19 -08:00 committed by GitHub
parent 0007439072
commit 0a16b6073e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -1 +1 @@
1131
1132

View File

@ -103,6 +103,25 @@ index eb25aedee4cd9ebe007e06c2515b37ee095b06f4..badf6559595c8377db1089ca3c25008e
static String createIdentifier();
static String requestId(unsigned long identifier);
};
diff --git a/Source/JavaScriptCore/inspector/InjectedScript.cpp b/Source/JavaScriptCore/inspector/InjectedScript.cpp
index cc849f051fa40518a9d1a03429bc2b4dbcfb3102..11b05346f6098fa23f51ba9abc1af0e0e60a626c 100644
--- a/Source/JavaScriptCore/inspector/InjectedScript.cpp
+++ b/Source/JavaScriptCore/inspector/InjectedScript.cpp
@@ -287,9 +287,13 @@ RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue
auto callResult = callFunctionWithEvalEnabled(wrapFunction);
if (!callResult)
return nullptr;
+ auto callResultValue = callResult.value();
+ // callResultValue could be missing if the execution was terminated
+ if (!callResultValue)
+ return nullptr;
RefPtr<JSON::Object> resultObject;
- bool castSucceeded = toInspectorValue(globalObject(), callResult.value())->asObject(resultObject);
+ bool castSucceeded = toInspectorValue(globalObject(), callResultValue)->asObject(resultObject);
ASSERT_UNUSED(castSucceeded, castSucceeded);
return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
index 038cb646d31706905deff8935040d63c0afd00f9..2fca7b043f15a8cce3819cc827912fb719a345db 100644
--- a/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp