mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1161677 - Expose dev mode state read-only through the navigator.hasFeature() api r=ehsan
This commit is contained in:
parent
6b55b045b4
commit
2104397d2c
@ -1508,6 +1508,12 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Mirror the dom.apps.developer_mode pref to let apps get it read-only.
|
||||
if (aName.EqualsLiteral("dom.apps.developer_mode")) {
|
||||
p->MaybeResolve(Preferences::GetBool("dom.apps.developer_mode", false));
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
p->MaybeResolve(JS::UndefinedHandleValue);
|
||||
return p.forget();
|
||||
}
|
||||
|
@ -76,13 +76,31 @@ function createManifestTest(aFeature) {
|
||||
}
|
||||
}
|
||||
|
||||
function testDevMode(aExpected) {
|
||||
return function() {
|
||||
navigator.getFeature("dom.apps.developer_mode").then(res => {
|
||||
is(res, aExpected, "dom.apps.developer_mode is " + aExpected);
|
||||
runNextTest();
|
||||
}, function() {
|
||||
ok(false, "The Promise should not be rejected");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function enableDevMode() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.apps.developer_mode", true]]}, runNextTest);
|
||||
}
|
||||
|
||||
var currentTest = -1;
|
||||
var tests = [
|
||||
testNotSupported,
|
||||
testNotSupportedManifest,
|
||||
testSupported,
|
||||
createManifestTest("manifest.origin"),
|
||||
createManifestTest("manifest.redirects")
|
||||
createManifestTest("manifest.redirects"),
|
||||
testDevMode(false),
|
||||
enableDevMode,
|
||||
testDevMode(true)
|
||||
];
|
||||
|
||||
function runNextTest() {
|
||||
|
Loading…
Reference in New Issue
Block a user