Bug 1216207 - Modify navigator.hasFeature method to implement new

late-customization feature detection and change the test as well
r=ehsan
This commit is contained in:
Juan Gomez 2015-10-27 13:39:35 +08:00
Родитель 2ae40270d1
Коммит 31872e0b2b
2 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -1607,9 +1607,10 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
return nullptr;
}
// Hardcoded web-extensions feature which is b2g specific.
// Hardcoded extensions features which are b2g specific.
#ifdef MOZ_B2G
if (aName.EqualsLiteral("web-extensions")) {
if (aName.EqualsLiteral("web-extensions") ||
aName.EqualsLiteral("late-customization")) {
p->MaybeResolve(true);
return p.forget();
}

Просмотреть файл

@ -65,11 +65,19 @@ function testExtensions() {
return Promise.resolve();
}
return navigator.hasFeature("web-extensions").then(function(value) {
is(value, true, "Resolve the Promise with " + value + " for web-extensions");
}, function() {
ok(false, "The Promise should not be rejected");
var builtInFeatures = [
{feature: "web-extensions", value: true},
{feature: "late-customization", value: true}
];
builtInFeatures.forEach(function(x) {
navigator.hasFeature(x.feature).then(function(value) {
is(value, x.value, "Resolve the Promise with " + value + " for feature: " + x.feature);
}).catch(function(ex) {
ok(false, "The Promise should not be rejected");
});
});
return Promise.resolve();
}
SpecialPowers.pushPermissions([