mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 06:22:20 +00:00
Bug 1403318 - Remove mozIntl.PluralRules. r=anba
MozReview-Commit-ID: IqkGenuXYrv --HG-- extra : rebase_source : c03e314f3885c184c6526e79b29af43133fd9898
This commit is contained in:
parent
fef60ef862
commit
c29fd22d76
@ -61,27 +61,6 @@ MozIntlHelper::AddGetDisplayNames(JS::Handle<JS::Value> val, JSContext* cx)
|
||||
return AddFunctions(cx, val, funcs);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MozIntlHelper::AddPluralRulesConstructor(JS::Handle<JS::Value> val, JSContext* cx)
|
||||
{
|
||||
if (!val.isObject()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> realIntlObj(cx, js::CheckedUnwrap(&val.toObject()));
|
||||
if (!realIntlObj) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, realIntlObj);
|
||||
|
||||
if (!js::AddPluralRulesConstructor(cx, realIntlObj)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MozIntlHelper::AddDateTimeFormatConstructor(JS::Handle<JS::Value> val, JSContext* cx)
|
||||
{
|
||||
|
@ -41,6 +41,5 @@ interface mozIMozIntl : nsISupports
|
||||
jsval getDisplayNames([optional] in jsval locales, [optional] in jsval options);
|
||||
jsval getLocaleInfo([optional] in jsval locales);
|
||||
|
||||
jsval createPluralRules([optional] in jsval locales, [optional] in jsval options);
|
||||
jsval createDateTimeFormat([optional] in jsval locales, [optional] in jsval options);
|
||||
};
|
||||
|
@ -20,13 +20,6 @@ interface mozIMozIntlHelper : nsISupports
|
||||
[implicit_jscontext] void addGetDisplayNames(in jsval intlObject);
|
||||
[implicit_jscontext] void addGetLocaleInfo(in jsval intlObject);
|
||||
|
||||
/**
|
||||
* Adds a PluralRules constructor to the given object. This function may only
|
||||
* be called once within a realm/global object: calling it multiple times will
|
||||
* throw.
|
||||
*/
|
||||
[implicit_jscontext] void addPluralRulesConstructor(in jsval intlObject);
|
||||
|
||||
/**
|
||||
* Adds a MozDateTimeFormat contructor to the given object. This function may only
|
||||
* be called once within a realm/global object: calling it multiple times will
|
||||
|
@ -70,14 +70,6 @@ class MozIntl {
|
||||
return this._cache.getLocaleInfo(getLocales(locales), ...args);
|
||||
}
|
||||
|
||||
createPluralRules(locales, ...args) {
|
||||
if (!this._cache.hasOwnProperty("PluralRules")) {
|
||||
mozIntlHelper.addPluralRulesConstructor(this._cache);
|
||||
}
|
||||
|
||||
return new this._cache.PluralRules(getLocales(locales), ...args);
|
||||
}
|
||||
|
||||
createDateTimeFormat(locales, options, ...args) {
|
||||
if (!this._cache.hasOwnProperty("DateTimeFormat")) {
|
||||
mozIntlHelper.addDateTimeFormatConstructor(this._cache);
|
||||
|
@ -15,7 +15,6 @@ function test_methods_presence(mozIntl) {
|
||||
equal(mozIntl.getCalendarInfo instanceof Function, true);
|
||||
equal(mozIntl.getDisplayNames instanceof Function, true);
|
||||
equal(mozIntl.getLocaleInfo instanceof Function, true);
|
||||
equal(mozIntl.createPluralRules instanceof Function, true);
|
||||
equal(mozIntl.createDateTimeFormat instanceof Function, true);
|
||||
}
|
||||
|
||||
@ -23,7 +22,6 @@ function test_methods_calling(mozIntl) {
|
||||
mozIntl.getCalendarInfo("pl");
|
||||
mozIntl.getDisplayNames("ar");
|
||||
mozIntl.getLocaleInfo("de");
|
||||
mozIntl.createPluralRules("fr");
|
||||
mozIntl.createDateTimeFormat("fr");
|
||||
ok(true);
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ function test_methods_presence(miHelper) {
|
||||
equal(miHelper.addGetCalendarInfo instanceof Function, true);
|
||||
equal(miHelper.addGetDisplayNames instanceof Function, true);
|
||||
equal(miHelper.addGetLocaleInfo instanceof Function, true);
|
||||
equal(miHelper.addPluralRulesConstructor instanceof Function, true);
|
||||
equal(miHelper.addDateTimeFormatConstructor instanceof Function, true);
|
||||
|
||||
let x = {};
|
||||
@ -50,9 +49,6 @@ function test_methods_presence(miHelper) {
|
||||
miHelper.addGetLocaleInfo(x);
|
||||
equal(x.getLocaleInfo instanceof Function, true);
|
||||
|
||||
miHelper.addPluralRulesConstructor(x);
|
||||
equal(x.PluralRules instanceof Function, true);
|
||||
|
||||
miHelper.addDateTimeFormatConstructor(x);
|
||||
equal(x.DateTimeFormat instanceof Function, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user