function whenNewWindowLoaded(aOptions, aCallback) {
BrowserTestUtils.waitForNewWindow().then(aCallback);
OpenBrowserWindow(aOptions);
}
async function clearHistoryAndHistoryCache() {
await PlacesUtils.history.clear(); // Clear HistoryRestiction cache as well.
Cc["@mozilla.org/browser/history;1"]
.getService(Ci.mozIAsyncHistory)
.clearCache();
}
async function synthesizeVisitByUser(browser, url) {
let onNewTab = BrowserTestUtils.waitForNewTab(browser.ownerGlobal.gBrowser); // We intentionally turn off this a11y check, because the following click is // purposefully sent on an arbitrary web content that is not expected to be // tested by itself with the browser mochitests, therefore this rule check // shall be ignored by a11y_checks suite.
AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
await ContentTask.spawn(browser, [url], async ([href]) => {
EventUtils.synthesizeMouseAtCenter(
content.document.querySelector(`a[href='${href}'`),
{},
content
);
});
AccessibilityUtils.resetEnv();
let tab = await onNewTab;
BrowserTestUtils.removeTab(tab);
}
async function synthesizeVisitByScript(browser, url) {
let onNewTab = BrowserTestUtils.waitForNewTab(browser.ownerGlobal.gBrowser);
AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false });
await ContentTask.spawn(browser, [url], async ([href]) => {
let a = content.document.querySelector(`a[href='${href}'`);
a.click();
});
AccessibilityUtils.resetEnv();
let tab = await onNewTab;
BrowserTestUtils.removeTab(tab);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.