diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index 3e88dd72ea15..331085cf4d27 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -274,6 +274,13 @@ void WebFrame::ExecuteJavaScriptInIsolatedWorld(int world_id, scriptExecutionType, callback.release()); } +void WebFrame::SetIsolatedWorldContentSecurityPolicy(int world_id, + const std::string& security_policy) { + web_frame_->SetIsolatedWorldContentSecurityPolicy( + world_id, + blink::WebString::FromUTF8(security_policy)); +} + // static mate::Handle WebFrame::Create(v8::Isolate* isolate) { return mate::CreateHandle(isolate, new WebFrame(isolate)); @@ -324,7 +331,9 @@ void WebFrame::BuildPrototype( .SetMethod("insertCSS", &WebFrame::InsertCSS) .SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript) .SetMethod("executeJavaScriptInIsolatedWorld", - &WebFrame::ExecuteJavaScriptInIsolatedWorld) + &WebFrame::ExecuteJavaScriptInIsolatedWorld) + .SetMethod("setIsolatedWorldContentSecurityPolicy", + &WebFrame::SetIsolatedWorldContentSecurityPolicy) .SetMethod("getResourceUsage", &WebFrame::GetResourceUsage) .SetMethod("clearCache", &WebFrame::ClearCache) // TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings diff --git a/atom/renderer/api/atom_api_web_frame.h b/atom/renderer/api/atom_api_web_frame.h index 6578feebd282..f28c9de9db53 100644 --- a/atom/renderer/api/atom_api_web_frame.h +++ b/atom/renderer/api/atom_api_web_frame.h @@ -78,6 +78,9 @@ class WebFrame : public mate::Wrappable { const base::string16& code, mate::Arguments* args); + void SetIsolatedWorldContentSecurityPolicy(int world_id, + const std::string& security_policy); + // Resource related methods blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate); void ClearCache(v8::Isolate* isolate);