1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/ */
4 const RELATIVE_DIR = "toolkit/components/pdfjs/test/";
5 const TESTROOT = "https://example.com/browser/" + RELATIVE_DIR;
8 * Test that the pdf doesn't use the minimum font size.
10 add_task(async function test() {
11 let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
12 let handlerInfo = mimeService.getFromTypeAndExtension(
17 // Make sure pdf.js is the default handler.
19 handlerInfo.alwaysAskBeforeHandling,
21 "pdf handler defaults to always-ask is false"
24 handlerInfo.preferredAction,
25 Ci.nsIHandlerInfo.handleInternally,
26 "pdf handler defaults to internal"
29 info("Pref action: " + handlerInfo.preferredAction);
31 await SpecialPowers.pushPrefEnv({
32 set: [["font.minimum-size.x-western", 56]],
35 await BrowserTestUtils.withNewTab(
36 { gBrowser, url: "about:blank" },
37 async function (browser) {
38 // check that PDF is opened with internal viewer
39 await waitForPdfJSAllLayers(
41 `${TESTROOT}file_pdfjs_test.pdf#zoom=10`,
45 await SpecialPowers.spawn(browser, [true], () => {
46 const pageNumberInput = content.document.querySelector("#pageNumber");
47 const { style } = pageNumberInput;
49 content.document.defaultView.getComputedStyle(pageNumberInput).height;
51 style.fontSize = "1px";
53 content.document.defaultView.getComputedStyle(pageNumberInput).height;
55 // Changing the font size should change the height of the input
56 // element. If the minimum font size is used, the height won't change.
60 "The pdf viewer musn't use the minimum font size."
63 await waitForPdfJSClose(browser);