Closed Bug 1119037 Opened 5 years ago Closed 5 years ago

Fetch API: Add Request context attribute

Categories

(Core :: DOM: Core & HTML, defect)

33 Branch
x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: nsm, Assigned: nsm)

References

Details

Attachments

(2 files, 1 obsolete file)

The context is what initiated the load (stylesheet, image etc.). Internally we have a nsContentPolicyType, which may not cover what the spec says, but we use for CSP.
Turns out there isn't a direct mapping from RequestContext to nsContentPolicyType since we often need more information (is window top level?, is this channel loaded to due a link?) to determine the exact CSP behaviour to apply to a fetch. Seems like the fetch interception code will have to set this as best as it can, and then map it back to CSP later in FetchDriver (or InternalRequest could hold the original channel's nsContentPolicyType). Repurposing this bug to just add the WebIDL property.
Summary: Fetch API: Expose Request's context to JavaScript → Fetch API: Add Request context attribute
Attached file MozReview Request: bz://1119037/nsm (obsolete) —
/r/3061 - Bug 1119037 - Add context attribute to Request. r=baku

Pull down this commit:

hg pull review -r 404f5e20259d145ba10ae3b658e93127cb363384
Attachment #8555536 - Flags: review?(amarchesini)
This removes ContextFrameType since it isn't exposed to content and does not help internally. Right now Request::mContext is only for content to get a valid value (always set to "fetch"), which can be set to good defaults when the network interception code creates a Request.
Comment on attachment 8555536 [details]
MozReview Request: bz://1119037/nsm

/r/3061 - Bug 1119037 - Add context attribute to Request. r=baku
/r/3063 - Bug 1124638 - Allow chrome to set Request context.

Pull down these commits:

hg pull review -r 2795af895358bf112207e8c855aebfcd22117087
Attachment #8555536 - Flags: review?(amarchesini) → review+
https://hg.mozilla.org/mozilla-central/rev/4ac6715d8224
Assignee: nobody → nsm.nikhil
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Attachment #8555536 - Attachment is obsolete: true
Attachment #8619061 - Flags: review+
Attachment #8619062 - Flags: review+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.