Skip to content

Commit 5407479

Browse files
semenkodiracdeltas
authored andcommitted
Don't try to update the URI() object unless needed (rare)
Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>
1 parent 248b562 commit 5407479

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

chromium/background.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ function onBeforeRequest(details) {
8787
// If there is a username / password, put them aside during the ruleset
8888
// analysis process
8989
var tmpuserinfo = tmpuri.userinfo();
90-
tmpuri.userinfo('');
90+
if (tmpuserinfo) {
91+
tmpuri.userinfo('');
92+
}
9193

9294
var canonical_url = tmpuri.toString();
9395
if (details.url != canonical_url && tmpuserinfo === '') {
@@ -141,7 +143,9 @@ function onBeforeRequest(details) {
141143
// re-insert userpass info which was stripped temporarily
142144
// while rules were applied
143145
var finaluri = new URI(newuristr);
144-
finaluri.userinfo(tmpuserinfo);
146+
if (tmpuserinfo) {
147+
finaluri.userinfo(tmpuserinfo);
148+
}
145149
var finaluristr = finaluri.toString();
146150
log(DBUG, "Redirecting from "+a.href+" to "+finaluristr);
147151
return {redirectUrl: finaluristr};

0 commit comments

Comments
 (0)