fix: "Failed to serialize arguments" when emitting 'context-menu' for webview (#31259)
* fix: sanitize params for 'context-menu' event sent over IPC for webview * Revert "fix: sanitize params for 'context-menu' event sent over IPC for webview" This reverts commit 7fee455138e8470756a677dcca1a830260ba8d97. * fix: make frame property non-enumerable in params for 'context-menu' event
This commit is contained in:
parent
3b2c46dfd6
commit
d7a7c120d1
2 changed files with 5 additions and 3 deletions
|
@ -80,7 +80,7 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithRenderFrameHost>::ToV8(
|
||||||
const auto& params = val.first;
|
const auto& params = val.first;
|
||||||
content::RenderFrameHost* render_frame_host = val.second;
|
content::RenderFrameHost* render_frame_host = val.second;
|
||||||
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
|
||||||
dict.SetGetter("frame", render_frame_host);
|
dict.SetGetter("frame", render_frame_host, v8::DontEnum);
|
||||||
dict.Set("x", params.x);
|
dict.Set("x", params.x);
|
||||||
dict.Set("y", params.y);
|
dict.Set("y", params.y);
|
||||||
dict.Set("linkURL", params.link_url);
|
dict.Set("linkURL", params.link_url);
|
||||||
|
|
|
@ -111,7 +111,9 @@ class Dictionary : public gin::Dictionary {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
bool SetGetter(const K& key, const V& val) {
|
bool SetGetter(const K& key,
|
||||||
|
const V& val,
|
||||||
|
v8::PropertyAttribute attribute = v8::None) {
|
||||||
AccessorValue<V> acc_value;
|
AccessorValue<V> acc_value;
|
||||||
acc_value.Value = val;
|
acc_value.Value = val;
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@ class Dictionary : public gin::Dictionary {
|
||||||
if (gin::TryConvertToV8(info.GetIsolate(), val, &v8_value))
|
if (gin::TryConvertToV8(info.GetIsolate(), val, &v8_value))
|
||||||
info.GetReturnValue().Set(v8_value);
|
info.GetReturnValue().Set(v8_value);
|
||||||
},
|
},
|
||||||
NULL, v8_value_accessor)
|
nullptr, v8_value_accessor, v8::DEFAULT, attribute)
|
||||||
.ToChecked();
|
.ToChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue