Resolve relative urls in window.open, fix #2166

This commit is contained in:
Cheng Zhao 2015-07-10 11:36:25 +08:00
parent 4379d24e9d
commit 260ec96edd

View file

@ -2,6 +2,12 @@ process = global.process
ipc = require 'ipc'
remote = require 'remote'
# Helper function to resolve relative url.
a = document.createElement 'a'
resolveUrl = (url) ->
a.href = url
a.href
# Window object returned by "window.open".
class BrowserWindowProxy
constructor: (@guestId) ->
@ -49,6 +55,9 @@ window.open = (url, frameName='', features='') ->
options.width ?= 800
options.height ?= 600
# Resolve relative urls.
url = resolveUrl url
(options[name] = parseInt(options[name], 10) if options[name]?) for name in ints
# Inherit the node-integration option of current window.