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

Commit

Permalink
Return about:[name] as origin for about: pages
Browse files Browse the repository at this point in the history
Fix #10410

Auditors: @diracdeltas

Notes this is in the branch of code which requires muon only so it is already in unit tests but we test it with the wrong url parsing from node.
  • Loading branch information
bbondy committed Aug 10, 2017
1 parent 10056bf commit 679c05a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/lib/urlutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,9 @@ const UrlUtil = {
},

/**
* 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|null}
*/
Expand All @@ -429,8 +430,11 @@ const UrlUtil = {
}

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 679c05a

Please sign in to comment.