mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-13 06:38:48 +02:00
The accessibility tests currently rely, in many places, on lexical variables defined in global frame scripts being available to other non-global frame scripts. While that is currently the case, it will stop being so soon. And, while the simplest solution would be to define them as properties on the frame message manager by using `var` rather than `let`, storing references to the current content window in a frame script scope is unsafe at best, and should be avoided at all costs. MozReview-Commit-ID: 4FCGtLgcFzl --HG-- extra : rebase_source : d21206c9f119ca0ce61f9956f84a2e2d11484bca
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
/* import-globals-from ../../mochitest/layout.js */
|
|
|
|
/* global getContentDPR */
|
|
|
|
async function runTests(browser, accDoc) {
|
|
async function testTextNode(id) {
|
|
let hyperTextNode = findAccessibleChildByID(accDoc, id);
|
|
let textNode = hyperTextNode.firstChild;
|
|
|
|
let contentDPR = await getContentDPR(browser);
|
|
let [x, y, width, height] = getBounds(textNode, contentDPR);
|
|
testTextBounds(hyperTextNode, 0, -1, [x, y, width, height],
|
|
COORDTYPE_SCREEN_RELATIVE);
|
|
}
|
|
|
|
async function testEmptyInputNode(id) {
|
|
let inputNode = findAccessibleChildByID(accDoc, id);
|
|
|
|
let [x, y, width, height] = getBounds(inputNode);
|
|
testTextBounds(inputNode, 0, -1, [x, y, width, height],
|
|
COORDTYPE_SCREEN_RELATIVE);
|
|
testTextBounds(inputNode, 0, 0, [x, y, width, height],
|
|
COORDTYPE_SCREEN_RELATIVE);
|
|
}
|
|
|
|
loadFrameScripts(browser, { name: "layout.js", dir: MOCHITESTS_DIR });
|
|
|
|
await testTextNode("p1");
|
|
await testTextNode("p2");
|
|
await testEmptyInputNode("i1");
|
|
|
|
await ContentTask.spawn(browser, {}, () => {
|
|
zoomDocument(content.document, 2.0);
|
|
});
|
|
|
|
await testTextNode("p1");
|
|
|
|
await ContentTask.spawn(browser, {}, () => {
|
|
zoomDocument(content.document, 1.0);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Test the text range boundary when page is zoomed
|
|
*/
|
|
addAccessibleTask(`
|
|
<p id='p1' style='font-family: monospace;'>Tilimilitryamdiya</p>
|
|
<p id='p2'>ل</p>
|
|
<form><input id='i1' /></form>`, runTests
|
|
);
|