Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Update background.js (fixes #12377) #12380

Merged
merged 3 commits into from Sep 19, 2017
Merged

Update background.js (fixes #12377) #12380

merged 3 commits into from Sep 19, 2017

Conversation

ghost
Copy link

@ghost ghost commented Sep 2, 2017

No description provided.

@ghost ghost mentioned this pull request Sep 2, 2017
@cschanaj
Copy link
Collaborator

cschanaj commented Sep 2, 2017

@koops76 the variable is being used again in chromium/background.js#L367. Thus the variables have to be declared outside the if statement, see #12381

@ghost
Copy link
Author

ghost commented Sep 2, 2017

@cschanaj Already done.

@@ -384,7 +386,7 @@ function onBeforeRequest(details) {
// failing.
if (shouldCancel) {
if (!newuristr) {
return {redirectUrl: canonical_url.replace(/^http:/, "https:")};
return {redirectUrl: details.url.replace(/^http:/, "https:")};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, this is change is not necessary, better not to change the existing behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually why they are replaced with null but not replaced back.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cschanaj Even better now, bug is fixed but the existing behavior is kept.

@@ -320,12 +320,14 @@ function onBeforeRequest(details) {
// If there is a username / password, put them aside during the ruleset
// analysis process
var using_credentials_in_url = false;
let tmp_user;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var for consistence

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let for ES6.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not even consistent in the same function ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be when we will run ESLint with new settings.

@cschanaj
Copy link
Collaborator

cschanaj commented Sep 2, 2017

lot more changes than I have expected. I am not going to review this (simply not having the time, not against you). ping Hainish when you are done, thanks anyway.

@ghost
Copy link
Author

ghost commented Sep 2, 2017

ping @Hainish.

const canonical_url_with_credentials = new URL(canonical_url);
canonical_url_with_credentials.username = tmp_user;
canonical_url_with_credentials.password = tmp_pass;
canonical_url = canonical_url_with_credentials.href;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be safe to add this as an else clause to the conditional immediately below. If newuristr is defined, this mutation of canonical_url is simply unused.

This is a minor point and shouldn't block merging, but it makes things a bit easier to follow with the matching if (!newuristr) below.

@Hainish Hainish merged commit a217985 into EFForg:master Sep 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants