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

Refactor basic auth #233

Merged
merged 1 commit into from
Mar 22, 2018
Merged

Refactor basic auth #233

merged 1 commit into from
Mar 22, 2018

Conversation

maximbaz
Copy link
Member

  • Use a shared tabs.onUpdated instead of subscribing multiple times
  • Extract onAuthRequired into a separate global function

@erayd I'll comment inline on a couple of particularly note-worthy points.

@@ -99,96 +100,86 @@ function onMessage(request, sender, sendResponse) {
// spawn a new tab with pre-provided credentials
if (request.action == "launch") {
chrome.tabs.create({ url: request.url }, function(tab) {
var tabLoaded = false;
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't see a particular use for tabLoaded, given that we discard onAuthListener immediately after tab is loaded. Did you have a point for this that I'm missing?

Copy link
Contributor

Choose a reason for hiding this comment

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

That can go. I went through a couple of different versions of the bugfix; that was left over from one of them but is no longer applicable.


// mark tab as loaded & wipe credentials
tabLoaded = true;
request.username = request.password = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

The reference to this object is in this function and now in onAuthRequired, as soon as both functions are gone the credentials are not accessible anyway - is there a point in additionally wiping them here?

Copy link
Contributor

Choose a reason for hiding this comment

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

As above - this was leftover from an earlier iteration of the bugfix; it can go.

- Use a shared tabs.onUpdated instead of subscribing multiple times
- Extract onAuthRequired into a separate global function
@maximbaz maximbaz force-pushed the refactor-basic-auth branch from 3f67f02 to baa90ca Compare March 22, 2018 18:40
@maximbaz
Copy link
Member Author

Thanks @erayd for the confirmations, any other feedback before this is merged?

Copy link
Contributor

@erayd erayd left a comment

Choose a reason for hiding this comment

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

This looks good - I like what you've done to it 👍

@erayd
Copy link
Contributor

erayd commented Mar 22, 2018

@maximbaz No other feedback at this point - I like what you've done, go ahead and merge it :-).

@maximbaz maximbaz merged commit 701414e into master Mar 22, 2018
@maximbaz maximbaz deleted the refactor-basic-auth branch March 22, 2018 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants