Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / intl / strres / nsIStringBundle.idl
bloba548517703a044b3e053d2c5478b77ce23b3a9c5
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsISupports.idl"
7 #include "nsISimpleEnumerator.idl"
9 %{C++
10 #include "mozilla/MemoryReporting.h"
12 namespace mozilla {
13 namespace dom {
14 class ContentParent;
16 namespace ipc {
17 class FileDescriptor;
21 // Define Contractid and CID
22 // {D85A17C1-AA7C-11d2-9B8C-00805F8A16D9}
23 #define NS_STRINGBUNDLESERVICE_CID \
24 { 0xd85a17c1, 0xaa7c, 0x11d2, \
25 { 0x9b, 0x8c, 0x0, 0x80, 0x5f, 0x8a, 0x16, 0xd9 } }
27 #define NS_STRINGBUNDLE_CONTRACTID "@mozilla.org/intl/stringbundle;1"
31 [ptr] native ContentParent(mozilla::dom::ContentParent);
32 [ref] native FileDescriptor(mozilla::ipc::FileDescriptor);
33 native MallocSizeOf(mozilla::MallocSizeOf);
35 [scriptable, builtinclass, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
36 interface nsIStringBundle : nsISupports
38 AString GetStringFromID(in long aID);
40 // This method is mostly used from JS, where AUTF8String is appropriate.
41 [binaryname(GetStringFromAUTF8Name)]
42 AString GetStringFromName(in AUTF8String aName);
44 // This method is mostly used from C++, where |string| is appropriate because
45 // the names are most often 8-bit string literals (normally ASCII, though
46 // u8"foo" literals will also work).
47 [noscript, binaryname(GetStringFromName)]
48 AString GetStringFromNameCpp(in string aName);
50 // this is kind of like ssprintf - except that you can
51 // only pass it unicode strings, using the %S formatting character.
52 // the id or name should refer to a string in the bundle that
53 // uses %S.. do NOT try to use any other types.
54 // this uses nsTextFormatter::ssprintf to do the dirty work.
55 AString formatStringFromID(in long aID, in Array<AString> params);
57 // This method is mostly used from JS, where AUTF8String is appropriate.
58 [binaryname(FormatStringFromAUTF8Name)]
59 AString formatStringFromName(in AUTF8String aName, in Array<AString> params);
61 // This method is mostly used from C++, where |string| is appropriate because
62 // the names are most often 8-bit string literals (normally ASCII, though
63 // u8"foo" literals will also work).
64 [noscript, binaryname(FormatStringFromName)]
65 AString formatStringFromNameCpp(in string aName, in Array<AString> params);
68 Implements nsISimpleEnumerator, replaces nsIEnumerator
70 nsISimpleEnumerator getSimpleEnumeration();
71 // Preloads string bundle data asynchronously
72 void asyncPreload();
74 [notxpcom, nostdcall] size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
75 [notxpcom, nostdcall] size_t SizeOfIncludingThisIfUnshared(in MallocSizeOf aMallocSizeOf);
78 [scriptable, builtinclass, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
79 interface nsIStringBundleService : nsISupports
81 nsIStringBundle createBundle(in string aURLSpec);
83 /**
84 * Formats a message string from a status code and status arguments.
85 * @param aStatus - The status code. This is mapped into a string ID and
86 * used in the string lookup process.
87 * @param aStatusArg - The status message argument(s). Multiple arguments
88 * can be separated by newline ('\n') characters.
89 * @return the formatted message
91 AString formatStatusMessage(in nsresult aStatus, in wstring aStatusArg);
93 /**
94 * flushes the string bundle cache - useful when the locale changes or
95 * when we need to get some extra memory back
97 * at some point, we might want to make this flush all the bundles,
98 * because any bundles that are floating around when the locale changes
99 * will suddenly contain bad data
102 void flushBundles();
104 [notxpcom, nostdcall] size_t sizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
106 [notxpcom, nostdcall] void sendContentBundles(in ContentParent aContentParent);
108 [notxpcom, nostdcall] void registerContentBundle(in ACString aBundleURL,
109 [const] in FileDescriptor aMapFile,
110 in size_t aMapSize);