tor-browser

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

test_reftests_with_caret.html (27401B)


      1 <!DOCTYPE HTML>
      2 <title>Reftests with caret drawing</title>
      3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4 <script src="/tests/SimpleTest/EventUtils.js"></script>
      5 <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
      6 <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
      7 <style>
      8  iframe {
      9    border: none;
     10    width: 600px;
     11    height: 400px;
     12  }
     13 </style>
     14 <script>
     15 
     16 SimpleTest.waitForExplicitFinish();
     17 SimpleTest.requestLongerTimeout(3);
     18 
     19 const { AppConstants } = SpecialPowers.ChromeUtils.importESModule(
     20  "resource://gre/modules/AppConstants.sys.mjs"
     21 );
     22 
     23 var iframes = [];
     24 function callbackTestIframe(iframe)
     25 {
     26  iframes.push(iframe);
     27 
     28  if (iframes.length != 2)
     29    return;
     30 
     31  var result = iframes[0];
     32  var reference = iframes[1];
     33  const shouldBeEqual = true;
     34  // Using assertSnapshots is important to get the data-URIs of failing tests
     35  // dumped into the log in a format that reftest-analyzer.xhtml can process.
     36  var passed = assertSnapshots(result.snapshot, reference.snapshot,
     37                               shouldBeEqual, null /*no fuzz*/, result.src,
     38                               reference.src);
     39 
     40  // Remove the iframes if the test was successful
     41  if (passed) {
     42    result.remove();
     43    reference.remove();
     44  }
     45 
     46  iframes = [];
     47  SimpleTest.waitForFocus(nextTest);
     48 }
     49 
     50 function doSnapShot(iframe) {
     51  iframe.snapshot = snapshotWindow(iframe.contentWindow, true);
     52  callbackTestIframe(iframe);
     53 };
     54 
     55 function remotePageLoaded(callback) {
     56  var iframe = this;
     57  setTimeout(function(){
     58    doSnapShot(iframe);
     59    callback();
     60  }, 0);
     61 };
     62 
     63 const MAX_ITERATIONS = 1000;
     64 
     65 function createIframe(url,next) {
     66  var iframe = document.createElement("iframe");
     67  iframe.remotePageLoaded = remotePageLoaded;
     68  var me = this;
     69  var currentIteration = 0;
     70  function iframeLoadCompleted() {
     71    let loc = iframe.contentWindow.location;
     72    if (loc && loc.href == "about:blank") {
     73      return;
     74    }
     75    var docEl = iframe.contentDocument.documentElement;
     76    if (docEl.className.includes("reftest-wait")) {
     77      if (currentIteration++ > MAX_ITERATIONS) {
     78        ok(false, "iframe load for " + url + " timed out");
     79        endTest();
     80      } else {
     81        setTimeout(iframeLoadCompleted, 0);
     82      }
     83      return;
     84    }
     85    iframe.remotePageLoaded(function() {
     86      if (next) {
     87        setTimeout(function(){createIframe(next,null);}, 0)
     88      }
     89    });
     90  }
     91  iframe.addEventListener("load", iframeLoadCompleted);
     92  window.document.body.appendChild(iframe);
     93  iframe.clientHeight; // flush layout.
     94  iframe.src = url;
     95  iframe.focus();
     96 };
     97 
     98 function refTest(test, ref) {
     99  createIframe(test, ref);
    100 };
    101 
    102 var caretBlinkTime = null;
    103 async function endTest() {
    104  await SpecialPowers.spawn(window.parent, [], () => {
    105    content.document.styleSheets[content.document.styleSheets.length-1].deleteRule(0);
    106  });
    107 
    108  // finish(), yet let the test actually end first, to be safe.
    109  SimpleTest.executeSoon(SimpleTest.finish);
    110 }
    111 
    112 var tests = [
    113    [ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
    114    [ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
    115    [ 'bug389321-2.html' , 'bug389321-2-ref.html' ] ,
    116    [ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
    117    [ 'bug1082486-1.html', 'bug1082486-1-ref.html'] ,
    118    [ 'bug1082486-2.html', 'bug1082486-2-ref.html'] ,
    119    [ 'bug1893673.html' , 'bug1893673-ref.html' ] ,
    120    [ 'bug1896051.html', 'bug1896051-ref.html'],
    121    // The following test cases uses mouse events. We need to make
    122    // AccessibleCaret unhide for them.
    123    function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.hide_carets_for_mouse_input', false]]}, nextTest);} ,
    124    [ 'bug1516963-1.html', 'bug1516963-1-ref.html'] ,
    125    [ 'bug1516963-2.html', 'bug1516963-2-ref.html'] ,
    126    [ 'bug1516963-3.html', 'bug1516963-3-ref.html'] ,
    127    [ 'bug1516963-4.html', 'bug1516963-4-ref.html'] ,
    128    [ 'bug1516963-5.html', 'bug1516963-5-ref.html'] ,
    129    [ 'bug1516963-6.html', 'bug1516963-6-ref.html'] ,
    130    [ 'bug1550869-1a.html', 'bug1550869-1-ref.html'] ,
    131    [ 'bug1550869-1b.html', 'bug1550869-1-ref.html'] ,
    132    [ 'bug1550869-2a.html', 'bug1550869-2-ref.html'] ,
    133    [ 'bug1550869-2b.html', 'bug1550869-2-ref.html'] ,
    134    [ 'bug1550869-2c.html', 'bug1550869-2-ref.html'] ,
    135    [ 'bug1550869-2d.html', 'bug1550869-2-ref.html'] ,
    136    function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.hide_carets_for_mouse_input']]}, nextTest);} ,
    137    // The following test cases are all involving with one sending
    138    // synthesizeKey(), the other without. They fail when accessiblecaret
    139    // is enabled. Test them with the preference off.
    140    function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.enabled_on_touch', false]]}, nextTest);} ,
    141    [ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
    142    [ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
    143    [ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
    144    [ 'bug389321-3.html' , 'bug389321-3-ref.html' ] ,
    145    [ 'bug482484.html'   , 'bug482484-ref.html'   ] ,
    146    [ 'bug503399.html'   , 'bug503399-ref.html'   ] ,
    147    [ 'bug585922.html'   , 'bug585922-ref.html'   ] ,
    148    [ 'bug597519-1.html' , 'bug597519-1-ref.html' ] ,
    149    [ 'bug602141-1.html' , 'bug602141-1-ref.html' ] ,
    150    [ 'bug602141-2.html' , 'bug602141-2-ref.html' ] ,
    151    [ 'bug602141-3.html' , 'bug602141-3-ref.html' ] ,
    152    [ 'bug602141-4.html' , 'bug602141-4-ref.html' ] ,
    153    [ 'bug612271-1.html' , 'bug612271-ref.html' ]   ,
    154    [ 'bug612271-2.html' , 'bug612271-ref.html' ]   ,
    155    [ 'bug612271-3.html' , 'bug612271-ref.html' ]   ,
    156    [ 'bug613433-1.html' , 'bug613433-ref.html' ]   ,
    157    [ 'bug613433-2.html' , 'bug613433-ref.html' ]   ,
    158    [ 'bug613433-3.html' , 'bug613433-ref.html' ]   ,
    159    [ 'bug632215-1.html' , 'bug632215-ref.html'   ] ,
    160    [ 'bug632215-2.html' , 'bug632215-ref.html'   ] ,
    161    [ 'bug633044-1.html' , 'bug633044-1-ref.html' ] ,
    162    [ 'bug634406-1.html' , 'bug634406-1-ref.html' ] ,
    163    [ 'bug644428-1.html' , 'bug644428-1-ref.html' ] ,
    164    [ 'input-maxlength-valid-before-change.html', 'input-valid-ref.html'] ,
    165    [ 'input-maxlength-valid-change.html', 'input-valid-ref.html'] ,
    166    [ 'input-maxlength-invalid-change.html', 'input-invalid-ref.html'] ,
    167    [ 'input-minlength-valid-before-change.html', 'input-valid-ref.html'] ,
    168    [ 'input-minlength-valid-change.html', 'input-valid-ref.html'] ,
    169    [ 'input-minlength-invalid-change.html', 'input-invalid-ref.html'] ,
    170    [ 'input-maxlength-ui-valid-change.html', 'input-valid-ref.html'] ,
    171    [ 'input-maxlength-ui-invalid-change.html', 'input-invalid-ref.html'] ,
    172    [ 'input-minlength-ui-valid-change.html', 'input-valid-ref.html'] ,
    173    [ 'input-minlength-ui-invalid-change.html', 'input-invalid-ref.html'] ,
    174 
    175    function() {SpecialPowers.pushPrefEnv({'set': [['layout.forms.reveal-password-button.enabled', false]]}, nextTest);} ,
    176    [ 'input-password-remask.html', 'input-password-remask-ref.html' ],
    177 
    178    // The following hash means language.
    179    function() {SpecialPowers.pushPrefEnv({'set': [['editor.password.mask_delay', 0]]}, nextTest);} ,
    180    [ 'input-password-RTL-input.html#arabic', 'input-password-RTL-input-ref.html'],
    181    [ 'input-password-RTL-input.html#hebrew', 'input-password-RTL-input-ref.html'],
    182    function() {SpecialPowers.pushPrefEnv({'clear': [['editor.password.mask_delay']]}, nextTest);} ,
    183 
    184    // The following hash means "text ('_' is a space)" - unmarsk start - unmask end - selection start - selection end[ - text-transform].
    185    [ 'input-password-unmask.html#abc_def-0-7-7-7', 'input-password-unmask-ref.html#abc_def-0-7-7-7'],
    186    [ 'input-password-unmask.html#abc_def-0-7-7-7-capitalize', 'input-password-unmask-ref.html#Abc_Def-0-7-7-7'],
    187    [ 'input-password-unmask.html#abc_def-0-7-7-7-uppercase', 'input-password-unmask-ref.html#ABC_DEF-0-7-7-7'],
    188    [ 'input-password-unmask.html#ABC_DEF-0-7-7-7-lowercase', 'input-password-unmask-ref.html#abc_def-0-7-7-7'],
    189    [ 'input-password-unmask.html#abc_def-0-1-1-1', 'input-password-unmask-ref.html#abc_def-0-1-1-1'],
    190    [ 'input-password-unmask.html#abc_def-2-4-1-5', 'input-password-unmask-ref.html#abc_def-2-4-1-5'],
    191    [ 'input-password-unmask.html#abc_def-6-7-7-7', 'input-password-unmask-ref.html#abc_def-6-7-7-7'],
    192 
    193    // The following hash means unmarsk start - unmask end - selection start - selection end.
    194    // The value is "a&#x1f914;b" so that the range is 0-4.
    195    [ 'input-password-unmask-around-emoji.html#0-4-4-4', 'input-password-unmask-around-emoji-ref.html#0-4-4-4'],
    196    [ 'input-password-unmask-around-emoji.html#0-3-3-3', 'input-password-unmask-around-emoji-ref.html#0-3-3-3'],
    197    [ 'input-password-unmask-around-emoji.html#0-1-3-3', 'input-password-unmask-around-emoji-ref.html#0-1-3-3'],
    198    [ 'input-password-unmask-around-emoji.html#1-2-3-3', 'input-password-unmask-around-emoji-ref.html#1-2-3-3'],
    199    [ 'input-password-unmask-around-emoji.html#1-3-3-3', 'input-password-unmask-around-emoji-ref.html#1-3-3-3'],
    200    [ 'input-password-unmask-around-emoji.html#2-3-3-3', 'input-password-unmask-around-emoji-ref.html#2-3-3-3'],
    201    [ 'input-password-unmask-around-emoji.html#3-4-4-4', 'input-password-unmask-around-emoji-ref.html#3-4-4-4'],
    202    [ 'input-password-unmask-around-emoji.html#1-4-4-4', 'input-password-unmask-around-emoji-ref.html#1-4-4-4'],
    203    function() {SpecialPowers.pushPrefEnv({'clear': [['layout.forms.reveal-password-button.enabled']]}, nextTest);} ,
    204 
    205    // The following tests something in editable elements so that we need to disable zoom to focused editor.
    206    function() {SpecialPowers.pushPrefEnv({'set': [['apz.zoom-to-focused-input.enabled', false]]}, nextTest);} ,
    207    [ 'bug956530-1.html' , 'bug956530-1-ref.html' ] ,    // Clicks an <input> element
    208    [ 'bug1097242-1.html', 'bug1097242-1-ref.html'] ,    // Clicks non-editable and non-selectable element in an editing host
    209    [ 'bug1423331-1.html' , 'bug1423331-1-ref.html' ] ,  // Clicks in an editing host
    210    [ 'bug1423331-2.html' , 'bug1423331-2-ref.html' ] ,  // Clicks in an editing host
    211    [ 'bug1506547-4.html' , 'bug1506547-4-ref.html' ] ,  // Clicks in an editing host
    212    [ 'bug1506547-5.html' , 'bug1506547-5-ref.html' ] ,  // Clicks in an editing host
    213    [ 'bug1506547-6.html' , 'bug1506547-5-ref.html' ] ,  // Clicks in an editing host (reference)
    214    [ 'bug1518339-1.html' , 'bug1518339-1-ref.html' ] ,  // Clicks in an editing host
    215    [ 'bug1518339-2.html' , 'bug1518339-2-ref.html' ] ,  // Clicks in an editing host
    216    function() {SpecialPowers.pushPrefEnv({'clear': [['apz.zoom-to-focused-input.enabled']]}, nextTest);} ,
    217 
    218    [ 'input-stoppropagation.html', 'input-stoppropagation-ref.html'] ,
    219    [ 'textarea-maxlength-valid-before-change.html', 'textarea-valid-ref.html'] ,
    220    [ 'textarea-maxlength-valid-change.html', 'textarea-valid-ref.html'] ,
    221    [ 'textarea-maxlength-invalid-change.html', 'textarea-invalid-ref.html'] ,
    222    [ 'textarea-minlength-valid-before-change.html', 'textarea-valid-ref.html'] ,
    223    [ 'textarea-minlength-valid-change.html', 'textarea-valid-ref.html'] ,
    224    [ 'textarea-minlength-invalid-change.html', 'textarea-invalid-ref.html'] ,
    225    [ 'textarea-maxlength-ui-valid-change.html', 'textarea-valid-ref.html'] ,
    226    [ 'textarea-maxlength-ui-invalid-change.html', 'textarea-invalid-ref.html'] ,
    227    [ 'textarea-minlength-ui-valid-change.html', 'textarea-valid-ref.html'] ,
    228    [ 'textarea-minlength-ui-invalid-change.html', 'textarea-invalid-ref.html'] ,
    229    function() {SpecialPowers.pushPrefEnv({'set': [['bidi.browser.ui', true]]}, nextTest);} ,
    230    [ 'bug646382-1.html' , 'bug646382-1-ref.html' ] ,
    231    [ 'bug646382-2.html' , 'bug646382-2-ref.html' ] ,
    232    [ 'bug664087-1.html' , 'bug664087-1-ref.html' ] ,
    233    [ 'bug664087-2.html' , 'bug664087-2-ref.html' ] ,
    234    [ 'bug682712-1.html' , 'bug682712-1-ref.html' ] ,
    235    function() {SpecialPowers.pushPrefEnv({'clear': [['bidi.browser.ui']]}, nextTest);} ,
    236    [ 'bug746993-1.html' , 'bug746993-1-ref.html' ] ,
    237    [ 'bug989012-1.html' , 'bug989012-1-ref.html' ] ,
    238    [ 'bug989012-2.html' , 'bug989012-2-ref.html' ] ,
    239    [ 'bug989012-3.html' , 'bug989012-3-ref.html' ] ,
    240    [ 'bug1007065-1.html' , 'bug1007065-1-ref.html' ] ,
    241    [ 'bug1007067-1.html' , 'bug1007067-1-ref.html' ] ,
    242    [ 'bug1061468.html'  , 'bug1061468-ref.html'  ] ,
    243    [ 'bug1109968-1.html', 'bug1109968-1-ref.html'] ,
    244    [ 'bug1109968-2.html', 'bug1109968-2-ref.html'] ,
    245    // [ 'bug1123067-1.html' , 'bug1123067-ref.html'  ] , TODO: bug 1129205
    246    [ 'bug1123067-2.html' , 'bug1123067-ref.html'  ] ,
    247    [ 'bug1123067-3.html' , 'bug1123067-ref.html'  ] ,
    248    [ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] ,
    249    [ 'bug1237236-1.html' , 'bug1237236-1-ref.html' ] ,
    250    [ 'bug1237236-2.html' , 'bug1237236-2-ref.html' ] ,
    251    [ 'bug1258308-1.html' , 'bug1258308-1-ref.html' ] ,
    252    [ 'bug1258308-2.html' , 'bug1258308-2-ref.html' ] ,
    253    [ 'bug1259949-1.html' , 'bug1259949-1-ref.html'] ,
    254    [ 'bug1259949-2.html' , 'bug1259949-2-ref.html'] ,
    255    [ 'bug1263288.html'   , 'bug1263288-ref.html'] ,
    256    [ 'bug1263357-1.html' , 'bug1263357-1-ref.html'] ,
    257    [ 'bug1263357-2.html' , 'bug1263357-2-ref.html'] ,
    258    [ 'bug1263357-3.html' , 'bug1263357-3-ref.html'] ,
    259    [ 'bug1263357-4.html' , 'bug1263357-4-ref.html'] ,
    260    [ 'bug1263357-5.html' , 'bug1263357-5-ref.html'] ,
    261    [ 'bug1354478-1.html' , 'bug1354478-1-ref.html'] ,
    262    [ 'bug1354478-2.html' , 'bug1354478-2-ref.html'] ,
    263    [ 'bug1354478-3.html' , 'bug1354478-3-ref.html'] ,
    264    [ 'bug1354478-4.html' , 'bug1354478-4-ref.html'] ,
    265    [ 'bug1354478-5.html' , 'bug1354478-5-ref.html'] ,
    266    [ 'bug1354478-6.html' , 'bug1354478-6-ref.html'] ,
    267    [ 'bug1359411.html'   , 'bug1359411-ref.html' ] ,
    268    [ 'bug1415416.html'   , 'bug1415416-ref.html' ] ,
    269    // FIXME(bug 1434949): These two fail in some platforms.
    270    // [ 'bug1423331-3.html' , 'bug1423331-1-ref.html' ] ,
    271    // [ 'bug1423331-4.html' , 'bug1423331-2-ref.html' ] ,
    272    [ 'bug1484094-1.html' , 'bug1484094-1-ref.html' ] ,
    273    [ 'bug1484094-2.html' , 'bug1484094-2-ref.html' ] ,
    274    [ 'bug1506547-1.html' , 'bug1506547-2.html' ] ,
    275    [ 'bug1506547-2.html' , 'bug1506547-3.html' ] ,
    276    [ 'bug1510942-1.html' , 'bug1510942-1-ref.html' ] ,
    277    [ 'bug1510942-2.html' , 'bug1510942-2-ref.html' ] ,
    278    [ 'bug1524266-1.html' , 'bug1524266-1-ref.html' ] ,
    279    // Checks that the caret isn't occluded by children background content.
    280    [ 'bug1591282-1.html' , 'bug1591282-1-ref.html' ] ,
    281    // Caret on contenteditable with abspos and / or empty content.
    282    [ 'bug1634543-1.html' , 'bug1634543-1-ref.html' ] ,
    283    [ 'bug1634543-2.html' , 'bug1634543-1-ref.html' ] ,
    284    // TODO(emilio): This fails because nsInlineFrame::GetCaretBaseline doesn't
    285    // return one line-height for an empty inline, and it probably should..
    286    // [ 'bug1634543-3.html' , 'bug1634543-1-ref.html' ] ,
    287    [ 'bug1634543-4.html' , 'bug1634543-1-ref.html' ] ,
    288    // Caret + line-height + pseudo-element only.
    289    [ 'bug1634743-1.html' , 'bug1634743-1-ref.html' ] ,
    290    [ 'bug1637476-1.html' , 'bug1637476-1-ref.html' ] ,
    291    [ 'bug1637476-2.html' , 'bug1637476-2-ref.html' ] ,
    292    [ 'bug1637476-3.html' , 'bug1637476-3-ref.html' ] ,
    293    [ 'bug1663475-1.html' , 'bug1663475-1-ref.html' ] ,
    294    [ 'bug1663475-2.html' , 'bug1663475-2-ref.html' ] ,
    295    // shift+arrow key should select non-editable only
    296    [ 'bug1670531-1.html' , 'bug1670531-2.html' ] ,
    297    [ 'bug1670531-3.html' , 'bug1670531-3-ref.html' ] ,
    298    [ 'bug1670531-4.html' , 'bug1670531-3-ref.html' ] ,
    299    function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled_on_touch']]}, nextTest);} ,
    300    function() {SpecialPowers.pushPrefEnv({'set': [['accessibility.browsewithcaret', true]]}, nextTest);} ,
    301    [ 'bug1529492-1.html' , 'bug1529492-1-ref.html' ] ,
    302    function() {SpecialPowers.pushPrefEnv({'clear': [['accessibility.browsewithcaret']]}, nextTest);} ,
    303    [ 'interlinePosition-after-Selection-addRange.html', 'interlinePosition-after-Selection-addRange-ref.html' ] ,
    304    [ 'collapse-selection-into-editing-host-during-blur-of-input.html', 'collapse-selection-into-editing-host-during-blur-of-input-ref.html' ] ,
    305    [ 'caret-empty-contenteditable-overflow-click.html', 'caret-empty-contenteditable-overflow-click-ref.html' ],
    306 ];
    307 
    308 if (AppConstants.platform != "android") {
    309  tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);  // Tests spellchecker
    310  tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);  // Tests spellchecker
    311  tests.push([ 'bug923376.html'   , 'bug923376-ref.html'   ]);  // Tests spellchecker
    312  tests.push([ 'bug1496118.html'  , 'bug1496118-ref.html' ]);   // Tests DnD
    313 } else {
    314  is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platform or this if..else check removed");
    315 }
    316 
    317 if (AppConstants.platform == "linux" || AppConstants.platform == "win") {
    318  tests = tests.concat([
    319    // Turn off accessiblecaret to prevent it from interfering with the
    320    // multi-range selection.
    321    function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.enabled_on_touch', false]]}, nextTest);} ,
    322    // eDirPrevious, Shift+click
    323    [ 'multi-range-user-select.html#prev1S_' , 'multi-range-user-select-ref.html#prev1S_'  ] ,
    324    [ 'multi-range-user-select.html#prev2S_' , 'multi-range-user-select-ref.html#prev2S_'  ] ,
    325    [ 'multi-range-user-select.html#prev3S_' , 'multi-range-user-select-ref.html#prev3S_'  ] ,
    326    [ 'multi-range-user-select.html#prev4S_' , 'multi-range-user-select-ref.html#prev4S_'  ] ,
    327    [ 'multi-range-user-select.html#prev5S_' , 'multi-range-user-select-ref.html#prev5S_'  ] ,
    328    [ 'multi-range-user-select.html#prev6S_' , 'multi-range-user-select-ref.html#prev6S_'  ] ,
    329    [ 'multi-range-user-select.html#prev7S_' , 'multi-range-user-select-ref.html#prev7S_'  ] ,
    330    // eDirPrevious, Shift+Accel+click
    331    [ 'multi-range-user-select.html#prev1SA' , 'multi-range-user-select-ref.html#prev1SA'  ] ,
    332    [ 'multi-range-user-select.html#prev2SA' , 'multi-range-user-select-ref.html#prev2SA'  ] ,
    333    [ 'multi-range-user-select.html#prev3SA' , 'multi-range-user-select-ref.html#prev3SA'  ] ,
    334    [ 'multi-range-user-select.html#prev4SA' , 'multi-range-user-select-ref.html#prev4SA'  ] ,
    335    [ 'multi-range-user-select.html#prev5SA' , 'multi-range-user-select-ref.html#prev5SA'  ] ,
    336    [ 'multi-range-user-select.html#prev6SA' , 'multi-range-user-select-ref.html#prev6SA'  ] ,
    337    [ 'multi-range-user-select.html#prev7SA' , 'multi-range-user-select-ref.html#prev7SA'  ] ,
    338    // eDirPrevious, Accel+drag-select (adding an additional range)
    339    [ 'multi-range-user-select.html#prev1AD' , 'multi-range-user-select-ref.html#prev1AD'  ] ,
    340    [ 'multi-range-user-select.html#prev7AD' , 'multi-range-user-select-ref.html#prev7AD'  ] ,
    341    // eDirPrevious, Accel+drag-select (bug 1128722)
    342    [ 'multi-range-user-select.html#prev8AD' , 'multi-range-user-select-ref.html#prev8AD'  ] ,
    343    // eDirPrevious, VK_RIGHT / LEFT
    344    [ 'multi-range-user-select.html#prev1SR' , 'multi-range-user-select-ref.html#prev1SR'  ] ,
    345    [ 'multi-range-user-select.html#prev1SL' , 'multi-range-user-select-ref.html#prev1SL'  ] ,
    346    // eDirNext, Shift+click
    347    [ 'multi-range-user-select.html#next1S_' , 'multi-range-user-select-ref.html#next1S_'  ] ,
    348    [ 'multi-range-user-select.html#next2S_' , 'multi-range-user-select-ref.html#next2S_'  ] ,
    349    [ 'multi-range-user-select.html#next3S_' , 'multi-range-user-select-ref.html#next3S_'  ] ,
    350    [ 'multi-range-user-select.html#next4S_' , 'multi-range-user-select-ref.html#next4S_'  ] ,
    351    [ 'multi-range-user-select.html#next5S_' , 'multi-range-user-select-ref.html#next5S_'  ] ,
    352    [ 'multi-range-user-select.html#next6S_' , 'multi-range-user-select-ref.html#next6S_'  ] ,
    353    [ 'multi-range-user-select.html#next7S_' , 'multi-range-user-select-ref.html#next7S_'  ] ,
    354    // eDirNext, Shift+Accel+click
    355    [ 'multi-range-user-select.html#next1SA' , 'multi-range-user-select-ref.html#next1SA'  ] ,
    356    [ 'multi-range-user-select.html#next2SA' , 'multi-range-user-select-ref.html#next2SA'  ] ,
    357    [ 'multi-range-user-select.html#next3SA' , 'multi-range-user-select-ref.html#next3SA'  ] ,
    358    [ 'multi-range-user-select.html#next4SA' , 'multi-range-user-select-ref.html#next4SA'  ] ,
    359    [ 'multi-range-user-select.html#next5SA' , 'multi-range-user-select-ref.html#next5SA'  ] ,
    360    [ 'multi-range-user-select.html#next6SA' , 'multi-range-user-select-ref.html#next6SA'  ] ,
    361    [ 'multi-range-user-select.html#next7SA' , 'multi-range-user-select-ref.html#next7SA'  ] ,
    362    // eDirNext, Accel+drag-select (adding an additional range)
    363    [ 'multi-range-user-select.html#next1AD' , 'multi-range-user-select-ref.html#next1AD'  ] ,
    364    [ 'multi-range-user-select.html#next7AD' , 'multi-range-user-select-ref.html#next7AD'  ] ,
    365    // eDirNext, Accel+drag-select (bug 1128722)
    366    [ 'multi-range-user-select.html#next8AD' , 'multi-range-user-select-ref.html#next8AD'  ] ,
    367    // eDirNext, VK_RIGHT / LEFT
    368    [ 'multi-range-user-select.html#next1SR' , 'multi-range-user-select-ref.html#next1SR'  ] ,
    369    [ 'multi-range-user-select.html#next1SL' , 'multi-range-user-select-ref.html#next1SL'  ] ,
    370    // eDirPrevious, Shift+click
    371    [ 'multi-range-script-select.html#prev1S_' , 'multi-range-script-select-ref.html#prev1S_'  ] ,
    372    [ 'multi-range-script-select.html#prev2S_' , 'multi-range-script-select-ref.html#prev2S_'  ] ,
    373    [ 'multi-range-script-select.html#prev3S_' , 'multi-range-script-select-ref.html#prev3S_'  ] ,
    374    [ 'multi-range-script-select.html#prev4S_' , 'multi-range-script-select-ref.html#prev4S_'  ] ,
    375    [ 'multi-range-script-select.html#prev5S_' , 'multi-range-script-select-ref.html#prev5S_'  ] ,
    376    [ 'multi-range-script-select.html#prev6S_' , 'multi-range-script-select-ref.html#prev6S_'  ] ,
    377    [ 'multi-range-script-select.html#prev7S_' , 'multi-range-script-select-ref.html#prev7S_'  ] ,
    378    // eDirPrevious, Shift+Accel+click
    379    [ 'multi-range-script-select.html#prev1SA' , 'multi-range-script-select-ref.html#prev1SA'  ] ,
    380    [ 'multi-range-script-select.html#prev2SA' , 'multi-range-script-select-ref.html#prev2SA'  ] ,
    381    [ 'multi-range-script-select.html#prev3SA' , 'multi-range-script-select-ref.html#prev3SA'  ] ,
    382    [ 'multi-range-script-select.html#prev4SA' , 'multi-range-script-select-ref.html#prev4SA'  ] ,
    383    [ 'multi-range-script-select.html#prev5SA' , 'multi-range-script-select-ref.html#prev5SA'  ] ,
    384    [ 'multi-range-script-select.html#prev6SA' , 'multi-range-script-select-ref.html#prev6SA'  ] ,
    385    [ 'multi-range-script-select.html#prev7SA' , 'multi-range-script-select-ref.html#prev7SA'  ] ,
    386    // eDirPrevious, Accel+drag-select (adding an additional range)
    387    [ 'multi-range-script-select.html#prev1AD' , 'multi-range-script-select-ref.html#prev1AD'  ] ,
    388    [ 'multi-range-script-select.html#prev7AD' , 'multi-range-script-select-ref.html#prev7AD'  ] ,
    389    // eDirPrevious, VK_RIGHT / LEFT
    390    [ 'multi-range-script-select.html#prev1SR' , 'multi-range-script-select-ref.html#prev1SR'  ] ,
    391    [ 'multi-range-script-select.html#prev1SL' , 'multi-range-script-select-ref.html#prev1SL'  ] ,
    392    // eDirNext, Shift+click
    393    [ 'multi-range-script-select.html#next1S_' , 'multi-range-script-select-ref.html#next1S_'  ] ,
    394    [ 'multi-range-script-select.html#next2S_' , 'multi-range-script-select-ref.html#next2S_'  ] ,
    395    [ 'multi-range-script-select.html#next3S_' , 'multi-range-script-select-ref.html#next3S_'  ] ,
    396    [ 'multi-range-script-select.html#next4S_' , 'multi-range-script-select-ref.html#next4S_'  ] ,
    397    [ 'multi-range-script-select.html#next5S_' , 'multi-range-script-select-ref.html#next5S_'  ] ,
    398    [ 'multi-range-script-select.html#next6S_' , 'multi-range-script-select-ref.html#next6S_'  ] ,
    399    [ 'multi-range-script-select.html#next7S_' , 'multi-range-script-select-ref.html#next7S_'  ] ,
    400    // eDirNext, Shift+Accel+click
    401    [ 'multi-range-script-select.html#next1SA' , 'multi-range-script-select-ref.html#next1SA'  ] ,
    402    [ 'multi-range-script-select.html#next2SA' , 'multi-range-script-select-ref.html#next2SA'  ] ,
    403    [ 'multi-range-script-select.html#next3SA' , 'multi-range-script-select-ref.html#next3SA'  ] ,
    404    [ 'multi-range-script-select.html#next4SA' , 'multi-range-script-select-ref.html#next4SA'  ] ,
    405    [ 'multi-range-script-select.html#next5SA' , 'multi-range-script-select-ref.html#next5SA'  ] ,
    406    [ 'multi-range-script-select.html#next6SA' , 'multi-range-script-select-ref.html#next6SA'  ] ,
    407    [ 'multi-range-script-select.html#next7SA' , 'multi-range-script-select-ref.html#next7SA'  ] ,
    408    // eDirNext, Accel+drag-select (adding an additional range)
    409    [ 'multi-range-script-select.html#next1AD' , 'multi-range-script-select-ref.html#next1AD'  ] ,
    410    [ 'multi-range-script-select.html#next7AD' , 'multi-range-script-select-ref.html#next7AD'  ] ,
    411    // eDirNext, VK_RIGHT / LEFT
    412    [ 'multi-range-script-select.html#next1SR' , 'multi-range-script-select-ref.html#next1SR'  ] ,
    413    [ 'multi-range-script-select.html#next1SL' , 'multi-range-script-select-ref.html#next1SL'  ] ,
    414 
    415    // Tries to select and delete non-selectable content in a user-select subtree.
    416    [ 'bug1524266-2.html' , 'bug1524266-2-ref.html' ] ,
    417    [ 'bug1524266-3.html' , 'bug1524266-2-ref.html' ] ,
    418    // Tries to select and delete non-editable content in a user-select subtree.
    419    [ 'bug1524266-4.html' , 'bug1524266-2-ref.html' ] ,
    420    // Tries to edit an <input type="number"> with arrows inside a user-select: none element.
    421    [ 'bug1611661.html' , 'bug1611661-ref.html' ] ,
    422    function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled_on_touch']]}, nextTest);} ,
    423  ]);
    424 }
    425 
    426 var testIndex = 0;
    427 
    428 // Change it to something like /bug1524266/ to skip all other tests and make
    429 // debugging easier...
    430 const DEBUG_TEST_FILTER = null;
    431 
    432 function isTestSkipped(test) {
    433  if (DEBUG_TEST_FILTER) {
    434    return !DEBUG_TEST_FILTER.test(test[0]);
    435  }
    436  // Tests disabled for frequent failures (bug 1777050).
    437  if (AppConstants.platform == "android") {
    438    return [
    439      "bug1516963-4.html",
    440      "bug1258308-1.html",
    441      "bug1591282-1.html",
    442      "bug1670531-1.html",
    443    ].includes(test[0]);
    444  }
    445  if (AppConstants.platform == "win" || AppConstants.platform == "macosx") {
    446    return [
    447      "bug1516963-3.html",
    448      "bug1516963-4.html",
    449      "bug1516963-6.html",
    450      "bug956530-1.html",
    451    ].includes(test[0]);
    452  }
    453  return false;
    454 }
    455 
    456 function nextTest() {
    457  // Move the mouse out of the way so that :hover doesn't interact with tests.
    458  synthesizeMouse(document.body, 1, 1, { type: "mousemove" });
    459 
    460  if (testIndex < tests.length) {
    461    let test = tests[testIndex];
    462    if (typeof(test) == 'function') {
    463      test();
    464    } else if (!isTestSkipped(test)) {
    465      refTest(test[0], test[1]);
    466    } else {
    467      info("Skipping " + test[0]);
    468      setTimeout(nextTest, 0);
    469    }
    470    ++testIndex;
    471  } else {
    472    endTest();
    473  }
    474 }
    475 async function runTests() {
    476  try {
    477    if (window.parent) {
    478      await SpecialPowers.spawn(window.parent, [], () => {
    479          content.document.styleSheets[content.document.styleSheets.length-1]
    480            .insertRule("iframe#testframe{width:600px;height:400px}",0);
    481      });
    482    }
    483    try {
    484      caretBlinkTime = SpecialPowers.getIntPref("ui.caretBlinkTime");
    485    } catch (e) {}
    486    SpecialPowers.pushPrefEnv({'set': [['ui.caretBlinkTime', -1]]}, nextTest);
    487  } catch(e) {
    488    endTest();
    489  }
    490 }
    491 
    492 SimpleTest.waitForFocus(runTests);
    493 
    494 </script>
    495 <body>
    496 </body>