nsIContentSniffer.idl 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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 nsIRequest;
  6. /**
  7. * Content sniffer interface. Components implementing this interface can
  8. * determine a MIME type from a chunk of bytes.
  9. */
  10. [scriptable, uuid(a5772d1b-fc63-495e-a169-96e8d3311af0)]
  11. interface nsIContentSniffer : nsISupports
  12. {
  13. /**
  14. * Given a chunk of data, determines a MIME type. Information from the given
  15. * request may be used in order to make a better decision.
  16. *
  17. * @param aRequest The request where this data came from. May be null.
  18. * @param aData Data to check
  19. * @param aLength Length of the data
  20. *
  21. * @return The content type
  22. *
  23. * @throw NS_ERROR_NOT_AVAILABLE if no MIME type could be determined.
  24. *
  25. * @note Implementations should consider the request read-only. Especially,
  26. * they should not attempt to set the content type property that subclasses of
  27. * nsIRequest might offer.
  28. */
  29. ACString getMIMETypeFromContent(in nsIRequest aRequest,
  30. [const,array,size_is(aLength)] in octet aData,
  31. in unsigned long aLength);
  32. };