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

Editorial: Add prose about constructing a request #1585

Merged
merged 25 commits into from
Mar 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update fetch.bs
Co-authored-by: Jeffrey Yasskin <jyasskin@gmail.com>
  • Loading branch information
noamr and jyasskin committed Jan 18, 2023
commit 690004d0b3ccb775c94ca413815c88589de43287
2 changes: 1 addition & 1 deletion fetch.bs
Original file line number Diff line number Diff line change
@@ -8452,7 +8452,7 @@ body, you can assign or stream it to <a for=/>request</a>'s <a for=request>body<
<p>Set your <a for=/>request</a>'s <a for=request>client</a> to the
<a>environment settings object</a> you're operating in. Web-exposed APIs usually operate on
<a>platform objects</a> (e.g. a <cite>Web IDL</cite> based API), which have a
<a>relevant settings object</a>. For example, a <a for=/>request</a> associated with a DOM
<a>relevant settings object</a> you can use. For example, a <a for=/>request</a> associated with a DOM
<a for=/>element</a> would set the <a for=/>request</a>'s <a for=request>client</a> to the element's
<a>node document</a>'s <a>relevant settings object</a>. [[WEBIDL]]
Copy link
Member

Choose a reason for hiding this comment

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

I might just have more contact with unusual APIs than most people, but I feel like "there's no obvious client" comes up fairly often. Could we say "If your request isn't associated with a particular environment settings object, please start a discussion with this repository's maintainers?" Ideally, we'd be able to link to a forum on which to start that discussion...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you give examples outside of FedCM? Is this mostly about UA-initiated fetches that are not web-exposed in themselves?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe these are all web-exposed:

Seems like the fetch itself is not web exposed?

This is a JS API with an IDL interface, which has a relevant settings object.

Seems like this ends up also doing something with a JS observer, which has a relevant settings object

Copy link
Member

Choose a reason for hiding this comment

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

For the first, I might be understanding something different by "web-exposed": the result doesn't get reported to Javascript running in a web page, but developers building websites will have their designs broken if it changes.

For the second, the relevant settings object's window may have closed by the time the fetch is sent, which means it can't use that as its client. Maybe the right answer is to start a Service Worker to exist while the fetch is running, so that can be the client, but the feature's designers need someone to tell them that, and help work through the tradeoffs.

For the third, the JS observer isn't really important, but there is a global available in the algorithm's caller, so the use of null is just a bug. But the developers thought they didn't have one, maybe because the algorithm originally ran after the originating client closed. They should have a way to ask what to do, so someone knowledgeable can find them the right client.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree that documentation for this is lacking. Let's fix it step by step.
btw client is not mandatory. Instead of a client you can populate the request's origin and policy container, and respond to callbacks on a parallel queue (some anonymous new thread). For some of these features maybe that's the right approach and we should address this in this documentation.