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

Commit

Permalink
Merge pull request #10414 from brave/10410-0.18.x
Browse files Browse the repository at this point in the history
Return about:[name] as origin for about: pages
  • Loading branch information
diracdeltas committed Aug 10, 2017
1 parent 2ba182b commit 4b22741
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/state/siteUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,8 +859,9 @@ module.exports.getBookmarks = function (sites) {
}

/**
* Gets a site origin (scheme + hostname + port) from a URL or null if not
* available.
* Gets a site origin (scheme + hostname + port) from a URL or null if not available.
* Warning: For unit tests, this currently runs as node without the parsed.origin
* branch of code, but in muon this runs through the parsed.origin branch of code.
* @param {string} location
* @return {string?}
*/
Expand All @@ -875,8 +876,11 @@ module.exports.getOrigin = function (location) {
}

let parsed = urlParse(location)
if (parsed.origin) {
// parsed.origin is specific to muon.url.parse
// parsed.origin is specific to muon.url.parse
if (parsed.origin !== undefined) {
if (parsed.protocol === 'about:') {
return [parsed.protocol, parsed.path].join('')
}
return parsed.origin.replace(/\/+$/, '')
}
if (parsed.host && parsed.protocol) {
Expand Down

0 comments on commit 4b22741

Please sign in to comment.