fix: isTrustedSender() in test-app (#24214)
This commit is contained in:
parent
48d1a70b52
commit
0629c6c2ea
1 changed files with 6 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
import { app, dialog, BrowserWindow, shell, ipcMain } from 'electron';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as url from 'url';
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow | null = null;
|
||||||
|
|
||||||
|
@ -29,12 +30,11 @@ function isTrustedSender (webContents: Electron.WebContents) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parsedUrl = new URL(webContents.getURL());
|
try {
|
||||||
const urlPath = process.platform === 'win32'
|
return url.fileURLToPath(webContents.getURL()) === indexPath;
|
||||||
// Strip the prefixed "/" that occurs on windows
|
} catch {
|
||||||
? path.resolve(parsedUrl.pathname.substr(1))
|
return false;
|
||||||
: parsedUrl.pathname;
|
}
|
||||||
return parsedUrl.protocol === 'file:' && urlPath === indexPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.handle('bootstrap', (event) => {
|
ipcMain.handle('bootstrap', (event) => {
|
||||||
|
|
Loading…
Reference in a new issue