fix: read nodeIntegrationInWorker from per-frame WebPreferences#50122
fix: read nodeIntegrationInWorker from per-frame WebPreferences#50122MarshallOfSound merged 1 commit intomainfrom
Conversation
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
| } | ||
| } | ||
| })); | ||
|
|
There was a problem hiding this comment.
nit: can you add snippet to check worker from parent has node integration in this case
There was a problem hiding this comment.
Oops missed this comment, will add in a follow up
|
Release Notes Persisted
|
|
I was unable to backport this PR to "39-x-y" cleanly; |
|
I was unable to backport this PR to "38-x-y" cleanly; |
|
I was unable to backport this PR to "40-x-y" cleanly; |
|
I have automatically backported this PR to "41-x-y", please check out #50134 |
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
|
@VerteDinde has manually backported this PR to "38-x-y", please check out #50163 |
* fix: read nodeIntegrationInWorker from per-frame WebPreferences (#50122) Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed. * chore: update patches --------- Co-authored-by: Samuel Attard <sam@electronjs.org>
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
|
@VerteDinde has manually backported this PR to "40-x-y", please check out #50467 |
|
@VerteDinde has manually backported this PR to "39-x-y", please check out #50468 |
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed.
…) (#50467) Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed. Co-authored-by: Samuel Attard <sam@electronjs.org>
…) (#50468) * fix: read nodeIntegrationInWorker from per-frame WebPreferences (#50122) Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosted multiple WebContents with different nodeIntegrationInWorker values (e.g. via window.open with overridden webPreferences in setWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line. Instead, plumb the flag through blink's WorkerSettings at worker creation time, copying it from the initiating frame's WebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker via WorkerSettings::Copy. The --node-integration-in-worker command-line switch is removed as it is no longer consumed. * fix: restore base/command_line.h include needed by SetUpWebAssemblyTrapHandler The backported PR removed this include (matching main where SetUpWebAssemblyTrapHandler was refactored), but on 39-x-y the function still uses base::CommandLine. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> --------- Co-authored-by: Samuel Attard <sam@electronjs.org> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com>
Previously the renderer checked a process-wide command-line switch to decide whether to create a Node.js environment for dedicated workers. When a renderer process hosts multiple WebContents with different
nodeIntegrationInWorkervalues (e.g. viawindow.openwith overriddenwebPreferencesinsetWindowOpenHandler), all workers in the process used whichever value the first WebContents set on the command line — the override had no effect.This plumbs the flag through blink's
WorkerSettingsat worker creation time, copying it from the initiating frame'sWebPreferences. The check on the worker thread then reads the per-worker value. Nested workers inherit the flag from their parent worker viaWorkerSettings::Copy.The
--node-integration-in-workercommand-line switch is removed as it is no longer consumed.Notes: Fixed an issue where
nodeIntegrationInWorkeroverrides insetWindowOpenHandlerwere not honored for child windows sharing a renderer process with their opener.