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

This commit is contained in:
Eryk Rakowski
2020-08-21 19:39:47 +02:00
committed by GitHub
parent 8191a8418f
commit 9193d35769
2 changed files with 23 additions and 1 deletions

View File

@@ -770,6 +770,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) {