зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
2ae40270d1
Коммит
31872e0b2b
|
@ -1607,9 +1607,10 @@ Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hardcoded web-extensions feature which is b2g specific.
|
// Hardcoded extensions features which are b2g specific.
|
||||||
#ifdef MOZ_B2G
|
#ifdef MOZ_B2G
|
||||||
if (aName.EqualsLiteral("web-extensions")) {
|
if (aName.EqualsLiteral("web-extensions") ||
|
||||||
|
aName.EqualsLiteral("late-customization")) {
|
||||||
p->MaybeResolve(true);
|
p->MaybeResolve(true);
|
||||||
return p.forget();
|
return p.forget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,11 +65,19 @@ function testExtensions() {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return navigator.hasFeature("web-extensions").then(function(value) {
|
var builtInFeatures = [
|
||||||
is(value, true, "Resolve the Promise with " + value + " for web-extensions");
|
{feature: "web-extensions", value: true},
|
||||||
}, function() {
|
{feature: "late-customization", value: true}
|
||||||
ok(false, "The Promise should not be rejected");
|
];
|
||||||
|
|
||||||
|
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([
|
SpecialPowers.pushPermissions([
|
||||||
|
|
Загрузка…
Ссылка в новой задаче