Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scope approvals to documentId #49

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Scope approvals to documentId #49

merged 3 commits into from
Jun 24, 2024

Conversation

turbocrime
Copy link
Contributor

replaces #42

validation is called in the handler before attempting to identify approval

@turbocrime turbocrime requested a review from grod220 June 22, 2024 00:10
Copy link

changeset-bot bot commented Jun 22, 2024

🦋 Changeset detected

Latest commit: 1133bcb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@turbocrime turbocrime changed the base branch from main to msg-doc-id June 22, 2024 01:06
@turbocrime turbocrime changed the base branch from msg-doc-id to main June 22, 2024 01:07
Copy link
Contributor Author

Choose a reason for hiding this comment

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

elaborated some of the comments and parameter naming in various places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is no logic or behavior change in this code, but its behavior is clearer now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer using chrome.tabs.onUpdated, just listening for content scripts to announce themselves

Comment on lines 37 to 42
} else {
respond(PraxConnection.Denied);
// something strange is happening. either storage is broken, the popup
// returned an error, the sender is invalid, or someone's misbehaving.
// obfuscate this rejection with a random delay 2-12 secs
setTimeout(() => respond(PenumbraRequestFailure.Denied), 2000 + Math.random() * 10000);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

addition

Comment on lines 23 to 25
void chrome.tabs.sendMessage(validSender.tab.id, PraxConnection.Init, {
documentId: validSender.documentId,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

requests now also use chrome.tabs.sendMessage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

validation extracted to a fairly comprehensive fn

apps/extension/src/shared/containers/import-form.tsx Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

validation tests

@turbocrime turbocrime requested a review from a team June 22, 2024 01:09
apps/extension/src/listeners/message-prax-init.ts Outdated Show resolved Hide resolved
console.warn('Connection request listener failed:', e);
}
// something is wrong. user may not have seen a popup.
if (globalThis.__DEV__) console.warn('Connection request listener failed:', e);
Copy link
Contributor

Choose a reason for hiding this comment

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

brackets plz

apps/extension/src/origins/valid-sender.test.ts Outdated Show resolved Hide resolved
apps/extension/src/origins/valid-sender.ts Outdated Show resolved Hide resolved
apps/extension/src/shared/containers/import-form.tsx Outdated Show resolved Hide resolved
@turbocrime turbocrime merged commit 2287a89 into main Jun 24, 2024
3 checks passed
@turbocrime turbocrime deleted the turbocrime/scope-init branch June 24, 2024 23:41
@grod220 grod220 mentioned this pull request Jun 25, 2024
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants