[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)) { if (CallsWidgetWindow.isCallsWidget(webContentsId)) {
return CallsWidgetWindow.getURL(); return CallsWidgetWindow.getViewURL();
} }
return ViewManager.getViewByWebContentsId(webContentsId)?.view.server.url; return ViewManager.getViewByWebContentsId(webContentsId)?.view.server.url;

View File

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

View File

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

View File

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