Skip to content

Commit 8be167a

Browse files
committed
Refactor "finaluri" confusion
Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>
1 parent 3a1e52e commit 8be167a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

chromium/background.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,13 @@ function onBeforeRequest(details) {
207207
}
208208
}
209209

210-
// TODO: Clean this silliness
211-
var finaluri = null;
212-
if (newuristr) {
213-
finaluri = document.createElement('a');
214-
finaluri.href = newuristr;
215-
}
216-
217210
if (newuristr && using_credentials_in_url) {
218211
// re-insert userpass info which was stripped temporarily
219-
finaluri.username = tmp_user;
220-
finaluri.password = tmp_pass;
221-
newuristr = finaluri.href;
212+
var uri_with_credentials = document.createElement('a');
213+
uri_with_credentials.href = newuristr;
214+
uri_with_credentials.username = tmp_user;
215+
uri_with_credentials.password = tmp_pass;
216+
newuristr = uri_with_credentials.href;
222217
}
223218

224219
// In Switch Planner Mode, record any non-rewriteable
@@ -232,7 +227,7 @@ function onBeforeRequest(details) {
232227
}
233228

234229
if (httpNowhereOn) {
235-
if (finaluri && finaluri.protocol === "http:") {
230+
if (newuristr && newuristr.substring(0, 5) === "http:") {
236231
// Abort early if we're about to redirect to HTTP in HTTP Nowhere mode
237232
return {cancel: true};
238233
}

0 commit comments

Comments
 (0)