Disable Web Security in Command Line

Summary:
We've disabled web security in `BrowserWindow` (https://fburl.com/diffusion/0l0q669m). However, there is a bug in Electron 9 that makes this doesn't work as expected (https://github.com/electron/electron/issues/23664). Earlier, we've resolved this problem by specifying `no-cors` mode in requests. This strikes again in other plugin.

This diff applies a workaround commented inside the issue to allow to make CORS requests.

Reviewed By: nikoant

Differential Revision: D22306977

fbshipit-source-id: ea0f5e3f1c4080037df258a6c5ce1fc89d433c3b
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-06-30 06:50:38 -07:00
committed by Facebook GitHub Bot
parent b943d215e0
commit c8af6da236

View File

@@ -273,6 +273,11 @@ ipcMain.on(
// Define custom protocol handler. Deep linking works on packaged versions of the application! // Define custom protocol handler. Deep linking works on packaged versions of the application!
app.setAsDefaultProtocolClient('flipper'); app.setAsDefaultProtocolClient('flipper');
// webSecurity is already disabled in BrowserWindow. However, it seems there is
// a bug in Electron 9 https://github.com/electron/electron/issues/23664. There
// is workaround suggested in the issue
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors');
function tryCreateWindow() { function tryCreateWindow() {
if (appReady && pluginsCompiled) { if (appReady && pluginsCompiled) {
win = new BrowserWindow({ win = new BrowserWindow({