|
@@ -116,9 +116,6 @@ RendererClientBase::RendererClientBase() {
|
|
|
ParseSchemesCLISwitch(command_line, switches::kSecureSchemes);
|
|
|
for (const std::string& scheme : secure_schemes_list)
|
|
|
url::AddSecureScheme(scheme.data());
|
|
|
- // In Chrome we should set extension's origins to match the pages they can
|
|
|
- // work on, but in Electron currently we just let extensions do anything.
|
|
|
- url::AddSecureScheme(extensions::kExtensionScheme);
|
|
|
// We rely on the unique process host id which is notified to the
|
|
|
// renderer process via command line switch from the content layer,
|
|
|
// if this switch is removed from the content layer for some reason,
|
|
@@ -411,6 +408,63 @@ void RendererClientBase::RunScriptsAtDocumentEnd(
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+bool RendererClientBase::AllowScriptExtensionForServiceWorker(
|
|
|
+ const url::Origin& script_origin) {
|
|
|
+#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
+ return script_origin.scheme() == extensions::kExtensionScheme;
|
|
|
+#else
|
|
|
+ return false;
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+void RendererClientBase::DidInitializeServiceWorkerContextOnWorkerThread(
|
|
|
+ blink::WebServiceWorkerContextProxy* context_proxy,
|
|
|
+ const GURL& service_worker_scope,
|
|
|
+ const GURL& script_url) {
|
|
|
+#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
+ extensions_renderer_client_->GetDispatcher()
|
|
|
+ ->DidInitializeServiceWorkerContextOnWorkerThread(
|
|
|
+ context_proxy, service_worker_scope, script_url);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+void RendererClientBase::WillEvaluateServiceWorkerOnWorkerThread(
|
|
|
+ blink::WebServiceWorkerContextProxy* context_proxy,
|
|
|
+ v8::Local<v8::Context> v8_context,
|
|
|
+ int64_t service_worker_version_id,
|
|
|
+ const GURL& service_worker_scope,
|
|
|
+ const GURL& script_url) {
|
|
|
+#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
+ extensions_renderer_client_->GetDispatcher()
|
|
|
+ ->WillEvaluateServiceWorkerOnWorkerThread(
|
|
|
+ context_proxy, v8_context, service_worker_version_id,
|
|
|
+ service_worker_scope, script_url);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+void RendererClientBase::DidStartServiceWorkerContextOnWorkerThread(
|
|
|
+ int64_t service_worker_version_id,
|
|
|
+ const GURL& service_worker_scope,
|
|
|
+ const GURL& script_url) {
|
|
|
+#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
+ extensions_renderer_client_->GetDispatcher()
|
|
|
+ ->DidStartServiceWorkerContextOnWorkerThread(
|
|
|
+ service_worker_version_id, service_worker_scope, script_url);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+void RendererClientBase::WillDestroyServiceWorkerContextOnWorkerThread(
|
|
|
+ v8::Local<v8::Context> context,
|
|
|
+ int64_t service_worker_version_id,
|
|
|
+ const GURL& service_worker_scope,
|
|
|
+ const GURL& script_url) {
|
|
|
+#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
|
+ extensions_renderer_client_->GetDispatcher()
|
|
|
+ ->WillDestroyServiceWorkerContextOnWorkerThread(
|
|
|
+ context, service_worker_version_id, service_worker_scope, script_url);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
v8::Local<v8::Context> RendererClientBase::GetContext(
|
|
|
blink::WebLocalFrame* frame,
|
|
|
v8::Isolate* isolate) const {
|