зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 93203c822307 (bug 900241) for mochitest failures
This commit is contained in:
Родитель
cae5f950d6
Коммит
63796c8a36
|
@ -1515,25 +1515,6 @@ Navigator::GetFeature(const nsAString& aName)
|
||||||
return p.forget();
|
return p.forget();
|
||||||
} // hardware.memory
|
} // hardware.memory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Hardcoded manifest features. Some are still b2g specific.
|
|
||||||
const char manifestFeatures[][64] = {
|
|
||||||
"manifest.origin"
|
|
||||||
, "manifest.redirects"
|
|
||||||
#ifdef MOZ_B2G
|
|
||||||
, "manifest.chrome.navigation"
|
|
||||||
, "manifest.precompile"
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
nsAutoCString feature = NS_ConvertUTF16toUTF8(aName);
|
|
||||||
for (uint32_t i = 0; i < MOZ_ARRAY_LENGTH(manifestFeatures); i++) {
|
|
||||||
if (feature.Equals(manifestFeatures[i])) {
|
|
||||||
p->MaybeResolve(true);
|
|
||||||
return p.forget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// resolve with <undefined> because the feature name is not supported
|
// resolve with <undefined> because the feature name is not supported
|
||||||
p->MaybeResolve(JS::UndefinedHandleValue);
|
p->MaybeResolve(JS::UndefinedHandleValue);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ function testSupported() {
|
||||||
ok(typeof mem === 'undefined', "hardware.memory is not support on this platform");
|
ok(typeof mem === 'undefined', "hardware.memory is not support on this platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
runNextTest();
|
SimpleTest.finish();
|
||||||
|
|
||||||
},function(mem) {
|
},function(mem) {
|
||||||
ok(false, "The Promise should not be rejected");
|
ok(false, "The Promise should not be rejected");
|
||||||
|
@ -49,57 +49,17 @@ function testNotSupported() {
|
||||||
var tv;
|
var tv;
|
||||||
navigator.getFeature("hardware.tv").then(function(tv) {
|
navigator.getFeature("hardware.tv").then(function(tv) {
|
||||||
ok(typeof tv === 'undefined', "Resolve the Promise with undefined value (hardware.tv)");
|
ok(typeof tv === 'undefined', "Resolve the Promise with undefined value (hardware.tv)");
|
||||||
runNextTest();
|
testSupported();
|
||||||
},function(tv) {
|
},function(tv) {
|
||||||
ok(false, "The Promise should not be rejected")
|
ok(false, "The Promise should not be rejected")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createManifestTest(aFeature) {
|
|
||||||
return function() {
|
|
||||||
var res;
|
|
||||||
navigator.getFeature(aFeature).then(function(res) {
|
|
||||||
info("Got " + res + " for " + aFeature);
|
|
||||||
ok(res === true, "Resolve the Promise with 'true' for " + aFeature);
|
|
||||||
runNextTest();
|
|
||||||
},function(tv) {
|
|
||||||
ok(false, "The Promise should not be rejected")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentTest = -1;
|
|
||||||
var tests = [
|
|
||||||
testNotSupported,
|
|
||||||
testSupported,
|
|
||||||
createManifestTest("manifest.origin"),
|
|
||||||
createManifestTest("manifest.redirects")
|
|
||||||
];
|
|
||||||
|
|
||||||
function runNextTest() {
|
|
||||||
currentTest++;
|
|
||||||
if (currentTest <= tests.length) {
|
|
||||||
tests[currentTest]();
|
|
||||||
} else {
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
info("About to run " + tests.length + " tests");
|
|
||||||
|
|
||||||
SpecialPowers.pushPermissions([
|
SpecialPowers.pushPermissions([
|
||||||
{type: "feature-detection", allow: 1, context: document}
|
{type: "feature-detection", allow: 1, context: document}
|
||||||
], function() {
|
], function() {
|
||||||
ok('getFeature' in navigator, "navigator.getFeature should exist");
|
ok('getFeature' in navigator, "navigator.getFeature should exist");
|
||||||
// B2G specific manifest features.
|
testNotSupported();
|
||||||
// Touching navigator before pushPermissions makes it fail.
|
|
||||||
if (!navigator.userAgent.contains("Android") &&
|
|
||||||
/Mobile|Tablet/.test(navigator.userAgent)) {
|
|
||||||
info("Adding B2G specific tests");
|
|
||||||
tests.push(createManifestTest("manifest.chrome.navigation"));
|
|
||||||
tests.push(createManifestTest("manifest.precompile"));
|
|
||||||
}
|
|
||||||
runNextTest();
|
|
||||||
ok(true, "Test DONE");
|
ok(true, "Test DONE");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче