js/src/builtin/Intl.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * vim: set ts=8 sts=4 et sw=4 tw=99:
     3  * This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef builtin_Intl_h
     8 #define builtin_Intl_h
    10 #include "NamespaceImports.h"
    11 #include "unicode/utypes.h"
    13 /*
    14  * The Intl module specified by standard ECMA-402,
    15  * ECMAScript Internationalization API Specification.
    16  */
    18 /**
    19  * Initializes the Intl Object and its standard built-in properties.
    20  * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1
    21  */
    22 extern JSObject *
    23 js_InitIntlClass(JSContext *cx, js::HandleObject obj);
    25 namespace js {
    27 /*
    28  * The following functions are for use by self-hosted code.
    29  */
    32 /******************** Collator ********************/
    34 /**
    35  * Returns a new instance of the standard built-in Collator constructor.
    36  * Self-hosted code cannot cache this constructor (as it does for others in
    37  * Utilities.js) because it is initialized after self-hosted code is compiled.
    38  *
    39  * Usage: collator = intl_Collator(locales, options)
    40  */
    41 extern bool
    42 intl_Collator(JSContext *cx, unsigned argc, Value *vp);
    44 /**
    45  * Returns an object indicating the supported locales for collation
    46  * by having a true-valued property for each such locale with the
    47  * canonicalized language tag as the property name. The object has no
    48  * prototype.
    49  *
    50  * Usage: availableLocales = intl_Collator_availableLocales()
    51  */
    52 extern bool
    53 intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp);
    55 /**
    56  * Returns an array with the collation type identifiers per Unicode
    57  * Technical Standard 35, Unicode Locale Data Markup Language, for the
    58  * collations supported for the given locale. "standard" and "search" are
    59  * excluded.
    60  *
    61  * Usage: collations = intl_availableCollations(locale)
    62  */
    63 extern bool
    64 intl_availableCollations(JSContext *cx, unsigned argc, Value *vp);
    66 /**
    67  * Compares x and y (which must be String values), and returns a number less
    68  * than 0 if x < y, 0 if x = y, or a number greater than 0 if x > y according
    69  * to the sort order for the locale and collation options of the given
    70  * Collator.
    71  *
    72  * Spec: ECMAScript Internationalization API Specification, 10.3.2.
    73  *
    74  * Usage: result = intl_CompareStrings(collator, x, y)
    75  */
    76 extern bool
    77 intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp);
    80 /******************** NumberFormat ********************/
    82 /**
    83  * Returns a new instance of the standard built-in NumberFormat constructor.
    84  * Self-hosted code cannot cache this constructor (as it does for others in
    85  * Utilities.js) because it is initialized after self-hosted code is compiled.
    86  *
    87  * Usage: numberFormat = intl_NumberFormat(locales, options)
    88  */
    89 extern bool
    90 intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp);
    92 /**
    93  * Returns an object indicating the supported locales for number formatting
    94  * by having a true-valued property for each such locale with the
    95  * canonicalized language tag as the property name. The object has no
    96  * prototype.
    97  *
    98  * Usage: availableLocales = intl_NumberFormat_availableLocales()
    99  */
   100 extern bool
   101 intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp);
   103 /**
   104  * Returns the numbering system type identifier per Unicode
   105  * Technical Standard 35, Unicode Locale Data Markup Language, for the
   106  * default numbering system for the given locale.
   107  *
   108  * Usage: defaultNumberingSystem = intl_numberingSystem(locale)
   109  */
   110 extern bool
   111 intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp);
   113 /**
   114  * Returns a string representing the number x according to the effective
   115  * locale and the formatting options of the given NumberFormat.
   116  *
   117  * Spec: ECMAScript Internationalization API Specification, 11.3.2.
   118  *
   119  * Usage: formatted = intl_FormatNumber(numberFormat, x)
   120  */
   121 extern bool
   122 intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp);
   125 /******************** DateTimeFormat ********************/
   127 /**
   128  * Returns a new instance of the standard built-in DateTimeFormat constructor.
   129  * Self-hosted code cannot cache this constructor (as it does for others in
   130  * Utilities.js) because it is initialized after self-hosted code is compiled.
   131  *
   132  * Usage: dateTimeFormat = intl_DateTimeFormat(locales, options)
   133  */
   134 extern bool
   135 intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp);
   137 /**
   138  * Returns an object indicating the supported locales for date and time
   139  * formatting by having a true-valued property for each such locale with the
   140  * canonicalized language tag as the property name. The object has no
   141  * prototype.
   142  *
   143  * Usage: availableLocales = intl_DateTimeFormat_availableLocales()
   144  */
   145 extern bool
   146 intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp);
   148 /**
   149  * Returns an array with the calendar type identifiers per Unicode
   150  * Technical Standard 35, Unicode Locale Data Markup Language, for the
   151  * supported calendars for the given locale. The default calendar is
   152  * element 0.
   153  *
   154  * Usage: calendars = intl_availableCalendars(locale)
   155  */
   156 extern bool
   157 intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp);
   159 /**
   160  * Return a pattern in the date-time format pattern language of Unicode
   161  * Technical Standard 35, Unicode Locale Data Markup Language, for the
   162  * best-fit date-time format pattern corresponding to skeleton for the
   163  * given locale.
   164  *
   165  * Usage: pattern = intl_patternForSkeleton(locale, skeleton)
   166  */
   167 extern bool
   168 intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp);
   170 /**
   171  * Returns a String value representing x (which must be a Number value)
   172  * according to the effective locale and the formatting options of the
   173  * given DateTimeFormat.
   174  *
   175  * Spec: ECMAScript Internationalization API Specification, 12.3.2.
   176  *
   177  * Usage: formatted = intl_FormatDateTime(dateTimeFormat, x)
   178  */
   179 extern bool
   180 intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp);
   182 /**
   183  * Cast jschar* strings to UChar* strings used by ICU.
   184  */
   185 inline const UChar *
   186 JSCharToUChar(const jschar *chars)
   187 {
   188   return reinterpret_cast<const UChar *>(chars);
   189 }
   191 inline UChar *
   192 JSCharToUChar(jschar *chars)
   193 {
   194   return reinterpret_cast<UChar *>(chars);
   195 }
   197 } // namespace js
   199 #endif /* builtin_Intl_h */

mercurial