@@ -987,7 +987,12 @@ module.exports = class Server extends EventEmitter {
987987
988988 if (incomingRequest.isNotification) {} else {
989989 httpResponse.setHeader("Content-Type", "application/json");
990- httpResponse.write(incomingRequest.callResultSerialized);
990+
991+ if (typeof incomingRequest.callResultSerialized === "object") {
992+ httpResponse.write(JSON.stringify(incomingRequest.callResultSerialized, undefined, "\t"));
993+ } else {
994+ httpResponse.write(incomingRequest.callResultSerialized);
995+ }
991996 }
992997 } catch (error) {
993998 httpResponse.statusCode = 500;
@@ -8724,7 +8729,7 @@ let electron = null;
87248729if (process && process.versions["electron"]) {
87258730 electron = __webpack_require__(39);
87268731
8727- if ((window || self) && !electron && typeof (window || self).require === "function") {
8732+ if (!electron && (window || self) && typeof (window || self).require === "function") {
87288733 electron = (window || self).require("electron");
87298734 }
87308735}
@@ -8808,7 +8813,7 @@ module.exports = class BidirectionalElectronIPCRouter extends JSONRPC.RouterBase
88088813
88098814 const nConnectionID = ++this._nConnectionIDCounter;
88108815
8811- const strChannel = "jsonrpc_winid_" + electron.remote.getCurrentWindow().id;
8816+ const strChannel = "jsonrpc_winid_" + (window || self).require(" electron") .remote.getCurrentWindow().id;
88128817
88138818 const objSession = {
88148819 browserWindow: null,
@@ -8821,7 +8826,7 @@ module.exports = class BidirectionalElectronIPCRouter extends JSONRPC.RouterBase
88218826
88228827 this._objSessions[nConnectionID] = objSession;
88238828
8824- electron.ipcRenderer.on(strChannel, async (event, objJSONRPCRequest) => {
8829+ (window || self).require(" electron") .ipcRenderer.on(strChannel, async (event, objJSONRPCRequest) => {
88258830 await this._routeMessage(objJSONRPCRequest, objSession, strChannel);
88268831 });
88278832
@@ -8926,7 +8931,7 @@ module.exports = class BidirectionalElectronIPCRouter extends JSONRPC.RouterBase
89268931 if (browserWindow) {
89278932 browserWindow.webContents.send(strChannel, incomingRequest.callResultToBeSerialized);
89288933 } else {
8929- electron.ipcRenderer.send(strChannel, incomingRequest.callResultToBeSerialized);
8934+ (window || self).require(" electron") .ipcRenderer.send(strChannel, incomingRequest.callResultToBeSerialized);
89308935 }
89318936 }
89328937 } else if (objMessage.hasOwnProperty("result") || objMessage.hasOwnProperty("error")) {
@@ -10135,7 +10140,7 @@ module.exports = class DebugLogger extends JSONRPC.ClientPluginBase {
1013510140if (process && process.versions["electron"]) {
1013610141 electron = __webpack_require__(39);
1013710142
10138- if ((window || self) && !electron && typeof (window || self).require === "function") {
10143+ if (!electron && (window || self) && typeof (window || self).require === "function") {
1013910144 electron = (window || self).require("electron");
1014010145 }
1014110146}
@@ -10155,7 +10160,7 @@ module.exports = class ElectronIPCTransport extends JSONRPC.ClientPluginBase {
1015510160 this._bBidirectionalMode = !!bBidirectionalMode;
1015610161 this._browserWindow = browserWindow;
1015710162
10158- this._strChannel = "jsonrpc_winid_" + (browserWindow ? browserWindow.id : electron.remote.getCurrentWindow().id);
10163+ this._strChannel = "jsonrpc_winid_" + (browserWindow ? browserWindow.id : (window || self).require(" electron") .remote.getCurrentWindow().id);
1015910164
1016010165 this._setupIPCTransport();
1016110166 }
@@ -10214,7 +10219,7 @@ module.exports = class ElectronIPCTransport extends JSONRPC.ClientPluginBase {
1021410219 if (this.browserWindow) {
1021510220 this.browserWindow.webContents.send(this.channel, outgoingRequest.requestObject);
1021610221 } else {
10217- electron.ipcRenderer.send(this.channel, outgoingRequest.requestObject);
10222+ (window || self).require(" electron") .ipcRenderer.send(this.channel, outgoingRequest.requestObject);
1021810223 }
1021910224
1022010225 if (outgoingRequest.isNotification) {} else {
@@ -10244,7 +10249,7 @@ module.exports = class ElectronIPCTransport extends JSONRPC.ClientPluginBase {
1024410249 _setupIPCTransport() {
1024510250 if (!this.browserWindow) {
1024610251 if (!this._bBidirectionalMode) {
10247- electron.ipcRenderer.on(this._strChannel, async (event, objJSONRPCRequest) => {
10252+ (window || self).require(" electron") .ipcRenderer.on(this._strChannel, async (event, objJSONRPCRequest) => {
1024810253 await this.processResponse(objJSONRPCRequest);
1024910254 });
1025010255 }
0 commit comments