Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
torbutton
Commits
8af90b32
Commit
8af90b32
authored
Jul 09, 2017
by
Arthur Edelstein
Browse files
Bug 21999: Detect homepage URLs more effectively
parent
90c35ef9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/chrome/content/torbutton.js
View file @
8af90b32
...
...
@@ -2275,6 +2275,25 @@ function torbutton_get_current_accept_language_value(aURI)
return
null
;
}
// Take URL strings the user has specified for a homepage
// and normalize it so it looks like a real URL.
function
torbutton_normalize_homepage_url_string
(
aURLString
)
{
if
(
!
aURLString
)
return
null
;
if
(
typeof
aURLString
!==
"
string
"
)
return
null
;
let
url
;
try
{
url
=
new
URL
(
aURLString
);
}
catch
(
e
)
{
try
{
url
=
new
URL
(
"
http://
"
+
aURLString
);
}
catch
(
e
)
{
return
null
;
}
}
return
url
.
href
;
}
function
torbutton_is_homepage_url
(
aURI
)
{
if
(
!
aURI
)
...
...
@@ -2292,7 +2311,8 @@ function torbutton_is_homepage_url(aURI)
if
(
!
homePageURLs
)
return
false
;
let
urls
=
homePageURLs
.
split
(
'
|
'
);
let
urls
=
homePageURLs
.
split
(
'
|
'
)
.
map
(
torbutton_normalize_homepage_url_string
);
return
(
urls
.
indexOf
(
aURI
.
spec
)
>=
0
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment