nsIContentSecurityManager.idl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "nsISupports.idl"
  5. interface nsIChannel;
  6. interface nsIPrincipal;
  7. interface nsIStreamListener;
  8. interface nsIURI;
  9. /**
  10. * nsIContentSecurityManager
  11. * Describes an XPCOM component used to perform security checks.
  12. */
  13. [scriptable, uuid(3a9a1818-2ae8-4ec5-a340-8b29d31fca3b)]
  14. interface nsIContentSecurityManager : nsISupports
  15. {
  16. /**
  17. * Checks whether a channel is allowed to access the given URI and
  18. * whether the channel should be openend or should be blocked consulting
  19. * internal security checks like Same Origin Policy, Content Security
  20. * Policy, Mixed Content Blocker, etc.
  21. *
  22. * If security checks within performSecurityCheck fail, the function
  23. * throws an exception.
  24. *
  25. * @param aChannel
  26. * The channel about to be openend
  27. * @param aStreamListener
  28. * The Streamlistener of the channel potentially wrapped
  29. * into CORSListenerProxy.
  30. * @return
  31. * The StreamListener of the channel wrapped into CORSListenerProxy.
  32. *
  33. * @throws NS_ERROR_DOM_BAD_URI
  34. * If accessing the URI is not allowed (e.g. prohibted by SOP)
  35. * @throws NS_ERROR_CONTENT_BLOCKED
  36. * If any of the security policies (CSP, Mixed content) is violated
  37. */
  38. nsIStreamListener performSecurityCheck(in nsIChannel aChannel,
  39. in nsIStreamListener aStreamListener);
  40. /**
  41. * Implementation of
  42. * https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy
  43. *
  44. * The value returned by this method feeds into the the Secure Context
  45. * algorithm that determins the value of Window.isSecureContext and
  46. * WorkerGlobalScope.isSecureContext.
  47. *
  48. * This method returns false instead of throwing upon errors.
  49. */
  50. boolean isOriginPotentiallyTrustworthy(in nsIPrincipal aPrincipal);
  51. };