A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

Difference between revisions of "Contexts"

From WHATWG Wiki
Jump to: navigation, search
(Context types: Add sniffing rules for plugin, style, and script contexts.)
(Context types: The connection context is distinct from the browsing context.)
Line 18: Line 18:
 
| No?
 
| No?
 
| Yes
 
| Yes
| [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#connect-src <code>connect-src</code>]
+
|  
 
| —
 
| —
| rowspan="2" | [http://mimesniff.spec.whatwg.org/#mime-type-sniffing-algorithm MIME type sniffing algorithm]
+
| rowspan="3" | [http://mimesniff.spec.whatwg.org/#mime-type-sniffing-algorithm MIME type sniffing algorithm]
 
|-
 
|-
 
| nested browsing
 
| nested browsing
Line 28: Line 28:
 
| Yes
 
| Yes
 
| [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#frame-src <code>frame-src</code>]
 
| [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#frame-src <code>frame-src</code>]
 +
|
 +
|-
 +
| connection
 +
|
 +
| Yes
 +
| No?
 +
| Yes?
 +
| [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#connect-src <code>connect-src</code>]
 
|  
 
|  
 
|-
 
|-

Revision as of 14:44, 16 June 2013


Context types

Context Definition Used in HTML? Used in CSS? Scriptable? CSP Directive Type Hint Sniffing Algorithm
browsing HTML Yes No? Yes MIME type sniffing algorithm
nested browsing HTML Yes No? Yes frame-src
connection Yes No? Yes? connect-src
image Yes Yes No img-src rules for sniffing images specifically
audio/video Yes No? No media-src rules for sniffing audio and video specifically
plugin Yes No? Yes? object-src rules for sniffing in a plugin context
style Yes Yes? No style-src @type or "text/css" rules for sniffing in a style context
script Yes No? Yes? script-src @type or "text/javascript" rules for sniffing in a script context
font No Yes No font-src format() rules for sniffing fonts specifically
text track Yes No No "text/vtt"
cache manifest Yes No No "text/cache-manifest"

How to use a context

  1. Identify context.
  2. Determine whether to fetch resource based on CSP directives and type hint, if any.
  3. Set no-sniff flag on resource, if necessary.
  4. Fetch resource.
  5. Handle resource.
  6. Sniff resource.
  7. Process and display resource or prompt to download resource, as appropriate.