Browse Source

Print error messages

Cheng Zhao 8 years ago
parent
commit
73c1fab423
1 changed files with 5 additions and 0 deletions
  1. 5 0
      lib/browser/guest-window-manager.js

+ 5 - 0
lib/browser/guest-window-manager.js

@@ -132,6 +132,8 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', function (event, guestI
   const guestWindow = getGuestWindow(guestId)
   if (guestWindow != null && canAccessWindow(event.sender, guestWindow.webContents)) {
     guestWindow.destroy()
+  } else {
+    console.error(`Blocked ${event.sender.getURL()} from closing its opener.`)
   }
 })
 
@@ -140,6 +142,7 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', function (event, guest
   if (guestWindow != null && canAccessWindow(event.sender, guestWindow.webContents)) {
     event.returnValue = guestWindow[method].apply(guestWindow, args)
   } else {
+    console.error(`Blocked ${event.sender.getURL()} from calling ${method} of its opener.`)
     event.returnValue = null
   }
 })
@@ -161,5 +164,7 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', function (event,
   const guestContents = webContents.fromId(guestId)
   if (guestContents != null && canAccessWindow(event.sender, guestContents)) {
     guestContents[method].apply(guestContents, args)
+  } else {
+    console.error(`Blocked ${event.sender.getURL()} from calling ${method} of its opener.`)
   }
 })