Skip to content

Commit 8737150

Browse files
committed
Remove 'chrome-extension://pdfjsOrigin' prefix from URL bar
fix brave#2534
1 parent e962ef9 commit 8737150

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

js/components/urlBar.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ const ipc = global.require('electron').ipcRenderer
1515
const UrlBarSuggestions = require('./urlBarSuggestions.js')
1616
const messages = require('../constants/messages')
1717
const dragTypes = require('../constants/dragTypes')
18+
const { getSetting } = require('../settings')
19+
const settings = require('../constants/settings')
1820
const contextMenus = require('../contextMenus')
1921
const dndData = require('../dndData')
22+
const appStoreRenderer = require('../stores/appStoreRenderer')
2023

2124
const { isUrl, isIntermediateAboutPage } = require('../lib/appUrlUtil')
2225

@@ -265,12 +268,18 @@ class UrlBar extends ImmutableComponent {
265268
}
266269
}
267270

268-
const location = this.props.urlbar.get('location')
271+
let location = this.props.urlbar.get('location')
269272
const history = this.props.activeFrameProps.get('history')
270273
if (isIntermediateAboutPage(location) && history.size > 0) {
271274
return history.last()
272275
}
273276

277+
// We can extend the conditions if there are more chrome-extension to
278+
// truncate
279+
if (getSetting(settings.PDFJS_ENABLED) && location.startsWith(appStoreRenderer.state.get('pdfjsOrigin'))) {
280+
location = location.replace(/^chrome-extension:\/\/.+\/(\w+:\/\/.+)/, '$1')
281+
}
282+
274283
return ['about:blank', 'about:newtab'].includes(this.props.urlbar.get('location'))
275284
? '' : location
276285
}

0 commit comments

Comments
 (0)