Files
palemoon27/dom/base/nsIDocumentEncoder.idl
T
roytam1 d67c7f2eca import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1255818. Switch from JS_ClearPendingException to AutoJSAPI::ClearException for cases when we have an AutoJSAPI around. r=bholley (e1e0413493)
- Bug 1253591. HTMLAllCollection should be rooted at the document, not the root element, so it can find the root element. r=peterv (c5f2f253a9)
- Bug 1257270 - Use std::nullptr_t instead of nullptr_t in WMFUtils.h. r=cpearce (539e705876)
- Bug 1251881 - use UniquePtr instead of ScopedDeletePtr in mozglue/linker/; r=glandium (2fe329e32c)
- Bug 1254950 - Remove several media Makefile.ins; r=ted (2a274dd21d)
- Bug 1219068 - Compute size correctly when a character consists entirely of glue. r=karlt (80f2e23268)
- Bug 1246132 - Improve register allocation speed on large functions, r=sunfish. (6e023c252b)
- Bug 1150354: Make nsPluginDirServiceProvider build with MSVC 2015 CTP 6, r=jmathies (0113760730)
- Bug 1197311 - Remove PR_snprintf calls in dom/ r=froydnj (6268400ef0)
- Bug 1255099 - XHR CTOR doesn't need to use implicitJSContext, r=bz (72f08fbc36)
- Bug 1255597 - Part 1: Remove redundent trailing spaces. r=khuey (7f2240cb05)
- Bug 1255597 - Part 2: Follow spec to modify the content-type check conditions which determine parsing XHR body or not. r=khuey (ba6f7fc536)
- Bug 1255597 - Part 3: Synchronize content-type hint of HttpChannelChild to HttpChannelParent. r=jduell (bb97478b01)
- Bug 1255597 - Part 4: Remove 'expected fail' settings and expect test cases in responsexml-media-type.htm should be passed. r=khuey (772884b4fb)
- Bug 1201170 - During message diversion must be possible to suspend them. r=jduell (abb2361b7f)
- Bug 1201174 - For FTP - in case of divertToParent, it myst be possible to delay delivering of OnDataAv./OnStopR. r=jduell (9299ef81be)
- Bug 1247393 - use arrays of UniquePtr in ChannelEventQueue; r=mcmanus (7621205b53)
- Bug 1254730 - ChannelEventQueue must be thread-safe, r=michal (b8e01204e9)
- Bug 1254859 part 2. Switch the AutoEntryScript in nsXULTemplateBuilder::InitHTMLTemplateRoot to take ownership of error reporting. r=bholley (f183ec692c)
- Bug 1254859 part 1. Switch the AutoEntryScript in nsGlobalWindow::FireOnNewGlobalObject to take ownership of error reporting. r=bholley (b0cd891917)
- Bug 1254860. Switch the AutoEntryScript TestShellCommandParent::RunCallback to taking ownership of error reporting. r=bholley (0c9697e60f)
- Bug 1254857. Switch the AutoEntryScript in xpc::EvalInSandbox to take ownership of error reporting. r=bholley (93b6bfc87c)
- Bug 1254847 part 3. Make AutoEntryScript always take ownership of error reporting. r=bholley (3c2929462f)
- Bug 1256688 - Continue using getPropertyDescriptor for has in Sandbox창. r=peterv (be7e50b715)
- Bug 1254730 - patch 2 - Better comments and a better management of lifetime of ChannelEvents, r=michal (8348911e35)
- Bug 1163198 - Remove instances of #ifdef PR_LOGGING in dom/plugins. r=froydnj (ba13039dfa)
- Bug 1253216 - clean up the atomic ops ifdef nest. r=jorendorff (6ca747d3cf)
- Bug 1257055 - Use jit/arm64/Architecture-arm64.h on non-JIT aarch64. r=lth (4f3949cd19)
- Bug 1253379 - Cache timings not send to HttpChannelChild r=mayhemer (395172278f)
- align SetAllowStaleCacheContent to FF52, possible misspatch (9d29d27011)
- Bug 1197901, ensure sensor events dispatching follows the becoming spec change, r=bz (f12fe4497c)
- Bug 1252055 P1 Make equivalent ServiceWorker DOM objects strictly equal in js. r=ehsan (cfd6649aa2)
- Bug 1200884: Make postmessage-to-client.https.html pass. r=jdm (7903e29cd3)
- Bug 1188545 - Make skip-waiting-using-registration.html wpt test pass. a=testonly (653f688ffb)
- Bug 1230164 P1 Ensure all service worker WPT tests remove controlled frames before completion. r=ehsan (0ca838a64d)
- Bug 1230164 P2 Only activate service workers in the activating state. r=ehsan (1a33f147d5)
- Bug 1230164 P3 Disable service worker update wpt tests for now. r=ehsan (51fde469a1)
- Bug 1252055 P2 Update tests to verify ServiceWorker object equality.  r=ehsan (8520f66261)
- Bug 1214293, initialize show focus rings state properly in all child frames, r=smaug (6547290d14)
- Bug 735251 - don't show focusrings on HTML video / audio elements on non-Windows when focused by mouse, r=bz (769932daf3)
- Bug 932080 - Support default values in destructuring; r=jorendorff (97d0f50478)
- Bug 1251480 - Implement Rooted<UniquePtr<T>>, r=terrence (86750eefef)
- Bug 1251480 - Use Rooted<UniquePtr<StateData>> in place of StateData::CustomAutoRooter, r=bz (e1d40cbac2)
- Bug 1248153 - Do not convert fp to int by cast. r=waldo (c0a759bfd5)
- Bug 1254335 - Remove invalid assertion; r=jorendorff (9b9e3f050e)
- Bug 1251667 - Add a measure SLOW_SCRIPT_PAGE_COUNT, which measures the number of pages per session that have slow scripts. r=wmccloskey (6ce4d8e0ca)
- Bug 1245185: Remove dead event handling code from nsPIDOMWindow<T>. r=smaug (01f8e77997)
- Bug 1252268: If the slow script dialog aborts an interval timer callback, don't schedule it again. r=bz (62c0828435)
- Bug 1245554. Window's named properties object should not claim to have duplicates of a given property name if it has multiple iframes with that name. r=peterv (78d5c55972)
- Bug 1255709. Simplify the JSContext/GlobalObject handling in ServiceWorkerRegistrationMainThread::GetPushManager a bit. r=bkelly (d157739571)
- Bug 1255655 - Const-ify and shrink kEntities and kAttrEntities. r=baku. (06dc0615ed)
- Bug 1228950 - Disallow scheme sets on nsHostObjectURI. r=bz (667c190935)
- Bug 1225864 - New flag OutputDisallowLineBreaking to disallow line breaking. r=masayuki. (f0e4d46807)
- Bug 1032979 part 1. Refactor the outerHTML web platform test to make it easier to add an XML version. r=smaug (6643f0678b)
- Bug 1032979 part 2. Getting outerHTML on a node from an XML document should not use the self-closing form of empty container tags from the HTML namespace. r=smaug (e3905a9c02)
- Bug 1225882 - Force XSLT to load async if CORS is required. r=sicking (485703225d)
- Bug 1168115 - Null CSSStyleSheet::mOwningPtr in the nsStyleLinkElement Unlink method. r=heycam (a82d26b778)
- Bug 1252841: Convert HAL daemon socket to |UniquePtr<>|, r=brsun (069171166d)
- Bug 1245901 - Measure counts of browser CPOW usage which is now rejected, r=billm (bf772d7df3)
- Bug 1258555: Fix return type of js::GCPointerPolicy::needsSweep. r=terrence (1e81399b2e)
- Bug 1249107 - Fix assertion failure when reaching start node in JS::ubi::ShortestPaths; r=jimb (1dba7085c2)
- Bug 1242462 - Allow IonMonkey re-enter until we reached the frequent bailout threshold. r=jandem (eaec0ee20d)
- Bug 1249736 - Remove redundant StartType from MStart. r=jandem (f18546e86f)
- Bug 1250964: SharedStubs - Don't add invalid stubs, r=jandem (b02cace7ee)
- Bug 1250964: SharedStubs - Remove bogus assert, r=bogus on CLOSED TREE (d310a60b69)
- Bug 1250031 - IonMonkey: MIPS: Fix ion/bug1233343.js crash. r=h4writer (ca83d03b77)
- Bug 1254808 - IonMonkey: MIPS: Define JS_USE_LINK_REGISTER on MIPS. r=h4writer (fce298a97e)
- Bug 1255352 - Use initial CacheIR infrastructure and use it for some simple Baseline stubs. r=efaust (c5ee30767f)
- Bug 1253170 - Enable clang's -Wimplicit-fallthrough warning to catch (65f53a0ddf)
- Bug 1250935 - Use mozilla::Variant instead of a raw union and manual tag for ScriptSource::data; r=terrence (034592e64c)
- bug 1253268 - allow getting ids of proxied accessibles r=yzen (cc73189ef3)
- Bug 1238555 - Always update the LazyScript's static scope chain when emitting functions. (r=till) (b7293ed553)
- Bug 1257434 - Remove MOZ_DEMANGLE_SYMBOLS and MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS from js/src/old-configure.in. r=ted (47928e829b)
- Bug 1256988 - Remove useless Gtk/accessibility check in js/src/old-configure.in. r=chmanchester (474378e87c)
- Bug 1122581 - Fix FormatFrame to not assert on Ion frames in some cases. r=shu (4cf9d53fca)
- Bug 1246605 - Fix getBacktrace assert with debugger breakpoints. r=evilpie (c05c44c085)
- Bug 1254861 - Unsupport building with clang < 3.3. r=froydnj (4e3246fa20)
- Bug 1255211 - Add profiledata to the list of LLVM libraries used by t (eb84825750)
- Bug 1233238 - Compile with play-services-{ads,analytics,appindexing} to support Adjust SDK. r=nalexander (ff35cdbdf7)
- Bug 1254174 - Convert uncaught symbol to a descriptive string. r=jorendorff (6917dd4540)
2024-03-18 23:26:24 +08:00

373 lines
13 KiB
Plaintext

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIDOMDocument;
interface nsIDOMRange;
interface nsISelection;
interface nsIDOMNode;
interface nsIOutputStream;
%{ C++
class nsINode;
class nsIDocument;
%}
[ptr] native nsINodePtr(nsINode);
[ptr] native nsIDocumentPtr(nsIDocument);
[scriptable, uuid(3d9371d8-a2ad-403e-8b0e-8885ad3562e3)]
interface nsIDocumentEncoderNodeFixup : nsISupports
{
/**
* Create a fixed up version of a node. This method is called before
* each node in a document is about to be persisted. The implementor
* may return a new node with fixed up attributes or null. If null is
* returned the node should be used as-is.
* @param aNode Node to fixup.
* @param [OUT] aSerializeCloneKids True if the document encoder should
* apply recursive serialization to the children of the fixed up node
* instead of the children of the original node.
* @return The resulting fixed up node.
*/
nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids);
};
[scriptable, uuid(21f112df-d96f-47da-bfcb-5331273003d1)]
interface nsIDocumentEncoder : nsISupports
{
// Output methods flag bits. There are a frightening number of these,
// because everyone wants something a little bit different
/**
* Output only the selection (as opposed to the whole document).
*/
const unsigned long OutputSelectionOnly = (1 << 0);
/** Plaintext output: Convert html to plaintext that looks like the html.
* Implies wrap (except inside <pre>), since html wraps.
* HTML, XHTML and XML output: do prettyprinting, ignoring existing formatting.
* XML output : it doesn't implicitly wrap
*/
const unsigned long OutputFormatted = (1 << 1);
/** Don't do prettyprinting. Don't do any wrapping that's not in the existing
* HTML/XML source. This option overrides OutputFormatted if both are set.
* HTML/XHTML output: If neither are set, there won't be prettyprinting too, but
* long lines will be wrapped.
* Supported also in XML and Plaintext output.
* @note This option does not affect entity conversion.
*/
const unsigned long OutputRaw = (1 << 2);
/**
* Do not print html head tags.
* XHTML/HTML output only.
*/
const unsigned long OutputBodyOnly = (1 << 3);
/**
* Output as though the content is preformatted
* (e.g. maybe it's wrapped in a PRE or PRE_WRAP style tag)
* Plaintext output only.
* XXXbz How does this interact with
* OutputFormatted/OutputRaw/OutputPreformatted/OutputFormatFlowed?
*/
const unsigned long OutputPreformatted = (1 << 4);
/**
* Wrap even if we're not doing formatted output (e.g. for text fields).
* Supported in XML, XHTML, HTML and Plaintext output.
* Set implicitly in HTML/XHTML output when no OutputRaw.
* Ignored when OutputRaw.
* XXXLJ: set implicitly in HTML/XHTML output, to keep compatible behaviors
* for old callers of this interface
* XXXbz How does this interact with OutputFormatFlowed?
*/
const unsigned long OutputWrap = (1 << 5);
/**
* Output for format flowed (RFC 2646). This is used when converting
* to text for mail sending. This differs just slightly
* but in an important way from normal formatted, and that is that
* lines are space stuffed. This can't (correctly) be done later.
* PlainText output only.
* XXXbz How does this interact with
* OutputFormatted/OutputRaw/OutputPreformatted/OutputWrap?
*/
const unsigned long OutputFormatFlowed = (1 << 6);
/**
* Convert links, image src, and script src to absolute URLs when possible.
* XHTML/HTML output only.
*/
const unsigned long OutputAbsoluteLinks = (1 << 7);
/**
* Attempt to encode entities standardized at W3C (HTML, MathML, etc).
* This is a catch-all flag for documents with mixed contents. Beware of
* interoperability issues. See below for other flags which might likely
* do what you want.
* HTML output only.
*/
const unsigned long OutputEncodeW3CEntities = (1 << 8);
/**
* LineBreak processing: if this flag is set than CR line breaks will
* be written. If neither this nor OutputLFLineBreak is set, then we
* will use platform line breaks. The combination of the two flags will
* cause CRLF line breaks to be written.
*/
const unsigned long OutputCRLineBreak = (1 << 9);
/**
* LineBreak processing: if this flag is set than LF line breaks will
* be written. If neither this nor OutputCRLineBreak is set, then we
* will use platform line breaks. The combination of the two flags will
* cause CRLF line breaks to be written.
*/
const unsigned long OutputLFLineBreak = (1 << 10);
/**
* Output the content of noscript elements (only for serializing
* to plaintext).
*/
const unsigned long OutputNoScriptContent = (1 << 11);
/**
* Output the content of noframes elements (only for serializing
* to plaintext). (Used only internally in the plain text serializer;
* ignored if passed by the caller.)
*/
const unsigned long OutputNoFramesContent = (1 << 12);
/**
* Don't allow any formatting nodes (e.g. <br>, <b>) inside a <pre>.
* This is used primarily by mail. XHTML/HTML output only.
*/
const unsigned long OutputNoFormattingInPre = (1 << 13);
/**
* Encode entities when outputting to a string.
* E.g. If set, we'll output &nbsp; if clear, we'll output 0xa0.
* The basic set is just &nbsp; &amp; &lt; &gt; &quot; for interoperability
* with older products that don't support &alpha; and friends.
* HTML output only.
*/
const unsigned long OutputEncodeBasicEntities = (1 << 14);
/**
* Encode entities when outputting to a string.
* The Latin1 entity set additionally includes 8bit accented letters
* between 128 and 255.
* HTML output only.
*/
const unsigned long OutputEncodeLatin1Entities = (1 << 15);
/**
* Encode entities when outputting to a string.
* The HTML entity set additionally includes accented letters, greek
* letters, and other special markup symbols as defined in HTML4.
* HTML output only.
*/
const unsigned long OutputEncodeHTMLEntities = (1 << 16);
/**
* Normally &nbsp; is replaced with a space character when
* encoding data as plain text, set this flag if that's
* not desired.
* Plaintext output only.
*/
const unsigned long OutputPersistNBSP = (1 << 17);
/**
* Normally when serializing the whole document using the HTML or
* XHTML serializer, the encoding declaration is rewritten to match.
* This flag suppresses that behavior.
*/
const unsigned long OutputDontRewriteEncodingDeclaration = (1 << 18);
/**
* When using the HTML or XHTML serializer, skip elements that are not
* visible when this flag is set. Elements are not visible when they
* have CSS style display:none or visibility:collapse, for example.
*/
const unsigned long SkipInvisibleContent = (1 << 19);
/**
* Output for delsp=yes (RFC 3676). This is used with OutputFormatFlowed
* when converting to text for mail sending.
* PlainText output only.
*/
const unsigned long OutputFormatDelSp = (1 << 20);
/**
* Drop <br> elements considered "invisible" by the editor. OutputPreformatted
* implies this flag.
*/
const unsigned long OutputDropInvisibleBreak = (1 << 21);
/**
* Don't check for _moz_dirty attributes when deciding whether to
* pretty-print if this flag is set (bug 599983).
*/
const unsigned long OutputIgnoreMozDirty = (1 << 22);
/**
* Output the content of non-text elements as the placehodler character
* U+FFFC (OBJECT REPLACEMENT CHARACTER, only for serializing to plaintext).
*/
const unsigned long OutputNonTextContentAsPlaceholder = (1 << 23);
/**
* Don't Strip ending spaces from a line (only for serializing to plaintext).
*/
const unsigned long OutputDontRemoveLineEndingSpaces = (1 << 24);
/**
* Serialize in a way that is suitable for copying a plaintext version of the
* document to the clipboard. This can for example cause line endings to be
* injected at preformatted block element boundaries.
*/
const unsigned long OutputForPlainTextClipboardCopy = (1 << 25);
/**
* Include ruby annotations and ruby parentheses in the output.
* PlainText output only.
*/
const unsigned long OutputRubyAnnotation = (1 << 26);
/**
* Disallow breaking of long character strings. This is important
* for serializing e-mail which contains CJK strings. These must
* not be broken just as "normal" longs strings aren't broken.
*/
const unsigned long OutputDisallowLineBreaking = (1 << 27);
/**
* Initialize with a pointer to the document and the mime type.
* @param aDocument Document to encode.
* @param aMimeType MimeType to use. May also be set by SetMimeType.
* @param aFlags Flags to use while encoding. May also be set by SetFlags.
*/
void init(in nsIDOMDocument aDocument,
in AString aMimeType,
in unsigned long aFlags);
[noscript] void nativeInit(in nsIDocumentPtr aDocument,
in AString aMimeType,
in unsigned long aFlags);
/**
* If the selection is set to a non-null value, then the
* selection is used for encoding, otherwise the entire
* document is encoded.
* @param aSelection The selection to encode.
*/
void setSelection(in nsISelection aSelection);
/**
* If the range is set to a non-null value, then the
* range is used for encoding, otherwise the entire
* document or selection is encoded.
* @param aRange The range to encode.
*/
void setRange(in nsIDOMRange aRange);
/**
* If the node is set to a non-null value, then the
* node is used for encoding, otherwise the entire
* document or range or selection is encoded.
* @param aNode The node to encode.
*/
void setNode(in nsIDOMNode aNode);
[noscript] void setNativeNode(in nsINodePtr aNode);
/**
* If the container is set to a non-null value, then its
* child nodes are used for encoding, otherwise the entire
* document or range or selection or node is encoded.
* @param aContainer The node which child nodes will be encoded.
*/
void setContainerNode(in nsIDOMNode aContainer);
[noscript] void setNativeContainerNode(in nsINodePtr aContainer);
/**
* Documents typically have an intrinsic character set,
* but if no intrinsic value is found, the platform character set
* is used. This function overrides both the intrinisc and platform
* charset.
* @param aCharset Overrides the both the intrinsic or platform
* character set when encoding the document.
*
* Possible result codes: NS_ERROR_NO_CHARSET_CONVERTER
*/
void setCharset(in ACString aCharset);
/**
* Set a wrap column. This may have no effect in some types of encoders.
* @param aWrapColumn Column to which to wrap.
*/
void setWrapColumn(in unsigned long aWrapColumn);
/**
* The mime type preferred by the encoder. This piece of api was
* added because the copy encoder may need to switch mime types on you
* if you ask it to copy html that really represents plaintext content.
* Call this AFTER Init() and SetSelection() have both been called.
*/
readonly attribute AString mimeType;
/**
* Encode the document and send the result to the nsIOutputStream.
*
* Possible result codes are the stream errors which might have
* been encountered.
* @param aStream Stream into which to encode.
*/
void encodeToStream(in nsIOutputStream aStream);
/**
* Encode the document into a string.
*
* @return The document encoded into a string.
*/
AString encodeToString();
/**
* Encode the document into a string. Stores the extra context information
* into the two arguments.
* @param [OUT] aContextString The string where the parent hierarchy
* information will be stored.
* @param [OUT] aInfoString The string where extra context info will
* be stored.
* @return The document encoded as a string.
*
*/
AString encodeToStringWithContext( out AString aContextString,
out AString aInfoString);
/**
* Encode the document into a string of limited size.
* @param aMaxLength After aMaxLength characters, the encoder will stop
* encoding new data.
* Only values > 0 will be considered.
* The returned string may be slightly larger than
* aMaxLength because some serializers (eg. HTML)
* may need to close some tags after they stop
* encoding new data, or finish a line (72 columns
* by default for the plain text serializer).
*
* @return The document encoded into a string.
*/
AString encodeToStringWithMaxLength(in unsigned long aMaxLength);
/**
* Set the fixup object associated with node persistence.
* @param aFixup The fixup object.
*/
void setNodeFixup(in nsIDocumentEncoderNodeFixup aFixup);
};