Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Allow about pages to reload and clone #4881

Merged
merged 1 commit into from
Oct 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const debounce = require('../lib/debounce')
const getSetting = require('../settings').getSetting
const config = require('../constants/config')
const settings = require('../constants/settings')
const {aboutUrls, isSourceAboutUrl, isTargetAboutUrl, getTargetAboutUrl, getBaseUrl, isNavigatableAboutPage} = require('../lib/appUrlUtil')
const {aboutUrls, isSourceAboutUrl, isTargetAboutUrl, getTargetAboutUrl, getBaseUrl, isIntermediateAboutPage} = require('../lib/appUrlUtil')
const {isFrameError} = require('../../app/common/lib/httpUtil')
const locale = require('../l10n')
const appConfig = require('../constants/appConfig')
Expand Down Expand Up @@ -73,6 +73,10 @@ class Frame extends ImmutableComponent {
return aboutUrls.get(getBaseUrl(this.props.location))
}

isIntermediateAboutPage () {
return isIntermediateAboutPage(getBaseUrl(this.props.location))
}

updateAboutDetails () {
let location = getBaseUrl(this.props.location)
if (location === 'about:preferences') {
Expand Down Expand Up @@ -404,9 +408,6 @@ class Frame extends ImmutableComponent {
}

clone (args) {
if (!isNavigatableAboutPage(getBaseUrl(this.props.location))) {
return
}
const newGuest = this.webview.clone()
const newGuestInstanceId = newGuest.getWebPreferences().guestInstanceId
let cloneAction
Expand All @@ -427,23 +428,19 @@ class Frame extends ImmutableComponent {
this.webview.stop()
break
case 'reload':
if (this.isAboutPage()) {
break
}
// Ensure that the webview thinks we're on the same location as the browser does.
// This can happen for pages which don't load properly.
// Some examples are basic http auth and bookmarklets.
// In this case both the user display and the user think they're on this.props.location.
if (this.webview.getURL() !== this.props.location) {
if (this.webview.getURL() !== this.props.location && !this.isAboutPage()) {
this.webview.loadURL(this.props.location)
} else if (this.isIntermediateAboutPage()) {
this.webview.loadURL(this.props.aboutDetails.get('url'))
} else {
this.webview.reload()
}
break
case 'clean-reload':
if (this.isAboutPage()) {
break
}
this.webview.reloadIgnoringCache()
break
case 'clone':
Expand Down
2 changes: 1 addition & 1 deletion js/components/navigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class NavigationBar extends ImmutableComponent {
}
<div className='startButtons'>
{
isSourceAboutUrl(this.props.location) || this.titleMode
this.titleMode
? null
: this.loading
? <Button iconClass='fa-times'
Expand Down
1 change: 1 addition & 0 deletions js/state/frameStateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ function cloneFrame (frameOpts, guestInstanceId) {
clone.location = 'about:blank'
clone.src = 'about:blank'
clone.parentFrameKey = frameOpts.key
clone.aboutDetails = frameOpts.aboutDetails
return clone
}

Expand Down