Re: [fetch] Introduce convenience property for request's context (#93)

@ehsan @sicking not claiming this is complete or accurate, but after staring at the Fetch "context" table for a bit, came up with the following...

```
Request {
 enum ResourceType { // CSP        "Context"
  document,
  stylesheet,  // style-src  (style)
  script,   // script-src (script)
  image,   // img-src    (image, imageset)
  media,   // media-src  (audio, track, video)
  font,   // font-src   (font)
  object,   // object-src (applet, embed, object)
  other
 },

 enum Initiator {
  parser,
  css,   // style-src?
  script,   // connect-src (fetch, xhr, beacon, eventsource)
  internal  // connect-src (cspreport, nelreport, ping)
 }

 enum Nested{
  none,
  frame,   // child-src
  iframe,   // child-src
  worker   // child-src
 }
}
```

- ResourceType would cleanly solve the use-case in https://github.com/whatwg/fetch/issues/64 -- just ignore the "context" part of that discussion.
- Separating out initiator does allow to ask new and interesting questions. For example, what's the policy for CSS-initiated image fetches vs parser or script initiated ("same" is valid answer).
- "Nested" is a bit odd but we do have a CSP policy around it and it also is an interesting bit of information to have for prioritization.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/93#issuecomment-125770410

Received on Tuesday, 28 July 2015 22:25:39 UTC