BrowserWindow.windows = new IDWeakMap
BrowserWindow::_init = ->
- @urlOptions = {}
-
# Simulate the application menu on platforms other than OS X.
if process.platform isnt 'darwin'
menu = app.getApplicationMenu()
BrowserWindow.windows.get id
# Helpers.
-BrowserWindow::loadUrl = ->
- args = [].slice.call arguments
- unless args.length > 1
- args.push @urlOptions
-
- #TODO: This needs fixing!
- @urlOptions = args[1]
-
- @webContents.loadUrl.apply @webContents, args
+BrowserWindow::loadUrl = (url, urlOptions={}) -> @webContents.loadUrl url, urlOptions
BrowserWindow::send = -> @webContents.send.apply @webContents, arguments
# Be compatible with old API.
BrowserWindow::restart = -> @webContents.reload()
BrowserWindow::getUrl = -> @webContents.getUrl()
-BrowserWindow::reload = -> @webContents.reload(@urlOptions)
-BrowserWindow::reloadIgnoringCache = -> @webContents.reloadIgnoringCache(@urlOptions)
+BrowserWindow::reload = (urlOptions={}) -> @webContents.reload(urlOptions)
+BrowserWindow::reloadIgnoringCache = (urlOptions={}) -> @webContents.reloadIgnoringCache(urlOptions)
BrowserWindow::getPageTitle = -> @webContents.getTitle()
BrowserWindow::isLoading = -> @webContents.isLoading()
BrowserWindow::isWaitingForResponse = -> @webContents.isWaitingForResponse()
# No setter.
enumerable: true
- @httpReferrer = @webviewNode.getAttribute 'httpReferrer'
- Object.defineProperty @webviewNode, 'httpReferrer',
+ @httpReferrer = @webviewNode.getAttribute 'httpreferrer'
+ Object.defineProperty @webviewNode, 'httpreferrer',
get: => @httpReferrer
- set: (value) => @webviewNode.setAttribute 'httpReferrer', value
+ set: (value) => @webviewNode.setAttribute 'httpreferrer', value
enumerable: true
# The purpose of this mutation observer is to catch assignment to the src
params =
attributes: true,
attributeOldValue: true,
- attributeFilter: ['src', 'partition', 'httpReferrer']
+ attributeFilter: ['src', 'partition', 'httpreferrer']
@srcAndPartitionObserver.observe @webviewNode, params
# This observer monitors mutations to attributes of the <webview> and
return unless @guestInstanceId
guestViewInternal.setAllowTransparency @guestInstanceId, @allowtransparency
- else if name is 'httpReferrer'
+ else if name is 'httpreferrer'
oldValue ?= ''
newValue ?= ''
if newValue == '' and oldValue != ''
- @webviewNode.setAttribute 'httpReferrer', oldValue
+ @webviewNode.setAttribute 'httpreferrer', oldValue
@httpReferrer = newValue
result = {}
- # I think the right thing to do if you change your referrer is to reload
- # the src since I've bundled the referrer in with the parseSrcAttribute.
- # I think it makes sense to do that.
+ # If the httpreferrer changes treat it as though the src changes and reload
+ # the page with the new httpreferrer.
@parseSrcAttribute result
throw result.error if result.error?
return
if @httpReferrer
- @urlOptions = { "httpReferrer": @httpReferrer }
+ @urlOptions = { "httpreferrer": @httpReferrer }
# Navigate to |this.src|.
remote.getGuestWebContents(@guestInstanceId).loadUrl @src, @urlOptions