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

Fix requestStorageAccess to set bool to true before resolving #166

Closed
wants to merge 2 commits into from

Conversation

cfredric
Copy link
Contributor

@cfredric cfredric commented Feb 15, 2023

This PR fixes the requestStorageAccess algorithm so that global's has storage access is set to true in all necessary cases when p resolves; not a subset of those cases. This was an oversight from #141.


Preview | Diff

storage-access.bs Outdated Show resolved Hide resolved
@cfredric cfredric changed the title Fix requestStorageAccess to always set bool to true before resolving Fix requestStorageAccess to set bool to true before resolving Feb 15, 2023
@@ -173,7 +173,7 @@ When invoked on {{Document}} |doc|, the <dfn export method for=Document><code>re
1. If |doc| is not [=allowed to use=] "`storage-access`", [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and return |p|.
1. If |doc|'s [=Document/origin=] is an [=opaque origin=], [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and return |p|.
1. If the [=top-level origin=] of |doc|'s [=relevant settings object=] is an [=opaque origin=], [=/reject=] |p| with a "{{NotAllowedError}}" {{DOMException}} and return |p|.
1. If |doc|'s [=Document/origin=] is [=same origin=] with the [=top-level origin=] of |doc|'s [=relevant settings object=], [=/resolve=] and return |p|.
1. If |doc|'s [=Document/origin=] is [=same origin=] with the [=top-level origin=] of |doc|'s [=relevant settings object=], set |global|'s [=environment/has storage access=] to true, then [=/resolve=] and return |p|.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this is motivated by ABA-type of embedding? If it is it seems like the algorithm for hasStorageAccess() would need changes as well. And we'd probably need some more involved explanation here. I discussed some possible solutions to this with @johannhof at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is what this particular step is about - but I'd say that's out of scope for this pull request. My goal for this PR is to ensure that in every case that document.requestStorageAccess() currently resolves, a subsequent invocation of document.hasStorageAccess() would resolve and yield true.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think in that case this step doesn't need to be changed because requestStorageAccess() already resolves with true for this particular condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though now that I look at hasStorageAccess again, I see that it also has a step for this case, so this PR seems unnecessary. Will revert.

@cfredric cfredric closed this Feb 15, 2023
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