diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 983d37d502f2..cf40de96e488 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -291,7 +291,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) { base::string16 http_referrer_; - if(options.Get("httpReferrer", &http_referrer_)) + if (options.Get("httpreferrer", &http_referrer_)) params.referrer = content::Referrer(GURL(http_referrer_).GetAsReferrer(), blink::WebReferrerPolicyDefault); params.transition_type = content::PAGE_TRANSITION_TYPED; diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index a25672e28e13..243ad1ac3c75 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -11,8 +11,6 @@ BrowserWindow::__proto__ = EventEmitter.prototype 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() @@ -86,23 +84,15 @@ BrowserWindow.fromId = (id) -> 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() diff --git a/atom/browser/lib/guest-window-manager.coffee b/atom/browser/lib/guest-window-manager.coffee index abd2d1b8729d..123c3898a9d4 100644 --- a/atom/browser/lib/guest-window-manager.coffee +++ b/atom/browser/lib/guest-window-manager.coffee @@ -7,11 +7,11 @@ frameToGuest = {} createGuest = (embedder, url, frameName, options) -> guest = frameToGuest[frameName] if frameName and guest? - guest.loadUrl url {} + guest.loadUrl url return guest.id guest = new BrowserWindow(options) - guest.loadUrl url {} + guest.loadUrl url # When |embedder| is destroyed we should also destroy attached guest, and if # guest is closed by user then we should prevent |embedder| from double diff --git a/atom/renderer/lib/web-view.coffee b/atom/renderer/lib/web-view.coffee index 1c35c163ffe5..96abb4865728 100644 --- a/atom/renderer/lib/web-view.coffee +++ b/atom/renderer/lib/web-view.coffee @@ -199,10 +199,10 @@ class WebView # 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 @@ -219,7 +219,7 @@ class WebView 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 and @@ -253,19 +253,18 @@ class WebView 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? @@ -388,7 +387,7 @@ class WebView return if @httpReferrer - @urlOptions = { "httpReferrer": @httpReferrer } + @urlOptions = { "httpreferrer": @httpReferrer } # Navigate to |this.src|. remote.getGuestWebContents(@guestInstanceId).loadUrl @src, @urlOptions