Resolve relative urls in window.open, fix #2166
This commit is contained in:
parent
4379d24e9d
commit
260ec96edd
1 changed files with 9 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue