зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1484420) for hazard failures on a CLOSED TREE
Backed out changeset d910e3c8372a (bug 1484420) Backed out changeset d79cdb73c55f (bug 1484420)
This commit is contained in:
Родитель
79b4121889
Коммит
d801b3a01e
|
@ -29,7 +29,6 @@
|
|||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "js/LocaleSensitive.h"
|
||||
#include "mozilla/AbstractThread.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#include "js/LocaleSensitive.h"
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "MessageEventRunnable.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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/. */
|
||||
|
||||
/*
|
||||
* Functions and structures related to locale-sensitive behavior, including
|
||||
* exposure of the default locale (used by operations like toLocaleString).
|
||||
*/
|
||||
|
||||
#ifndef js_LocaleSensitive_h
|
||||
#define js_LocaleSensitive_h
|
||||
|
||||
#include "jstypes.h" // JS_PUBLIC_API
|
||||
|
||||
#include "js/RootingAPI.h" // JS::Handle, JS::MutableHandle
|
||||
#include "js/Utility.h" // JS::UniqueChars
|
||||
|
||||
struct JSContext;
|
||||
struct JSRuntime;
|
||||
class JSString;
|
||||
|
||||
namespace JS { union Value; }
|
||||
|
||||
/**
|
||||
* Set the default locale for the ECMAScript Internationalization API
|
||||
* (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat, and others that will
|
||||
* arise as time passes). (Note that the Internationalization API encourages
|
||||
* clients to specify their own locales; this default locale is only used when
|
||||
* no locale is specified, e.g. calling a toLocaleString function without
|
||||
* passing a locale argument to it.)
|
||||
*
|
||||
* The locale string remains owned by the caller.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_SetDefaultLocale(JSRuntime* rt, const char* locale);
|
||||
|
||||
/**
|
||||
* Return a copy of the default locale for the ECMAScript Internationalization
|
||||
* API (and for various ECMAScript functions that will invoke it). The locale
|
||||
* is retrieved from the |JSRuntime| that corresponds to |cx|.
|
||||
*
|
||||
* XXX Bug 1483961 means it's difficult to interpret the meaning of a null
|
||||
* return value for the time being, and we should fix this!
|
||||
*/
|
||||
extern JS_PUBLIC_API(JS::UniqueChars)
|
||||
JS_GetDefaultLocale(JSContext* cx);
|
||||
|
||||
/** Reset the default locale to OS defaults. */
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ResetDefaultLocale(JSRuntime* rt);
|
||||
|
||||
using JSLocaleToUpperCase =
|
||||
bool (*)(JSContext* cx, JS::Handle<JSString*> src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
using JSLocaleToLowerCase =
|
||||
bool (*)(JSContext* cx, JS::Handle<JSString*> src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
using JSLocaleCompare =
|
||||
bool (*)(JSContext* cx, JS::Handle<JSString*> src1, JS::Handle<JSString*> src2,
|
||||
JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
using JSLocaleToUnicode =
|
||||
bool (*)(JSContext* cx, const char* src, JS::MutableHandle<JS::Value> rval);
|
||||
|
||||
/**
|
||||
* A suite of locale-specific string conversion and error message callbacks
|
||||
* used to implement locale-sensitive behaviors (such as those performed by
|
||||
* the various toLocaleString and toLocale{Date,Time}String functions).
|
||||
*
|
||||
* If SpiderMonkey is compiled --with-intl-api, then #if EXPOSE_INTL_API. In
|
||||
* this case, SpiderMonkey itself will implement ECMA-402-compliant behavior by
|
||||
* calling on ICU, and none of the fields in this struct will ever be used.
|
||||
* (You'll still be able to call the get/set-callbacks functions; they just
|
||||
* won't affect JavaScript semantics.)
|
||||
*/
|
||||
struct JSLocaleCallbacks
|
||||
{
|
||||
JSLocaleToUpperCase localeToUpperCase;
|
||||
JSLocaleToLowerCase localeToLowerCase;
|
||||
JSLocaleCompare localeCompare;
|
||||
JSLocaleToUnicode localeToUnicode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set locale callbacks to be used in builds not compiled --with-intl-api.
|
||||
* |callbacks| must persist as long as the |JSRuntime|. Pass |nullptr| to
|
||||
* restore default behavior.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetLocaleCallbacks(JSRuntime* rt, const JSLocaleCallbacks* callbacks);
|
||||
|
||||
/**
|
||||
* Return the current locale callbacks, which may be nullptr.
|
||||
*/
|
||||
extern JS_PUBLIC_API(const JSLocaleCallbacks*)
|
||||
JS_GetLocaleCallbacks(JSRuntime* rt);
|
||||
|
||||
#endif /* js_LocaleSensitive_h */
|
|
@ -31,9 +31,6 @@
|
|||
#include "builtin/RegExp.h"
|
||||
#include "jit/InlinableNatives.h"
|
||||
#include "js/Conversions.h"
|
||||
#if !EXPOSE_INTL_API
|
||||
#include "js/LocaleSensitive.h"
|
||||
#endif
|
||||
#include "js/StableStringChars.h"
|
||||
#include "js/UniquePtr.h"
|
||||
#if ENABLE_INTL_API
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "js/AutoByteString.h"
|
||||
#include "js/Debug.h"
|
||||
#include "js/HashTable.h"
|
||||
#include "js/LocaleSensitive.h"
|
||||
#include "js/StableStringChars.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "js/UbiNode.h"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 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 "js/LocaleSensitive.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
BEGIN_TEST(testDateToLocaleString)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* 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 "js/LocaleSensitive.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
BEGIN_TEST(testIntlAvailableLocales)
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
#include "js/Date.h"
|
||||
#include "js/Initialization.h"
|
||||
#include "js/JSON.h"
|
||||
#include "js/LocaleSensitive.h"
|
||||
#include "js/Proxy.h"
|
||||
#include "js/SliceBudget.h"
|
||||
#include "js/StableStringChars.h"
|
||||
|
|
|
@ -223,6 +223,19 @@ typedef void
|
|||
JS::PromiseRejectionHandlingState state,
|
||||
void* data);
|
||||
|
||||
typedef bool
|
||||
(* JSLocaleToUpperCase)(JSContext* cx, JS::HandleString src, JS::MutableHandleValue rval);
|
||||
|
||||
typedef bool
|
||||
(* JSLocaleToLowerCase)(JSContext* cx, JS::HandleString src, JS::MutableHandleValue rval);
|
||||
|
||||
typedef bool
|
||||
(* JSLocaleCompare)(JSContext* cx, JS::HandleString src1, JS::HandleString src2,
|
||||
JS::MutableHandleValue rval);
|
||||
|
||||
typedef bool
|
||||
(* JSLocaleToUnicode)(JSContext* cx, const char* src, JS::MutableHandleValue rval);
|
||||
|
||||
/**
|
||||
* Callback used to ask the embedding for the cross compartment wrapper handler
|
||||
* that implements the desired prolicy for this kind of object in the
|
||||
|
@ -4712,6 +4725,55 @@ PropertySpecNameToPermanentId(JSContext* cx, const char* name, jsid* idp);
|
|||
|
||||
/************************************************************************/
|
||||
|
||||
/**
|
||||
* The default locale for the ECMAScript Internationalization API
|
||||
* (Intl.Collator, Intl.NumberFormat, Intl.DateTimeFormat).
|
||||
* Note that the Internationalization API encourages clients to
|
||||
* specify their own locales.
|
||||
* The locale string remains owned by the caller.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_SetDefaultLocale(JSRuntime* rt, const char* locale);
|
||||
|
||||
/**
|
||||
* Look up the default locale for the ECMAScript Internationalization API.
|
||||
* NB: The locale information is retrieved from cx's runtime.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JS::UniqueChars)
|
||||
JS_GetDefaultLocale(JSContext* cx);
|
||||
|
||||
/**
|
||||
* Reset the default locale to OS defaults.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_ResetDefaultLocale(JSRuntime* rt);
|
||||
|
||||
/**
|
||||
* Locale specific string conversion and error message callbacks.
|
||||
*/
|
||||
struct JSLocaleCallbacks {
|
||||
JSLocaleToUpperCase localeToUpperCase; // not used #if EXPOSE_INTL_API
|
||||
JSLocaleToLowerCase localeToLowerCase; // not used #if EXPOSE_INTL_API
|
||||
JSLocaleCompare localeCompare; // not used #if EXPOSE_INTL_API
|
||||
JSLocaleToUnicode localeToUnicode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Establish locale callbacks. The pointer must persist as long as the
|
||||
* JSContext. Passing nullptr restores the default behaviour.
|
||||
*/
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_SetLocaleCallbacks(JSRuntime* rt, const JSLocaleCallbacks* callbacks);
|
||||
|
||||
/**
|
||||
* Return the address of the current locale callbacks struct, which may
|
||||
* be nullptr.
|
||||
*/
|
||||
extern JS_PUBLIC_API(const JSLocaleCallbacks*)
|
||||
JS_GetLocaleCallbacks(JSRuntime* rt);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
* Error reporting.
|
||||
*
|
||||
|
|
|
@ -68,6 +68,7 @@ struct JSClass;
|
|||
class JSErrorReport;
|
||||
struct JSExceptionState;
|
||||
struct JSFunctionSpec;
|
||||
struct JSLocaleCallbacks;
|
||||
struct JSPrincipals;
|
||||
struct JSPropertySpec;
|
||||
struct JSSecurityCallbacks;
|
||||
|
|
|
@ -144,7 +144,6 @@ EXPORTS.js += [
|
|||
'../public/Id.h',
|
||||
'../public/Initialization.h',
|
||||
'../public/JSON.h',
|
||||
'../public/LocaleSensitive.h',
|
||||
'../public/MemoryFunctions.h',
|
||||
'../public/MemoryMetrics.h',
|
||||
'../public/Principals.h',
|
||||
|
|
|
@ -69,7 +69,6 @@ class AutoHeapSession;
|
|||
} // namespace js
|
||||
|
||||
struct DtoaState;
|
||||
struct JSLocaleCallbacks;
|
||||
|
||||
#ifdef JS_SIMULATOR_ARM64
|
||||
namespace vixl {
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
#include "js/LocaleSensitive.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
@ -17,6 +18,7 @@
|
|||
|
||||
#include "xpcpublic.h"
|
||||
|
||||
using namespace JS;
|
||||
using namespace mozilla;
|
||||
using mozilla::intl::LocaleService;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче