mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: loading dedicated/shared worker scripts over custom protocol (#24749)
* fix: add patch to avoid crash in worker with nodeintegration enabled [worker_global_scope.cc(111)] Check failed: url_.IsValid(). * fix: loading dedicated/shared worker over custom protocols Backports https://chromium-review.googlesource.com/c/chromium/src/+/1798250 that distinguishes loading the main script resource of dedicated/shared worker, this allows us to register a custom URLLoaderFactory. * spec: add crash test for worker with nodeIntegrationInWorker * update patches * Remove extra patchlist patches * Fixup patch * update patches Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Electron Bot <anonymous@electronjs.org>
This commit is contained in:
@@ -200,11 +200,11 @@ bool ElectronRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
return http_method == "GET";
|
||||
}
|
||||
|
||||
void ElectronRendererClient::DidInitializeWorkerContextOnWorkerThread(
|
||||
void ElectronRendererClient::WorkerScriptReadyForEvaluationOnWorkerThread(
|
||||
v8::Local<v8::Context> context) {
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kNodeIntegrationInWorker)) {
|
||||
WebWorkerObserver::GetCurrent()->ContextCreated(context);
|
||||
WebWorkerObserver::GetCurrent()->WorkerScriptReadyForEvaluation(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class ElectronRendererClient : public RendererClientBase {
|
||||
const std::string& http_method,
|
||||
bool is_initial_navigation,
|
||||
bool is_server_redirect) override;
|
||||
void DidInitializeWorkerContextOnWorkerThread(
|
||||
void WorkerScriptReadyForEvaluationOnWorkerThread(
|
||||
v8::Local<v8::Context> context) override;
|
||||
void WillDestroyWorkerContextOnWorkerThread(
|
||||
v8::Local<v8::Context> context) override;
|
||||
|
||||
@@ -42,7 +42,8 @@ WebWorkerObserver::~WebWorkerObserver() {
|
||||
asar::ClearArchives();
|
||||
}
|
||||
|
||||
void WebWorkerObserver::ContextCreated(v8::Local<v8::Context> worker_context) {
|
||||
void WebWorkerObserver::WorkerScriptReadyForEvaluation(
|
||||
v8::Local<v8::Context> worker_context) {
|
||||
v8::Context::Scope context_scope(worker_context);
|
||||
|
||||
// Start the embed thread.
|
||||
|
||||
@@ -21,7 +21,7 @@ class WebWorkerObserver {
|
||||
// Returns the WebWorkerObserver for current worker thread.
|
||||
static WebWorkerObserver* GetCurrent();
|
||||
|
||||
void ContextCreated(v8::Local<v8::Context> context);
|
||||
void WorkerScriptReadyForEvaluation(v8::Local<v8::Context> context);
|
||||
void ContextWillDestroy(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user