Browse Source

Use isSameOrigin helper when posting message

Kevin Sawicki 8 years ago
parent
commit
fa4ec11a12
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/browser/guest-window-manager.js

+ 1 - 1
lib/browser/guest-window-manager.js

@@ -309,7 +309,7 @@ ipcMain.on('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_POSTMESSAGE', function (event,
   // The W3C does not seem to have word on how postMessage should work when the
   // origins do not match, so we do not do |canAccessWindow| check here since
   // postMessage across origins is useful and not harmful.
-  if (guestContents.getURL().indexOf(targetOrigin) === 0 || targetOrigin === '*') {
+  if (targetOrigin === '*' || isSameOrigin(guestContents.getURL(), targetOrigin)) {
     const sourceId = event.sender.id
     guestContents.send('ELECTRON_GUEST_WINDOW_POSTMESSAGE', sourceId, message, sourceOrigin)
   }