author Gabriel Luong <>
Tue, 16 Jul 2019 11:19:59 -0400
changeset 483099 b6d154b2309846531934289c1e167208fc385ac3
parent 224853 4ec37503ea6a752baf92e053ede5f0ff7750ff36
permissions -rw-r--r--
Bug 1566467 - Speed up shared/node-attribute-parser getType function. r=nchevobbe We can speed up the getType function by changing the dataType into an object from an array. That way we avoid looping looking for the matching tagName and namespaceURI and access the typeData directly by their tagName. Differential Revision:

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#include "nsISupports.idl"

interface nsIRequest;

 * Content sniffer interface. Components implementing this interface can
 * determine a MIME type from a chunk of bytes.
[scriptable, uuid(a5772d1b-fc63-495e-a169-96e8d3311af0)]
interface nsIContentSniffer : nsISupports
   * Given a chunk of data, determines a MIME type. Information from the given
   * request may be used in order to make a better decision.
   * @param aRequest The request where this data came from. May be null.
   * @param aData Data to check
   * @param aLength Length of the data
   * @return The content type
   * @throw NS_ERROR_NOT_AVAILABLE if no MIME type could be determined.
   * @note Implementations should consider the request read-only. Especially,
   * they should not attempt to set the content type property that subclasses of
   * nsIRequest might offer.
  ACString getMIMETypeFromContent(in nsIRequest aRequest,
                                  [const,array,size_is(aLength)] in octet aData,
                                  in unsigned long aLength);