зеркало из https://github.com/mozilla/gecko-dev.git
Bug 853301 - Expose the Intl API in desktop builds. r=ted on the build bits, r=smaug on the test-fix
This commit is contained in:
Родитель
98d069099d
Коммит
db6beebeeb
11
configure.in
11
configure.in
|
@ -9207,14 +9207,11 @@ MOZ_ARG_WITH_STRING(intl-api,
|
|||
WITH_INTL="--with-intl-api=$withval"
|
||||
])
|
||||
if test -z "$WITH_INTL"; then
|
||||
if test "$NIGHTLY_BUILD" = "1" -a "$MOZ_BUILD_APP" = "browser" -a -z "$DEVELOPER_OPTIONS"; then
|
||||
# In desktop nightlies the Internationalization API is disabled, but all
|
||||
# code for it is still built. Bug 853301 will remove this so that it's
|
||||
# built and the API is enabled.
|
||||
WITH_INTL="--with-intl-api=build"
|
||||
if test "$MOZ_BUILD_APP" = "browser"; then
|
||||
WITH_INTL="--with-intl-api"
|
||||
else
|
||||
# Internationalization isn't built or exposed by default in non-desktop and
|
||||
# non-nightly builds. Bugs to enable:
|
||||
# Internationalization isn't built or exposed by default in non-desktop
|
||||
# builds. Bugs to enable:
|
||||
#
|
||||
# Android: bug 864843
|
||||
# B2G: bug 866301
|
||||
|
|
|
@ -43,6 +43,7 @@ var ecmaGlobals =
|
|||
"Int32Array",
|
||||
"Int8Array",
|
||||
"InternalError",
|
||||
{name: "Intl", desktop: true},
|
||||
"Iterator",
|
||||
"JSON",
|
||||
"Map",
|
||||
|
@ -610,36 +611,38 @@ function createInterfaceMap(isXBLScope) {
|
|||
var isRelease = !version.contains("a");
|
||||
var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
|
||||
var isB2G = !isDesktop && !navigator.userAgent.contains("Android");
|
||||
|
||||
var interfaceMap = {};
|
||||
for (var entry of ecmaGlobals) {
|
||||
if (typeof(entry) === "string") {
|
||||
// Standard ECMAScript global objects are not defined on the XBL scope.
|
||||
interfaceMap[entry] = !isXBLScope;
|
||||
} else if (entry.nightly === isNightly) {
|
||||
interfaceMap[entry.name] = !isXBLScope;
|
||||
} else {
|
||||
interfaceMap[entry.name] = false;
|
||||
}
|
||||
}
|
||||
for (var entry of interfaceNamesInGlobalScope) {
|
||||
if (typeof(entry) === "string") {
|
||||
interfaceMap[entry] = true;
|
||||
} else if (entry.xbl === !isXBLScope ||
|
||||
entry.desktop === !isDesktop ||
|
||||
entry.b2g === !isB2G ||
|
||||
entry.release === !isRelease) {
|
||||
interfaceMap[entry.name] = false;
|
||||
} else {
|
||||
interfaceMap[entry.name] = true;
|
||||
|
||||
function addInterfaces(interfaces, shouldExpect)
|
||||
{
|
||||
for (var entry of interfaces) {
|
||||
if (typeof(entry) === "string") {
|
||||
interfaceMap[entry] = shouldExpect;
|
||||
} else if ((entry.nightly === !isNightly) ||
|
||||
(entry.xbl === !isXBLScope) ||
|
||||
(entry.desktop === !isDesktop) ||
|
||||
(entry.b2g === !isB2G) ||
|
||||
(entry.release === !isRelease)) {
|
||||
interfaceMap[entry.name] = false;
|
||||
} else {
|
||||
interfaceMap[entry.name] = shouldExpect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Standard ECMAScript global objects are not defined on the XBL scope, but
|
||||
// everything else exists everywhere.
|
||||
addInterfaces(ecmaGlobals, !isXBLScope);
|
||||
addInterfaces(interfaceNamesInGlobalScope, true);
|
||||
|
||||
return interfaceMap;
|
||||
}
|
||||
|
||||
function runTest(isXBLScope) {
|
||||
var interfaceMap = createInterfaceMap(isXBLScope);
|
||||
for (var name of Object.getOwnPropertyNames(window)) {
|
||||
// An interfae name should start with an upper case character.
|
||||
// An interface name should start with an upper case character.
|
||||
if (!/^(moz)?[A-Z]/.test(name)) {
|
||||
continue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче