Backed out changeset 93203c822307 (bug 900241) for mochitest failures

This commit is contained in:
Wes Kocher 2014-07-09 15:17:09 -07:00
Родитель cae5f950d6
Коммит 63796c8a36
2 изменённых файлов: 3 добавлений и 62 удалений

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

@ -1515,25 +1515,6 @@ Navigator::GetFeature(const nsAString& aName)
return p.forget();
} // hardware.memory
#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
p->MaybeResolve(JS::UndefinedHandleValue);

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

@ -38,7 +38,7 @@ function testSupported() {
ok(typeof mem === 'undefined', "hardware.memory is not support on this platform");
}
runNextTest();
SimpleTest.finish();
},function(mem) {
ok(false, "The Promise should not be rejected");
@ -49,57 +49,17 @@ function testNotSupported() {
var tv;
navigator.getFeature("hardware.tv").then(function(tv) {
ok(typeof tv === 'undefined', "Resolve the Promise with undefined value (hardware.tv)");
runNextTest();
testSupported();
},function(tv) {
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([
{type: "feature-detection", allow: 1, context: document}
], function() {
ok('getFeature' in navigator, "navigator.getFeature should exist");
// B2G specific manifest features.
// 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();
testNotSupported();
ok(true, "Test DONE");
});