1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/public/nsIContentSniffer.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIRequest; 1.11 + 1.12 +/** 1.13 + * Content sniffer interface. Components implementing this interface can 1.14 + * determine a MIME type from a chunk of bytes. 1.15 + */ 1.16 +[scriptable, uuid(a5772d1b-fc63-495e-a169-96e8d3311af0)] 1.17 +interface nsIContentSniffer : nsISupports 1.18 +{ 1.19 + /** 1.20 + * Given a chunk of data, determines a MIME type. Information from the given 1.21 + * request may be used in order to make a better decision. 1.22 + * 1.23 + * @param aRequest The request where this data came from. May be null. 1.24 + * @param aData Data to check 1.25 + * @param aLength Length of the data 1.26 + * 1.27 + * @return The content type 1.28 + * 1.29 + * @throw NS_ERROR_NOT_AVAILABLE if no MIME type could be determined. 1.30 + * 1.31 + * @note Implementations should consider the request read-only. Especially, 1.32 + * they should not attempt to set the content type property that subclasses of 1.33 + * nsIRequest might offer. 1.34 + */ 1.35 + ACString getMIMETypeFromContent(in nsIRequest aRequest, 1.36 + [const,array,size_is(aLength)] in octet aData, 1.37 + in unsigned long aLength); 1.38 +};