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 CSP directives and 'plugin' context.)
(How to use a context: Add CSP directives to decision-making process.)
Line 98: Line 98:
  
 
# Identify context.
 
# Identify context.
# Determine whether to fetch resource based on type hint, if any.
+
# Determine whether to fetch resource based on CSP directives and type hint, if any.
 
# Set no-sniff flag on resource, if necessary.
 
# Set no-sniff flag on resource, if necessary.
 
# Fetch resource.
 
# Fetch resource.

Revision as of 18:22, 5 June 2013


Context types

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

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.