Skip to content

Commit

Permalink
fix: do not reset process_id in URLLoaderFactoryParams (#25139) (#25181)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Aug 31, 2020
1 parent 7dafaf1 commit caaaa34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 3 additions & 4 deletions shell/browser/electron_browser_client.cc
Expand Up @@ -1090,10 +1090,9 @@ void ElectronBrowserClient::OverrideURLLoaderFactoryParams(
content::RenderProcessHost* process,
const url::Origin& origin,
network::mojom::URLLoaderFactoryParams* factory_params) {
const auto& iter = process_preferences_.find(process->GetID());
if (iter != process_preferences_.end() && !iter->second.web_security) {
// bypass CORB
factory_params->process_id = iter->first;
// 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;
}
}
Expand Down
8 changes: 8 additions & 0 deletions spec-main/chromium-spec.ts
Expand Up @@ -277,6 +277,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

0 comments on commit caaaa34

Please sign in to comment.