3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
4 - License, v. 2.0. If a copy of the MPL was not distributed with this
5 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
7 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
9 <window id=
"system_font_changes_window"
10 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
15 <span id=
"target" style=
"font:menu">Hello world
</span>
17 <script type=
"application/javascript"><![CDATA[
18 function is(condition, message) {
19 window.arguments[
0].SimpleTest.is(condition, message);
21 function registerCleanupFunction(func) {
22 window.arguments[
0].SimpleTest.registerCleanupFunction(func);
25 async function waitForFrame() {
26 return new Promise(resolve =
> {
27 requestAnimationFrame(resolve);
31 let windowUtils = window.windowUtils;
32 async function start() {
35 const originalSystemFont = windowUtils.systemFont;
36 registerCleanupFunction(() =
> {
37 windowUtils.systemFont = originalSystemFont;
40 windowUtils.systemFont = 'Sans
11';
41 is(windowUtils.systemFont, 'Sans
11');
43 // Wait for two frames for the safety since the notification for system
44 // font changes is asynchronously processed.
48 const target = document.getElementById('target');
49 is(getComputedStyle(target).fontFamily, 'Sans');
51 windowUtils.systemFont = 'Serif
11';
52 is(windowUtils.systemFont, 'Serif
11');
57 is(getComputedStyle(target).fontFamily, 'Serif');
60 window.arguments[
0].SimpleTest.finish();