intl/locale/idl/nsICollation.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.

     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 "nsILocale.idl"
     8 interface nsICollation;
    10 [scriptable, uuid(04971e14-d6b3-4ada-8cbb-c3a13842b349)]
    11 interface nsICollationFactory : nsISupports
    12 {
    13     /**
    14      * Create the collation for a given locale.
    15      *
    16      * Use NULL as the locale parameter to use the user's locale preference
    17      * from the operating system.
    18      *
    19      * @param locale
    20      *        The locale for which to create the collation or null to use
    21      *        user preference.
    22      * @return A collation for the given locale.
    23      */
    24     nsICollation CreateCollation(in nsILocale locale);
    25 };
    27 [scriptable, uuid(b0132cc0-3786-4557-9874-910d7def5f93)]
    28 interface nsICollation : nsISupports {
    30   // use the primary comparison for the given locale - no flags
    31   const long kCollationStrengthDefault = 0;
    33   // do not consider case differences when doing the comparison i.e. A=a) 
    34   const long kCollationCaseInsensitiveAscii = 1;
    36   // do not consider accent differences when doing the comparison a=รก) 
    37   const long kCollationAccentInsenstive = 2;
    39   // case sensitive collation (default)
    40   const long kCollationCaseSensitive = kCollationStrengthDefault;
    42   // case insensitive collation
    43   const long kCollationCaseInSensitive = (kCollationCaseInsensitiveAscii | kCollationAccentInsenstive);
    45   // init this interface to a specified locale (should only be called by collation factory)
    46   void initialize(in nsILocale locale);
    48   // compare two strings
    49   // result is same as strcmp
    50   long compareString(in long strength, in AString string1, in AString string2);
    52   // allocate sort key from input string
    53   // returns newly allocated key, and its band its byte length
    54   [noscript] void allocateRawSortKey(in long strength, 
    55                                      in AString stringIn,
    56                                      [array,size_is(outLen)] out octet key,
    57                                      out unsigned long outLen);
    59   // compare two sort keys
    60   // length is a byte length, result is same as strcmp
    61   [noscript] long compareRawSortKey([const,array,size_is(len1)] in octet key1, in unsigned long len1,
    62                                     [const,array,size_is(len2)] in octet key2, in unsigned long len2);
    64 };

mercurial