feat: support registering MV3 extension service workers (#27562)

* feat: support registering MV3 extension service workers

* feat: load chrome extension APIs in worker context

* feat: add more ContentRendererClient service worker overrides

* fix: lint error

* refactor: emit object for 'registration-completed'

* docs: clarify when registration-completed emits
This commit is contained in:
Samuel Maddock 2021-02-11 10:58:03 -05:00 committed by GitHub
parent 6681f8f507
commit 3250ef551c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 152 additions and 6 deletions

View file

@ -117,6 +117,28 @@ class RendererClientBase : public content::ContentRendererClient
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
bool AllowScriptExtensionForServiceWorker(
const url::Origin& script_origin) override;
void DidInitializeServiceWorkerContextOnWorkerThread(
blink::WebServiceWorkerContextProxy* context_proxy,
const GURL& service_worker_scope,
const GURL& script_url) override;
void 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) override;
void DidStartServiceWorkerContextOnWorkerThread(
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) override;
void WillDestroyServiceWorkerContextOnWorkerThread(
v8::Local<v8::Context> context,
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) override;
protected:
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
// app_shell embedders may need custom extensions client interfaces.