Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not reset process_id in URLLoaderFactoryParams #25178

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions shell/browser/electron_browser_client.cc
Expand Up @@ -1516,15 +1516,10 @@ void ElectronBrowserClient::OverrideURLLoaderFactoryParams(
const url::Origin& origin,
bool is_for_isolated_world,
network::mojom::URLLoaderFactoryParams* factory_params) {
for (const auto& iter : process_preferences_) {
if (iter.second.browser_context != browser_context)
continue;

if (!iter.second.web_security) {
// bypass CORB
factory_params->process_id = iter.first;
factory_params->is_corb_enabled = false;
}
// Bypass CORB when web security is disabled.
auto it = process_preferences_.find(factory_params->process_id);
if (it != process_preferences_.end() && !it->second.web_security) {
factory_params->is_corb_enabled = false;
}

extensions::URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
Expand Down
8 changes: 8 additions & 0 deletions spec-main/chromium-spec.ts
Expand Up @@ -245,6 +245,14 @@ describe('web security', () => {
<script src="${serverUrl}"></script>`);
await p;
});

it('does not crash when multiple WebContent are created with web security disabled', () => {
const options = { webPreferences: { webSecurity: false } };
const w1 = new BrowserWindow(options);
w1.loadURL(serverUrl);
const w2 = new BrowserWindow(options);
w2.loadURL(serverUrl);
});
});

describe('command line switches', () => {
Expand Down