mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1056851 - [layout] Change existing callers of SpecialPowers.setBoolPref/setIntPref/setCharPref to SpecialPowers.pushPrefEnv. r=jmaher
--HG-- extra : rebase_source : a4fdccae34cdbb27d9e1f03f2a758f26651abb1b
This commit is contained in:
parent
110886d205
commit
2abf21620d
@ -31,15 +31,6 @@ RemoteCanvas.prototype.remotePageLoaded = function(callback) {
|
||||
callback(this);
|
||||
};
|
||||
|
||||
function bidiNumeral(val) {
|
||||
if (typeof val == "undefined")
|
||||
return SpecialPowers.getIntPref("bidi.numeral");
|
||||
else
|
||||
SpecialPowers.setIntPref("bidi.numeral", val);
|
||||
}
|
||||
|
||||
var bidiNumeralDefault = bidiNumeral();
|
||||
|
||||
var currentPass = 0;
|
||||
|
||||
function run()
|
||||
@ -65,7 +56,6 @@ function do_test()
|
||||
" is not different with bidi.numeral == " + passes[currentPass].bidiNumeralValue);
|
||||
}
|
||||
|
||||
bidiNumeral(bidiNumeralDefault);
|
||||
|
||||
if (currentPass < passes.length - 1) {
|
||||
++currentPass;
|
||||
@ -85,13 +75,15 @@ function do_test()
|
||||
" expecting " + passes[currentPass].op));
|
||||
document.body.appendChild(header);
|
||||
|
||||
bidiNumeral(passes[currentPass].bidiNumeralValue);
|
||||
SpecialPowers.pushPrefEnv({'set': [['bidi.numeral', passes[currentPass].bidiNumeralValue]]},callback);
|
||||
|
||||
var testCanvas = new RemoteCanvas(fileprefix + file + ".html", "test-" + currentPass);
|
||||
testCanvas.load(callbackTestCanvas);
|
||||
function callback() {
|
||||
var testCanvas = new RemoteCanvas(fileprefix + file + ".html", "test-" + currentPass);
|
||||
testCanvas.load(callbackTestCanvas);
|
||||
|
||||
var refCanvas = new RemoteCanvas(fileprefix + file + "-ref.html", "ref-" + currentPass);
|
||||
refCanvas.load(callbackTestCanvas);
|
||||
var refCanvas = new RemoteCanvas(fileprefix + file + "-ref.html", "ref-" + currentPass);
|
||||
refCanvas.load(callbackTestCanvas);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
|
@ -16,22 +16,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=608030
|
||||
|
||||
/** Test for Bug 608030 **/
|
||||
|
||||
function get_pref()
|
||||
{
|
||||
return SpecialPowers.getBoolPref("dom.send_after_paint_to_content");
|
||||
}
|
||||
|
||||
function set_pref(val)
|
||||
{
|
||||
SpecialPowers.setBoolPref("dom.send_after_paint_to_content", val);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
|
||||
window.addEventListener("load", step0, false);
|
||||
|
||||
is(get_pref(), true, "pref defaults to true in mochitest harness");
|
||||
is(SpecialPowers.getBoolPref("dom.send_after_paint_to_content"), true, "pref defaults to true in mochitest harness");
|
||||
|
||||
function print_rect(rect) {
|
||||
return "(top=" + rect.top + ",left=" + rect.left + ",width=" + rect.width + ",height=" + rect.height + ")";
|
||||
@ -82,12 +72,11 @@ function step2(event)
|
||||
ok(true, "got MozAfterPaint (timeout for next step is " + timeout + "ms)");
|
||||
|
||||
// Set the pref for our second test
|
||||
set_pref(false);
|
||||
|
||||
// When there was previously another page in our window, we seem to
|
||||
// get duplicate events, simultaneously, so we need to register our
|
||||
// next listener after a zero timeout.
|
||||
setTimeout(step3, 0, timeout);
|
||||
SpecialPowers.pushPrefEnv({'set': [['dom.send_after_paint_to_content', false]]}, function() {setTimeout(step3, 0, timeout);});
|
||||
}
|
||||
function step3(timeout)
|
||||
{
|
||||
@ -113,9 +102,7 @@ function step4()
|
||||
window.removeEventListener("MozAfterPaint", failstep, false);
|
||||
|
||||
// Set the pref back in its initial state.
|
||||
set_pref(true);
|
||||
|
||||
SimpleTest.finish();
|
||||
SpecialPowers.pushPrefEnv({'set': [['dom.send_after_paint_to_content', true]]}, SimpleTest.finish);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -17,25 +17,15 @@ browser.
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function setEmPerLineTo0() {
|
||||
SpecialPowers.setIntPref("font.size.inflation.emPerLine", 0);
|
||||
setTimeout(endTest, 100);
|
||||
}
|
||||
|
||||
function removeBoldStyle() {
|
||||
document.getElementById('b').removeAttribute('style');
|
||||
setTimeout(setEmPerLineTo0, 100);
|
||||
}
|
||||
|
||||
function setEmPerLineTo8() {
|
||||
SpecialPowers.setIntPref("font.size.inflation.emPerLine", 8);
|
||||
setTimeout(removeBoldStyle, 100);
|
||||
SpecialPowers.pushPrefEnv({'set': [['font.size.inflation.emPerLine', 0]]},endTest);
|
||||
}
|
||||
|
||||
function startTest() {
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
setTimeout(setEmPerLineTo8, 100);
|
||||
SpecialPowers.pushPrefEnv({'set': [['font.size.inflation.emPerLine', 8]]},removeBoldStyle);
|
||||
}
|
||||
|
||||
startTest();
|
||||
|
@ -92,12 +92,6 @@ function refTest(test,ref) {
|
||||
|
||||
var caretBlinkTime = null;
|
||||
function endTest() {
|
||||
if (caretBlinkTime !== null) {
|
||||
SpecialPowers.setIntPref("ui.caretBlinkTime", caretBlinkTime);
|
||||
} else {
|
||||
SpecialPowers.clearUserPref("ui.caretBlinkTime");
|
||||
}
|
||||
|
||||
// finish(), yet let the test actually end first, to be safe.
|
||||
SimpleTest.executeSoon(SimpleTest.finish);
|
||||
}
|
||||
@ -115,7 +109,7 @@ var tests = [
|
||||
// The following test cases are all involving with one sending
|
||||
// synthesizeKey(), the other without. They ought to be failed
|
||||
// when touch caret preference on. Test them with preference off.
|
||||
function() {SpecialPowers.setBoolPref("touchcaret.enabled", false);} ,
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} ,
|
||||
[ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
|
||||
[ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
|
||||
@ -139,13 +133,13 @@ var tests = [
|
||||
[ 'bug633044-1.html' , 'bug633044-1-ref.html' ] ,
|
||||
[ 'bug634406-1.html' , 'bug634406-1-ref.html' ] ,
|
||||
[ 'bug644428-1.html' , 'bug644428-1-ref.html' ] ,
|
||||
function() {SpecialPowers.setBoolPref("bidi.browser.ui", true);} ,
|
||||
function() {SpecialPowers.pushPrefEnv({'set': [['bidi.browser.ui', true]]}, nextTest);} ,
|
||||
[ 'bug646382-1.html' , 'bug646382-1-ref.html' ] ,
|
||||
[ 'bug646382-2.html' , 'bug646382-2-ref.html' ] ,
|
||||
[ 'bug664087-1.html' , 'bug664087-1-ref.html' ] ,
|
||||
[ 'bug664087-2.html' , 'bug664087-2-ref.html' ] ,
|
||||
[ 'bug682712-1.html' , 'bug682712-1-ref.html' ] ,
|
||||
function() {SpecialPowers.clearUserPref("bidi.browser.ui");} ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['bidi.browser.ui']]}, nextTest);} ,
|
||||
[ 'bug746993-1.html' , 'bug746993-1-ref.html' ] ,
|
||||
[ 'bug1007065-1.html' , 'bug1007065-1-ref.html' ] ,
|
||||
[ 'bug1007067-1.html' , 'bug1007067-1-ref.html' ] ,
|
||||
@ -155,21 +149,21 @@ var tests = [
|
||||
// [ 'bug1123067-1.html' , 'bug1123067-ref.html' ] , TODO: bug 1129205
|
||||
[ 'bug1123067-2.html' , 'bug1123067-ref.html' ] ,
|
||||
[ 'bug1123067-3.html' , 'bug1123067-ref.html' ] ,
|
||||
function() {SpecialPowers.clearUserPref("touchcaret.enabled");} ,
|
||||
function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} ,
|
||||
];
|
||||
|
||||
if (navigator.appVersion.indexOf("Android") == -1 &&
|
||||
SpecialPowers.Services.appinfo.name != "B2G") {
|
||||
tests.push(function() {SpecialPowers.setBoolPref("touchcaret.enabled", false);});
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);});
|
||||
tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);
|
||||
tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);
|
||||
tests.push([ 'bug923376.html' , 'bug923376-ref.html' ]);
|
||||
tests.push(function() {SpecialPowers.clearUserPref("touchcaret.enabled");});
|
||||
tests.push(function() {SpecialPowers.setBoolPref("layout.css.overflow-clip-box.enabled", true);});
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);});
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['layout.css.overflow-clip-box.enabled', true]]}, nextTest);});
|
||||
tests.push([ 'bug966992-1.html' , 'bug966992-1-ref.html' ]);
|
||||
tests.push([ 'bug966992-2.html' , 'bug966992-2-ref.html' ]);
|
||||
tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]);
|
||||
tests.push(function() {SpecialPowers.setBoolPref("layout.css.overflow-clip-box.enabled", false);});
|
||||
tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['layout.css.overflow-clip-box.enabled']]}, nextTest);});
|
||||
} else {
|
||||
is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed");
|
||||
}
|
||||
@ -180,7 +174,6 @@ function nextTest() {
|
||||
if (testIndex < tests.length) {
|
||||
if (typeof(tests[testIndex]) == 'function') {
|
||||
tests[testIndex]();
|
||||
SimpleTest.executeSoon(nextTest);
|
||||
} else {
|
||||
refTest(tests[testIndex][0],tests[testIndex][1]);
|
||||
}
|
||||
@ -194,9 +187,7 @@ function runTests() {
|
||||
try {
|
||||
caretBlinkTime = SpecialPowers.getIntPref("ui.caretBlinkTime");
|
||||
} catch (e) {}
|
||||
SpecialPowers.setIntPref("ui.caretBlinkTime", -1);
|
||||
|
||||
nextTest();
|
||||
SpecialPowers.pushPrefEnv({'set': [['ui.caretBlinkTime', -1]]}, nextTest);
|
||||
} catch(e) {
|
||||
endTest();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user