Bug 1216150 - Turn on the experimental Intl.DateTimeFormat.prototype.formatToParts in b2g certified apps. r=fabrice

This commit is contained in:
Jeff Walden 2016-02-01 12:48:58 -08:00
parent 38b610ee4e
commit 9621f949eb
2 changed files with 14 additions and 6 deletions

View File

@ -437,8 +437,11 @@ DedicatedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx,
behaviors.setDiscardSource(discardSource)
.extraWarningsOverride().set(extraWarnings);
const bool inCertifiedApp = mWorkerPrivate->IsInCertifiedApp();
JS::CompartmentCreationOptions& creationOptions = options.creationOptions();
creationOptions.setSharedMemoryAndAtomicsEnabled(xpc::SharedMemoryEnabled());
.setExperimentalDateTimeFormatFormatToPartsEnabled(inCertifiedApp);
return DedicatedWorkerGlobalScopeBinding_workers::Wrap(aCx, this, this,
options,

View File

@ -400,13 +400,18 @@ InitGlobalObjectOptions(JS::CompartmentOptions& aOptions,
if (shouldDiscardSystemSource || extraWarningsForSystemJS)
isSystem = nsContentUtils::IsSystemPrincipal(aPrincipal);
short status = aPrincipal->GetAppStatus();
// Enable the ECMA-402 experimental formatToParts in certified apps.
if (status == nsIPrincipal::APP_STATUS_CERTIFIED) {
aOptions.creationOptions()
.setExperimentalDateTimeFormatFormatToPartsEnabled(true);
}
if (shouldDiscardSystemSource) {
bool discardSource = isSystem;
if (!discardSource) {
short status = aPrincipal->GetAppStatus();
discardSource = status == nsIPrincipal::APP_STATUS_PRIVILEGED ||
status == nsIPrincipal::APP_STATUS_CERTIFIED;
}
bool discardSource = isSystem ||
(status == nsIPrincipal::APP_STATUS_PRIVILEGED ||
status == nsIPrincipal::APP_STATUS_CERTIFIED);
aOptions.behaviors().setDiscardSource(discardSource);
}