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

Commit

Permalink
Use untitled and loading for opener pages
Browse files Browse the repository at this point in the history
Fix #6495

Auditors: @bsclifton

This feels a lot better especially with the loading icon being used now
  • Loading branch information
bbondy committed Jan 6, 2017
1 parent b1def4d commit cfa8388
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/extensions/brave/about-blank.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
<meta charset="utf-8">
<meta name="availableLanguages" content="">
<meta name="defaultLanguage" content="en-US">
<title data-l10n-id="aboutBlank"></title>
<title data-l10n-id="aboutBlankTitle"></title>
<script src="ext/l20n.min.js"></script>
<script src="gen/aboutPages.entry.js" async></script>
<link rel="localization" href="locales/{locale}/preferences.properties">
<link rel="localization" href="locales/{locale}/common.properties">
</head>
<body />
</html>
1 change: 1 addition & 0 deletions app/extensions/brave/locales/en-US/common.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
enableWidevineSubtext=Google Widevine is a piece of Digital Rights Management (DRM) code that we at Brave Software do not own and cannot inspect. The Google Widevine code is loaded from Google servers, not from our servers. It is loaded only when you enable this option. We discourage the use of DRM, but we respect user choice and acknowledge that some Brave users would like to use services that require it.
enableWidevineSubtext2=By installing this extension, you are agreeing to the Google Widevine Terms of Use. You agree that Brave is not responsible for any damages or losses in connection with your use of Google Widevine.
aboutBlankTitle=Untitled
7 changes: 5 additions & 2 deletions app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ var rendererIdentifiers = function () {
'ignoreSpelling',
'lookupSelection',
// Other identifiers
'aboutBlankTitle',
'urlCopied',
'autoHideMenuBar',
'unexpectedErrorWindowReload',
Expand Down Expand Up @@ -353,10 +354,12 @@ exports.init = function (language) {
const propertyFiles = []
const appendLangProperties = function (lang) {
// Property files to parse (only ones containing menu specific identifiers)
propertyFiles.push(path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'menu.properties'),
propertyFiles.push(
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'menu.properties'),
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'app.properties'),
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'error.properties'),
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'passwords.properties'))
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'passwords.properties'),
path.join(__dirname, 'extensions', 'brave', 'locales', lang, 'common.properties'))
}

appendLangProperties(lang)
Expand Down
13 changes: 11 additions & 2 deletions js/components/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const React = require('react')
const ImmutableComponent = require('./immutableComponent')

const windowActions = require('../actions/windowActions')
const locale = require('../l10n')
const dragTypes = require('../constants/dragTypes')
const messages = require('../constants/messages')
const cx = require('../lib/classSet')
Expand Down Expand Up @@ -71,6 +72,13 @@ class Tab extends ImmutableComponent {
}

get displayValue () {
// For renderer initiated navigations, make sure we show Untitled
// until we know what we're loading. We should probably do this for
// all about: pages that we already know the title for so we don't have
// to wait for the title to be parsed.
if (this.props.tab.get('location') === 'about:blank') {
return locale.translation('aboutBlankTitle')
}
// YouTube tries to change the title to add a play icon when
// there is audio. Since we have our own audio indicator we get
// rid of it.
Expand Down Expand Up @@ -107,7 +115,8 @@ class Tab extends ImmutableComponent {

get loading () {
return this.frame &&
this.props.tab.get('loading') &&
(this.props.tab.get('loading') ||
this.props.tab.get('location') === 'about:blank') &&
(!this.props.tab.get('provisionalLocation') ||
!this.props.tab.get('provisionalLocation').startsWith('chrome-extension://mnojpmjdmbbfmejpflffifhffcmidifd/'))
}
Expand Down Expand Up @@ -178,7 +187,7 @@ class Tab extends ImmutableComponent {
playIcon = true
}

const locationHasFavicon = this.props.tab.get('location') !== 'about:newtab' && this.props.tab.get('location') !== 'about:blank'
const locationHasFavicon = this.props.tab.get('location') !== 'about:newtab'

return <div
className={cx({
Expand Down
16 changes: 16 additions & 0 deletions test/components/tabTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Brave = require('../lib/brave')
const messages = require('../../js/constants/messages')
const assert = require('assert')
const settings = require('../../js/constants/settings')
const {urlInput, backButton, forwardButton, activeTabTitle, activeTabFavicon, newFrameButton} = require('../lib/selectors')

Expand Down Expand Up @@ -330,4 +331,19 @@ describe('tab tests', function () {
.waitForExist(activeTabFavicon, 1000, true)
})
})

describe('about:blank tab', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
})

it('has untitled text right away', function * () {
yield this.app.client
.ipcSend(messages.SHORTCUT_NEW_FRAME, 'about:blank', { openInForeground: false })
.waitForVisible('.tab[data-frame-key="2"]')
// This should not be converted to a waitUntil
.getText('.tab[data-frame-key="2"]').then((val) => assert.equal(val, 'Untitled'))
})
})
})

1 comment on commit cfa8388

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.