Advertisement
Guest User

Browser features description model

a guest
Oct 7th, 2018
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
IDL 2.15 KB | None | 0 0
  1. //Subject: Browser features description model
  2. //Project: Feature Policy ( https://github.com/WICG/feature-policy )
  3. //Related projects: https://github.com/w3c/WebAppSec
  4. //See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1494945
  5. //Author: would be anonymous
  6. //Version without comments: https://pastebin.com/tWqLKg7N
  7. interface BrowserFeature
  8. {
  9.     boolean canAccessHardwareInfo;
  10.     boolean canAccessSoftwareInfo;
  11.     boolean canAccessLocalFilesystem;
  12.     boolean canAccessExternalData; //camera, microphone, sensors, etc
  13.     boolean canAccessNativeFunctions;
  14.     boolean requiresPlugins;
  15.     boolean isBrowserSpecific; //Vendor-specific features (non-standard)
  16.     boolean hasOSSpecificImplementation;
  17.     DOMString name;
  18. };
  19.  
  20. interface NetworkFeature : BrowserFeature
  21. {
  22. };
  23.  
  24. interface ContentFeature : BrowserFeature
  25. {
  26.     sequence<DOMString> associatedMIMETypes;
  27.     sequence<DOMString> associatedTagNames;
  28.     sequence<DOMString> associatedAttributes;
  29.     sequence<DOMString> associatedDOMProperties;
  30. };
  31.  
  32. interface ProtocolSpecificNetworkFeature : NetworkFeature
  33. {
  34.     sequence<DOMString> associatedURISchemes;
  35. };
  36.  
  37. //Cookie, Referer, etc
  38. interface ProtocolHeaderFeature : ProtocolSpecificNetworkFeature
  39. {
  40.     sequence<DOMString> associatedHeaderNames;
  41. };
  42.  
  43. //Any content features that produce network requests
  44. interface ContentNetworkFeature : ContentFeature, NetworkFeature
  45. {
  46. }
  47.  
  48. interface CSSFeature : ContentFeature
  49. {
  50.     sequence<DOMString> associatedCSSProperties;
  51. };
  52.  
  53. interface FeaturePermissionRule
  54. {
  55.     BrowserFeature feature;
  56.     getter boolean allowed(DOMString propertyName);
  57. };
  58.  
  59. interface NetworkFeaturePermissionRule : FeaturePermissionRule
  60. {
  61.     NetworkFeature feature;
  62.     DOMString contentRequestMethod; //POST, GET, etc
  63.     DOMString contentMIMETypeMask;
  64.     DOMString contentSourceURIMask;
  65.     DOMString originDomain;
  66.     int originPort;
  67.     DOMString originScheme;
  68.     int frameNestingLevel;
  69. };
  70.  
  71. //Each ScriptContext must have independent Global Environment
  72. interface ScriptContext
  73. {
  74.     sequence<FeaturePermissionRule> featurePermissionRules;
  75.     sequence<HTMLScriptElement> scripts;
  76.     boolean derivePermissionRulesFromDocument; //derive sequence<FeaturePermissionRule> from Document
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement