tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_test_link.js (1276B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 async function runTests(browser, accDoc) {
      8  let getAcc = id => findAccessibleChildByID(accDoc, id);
      9 
     10  // a: no traversed state
     11  testStates(getAcc("link_traversed"), 0, 0, STATE_TRAVERSED);
     12 
     13  let onStateChanged = waitForEvent(EVENT_STATE_CHANGE, "link_traversed");
     14  let newTabOpened = BrowserTestUtils.waitForNewTab(gBrowser);
     15 
     16  await BrowserTestUtils.synthesizeMouse(
     17    "#link_traversed",
     18    1,
     19    1,
     20    { ctrlKey: !MAC, metaKey: MAC },
     21    browser
     22  );
     23 
     24  await onStateChanged;
     25  testStates(getAcc("link_traversed"), STATE_TRAVERSED);
     26 
     27  let newTab = await newTabOpened;
     28  gBrowser.removeTab(newTab);
     29 }
     30 
     31 /**
     32 * Test caching of accessible object states
     33 */
     34 addAccessibleTask(
     35  // The URL doesn't really matter, just the fact that it isn't in the history
     36  // initially. We append ms since epoch to the URL so it will never be visited
     37  // initially, regardless of other tests (even this one) that ran before.
     38  `
     39  <a id="link_traversed"
     40      href="https://www.example.com/${Date.now()}" target="_top">
     41    example.com
     42  </a>`,
     43  runTests
     44 );