@@ -340,7 +340,9 @@ export default class BrowserMainView extends Vue {
340
340
this .onCommitted .emit ({
341
341
frameId: 0 ,
342
342
parentFrameId: - 1 ,
343
- processId: this .getWebView (tabIndex ).getWebContents ().getOSProcessId (),
343
+ processId: this .$electron .remote .webContents .fromId (
344
+ this .getWebView (tabIndex ).getWebContentsId ()
345
+ ).getOSProcessId (),
344
346
tabId: this .getTabObject (tabIndex ).id ,
345
347
timeStamp: Date .now (),
346
348
url: webview .getAttribute (' src' ),
@@ -356,7 +358,9 @@ export default class BrowserMainView extends Vue {
356
358
this .onCompleted .emit ({
357
359
frameId: 0 ,
358
360
parentFrameId: - 1 ,
359
- processId: this .getWebView (tabIndex ).getWebContents ().getOSProcessId (),
361
+ processId: this .$electron .remote .webContents .fromId (
362
+ this .getWebView (tabIndex ).getWebContentsId ()
363
+ ).getOSProcessId (),
360
364
tabId: this .getTabObject (tabIndex ).id ,
361
365
timeStamp: Date .now (),
362
366
url: event .url ,
@@ -398,7 +402,9 @@ export default class BrowserMainView extends Vue {
398
402
windowId: this .windowId ,
399
403
});
400
404
} else {
401
- webview .getWebContents ().downloadURL (parsedURL .query .src as string );
405
+ this .$electron .remote .webContents .fromId (
406
+ webview .getWebContentsId ()
407
+ ).downloadURL (parsedURL .query .src as string );
402
408
}
403
409
} else {
404
410
this .$store .dispatch (' domReady' , {
@@ -413,7 +419,9 @@ export default class BrowserMainView extends Vue {
413
419
url ,
414
420
frameId: 0 ,
415
421
parentFrameId: - 1 ,
416
- processId: this .getWebView (tabIndex ).getWebContents ().getOSProcessId (),
422
+ processId: this .$electron .remote .webContents .fromId (
423
+ this .getWebView (tabIndex ).getWebContentsId ()
424
+ ).getOSProcessId (),
417
425
tabId: this .getTabObject (tabIndex ).id ,
418
426
timeStamp: Date .now (),
419
427
});
@@ -595,7 +603,9 @@ export default class BrowserMainView extends Vue {
595
603
}
596
604
this .onCreatedNavigationTarget .emit ({
597
605
sourceTabId: this .getTabObject (tabIndex ).id ,
598
- sourceProcessId: this .getWebView (tabIndex ).getWebContents ().getOSProcessId (),
606
+ sourceProcessId: this .$electron .remote .webContents .fromId (
607
+ this .getWebView (tabIndex ).getWebContentsId ()
608
+ ).getOSProcessId (),
599
609
sourceFrameId: 0 ,
600
610
timeStamp: Date .now (),
601
611
url: event .url ,
@@ -1018,12 +1028,14 @@ export default class BrowserMainView extends Vue {
1018
1028
const webview = this .getWebView ();
1019
1029
const url = urlUtil .getUrlIfError (this .tab .url );
1020
1030
if (webview .getURL () === url ) {
1021
- webview .getWebContents ().openDevTools ({ mode: ' bottom' });
1031
+ this .$electron .remote .webContents .fromId (
1032
+ webview .getWebContentsId ()
1033
+ ).openDevTools ({ mode: ' bottom' });
1022
1034
}
1023
1035
}
1024
1036
onClickJavaScriptPanel(): void {
1025
1037
const webview = this .getWebView ();
1026
- const webContent = webview .getWebContents ( );
1038
+ const webContent = this . $electron . remote . webContents . fromId ( webview .getWebContentsId () );
1027
1039
if (webContent .isDevToolsOpened ()) {
1028
1040
webContent .closeDevTools ();
1029
1041
} else {
@@ -1081,7 +1093,7 @@ export default class BrowserMainView extends Vue {
1081
1093
if (currentWindow ) {
1082
1094
const menuItems: any [] = [];
1083
1095
const webview = this .getWebView ();
1084
- const webContents: any = webview .getWebContents ( );
1096
+ const webContents: any = this . $electron . remote . webContents . fromId ( webview .getWebContentsId () );
1085
1097
const navbar = document .getElementById (' browser-navbar' );
1086
1098
const goBack = document .getElementById (' browser-navbar__goBack' );
1087
1099
@@ -1145,7 +1157,7 @@ export default class BrowserMainView extends Vue {
1145
1157
if (currentWindow ) {
1146
1158
const menuItems: any [] = [];
1147
1159
const webview = this .getWebView ();
1148
- const webContents: any = webview .getWebContents ( );
1160
+ const webContents: any = this . $electron . remote . webContents . fromId ( webview .getWebContentsId () );
1149
1161
const navbar = document .getElementById (' browser-navbar' );
1150
1162
const goForward = document .getElementById (' browser-navbar__goForward' );
1151
1163
@@ -1477,8 +1489,9 @@ export default class BrowserMainView extends Vue {
1477
1489
menu .append (new MenuItem ({
1478
1490
label: this .$t (' webview.contextMenu.openLinkInNewWindow' ) as string ,
1479
1491
click : () => {
1480
- const webContent = webview .getWebContents ();
1481
- webContent .executeJavaScript (` window.open('${params .linkURL }') ` );
1492
+ this .$electron .remote .webContents .fromId (
1493
+ webview .getWebContentsId ()
1494
+ ).executeJavaScript (` window.open('${params .linkURL }') ` );
1482
1495
},
1483
1496
}));
1484
1497
@@ -1632,15 +1645,21 @@ export default class BrowserMainView extends Vue {
1632
1645
const ipc = this .$electron .ipcRenderer ;
1633
1646
1634
1647
ipc .on (' reset-zoom' , () => {
1635
- this .getWebView ().getWebContents ().setZoomLevel (0 );
1648
+ this .$electron .remote .webContents .fromId (
1649
+ this .getWebView ().getWebContentsId ()
1650
+ ).setZoomLevel (0 );
1636
1651
});
1637
1652
ipc .on (' zoom-in' , () => {
1638
- const webContents = this .getWebView ().getWebContents ();
1653
+ const webContents = this .$electron .remote .webContents .fromId (
1654
+ this .getWebView ().getWebContentsId ()
1655
+ );
1639
1656
const zoomLevel = webContents .getZoomLevel ();
1640
1657
webContents .setZoomLevel (zoomLevel + 0.5 );
1641
1658
});
1642
1659
ipc .on (' zoom-out' , () => {
1643
- const webContents = this .getWebView ().getWebContents ();
1660
+ const webContents = this .$electron .remote .webContents .fromId (
1661
+ this .getWebView ().getWebContentsId ()
1662
+ );
1644
1663
const zoomLevel = webContents .getZoomLevel ();
1645
1664
webContents .setZoomLevel (zoomLevel - 0.5 );
1646
1665
});
0 commit comments