mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
f70e67ad2d
The SpecialPowers set*Pref/get*Pref APIs currently use synchronous messaging to set and get preference values from the parent process. Aside from directly affecting callers of those APIs, it also affects callers of `pushPrefEnv`, which is meant to be asynchronous, but is in practice usually synchronous due to the synchronous messaging it uses. This patch updates the getPref APIs to use the in-process preference service (which most callers are expecting anyway), and also updates the callers of the setPref and pushPrefEnv APIs to await the result if they're relying on it taking effect immediately. Unfortunately, there are some corner cases in tests that appear to only work because of the quirks of the current sync messaging approach. The synchronous setPref APIs, for instance, trigger preference changes in the parent instantly, but don't update the values in the child until we've returned to the event loop and had a chance to process the notifications from the parent. The differnce in timing leads some tests to fail in strange ways, which this patch works around by just adding timeouts. There should be follow-ups for test owners to fix the flakiness. Differential Revision: https://phabricator.services.mozilla.com/D35054 --HG-- extra : rebase_source : 941298157e7c82f420cf50ce057154ce9b85301c extra : source : 189dc8a359815e059a4a217f788d183260bb2bfe
53 lines
1.6 KiB
HTML
53 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=1414077
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 1414077</title>
|
|
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 1414077 **/
|
|
|
|
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
|
|
add_task(async function() {
|
|
await SpecialPowers.pushPrefEnv({"set": [["browser.enable_automatic_image_resizing", true]]});
|
|
|
|
return new Promise(resolve => {
|
|
var testWin = document.querySelector("iframe");
|
|
testWin.src = "image.png";
|
|
testWin.onload = function() {
|
|
var testDoc = testWin.contentDocument;
|
|
|
|
// testDoc should be a image document.
|
|
ok(testDoc.imageIsOverflowing, "image is overflowing");
|
|
ok(testDoc.imageIsResized, "image is resized to fit visible area by default");
|
|
|
|
// Restore image to original size.
|
|
testDoc.restoreImage();
|
|
ok(testDoc.imageIsOverflowing, "image is overflowing");
|
|
ok(!testDoc.imageIsResized, "image is restored to original size");
|
|
|
|
// Resize the image to fit visible area
|
|
testDoc.shrinkToFit();
|
|
ok(testDoc.imageIsOverflowing, "image is overflowing");
|
|
ok(testDoc.imageIsResized, "image is resized to fit visible area");
|
|
|
|
resolve();
|
|
};
|
|
})
|
|
});
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1414077">Mozilla Bug 1414077</a>
|
|
<iframe width="0" height="0"></iframe>
|
|
</body>
|
|
</html>
|