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 Chat (such as one of these permanent autoconfirmed members).
Contexts: Difference between revisions
Jump to navigation
Jump to search
(→Context triggers: This list should include obsolete triggers like <frame>, too.) |
(Can't set the no-sniff flag on a resource until you actually fetch it.) |
||
Line 3: | Line 3: | ||
# Identify context. | # Identify context. | ||
# Determine whether to fetch resource based on CSP directives and type hint, if any. | # Determine whether to fetch resource based on CSP directives and type hint, if any. | ||
# Fetch resource. | # Fetch resource. | ||
# Set no-sniff flag on resource (based on URL), if necessary. | |||
# Handle resource. | # Handle resource. | ||
# Sniff resource. | # Sniff resource. |
Revision as of 15:04, 24 June 2013
How to use a context
- Identify context.
- Determine whether to fetch resource based on CSP directives and type hint, if any.
- Fetch resource.
- Set no-sniff flag on resource (based on URL), if necessary.
- Handle resource.
- Sniff resource.
- Process and display resource or prompt to download resource, as appropriate.
Context types
Context | Definition | Used in HTML? | Used in CSS? | Scriptable? | CSP Directive | Type Hint | Sniffing Algorithm |
---|---|---|---|---|---|---|---|
browsing (navigate) | HTML | Yes | No? | Yes | — | MIME type sniffing algorithm | |
nested browsing (navigate) | 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 "
|
Context triggers
Context | HTML Triggers | CSS Triggers | Other |
---|---|---|---|
browsing | |||
nested browsing | <iframe> , <object> (sometimes), <frame>
|
||
connection | EventSource, WebSocket, XMLHttpRequest | ||
image | <img> , <link rel=icon> , <input type=image> , <object> (sometimes)
|
background-image
|
|
audio/video | <audio> , <video>
|
||
plugin | <embed> , <object> (sometimes)
|
||
style | <link rel=stylesheet>
|
@import ?
|
|
script | <script src>
|
||
font | — | @font-face
|
|
text track | <track>
|
— | |
cache manifest | <html manifest>
|
— |
Issues
- What about SVG?
- What about XSLT?
- document.load()? (Seems similar enough to connect-src.)
- What about CSS masks?
- What about CSS shapes?