Skip to content

Writing to Shared Storage in generateBid #210

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

Closed
ccharnay67 opened this issue Dec 5, 2024 · 4 comments
Closed

Writing to Shared Storage in generateBid #210

ccharnay67 opened this issue Dec 5, 2024 · 4 comments

Comments

@ccharnay67
Copy link

Hello,

We have use cases where we think of leveraging Shared Storage by writing to it during a call to generateBid in Protected Audience, and read from it later.

Calling sharedStorage.set seems possible in generateBid, but we are not sure to which origin Shared Storage writes to in this case, could you please clarify it?

According to the documentation: “the data is written to the origin of the browsing context that the call was made from”, but for generateBid it is unclear what the context is.

We think it’s either the publisher origin or the generateBid script origin. When we tested on a publisher page with the same origin as the bidding script, we see a write to Shared Storage. However, when the publisher origin differs from the script origin, we see no write at all to shared storage. Is this normal? Must the publisher page and bidding script have the same origin for generateBid to be able to write to shared storage?

@jkarlin
Copy link
Collaborator

jkarlin commented Dec 5, 2024

I believe (off the top of my head) that the shared storage data origin should be that of the context of the worklet. That should be the buyer origin in the bidding case, and seller origin in the seller case. @xyaoinum would know better.

@xyaoinum
Copy link
Collaborator

xyaoinum commented Dec 5, 2024

@ccharnay67: Josh is correct. How did you verify that the write did or did not happen? Also, it might be helpful to check the DevTools console for any errors that could provide clues.

@ccharnay67
Copy link
Author

@xyaoinum and @jkarlin thanks for your answers. I originally had a look at DevTools > Applications > Shared Storage, and that would never show me the write events I wanted to see.

But I now had a look at the local Chrome Shared Storage DB, and I confirm the write happened to the buyer origin even with the publisher page being another domain, which confirms what you say.

Thanks again! I'll close this.

@jkarlin
Copy link
Collaborator

jkarlin commented Dec 5, 2024

Cool, glad it's working. @pythagoraskitty for a potential devtools issue.

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

No branches or pull requests

3 participants