[WRT] Fix ipc message 71/156271/3
authorSanghyup Lee <sh53.lee@samsung.com>
Wed, 18 Oct 2017 01:29:06 +0000 (10:29 +0900)
committerSanghyup Lee <sh53.lee@samsung.com>
Wed, 18 Oct 2017 09:02:35 +0000 (18:02 +0900)
|ipcRenderer.send| doesn't work in in wrt/src/web_window.js.
This patch uses |app.emit| instead of it.

Change-Id: I6631bb3dbd735f447e6276e7e077fc06b60d5f88
Signed-off-by: Sanghyup Lee <sh53.lee@samsung.com>
wrt/src/web_window.js

index 891c9c2..911741e 100644 (file)
@@ -9,9 +9,9 @@ const path = require('path');
 const ExtensionManager = require('./extension_manager');
 const rp_new_debug = require('debug')('RP_NEW');
 const commonModuleManager = require('./manager');
-const {ipcRenderer} = require('electron');
 const BrowserWindow = commonModuleManager.browserWindow;
 const events = commonModuleManager.events;
+const app = commonModuleManager.app;
 
 class WebWindow {
     constructor(options) {
@@ -142,7 +142,7 @@ class WebWindow {
                 webwindow_debug('WebWindow : browserWindow show options is ',options.show);
                 self.show();
             }
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FINISH_LOAD, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FINISH_LOAD, self.mainWindow.id);
         });
         this.mainWindow.webContents.on('did-fail-load', function(event, errorCode, errorDescription, validatedUrl) {
             webwindow_debug('WebWindow : webContents did-fail-load');
@@ -150,21 +150,21 @@ class WebWindow {
             params.errorCode = errorCode;
             params.errorDescription = errorDescription;
             params.validatedUrl = validatedUrl;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FAIL_LOAD, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FAIL_LOAD, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('did-frame-finish-load', function(event, isMainFrame) {
             webwindow_debug('WebWindow : webContents did-frame-finish-load:');
             var params = {};
             params.isMainFrame = isMainFrame;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_FRAME_FINISH_LOAD, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_FRAME_FINISH_LOAD, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('did-start-loading', function() {
             webwindow_debug('WebWindow : webContents did-start-loading');
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_START_LOADING, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_START_LOADING, self.mainWindow.id);
         });
         this.mainWindow.webContents.on('did-stop-loading', function() {
             webwindow_debug('WebWindow : webContents did-stop-loading');
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_STOP_LOADING, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_STOP_LOADING, self.mainWindow.id);
         });
         this.mainWindow.webContents.on('did-get-response-details', function(event, status, newUrl, originalUrl, httpResponseCode, requestMethod, referrer, headers) {
             webwindow_debug('WebWindow : webContents did-get-response-details');
@@ -176,7 +176,7 @@ class WebWindow {
             params.requestMethod = requestMethod;
             params.referrer = referrer;
             params.headers = headers;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_GET_RESPONSE_DETAILS, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_GET_RESPONSE_DETAILS, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('did-get-redirect-request', function(event, oldUrl, newUrl, isMainFrame, httpResponseCode, requestMethod, referrer, headers) {
             webwindow_debug('WebWindow : webContents did-get-redirect-request');
@@ -188,17 +188,17 @@ class WebWindow {
             params.requestMethod = requestMethod;
             params.referrer = referrer;
             params.headers = headers;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DID_GET_REDIRECT_REQUEST, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DID_GET_REDIRECT_REQUEST, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('dom-ready', function(event) {
             webwindow_debug('WebWindow : webContents dom-ready');
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DOM_READY, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DOM_READY, self.mainWindow.id);
         });
         this.mainWindow.webContents.on('page-favicon-updated', function(event, favicons) {
             webwindow_debug('WebWindow : webContents page-favicon-updated');
             var params = {};
             params.favicons = favicons;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.PAGE_FAVICON_UPDATED, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.PAGE_FAVICON_UPDATED, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('new-window', function(event, url, frameName, disposition, options) {
             webwindow_debug('WebWindow : webContents new-window');
@@ -207,25 +207,25 @@ class WebWindow {
             params.frameName = frameName;
             params.disposition = disposition;
             params.options = options;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.NEW_WINDOW, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.NEW_WINDOW, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('will-navigate', function(event, url) {
             webwindow_debug('WebWindow : webContents will-navigate');
         });
         this.mainWindow.webContents.on('crashed', function() {
             webwindow_debug('WebWindow : webContents crashed');
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.CRASHED, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.CRASHED, self.mainWindow.id);
         });
         this.mainWindow.webContents.on('plugin-crashed', function(event, name, version) {
             webwindow_debug('WebWindow : webContents plugin-crashed');
             var params = {};
             params.name = name;
             params.version = version;
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.PLUGIN_CRASHED, 'web_window', self.mainWindow.id, params);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.PLUGIN_CRASHED, self.mainWindow.id, params);
         });
         this.mainWindow.webContents.on('destroyed', function() {
             webwindow_debug('WebWindow : webContents destroyed');
-            ipcRenderer.send(IPC_MESSAGE.WEBCONTENTS.DESTROYED, 'web_window', self.mainWindow.id);
+            app.emit(IPC_MESSAGE.WEBCONTENTS.DESTROYED, self.mainWindow.id);
         });
     }
     setUrl(path) {