mirror of
https://github.com/electron/electron.git
synced 2026-01-23 06:18:17 -05:00
Resolve relative urls in window.open, fix #2166
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user