mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 868439 - Convert some uses of nsIPrefBranch to SpecialPowers. r=jmaher
This commit is contained in:
parent
82984fe6e0
commit
e36a806dd2
@ -117,7 +117,6 @@ MOCHITEST_FILES = \
|
||||
test_too_many_elements.html \
|
||||
test_volume.html \
|
||||
test_video_to_canvas.html \
|
||||
use_large_cache.js \
|
||||
test_audiowrite.html \
|
||||
test_mozHasAudio.html \
|
||||
test_source_media.html \
|
||||
|
@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462957
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
<script type="application/javascript" src="use_large_cache.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462957">Mozilla Bug 462957</a>
|
||||
@ -85,8 +84,11 @@ function startTest(test, token) {
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
|
||||
manager.runTests(gSeekTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(gSeekTests, startTest);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493187
|
||||
<title>Bug 493187 - enter HAVE_FUTURE_DATA when seeking within buffered data even if new data isn't arriving</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -62,8 +61,11 @@ function startTest(test, token) {
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
|
||||
manager.runTests(gSeekTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(gSeekTests, startTest);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -33,24 +33,17 @@ function IsWindows7() {
|
||||
}
|
||||
|
||||
function getMediaPref(name) {
|
||||
// Can't use SpecialPowers.getBoolPref because it throws when pref isn't
|
||||
// present, and for example on non-Windows systems the WMF prefs won't be
|
||||
// present.
|
||||
var pref = false;
|
||||
var prefService = SpecialPowers.wrap(SpecialPowers.Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
try {
|
||||
pref = branch.getBoolPref(name);
|
||||
pref = SpecialPowers.getBoolPref(name);
|
||||
} catch(ex) { }
|
||||
return pref;
|
||||
}
|
||||
|
||||
var haveMp4 = (getMediaPref("windows-media-foundation.enabled") && IsWindowsVistaOrLater()) ||
|
||||
getMediaPref("omx.enabled") ||
|
||||
getMediaPref("gstreamer.enabled");
|
||||
// TODO: Add "getMediaPref("plugins.enabled")" once MP4 works on Gingerbread.
|
||||
var haveMp4 = (getMediaPref("media.windows-media-foundation.enabled") && IsWindowsVistaOrLater()) ||
|
||||
getMediaPref("media.omx.enabled") ||
|
||||
getMediaPref("media.gstreamer.enabled");
|
||||
// TODO: Add "getMediaPref("media.plugins.enabled")" once MP4 works on Gingerbread.
|
||||
|
||||
check_mp4(document.getElementById('v'), haveMp4);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML>
|
||||
hg diff<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=479863
|
||||
@ -32,17 +32,20 @@ window.onload = function() {
|
||||
we've got the first frame.
|
||||
*/
|
||||
|
||||
|
||||
var resource = getPlayableVideo(gSeekTests);
|
||||
if (resource != null) {
|
||||
for (var i=0; i<20; ++i) {
|
||||
var v = document.createElement("video");
|
||||
v.src = resource.name;
|
||||
document.body.appendChild(v);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
if (resource != null) {
|
||||
for (var i=0; i<20; ++i) {
|
||||
var v = document.createElement("video");
|
||||
v.src = resource.name;
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
} else {
|
||||
todo(false, "No types supported");
|
||||
}
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
} else {
|
||||
todo(false, "No types supported");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
<title>Media test: unknown/invalid formats raise decode error</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -44,8 +43,11 @@ function startTest(test, token) {
|
||||
v.src = test.name; // implicitly starts a load.
|
||||
}
|
||||
|
||||
manager.runTests(gDecodeErrorTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(gDecodeErrorTests, startTest);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -8,7 +8,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=548523">Mozilla Bug 548523</a>
|
||||
@ -568,8 +567,11 @@ function startTest(test, token) {
|
||||
}
|
||||
|
||||
var twiceTests = tests.concat(tests);
|
||||
manager.runTests(twiceTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(twiceTests, startTest);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -7,7 +7,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=479863
|
||||
<title>Test for Bug 479863</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript" src="use_large_cache.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479863">Mozilla Bug 479863</a>
|
||||
@ -70,17 +69,21 @@ function suspended(event) {
|
||||
}
|
||||
|
||||
var key = Math.random();
|
||||
for (var i = 1; i <= 6; ++i) {
|
||||
var id = "v" + i;
|
||||
var v = document.getElementById(id);
|
||||
suspendCount[id] = 0;
|
||||
v.addEventListener("suspend", suspended, false);
|
||||
// Treat "load" as "suspend" for now, it means the same thing: we
|
||||
// stopped the download.
|
||||
v.addEventListener("load", suspended, false);
|
||||
v.src = "seek.ogv?key=" + key + "&id=" + id;
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
for (var i = 1; i <= 6; ++i) {
|
||||
var id = "v" + i;
|
||||
var v = document.getElementById(id);
|
||||
suspendCount[id] = 0;
|
||||
v.addEventListener("suspend", suspended, false);
|
||||
// Treat "load" as "suspend" for now, it means the same thing: we
|
||||
// stopped the download.
|
||||
v.addEventListener("load", suspended, false);
|
||||
v.src = "seek.ogv?key=" + key + "&id=" + id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -8,7 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script src="use_large_cache.js"></script>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var manager = new MediaTestManager;
|
||||
@ -40,8 +39,11 @@ function startTest(test, token) {
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
|
||||
manager.runTests(gProgressTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(gProgressTests, startTest);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -9,7 +9,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=486646
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script type="text/javascript" src="manifest.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -56,8 +55,11 @@ function startTest(test, token) {
|
||||
document.body.appendChild(v);
|
||||
}
|
||||
|
||||
manager.runTests(gSmallTests, startTest);
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, beginTest);
|
||||
function beginTest() {
|
||||
manager.runTests(gSmallTests, startTest);
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -1,14 +0,0 @@
|
||||
(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
// Set cache size to something large
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
var oldSize = branch.getIntPref("cache_size");
|
||||
branch.setIntPref("cache_size", 40000);
|
||||
|
||||
window.addEventListener("unload", function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
branch.setIntPref("cache_size", oldSize);
|
||||
}, false);
|
||||
})();
|
@ -24,20 +24,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=411236
|
||||
window.oTarget = null;
|
||||
window.fileInputGotClick = false;
|
||||
|
||||
// accessibility.tabfocus must be set to value 7 before running test also
|
||||
// on a mac.
|
||||
function setOrRestoreTabFocus(newValue) {
|
||||
const prefSvcContractID = "@mozilla.org/preferences-service;1";
|
||||
const prefSvcIID = SpecialPowers.Ci.nsIPrefService;
|
||||
var prefs = SpecialPowers.Cc[prefSvcContractID].getService(prefSvcIID)
|
||||
.getBranch("accessibility.");
|
||||
if (!newValue) {
|
||||
prefs.clearUserPref("tabfocus");
|
||||
} else {
|
||||
prefs.setIntPref("tabfocus", newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function tab() {
|
||||
var utils = SpecialPowers.DOMWindowUtils;
|
||||
// Send tab key events.
|
||||
@ -57,7 +43,6 @@ function test() {
|
||||
|
||||
if (i >= 100) {
|
||||
ok(false, "Couldn't find an input element!");
|
||||
setOrRestoreTabFocus(0);
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
@ -70,22 +55,25 @@ function test() {
|
||||
SpecialPowers.wrap(window.oTarget).dispatchEvent(e);
|
||||
ok(window.fileInputGotClick,
|
||||
"File input should have got a click event, but not open the file dialog.");
|
||||
setOrRestoreTabFocus(0);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function beginTest() {
|
||||
// accessibility.tabfocus must be set to value 7 before running test also
|
||||
// on a mac.
|
||||
SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}, do_test);
|
||||
}
|
||||
|
||||
function do_test() {
|
||||
setOrRestoreTabFocus(7);
|
||||
window.focus();
|
||||
document.getElementById('fileinput').focus();
|
||||
setTimeout(test, 100);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(do_test);
|
||||
addLoadEvent(beginTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -38,7 +38,6 @@ MOCHITEST_FILES = \
|
||||
videocontrols_direction-2d.html \
|
||||
videocontrols_direction-2e.html \
|
||||
videocontrols_direction_test.js \
|
||||
use_large_cache.js \
|
||||
$(topsrcdir)/content/media/test/audio.wav \
|
||||
$(topsrcdir)/content/media/test/seek_with_sound.ogg \
|
||||
videomask.css \
|
||||
|
@ -14,7 +14,6 @@
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script class="testbody" type="text/javascript">
|
||||
function loadedmetadata(event) {
|
||||
is(event.type, "loadedmetadata", "checking event type");
|
||||
@ -25,12 +24,14 @@
|
||||
|
||||
var audio = document.getElementById("audio");
|
||||
|
||||
// Kick off test once audio has loaded.
|
||||
audio.addEventListener("loadedmetadata", loadedmetadata, false);
|
||||
audio.src = "audio.wav";
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startTest);
|
||||
function startTest() {
|
||||
// Kick off test once audio has loaded.
|
||||
audio.addEventListener("loadedmetadata", loadedmetadata, false);
|
||||
audio.src = "audio.wav";
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -14,7 +14,6 @@
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/*
|
||||
@ -238,16 +237,19 @@ function maybeStartTest() {
|
||||
var testnum = 1;
|
||||
var video = document.getElementById("video");
|
||||
|
||||
// Kick off test once video has loaded.
|
||||
video.addEventListener("canplaythrough", canplaythroughevent, false);
|
||||
window.addEventListener("load", loadevent, false);
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, startTest);
|
||||
function startTest() {
|
||||
// Kick off test once video has loaded.
|
||||
video.addEventListener("canplaythrough", canplaythroughevent, false);
|
||||
window.addEventListener("load", loadevent, false);
|
||||
|
||||
// Other events expected by the test.
|
||||
video.addEventListener("play", runTest, false);
|
||||
video.addEventListener("pause", runTest, false);
|
||||
video.addEventListener("volumechange", runTest, false);
|
||||
video.addEventListener("seeking", runTest, false);
|
||||
video.addEventListener("seeked", runTest, false);
|
||||
// Other events expected by the test.
|
||||
video.addEventListener("play", runTest, false);
|
||||
video.addEventListener("pause", runTest, false);
|
||||
video.addEventListener("volumechange", runTest, false);
|
||||
video.addEventListener("seeking", runTest, false);
|
||||
video.addEventListener("seeked", runTest, false);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -25,7 +25,6 @@ var tests = [
|
||||
];
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script type="text/javascript" src="videocontrols_direction_test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -25,7 +25,6 @@ var tests = [
|
||||
];
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="use_large_cache.js"></script>
|
||||
<script type="text/javascript" src="videocontrols_direction_test.js"></script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -1,12 +0,0 @@
|
||||
(function() {
|
||||
// Set cache size to something large
|
||||
var prefService = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
var oldSize = branch.getIntPref("cache_size");
|
||||
branch.setIntPref("cache_size", 40000);
|
||||
|
||||
window.addEventListener("unload", function() {
|
||||
branch.setIntPref("cache_size", oldSize);
|
||||
}, false);
|
||||
})();
|
@ -87,4 +87,6 @@ function runTest(index) {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("load", function() { runTest(0); }, true);
|
||||
window.addEventListener("load", function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function(){ runTest(0); });
|
||||
}, true);
|
||||
|
Loading…
Reference in New Issue
Block a user