content/base/public/nsIDOMParser.idl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIInputStream;
michael@0 9 interface nsIDOMDocument;
michael@0 10 interface nsIURI;
michael@0 11 interface nsIPrincipal;
michael@0 12 interface nsIScriptGlobalObject;
michael@0 13
michael@0 14 /**
michael@0 15 * The nsIDOMParser interface is a non-SAX interface that can be used
michael@0 16 * to parse a string or byte stream containing XML or HTML content
michael@0 17 * to a DOM document. Parsing is always synchronous - a document is always
michael@0 18 * returned from the parsing methods. This is as opposed to loading and
michael@0 19 * parsing with the XMLHttpRequest interface, which can be used for
michael@0 20 * asynchronous (callback-based) loading.
michael@0 21 */
michael@0 22 [scriptable, uuid(5677f36e-1842-4c6f-a39c-2e5576ab8b40)]
michael@0 23 interface nsIDOMParser : nsISupports
michael@0 24 {
michael@0 25 /**
michael@0 26 * The string passed in is parsed into a DOM document.
michael@0 27 *
michael@0 28 * @param str The UTF16 string to be parsed
michael@0 29 * @param contentType The content type of the string (see parseFromStream)
michael@0 30 * @returns The DOM document created as a result of parsing the
michael@0 31 * string
michael@0 32 */
michael@0 33 nsIDOMDocument parseFromString(in wstring str, in string contentType);
michael@0 34
michael@0 35 /**
michael@0 36 * The buffer is parsed into a DOM document.
michael@0 37 * The charset is determined from the xml entity decl.
michael@0 38 *
michael@0 39 * @param buf The octet array data to be parsed
michael@0 40 * @param bufLen Length (in bytes) of the data
michael@0 41 * @param contentType The content type of the data (see parseFromStream)
michael@0 42 * @returns The DOM document created as a result of parsing the
michael@0 43 * string
michael@0 44 */
michael@0 45 nsIDOMDocument parseFromBuffer([const,array,size_is(bufLen)] in octet buf,
michael@0 46 in uint32_t bufLen, in string contentType);
michael@0 47
michael@0 48 /**
michael@0 49 * The byte stream passed in is parsed into a DOM document.
michael@0 50 *
michael@0 51 * Not accessible from web content.
michael@0 52 *
michael@0 53 * @param stream The byte stream whose contents are parsed
michael@0 54 * @param charset The character set that was used to encode the byte
michael@0 55 * stream. NULL if not specified.
michael@0 56 * @param contentLength The number of bytes in the input stream.
michael@0 57 * @param contentType The content type of the string - either text/xml,
michael@0 58 * application/xml, or application/xhtml+xml.
michael@0 59 * Must not be NULL.
michael@0 60 * @returns The DOM document created as a result of parsing the
michael@0 61 * stream
michael@0 62 */
michael@0 63 nsIDOMDocument parseFromStream(in nsIInputStream stream,
michael@0 64 in string charset,
michael@0 65 in long contentLength,
michael@0 66 in string contentType);
michael@0 67
michael@0 68 /**
michael@0 69 * Initialize the principal and document and base URIs that the parser should
michael@0 70 * use for documents it creates. If this is not called, then a null
michael@0 71 * principal and its URI will be used. When creating a DOMParser via the JS
michael@0 72 * constructor, this will be called automatically. This method may only be
michael@0 73 * called once. If this method fails, all following parse attempts will
michael@0 74 * fail.
michael@0 75 *
michael@0 76 * @param principal The principal to use for documents we create.
michael@0 77 * If this is null, a codebase principal will be created
michael@0 78 * based on documentURI; in that case the documentURI must
michael@0 79 * be non-null.
michael@0 80 * @param documentURI The documentURI to use for the documents we create.
michael@0 81 * If null, the principal's URI will be used;
michael@0 82 * in that case, the principal must be non-null and its
michael@0 83 * URI must be non-null.
michael@0 84 * @param baseURI The baseURI to use for the documents we create.
michael@0 85 * If null, the documentURI will be used.
michael@0 86 * @param scriptObject The object from which the context for event handling
michael@0 87 * can be got.
michael@0 88 */
michael@0 89 [noscript] void init(in nsIPrincipal principal,
michael@0 90 in nsIURI documentURI,
michael@0 91 in nsIURI baseURI,
michael@0 92 in nsIScriptGlobalObject scriptObject);
michael@0 93 };
michael@0 94
michael@0 95 %{ C++
michael@0 96 #define NS_DOMPARSER_CID \
michael@0 97 { /* 3a8a3a50-512c-11d4-9a54-000064657374 */ \
michael@0 98 0x3a8a3a50, 0x512c, 0x11d4, \
michael@0 99 {0x9a, 0x54, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }
michael@0 100 #define NS_DOMPARSER_CONTRACTID \
michael@0 101 "@mozilla.org/xmlextras/domparser;1"
michael@0 102 %}

mercurial