chore: Add new webFrame IsolatedWorldInfo API and deprecate (#16801)
* chore: Add new webFrame IsolatedWorldInfo API and deprecate * Flag deprecated methods in documentation * address comments * Address review comments * remove unused variable * Update based on review
This commit is contained in:
parent
1f458eb177
commit
3dfef4a376
4 changed files with 72 additions and 6 deletions
|
@ -399,6 +399,26 @@ void SetIsolatedWorldHumanReadableName(v8::Local<v8::Value> window,
|
|||
world_id, blink::WebString::FromUTF8(name));
|
||||
}
|
||||
|
||||
void SetIsolatedWorldInfo(v8::Local<v8::Value> window,
|
||||
int world_id,
|
||||
const mate::Dictionary& options,
|
||||
mate::Arguments* args) {
|
||||
std::string origin, csp, name;
|
||||
options.Get("securityOrigin", &origin);
|
||||
options.Get("csp", &csp);
|
||||
options.Get("name", &name);
|
||||
|
||||
if (!csp.empty() && origin.empty()) {
|
||||
args->ThrowError(
|
||||
"If csp is specified, securityOrigin should also be specified");
|
||||
return;
|
||||
}
|
||||
|
||||
SetIsolatedWorldSecurityOrigin(window, world_id, origin);
|
||||
SetIsolatedWorldContentSecurityPolicy(window, world_id, csp);
|
||||
SetIsolatedWorldHumanReadableName(window, world_id, name);
|
||||
}
|
||||
|
||||
blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate) {
|
||||
blink::WebCache::ResourceTypeStats stats;
|
||||
blink::WebCache::GetResourceTypeStats(&stats);
|
||||
|
@ -530,12 +550,13 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
dict.SetMethod("executeJavaScript", &ExecuteJavaScript);
|
||||
dict.SetMethod("executeJavaScriptInIsolatedWorld",
|
||||
&ExecuteJavaScriptInIsolatedWorld);
|
||||
dict.SetMethod("setIsolatedWorldSecurityOrigin",
|
||||
dict.SetMethod("_setIsolatedWorldSecurityOrigin",
|
||||
&SetIsolatedWorldSecurityOrigin);
|
||||
dict.SetMethod("setIsolatedWorldContentSecurityPolicy",
|
||||
dict.SetMethod("_setIsolatedWorldContentSecurityPolicy",
|
||||
&SetIsolatedWorldContentSecurityPolicy);
|
||||
dict.SetMethod("setIsolatedWorldHumanReadableName",
|
||||
dict.SetMethod("_setIsolatedWorldHumanReadableName",
|
||||
&SetIsolatedWorldHumanReadableName);
|
||||
dict.SetMethod("setIsolatedWorldInfo", &SetIsolatedWorldInfo);
|
||||
dict.SetMethod("getResourceUsage", &GetResourceUsage);
|
||||
dict.SetMethod("clearCache", &ClearCache);
|
||||
dict.SetMethod("_findFrameByRoutingId", &FindFrameByRoutingId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue