From 96158194d2647dd036c1975380fb957aaf5b1f74 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 13 Jul 2020 11:38:21 -0700 Subject: [PATCH] chore: allow primitives through the world safe checl --- shell/renderer/api/electron_api_web_frame.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 07d29265a217b..d34bf868611df 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -174,11 +174,13 @@ class ScriptExecutionCallback : public blink::WebScriptExecutionCallback { if (!result.empty()) { if (!result[0].IsEmpty()) { // Either world safe results are disabled or the result was created in - // the same world as the caller + // the same world as the caller or the result is not an object and + // therefore does not have a prototype chain to protect if (!world_safe_result_ || (result[0]->IsObject() && promise_.GetContext() == - result[0].As()->CreationContext())) { + result[0].As()->CreationContext()) || + !result[0]->IsObject()) { // Right now only single results per frame is supported. if (!callback_.is_null()) std::move(callback_).Run(result[0], v8::Undefined(isolate));