[MM-52879] Fixed calls popout URL checking (#2725)

This commit is contained in:
Devin Binnie
2023-05-18 12:58:05 -04:00
committed by GitHub
parent 3899b7c582
commit 2ed851c2a4
4 changed files with 10 additions and 11 deletions

View File

@@ -78,7 +78,7 @@ export class WebContentsEventManager {
}
if (CallsWidgetWindow.isCallsWidget(webContentsId)) {
return CallsWidgetWindow.getURL();
return CallsWidgetWindow.getViewURL();
}
return ViewManager.getViewByWebContentsId(webContentsId)?.view.server.url;

View File

@@ -438,15 +438,16 @@ describe('main/windows/callsWidgetWindow', () => {
expect(callsWidgetWindow.popOut).not.toBeDefined();
});
it('getURL', () => {
it('getViewURL', () => {
const callsWidgetWindow = new CallsWidgetWindow();
callsWidgetWindow.win = {
webContents: {
getURL: () => 'http://localhost:8065/',
callsWidgetWindow.mainView = {
view: {
server: {
url: new URL('http://localhost:8065/'),
},
},
};
urlUtils.parseURL.mockImplementation((url) => new URL(url));
expect(callsWidgetWindow.getURL().toString()).toBe('http://localhost:8065/');
expect(callsWidgetWindow.getViewURL().toString()).toBe('http://localhost:8065/');
});
describe('isAllowedEvent', () => {

View File

@@ -94,8 +94,8 @@ export class CallsWidgetWindow {
* Helper functions
*/
getURL = () => {
return this.win && parseURL(this.win?.webContents.getURL());
getViewURL = () => {
return this.mainView?.view.server.url;
}
isCallsWidget = (webContentsId: number) => {

View File

@@ -7,8 +7,6 @@ import {SHOW_SETTINGS_WINDOW} from 'common/communication';
import Config from 'common/config';
import {Logger} from 'common/log';
import ViewManager from 'main/views/viewManager';
import ContextMenu from '../contextMenu';
import {getLocalPreload, getLocalURLString} from '../utils';