fix(extensions): enable WebSQL in background pages (#24798)

* fix(extensions): enable WebSQL in background pages

* fix: apply suggestions

* fix: remove duplicate include

* fix: remove trailing spaces
This commit is contained in:
Eryk Rakowski 2020-08-19 02:41:47 +02:00 committed by GitHub
parent ff24caf798
commit 9e53112ee1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -772,6 +772,16 @@ void ElectronBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitch("profile-electron-init");
}
// Extension background pages don't have WebContentsPreferences, but they
// support WebSQL by default.
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
content::RenderProcessHost* process =
content::RenderProcessHost::FromID(process_id);
if (extensions::ProcessMap::Get(process->GetBrowserContext())
->Contains(process_id))
command_line->AppendSwitch(switches::kEnableWebSQL);
#endif
content::WebContents* web_contents =
GetWebContentsFromProcessID(process_id);
if (web_contents) {