tor-browser

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

browser_suggestedIndex_10_search_10_url.js (26420B)


      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 // This test checks row visibility during view updates when rows with suggested
      6 // indexes are added and removed. Each task performs two searches: Search 1
      7 // returns 10 results with search suggestions, and search 2 returns 10 results
      8 // with URL results.
      9 
     10 "use strict";
     11 
     12 // Search 1:
     13 //   10 results, no suggestedIndex
     14 // Search 2:
     15 //   10 results including suggestedIndex = 1
     16 // Expected visible rows during update:
     17 //   10 original rows with no changes
     18 add_suggestedIndex_task({
     19  search1: {
     20    otherCount: 10,
     21    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     22    viewCount: 10,
     23  },
     24  search2: {
     25    otherCount: 10,
     26    otherType: UrlbarUtils.RESULT_TYPE.URL,
     27    suggestedIndex: 1,
     28    viewCount: 10,
     29  },
     30  duringUpdate: [
     31    { count: 1 },
     32    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
     33    {
     34      count: 1,
     35      type: UrlbarUtils.RESULT_TYPE.URL,
     36      suggestedIndex: 1,
     37      hidden: true,
     38    },
     39    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
     40  ],
     41 });
     42 
     43 // Search 1:
     44 //   10 results, no suggestedIndex
     45 // Search 2:
     46 //   10 results including suggestedIndex = 2
     47 // Expected visible rows during update:
     48 //   10 original rows with no changes
     49 add_suggestedIndex_task({
     50  search1: {
     51    otherCount: 10,
     52    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     53    viewCount: 10,
     54  },
     55  search2: {
     56    otherCount: 10,
     57    otherType: UrlbarUtils.RESULT_TYPE.URL,
     58    suggestedIndex: 2,
     59    viewCount: 10,
     60  },
     61  duringUpdate: [
     62    { count: 1 },
     63    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
     64    { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
     65    {
     66      count: 1,
     67      type: UrlbarUtils.RESULT_TYPE.URL,
     68      suggestedIndex: 2,
     69      hidden: true,
     70    },
     71    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
     72  ],
     73 });
     74 
     75 // Search 1:
     76 //   10 results, no suggestedIndex
     77 // Search 2:
     78 //   10 results including suggestedIndex = 9
     79 // Expected visible rows during update:
     80 //   10 original rows with no changes
     81 add_suggestedIndex_task({
     82  search1: {
     83    otherCount: 10,
     84    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     85    viewCount: 10,
     86  },
     87  search2: {
     88    otherCount: 10,
     89    otherType: UrlbarUtils.RESULT_TYPE.URL,
     90    suggestedIndex: 9,
     91    viewCount: 10,
     92  },
     93  duringUpdate: [
     94    { count: 1 },
     95    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
     96    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
     97    {
     98      count: 1,
     99      type: UrlbarUtils.RESULT_TYPE.URL,
    100      suggestedIndex: 9,
    101      hidden: true,
    102    },
    103  ],
    104 });
    105 
    106 // Search 1:
    107 //   10 results, no suggestedIndex
    108 // Search 2:
    109 //   10 results including suggestedIndex = -1
    110 // Expected visible rows during update:
    111 //   10 original rows with no changes
    112 add_suggestedIndex_task({
    113  search1: {
    114    otherCount: 10,
    115    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    116    viewCount: 10,
    117  },
    118  search2: {
    119    otherCount: 10,
    120    otherType: UrlbarUtils.RESULT_TYPE.URL,
    121    suggestedIndex: -1,
    122    viewCount: 10,
    123  },
    124  duringUpdate: [
    125    { count: 1 },
    126    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    127    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    128    {
    129      count: 1,
    130      type: UrlbarUtils.RESULT_TYPE.URL,
    131      suggestedIndex: -1,
    132      hidden: true,
    133    },
    134  ],
    135 });
    136 
    137 // Search 1:
    138 //   10 results, no suggestedIndex
    139 // Search 2:
    140 //   10 results including suggestedIndex = -2
    141 // Expected visible rows during update:
    142 //   10 original rows with no changes
    143 add_suggestedIndex_task({
    144  search1: {
    145    otherCount: 10,
    146    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    147    viewCount: 10,
    148  },
    149  search2: {
    150    otherCount: 10,
    151    otherType: UrlbarUtils.RESULT_TYPE.URL,
    152    suggestedIndex: -2,
    153    viewCount: 10,
    154  },
    155  duringUpdate: [
    156    { count: 1 },
    157    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    158    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    159    {
    160      count: 1,
    161      type: UrlbarUtils.RESULT_TYPE.URL,
    162      suggestedIndex: -2,
    163      hidden: true,
    164    },
    165    { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    166  ],
    167 });
    168 
    169 // Search 1:
    170 //   10 results, no suggestedIndex
    171 // Search 2:
    172 //   10 results including suggestedIndex = -9
    173 // Expected visible rows during update:
    174 //   10 original rows with no changes
    175 add_suggestedIndex_task({
    176  search1: {
    177    otherCount: 10,
    178    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    179    viewCount: 10,
    180  },
    181  search2: {
    182    otherCount: 10,
    183    otherType: UrlbarUtils.RESULT_TYPE.URL,
    184    suggestedIndex: -9,
    185    viewCount: 10,
    186  },
    187  duringUpdate: [
    188    { count: 1 },
    189    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    190    {
    191      count: 1,
    192      type: UrlbarUtils.RESULT_TYPE.URL,
    193      suggestedIndex: -9,
    194      hidden: true,
    195    },
    196    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    197  ],
    198 });
    199 
    200 // Search 1:
    201 //   10 results including suggestedIndex = 1
    202 // Search 2:
    203 //   10 results including suggestedIndex = 1
    204 // Expected visible rows during update:
    205 //   10 original rows with no changes (because the original search results can't
    206 //   be replaced with URL results)
    207 add_suggestedIndex_task({
    208  search1: {
    209    otherCount: 10,
    210    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    211    suggestedIndex: 1,
    212    viewCount: 10,
    213  },
    214  search2: {
    215    otherCount: 10,
    216    otherType: UrlbarUtils.RESULT_TYPE.URL,
    217    suggestedIndex: 1,
    218    viewCount: 10,
    219  },
    220  duringUpdate: [
    221    { count: 1 },
    222    {
    223      count: 1,
    224      type: UrlbarUtils.RESULT_TYPE.URL,
    225      suggestedIndex: 1,
    226    },
    227    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    228    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    229  ],
    230 });
    231 
    232 // Search 1:
    233 //   10 results including suggestedIndex = 1
    234 // Search 2:
    235 //   10 results including suggestedIndex = 2
    236 // Expected visible rows during update:
    237 //   10 original rows with no changes
    238 add_suggestedIndex_task({
    239  search1: {
    240    otherCount: 10,
    241    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    242    suggestedIndex: 1,
    243    viewCount: 10,
    244  },
    245  search2: {
    246    otherCount: 10,
    247    otherType: UrlbarUtils.RESULT_TYPE.URL,
    248    suggestedIndex: 2,
    249    viewCount: 10,
    250  },
    251  duringUpdate: [
    252    { count: 1 },
    253    {
    254      count: 1,
    255      type: UrlbarUtils.RESULT_TYPE.URL,
    256      suggestedIndex: 1,
    257      stale: true,
    258    },
    259    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    260    { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    261    {
    262      count: 1,
    263      type: UrlbarUtils.RESULT_TYPE.URL,
    264      suggestedIndex: 2,
    265      hidden: true,
    266    },
    267    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    268  ],
    269 });
    270 
    271 // Search 1:
    272 //   10 results including suggestedIndex = 1
    273 // Search 2:
    274 //   10 results including suggestedIndex = 9
    275 // Expected visible rows during update:
    276 //   10 original rows with no changes
    277 add_suggestedIndex_task({
    278  search1: {
    279    otherCount: 10,
    280    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    281    suggestedIndex: 1,
    282    viewCount: 10,
    283  },
    284  search2: {
    285    otherCount: 10,
    286    otherType: UrlbarUtils.RESULT_TYPE.URL,
    287    suggestedIndex: 9,
    288    viewCount: 10,
    289  },
    290  duringUpdate: [
    291    { count: 1 },
    292    {
    293      count: 1,
    294      type: UrlbarUtils.RESULT_TYPE.URL,
    295      suggestedIndex: 1,
    296      stale: true,
    297    },
    298    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    299    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    300    {
    301      count: 1,
    302      type: UrlbarUtils.RESULT_TYPE.URL,
    303      suggestedIndex: 9,
    304      hidden: true,
    305    },
    306  ],
    307 });
    308 
    309 // Search 1:
    310 //   10 results including suggestedIndex = 1
    311 // Search 2:
    312 //   10 results including suggestedIndex = -1
    313 // Expected visible rows during update:
    314 //   10 original rows with no changes
    315 add_suggestedIndex_task({
    316  search1: {
    317    otherCount: 10,
    318    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    319    suggestedIndex: 1,
    320    viewCount: 10,
    321  },
    322  search2: {
    323    otherCount: 10,
    324    otherType: UrlbarUtils.RESULT_TYPE.URL,
    325    suggestedIndex: -1,
    326    viewCount: 10,
    327  },
    328  duringUpdate: [
    329    { count: 1 },
    330    {
    331      count: 1,
    332      type: UrlbarUtils.RESULT_TYPE.URL,
    333      suggestedIndex: 1,
    334      stale: true,
    335    },
    336    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    337    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    338    {
    339      count: 1,
    340      type: UrlbarUtils.RESULT_TYPE.URL,
    341      suggestedIndex: -1,
    342      hidden: true,
    343    },
    344  ],
    345 });
    346 
    347 // Search 1:
    348 //   10 results including suggestedIndex = 1
    349 // Search 2:
    350 //   10 results including suggestedIndex = -2
    351 // Expected visible rows during update:
    352 //   10 original rows with no changes
    353 add_suggestedIndex_task({
    354  search1: {
    355    otherCount: 10,
    356    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    357    suggestedIndex: 1,
    358    viewCount: 10,
    359  },
    360  search2: {
    361    otherCount: 10,
    362    otherType: UrlbarUtils.RESULT_TYPE.URL,
    363    suggestedIndex: -2,
    364    viewCount: 10,
    365  },
    366  duringUpdate: [
    367    { count: 1 },
    368    {
    369      count: 1,
    370      type: UrlbarUtils.RESULT_TYPE.URL,
    371      suggestedIndex: 1,
    372      stale: true,
    373    },
    374    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    375    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    376    {
    377      count: 1,
    378      type: UrlbarUtils.RESULT_TYPE.URL,
    379      suggestedIndex: -2,
    380      hidden: true,
    381    },
    382    { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    383  ],
    384 });
    385 
    386 // Search 1:
    387 //   10 results including suggestedIndex = 1
    388 // Search 2:
    389 //   10 results including suggestedIndex = -9
    390 // Expected visible rows during update:
    391 //   10 original rows with no changes
    392 add_suggestedIndex_task({
    393  search1: {
    394    otherCount: 10,
    395    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    396    suggestedIndex: 1,
    397    viewCount: 10,
    398  },
    399  search2: {
    400    otherCount: 10,
    401    otherType: UrlbarUtils.RESULT_TYPE.URL,
    402    suggestedIndex: -9,
    403    viewCount: 10,
    404  },
    405  duringUpdate: [
    406    { count: 1 },
    407    {
    408      count: 1,
    409      type: UrlbarUtils.RESULT_TYPE.URL,
    410      suggestedIndex: 1,
    411      stale: true,
    412    },
    413    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    414    {
    415      count: 1,
    416      type: UrlbarUtils.RESULT_TYPE.URL,
    417      suggestedIndex: -9,
    418      hidden: true,
    419    },
    420    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    421  ],
    422 });
    423 
    424 // Search 1:
    425 //   10 results including suggestedIndex = 9
    426 // Search 2:
    427 //   10 results including suggestedIndex = 1
    428 // Expected visible rows during update:
    429 //   10 original rows with no changes
    430 add_suggestedIndex_task({
    431  search1: {
    432    otherCount: 10,
    433    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    434    suggestedIndex: 9,
    435    viewCount: 10,
    436  },
    437  search2: {
    438    otherCount: 10,
    439    otherType: UrlbarUtils.RESULT_TYPE.URL,
    440    suggestedIndex: 1,
    441    viewCount: 10,
    442  },
    443  duringUpdate: [
    444    { count: 1 },
    445    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    446    {
    447      count: 1,
    448      type: UrlbarUtils.RESULT_TYPE.URL,
    449      suggestedIndex: 9,
    450      stale: true,
    451    },
    452    {
    453      count: 1,
    454      type: UrlbarUtils.RESULT_TYPE.URL,
    455      suggestedIndex: 1,
    456      hidden: true,
    457    },
    458    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    459  ],
    460 });
    461 
    462 // Search 1:
    463 //   10 results including suggestedIndex = 9
    464 // Search 2:
    465 //   10 results including suggestedIndex = 9
    466 // Expected visible rows during update:
    467 //   10 original rows with no changes
    468 add_suggestedIndex_task({
    469  search1: {
    470    otherCount: 10,
    471    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    472    suggestedIndex: 9,
    473    viewCount: 10,
    474  },
    475  search2: {
    476    otherCount: 10,
    477    otherType: UrlbarUtils.RESULT_TYPE.URL,
    478    suggestedIndex: 9,
    479    viewCount: 10,
    480  },
    481  duringUpdate: [
    482    { count: 1 },
    483    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    484    {
    485      count: 1,
    486      type: UrlbarUtils.RESULT_TYPE.URL,
    487      suggestedIndex: 9,
    488      stale: true,
    489    },
    490    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    491    {
    492      count: 1,
    493      type: UrlbarUtils.RESULT_TYPE.URL,
    494      suggestedIndex: 9,
    495      hidden: true,
    496    },
    497  ],
    498 });
    499 
    500 // Search 1:
    501 //   10 results including suggestedIndex = 9
    502 // Search 2:
    503 //   10 results including suggestedIndex = -1
    504 // Expected visible rows during update:
    505 //   10 original rows with no changes
    506 add_suggestedIndex_task({
    507  search1: {
    508    otherCount: 10,
    509    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    510    suggestedIndex: 9,
    511    viewCount: 10,
    512  },
    513  search2: {
    514    otherCount: 10,
    515    otherType: UrlbarUtils.RESULT_TYPE.URL,
    516    suggestedIndex: -1,
    517    viewCount: 10,
    518  },
    519  duringUpdate: [
    520    { count: 1 },
    521    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    522    {
    523      count: 1,
    524      type: UrlbarUtils.RESULT_TYPE.URL,
    525      suggestedIndex: 9,
    526      stale: true,
    527    },
    528    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    529    {
    530      count: 1,
    531      type: UrlbarUtils.RESULT_TYPE.URL,
    532      suggestedIndex: -1,
    533      hidden: true,
    534    },
    535  ],
    536 });
    537 
    538 // Search 1:
    539 //   10 results including suggestedIndex = 9
    540 // Search 2:
    541 //   10 results including suggestedIndex = -9
    542 // Expected visible rows during update:
    543 //   10 original rows with no changes
    544 add_suggestedIndex_task({
    545  search1: {
    546    otherCount: 10,
    547    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    548    suggestedIndex: 9,
    549    viewCount: 10,
    550  },
    551  search2: {
    552    otherCount: 10,
    553    otherType: UrlbarUtils.RESULT_TYPE.URL,
    554    suggestedIndex: -9,
    555    viewCount: 10,
    556  },
    557  duringUpdate: [
    558    { count: 1 },
    559    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    560    {
    561      count: 1,
    562      type: UrlbarUtils.RESULT_TYPE.URL,
    563      suggestedIndex: 9,
    564      stale: true,
    565    },
    566    {
    567      count: 1,
    568      type: UrlbarUtils.RESULT_TYPE.URL,
    569      suggestedIndex: -9,
    570      hidden: true,
    571    },
    572    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    573  ],
    574 });
    575 
    576 // Search 1:
    577 //   10 results including suggestedIndex = -1
    578 // Search 2:
    579 //   10 results including suggestedIndex = 1
    580 // Expected visible rows during update:
    581 //   10 original rows with no changes
    582 add_suggestedIndex_task({
    583  search1: {
    584    otherCount: 10,
    585    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    586    suggestedIndex: -1,
    587    viewCount: 10,
    588  },
    589  search2: {
    590    otherCount: 10,
    591    otherType: UrlbarUtils.RESULT_TYPE.URL,
    592    suggestedIndex: 1,
    593    viewCount: 10,
    594  },
    595  duringUpdate: [
    596    { count: 1 },
    597    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    598    {
    599      count: 1,
    600      type: UrlbarUtils.RESULT_TYPE.URL,
    601      suggestedIndex: -1,
    602      stale: true,
    603    },
    604    {
    605      count: 1,
    606      type: UrlbarUtils.RESULT_TYPE.URL,
    607      suggestedIndex: 1,
    608      hidden: true,
    609    },
    610    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    611  ],
    612 });
    613 
    614 // Search 1:
    615 //   10 results including suggestedIndex = -1
    616 // Search 2:
    617 //   10 results including suggestedIndex = 9
    618 // Expected visible rows during update:
    619 //   10 original rows with no changes
    620 add_suggestedIndex_task({
    621  search1: {
    622    otherCount: 10,
    623    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    624    suggestedIndex: -1,
    625    viewCount: 10,
    626  },
    627  search2: {
    628    otherCount: 10,
    629    otherType: UrlbarUtils.RESULT_TYPE.URL,
    630    suggestedIndex: 9,
    631    viewCount: 10,
    632  },
    633  duringUpdate: [
    634    { count: 1 },
    635    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    636    {
    637      count: 1,
    638      type: UrlbarUtils.RESULT_TYPE.URL,
    639      suggestedIndex: -1,
    640      stale: true,
    641    },
    642    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    643    {
    644      count: 1,
    645      type: UrlbarUtils.RESULT_TYPE.URL,
    646      suggestedIndex: 9,
    647      hidden: true,
    648    },
    649  ],
    650 });
    651 
    652 // Search 1:
    653 //   10 results including suggestedIndex = -1
    654 // Search 2:
    655 //   10 results including suggestedIndex = -1
    656 // Expected visible rows during update:
    657 //   10 original rows with no changes
    658 add_suggestedIndex_task({
    659  search1: {
    660    otherCount: 10,
    661    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    662    suggestedIndex: -1,
    663    viewCount: 10,
    664  },
    665  search2: {
    666    otherCount: 10,
    667    otherType: UrlbarUtils.RESULT_TYPE.URL,
    668    suggestedIndex: -1,
    669    viewCount: 10,
    670  },
    671  duringUpdate: [
    672    { count: 1 },
    673    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    674    {
    675      count: 1,
    676      type: UrlbarUtils.RESULT_TYPE.URL,
    677      suggestedIndex: -1,
    678      stale: true,
    679    },
    680    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    681    {
    682      count: 1,
    683      type: UrlbarUtils.RESULT_TYPE.URL,
    684      suggestedIndex: -1,
    685      hidden: true,
    686    },
    687  ],
    688 });
    689 
    690 // Search 1:
    691 //   10 results including suggestedIndex = -1
    692 // Search 2:
    693 //   10 results including suggestedIndex = -9
    694 // Expected visible rows during update:
    695 //   10 original rows with no changes
    696 add_suggestedIndex_task({
    697  search1: {
    698    otherCount: 10,
    699    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    700    suggestedIndex: -1,
    701    viewCount: 10,
    702  },
    703  search2: {
    704    otherCount: 10,
    705    otherType: UrlbarUtils.RESULT_TYPE.URL,
    706    suggestedIndex: -9,
    707    viewCount: 10,
    708  },
    709  duringUpdate: [
    710    { count: 1 },
    711    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    712    {
    713      count: 1,
    714      type: UrlbarUtils.RESULT_TYPE.URL,
    715      suggestedIndex: -1,
    716      stale: true,
    717    },
    718    {
    719      count: 1,
    720      type: UrlbarUtils.RESULT_TYPE.URL,
    721      suggestedIndex: -9,
    722      hidden: true,
    723    },
    724    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    725  ],
    726 });
    727 
    728 // Search 1:
    729 //   10 results including suggestedIndex = -9
    730 // Search 2:
    731 //   10 results including suggestedIndex = 1
    732 // Expected visible rows during update:
    733 //   10 original rows with no changes
    734 add_suggestedIndex_task({
    735  search1: {
    736    otherCount: 10,
    737    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    738    suggestedIndex: -9,
    739    viewCount: 10,
    740  },
    741  search2: {
    742    otherCount: 10,
    743    otherType: UrlbarUtils.RESULT_TYPE.URL,
    744    suggestedIndex: 1,
    745    viewCount: 10,
    746  },
    747  duringUpdate: [
    748    { count: 1 },
    749    {
    750      count: 1,
    751      type: UrlbarUtils.RESULT_TYPE.URL,
    752      suggestedIndex: -9,
    753      stale: true,
    754    },
    755    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    756    {
    757      count: 1,
    758      type: UrlbarUtils.RESULT_TYPE.URL,
    759      suggestedIndex: 1,
    760      hidden: true,
    761    },
    762    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    763  ],
    764 });
    765 
    766 // Search 1:
    767 //   10 results including suggestedIndex = -9
    768 // Search 2:
    769 //   10 results including suggestedIndex = 9
    770 // Expected visible rows during update:
    771 //   10 original rows with no changes
    772 add_suggestedIndex_task({
    773  search1: {
    774    otherCount: 10,
    775    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    776    suggestedIndex: -9,
    777    viewCount: 10,
    778  },
    779  search2: {
    780    otherCount: 10,
    781    otherType: UrlbarUtils.RESULT_TYPE.URL,
    782    suggestedIndex: 9,
    783    viewCount: 10,
    784  },
    785  duringUpdate: [
    786    { count: 1 },
    787    {
    788      count: 1,
    789      type: UrlbarUtils.RESULT_TYPE.URL,
    790      suggestedIndex: -9,
    791      stale: true,
    792    },
    793    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    794    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    795    {
    796      count: 1,
    797      type: UrlbarUtils.RESULT_TYPE.URL,
    798      suggestedIndex: 9,
    799      hidden: true,
    800    },
    801  ],
    802 });
    803 
    804 // Search 1:
    805 //   10 results including suggestedIndex = -9
    806 // Search 2:
    807 //   10 results including suggestedIndex = -1
    808 // Expected visible rows during update:
    809 //   10 original rows with no changes
    810 add_suggestedIndex_task({
    811  search1: {
    812    otherCount: 10,
    813    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    814    suggestedIndex: -9,
    815    viewCount: 10,
    816  },
    817  search2: {
    818    otherCount: 10,
    819    otherType: UrlbarUtils.RESULT_TYPE.URL,
    820    suggestedIndex: -1,
    821    viewCount: 10,
    822  },
    823  duringUpdate: [
    824    { count: 1 },
    825    {
    826      count: 1,
    827      type: UrlbarUtils.RESULT_TYPE.URL,
    828      suggestedIndex: -9,
    829      stale: true,
    830    },
    831    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    832    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    833    {
    834      count: 1,
    835      type: UrlbarUtils.RESULT_TYPE.URL,
    836      suggestedIndex: -1,
    837      hidden: true,
    838    },
    839  ],
    840 });
    841 
    842 // Search 1:
    843 //   10 results including suggestedIndex = -9
    844 // Search 2:
    845 //   10 results including suggestedIndex = -9
    846 // Expected visible rows during update:
    847 //   10 original rows with no changes
    848 add_suggestedIndex_task({
    849  search1: {
    850    otherCount: 10,
    851    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    852    suggestedIndex: -9,
    853    viewCount: 10,
    854  },
    855  search2: {
    856    otherCount: 10,
    857    otherType: UrlbarUtils.RESULT_TYPE.URL,
    858    suggestedIndex: -9,
    859    viewCount: 10,
    860  },
    861  duringUpdate: [
    862    { count: 1 },
    863    {
    864      count: 1,
    865      type: UrlbarUtils.RESULT_TYPE.URL,
    866      suggestedIndex: -9,
    867    },
    868    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    869    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    870  ],
    871 });
    872 
    873 // Search 1:
    874 //   10 results, no suggestedIndex
    875 // Search 2:
    876 //   10 results including suggestedIndex = 1 and suggestedIndex = -1
    877 // Expected visible rows during update:
    878 //   10 original rows with no changes
    879 add_suggestedIndex_task({
    880  search1: {
    881    otherCount: 10,
    882    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    883    viewCount: 10,
    884  },
    885  search2: {
    886    otherCount: 10,
    887    otherType: UrlbarUtils.RESULT_TYPE.URL,
    888    suggestedIndexes: [1, -1],
    889    viewCount: 10,
    890  },
    891  duringUpdate: [
    892    { count: 1 },
    893    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    894    {
    895      count: 1,
    896      type: UrlbarUtils.RESULT_TYPE.URL,
    897      suggestedIndex: 1,
    898      hidden: true,
    899    },
    900    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    901    {
    902      count: 1,
    903      type: UrlbarUtils.RESULT_TYPE.URL,
    904      suggestedIndex: -1,
    905      hidden: true,
    906    },
    907  ],
    908 });
    909 
    910 // Search 1:
    911 //   10 results including suggestedIndex = 1
    912 // Search 2:
    913 //   10 results including suggestedIndex = 1 and suggestedIndex = -1
    914 // Expected visible rows during update:
    915 //   10 original rows with no changes
    916 add_suggestedIndex_task({
    917  search1: {
    918    otherCount: 10,
    919    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    920    suggestedIndex: 1,
    921    viewCount: 10,
    922  },
    923  search2: {
    924    otherCount: 10,
    925    otherType: UrlbarUtils.RESULT_TYPE.URL,
    926    suggestedIndexes: [1, -1],
    927    viewCount: 10,
    928  },
    929  duringUpdate: [
    930    { count: 1 },
    931    {
    932      count: 1,
    933      type: UrlbarUtils.RESULT_TYPE.URL,
    934      suggestedIndex: 1,
    935    },
    936    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    937    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    938    {
    939      count: 1,
    940      type: UrlbarUtils.RESULT_TYPE.URL,
    941      suggestedIndex: -1,
    942      hidden: true,
    943    },
    944  ],
    945 });
    946 
    947 // Search 1:
    948 //   10 results including suggestedIndex = -1
    949 // Search 2:
    950 //   10 results including suggestedIndex = 1 and suggestedIndex = -1
    951 // Expected visible rows during update:
    952 //   10 original rows with no changes
    953 add_suggestedIndex_task({
    954  search1: {
    955    otherCount: 10,
    956    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    957    suggestedIndex: -1,
    958    viewCount: 10,
    959  },
    960  search2: {
    961    otherCount: 10,
    962    otherType: UrlbarUtils.RESULT_TYPE.URL,
    963    suggestedIndexes: [1, -1],
    964    viewCount: 10,
    965  },
    966  duringUpdate: [
    967    { count: 1 },
    968    { count: 8, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    969    {
    970      count: 1,
    971      type: UrlbarUtils.RESULT_TYPE.URL,
    972      suggestedIndex: -1,
    973      stale: true,
    974    },
    975    {
    976      count: 1,
    977      type: UrlbarUtils.RESULT_TYPE.URL,
    978      suggestedIndex: 1,
    979      hidden: true,
    980    },
    981    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
    982    {
    983      count: 1,
    984      type: UrlbarUtils.RESULT_TYPE.URL,
    985      suggestedIndex: -1,
    986      hidden: true,
    987    },
    988  ],
    989 });
    990 
    991 // Search 1:
    992 //   10 results, no suggestedIndex
    993 // Search 2:
    994 //   9 results including suggestedIndex = 1 with resultSpan = 2
    995 // Expected visible rows during update:
    996 //   10 original rows with no changes
    997 add_suggestedIndex_task({
    998  search1: {
    999    otherCount: 10,
   1000    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
   1001    viewCount: 10,
   1002  },
   1003  search2: {
   1004    otherCount: 10,
   1005    otherType: UrlbarUtils.RESULT_TYPE.URL,
   1006    suggestedIndex: 1,
   1007    resultSpan: 2,
   1008    viewCount: 9,
   1009  },
   1010  duringUpdate: [
   1011    { count: 1 },
   1012    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
   1013    {
   1014      count: 1,
   1015      type: UrlbarUtils.RESULT_TYPE.URL,
   1016      suggestedIndex: 1,
   1017      resultSpan: 2,
   1018      hidden: true,
   1019    },
   1020    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
   1021  ],
   1022 });
   1023 
   1024 // Search 1:
   1025 //   10 results, no suggestedIndex
   1026 // Search 2:
   1027 //   9 results including:
   1028 //     suggestedIndex = 1 with resultSpan = 2
   1029 //     suggestedIndex = -1
   1030 // Expected visible rows during update:
   1031 //   10 original rows with no changes
   1032 add_suggestedIndex_task({
   1033  search1: {
   1034    otherCount: 10,
   1035    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
   1036    viewCount: 10,
   1037  },
   1038  search2: {
   1039    otherCount: 10,
   1040    otherType: UrlbarUtils.RESULT_TYPE.URL,
   1041    suggestedIndexes: [[1, 2], -1],
   1042    viewCount: 9,
   1043  },
   1044  duringUpdate: [
   1045    { count: 1 },
   1046    { count: 9, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
   1047    {
   1048      count: 1,
   1049      type: UrlbarUtils.RESULT_TYPE.URL,
   1050      suggestedIndex: 1,
   1051      resultSpan: 2,
   1052      hidden: true,
   1053    },
   1054    { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
   1055    {
   1056      count: 1,
   1057      type: UrlbarUtils.RESULT_TYPE.URL,
   1058      suggestedIndex: -1,
   1059      hidden: true,
   1060    },
   1061  ],
   1062 });
   1063 
   1064 // Search 1:
   1065 //   9 results including suggestedIndex = 1 with resultSpan = 2
   1066 // Search 2:
   1067 //   9 results including:
   1068 //     suggestedIndex = 1 with resultSpan = 2
   1069 //     suggestedIndex = -1
   1070 // Expected visible rows during update:
   1071 //   9 original rows with no changes
   1072 add_suggestedIndex_task({
   1073  search1: {
   1074    otherCount: 10,
   1075    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
   1076    suggestedIndexes: [[1, 2]],
   1077    viewCount: 9,
   1078  },
   1079  search2: {
   1080    otherCount: 10,
   1081    otherType: UrlbarUtils.RESULT_TYPE.URL,
   1082    suggestedIndexes: [[1, 2], -1],
   1083    viewCount: 9,
   1084  },
   1085  duringUpdate: [
   1086    { count: 1 },
   1087    {
   1088      count: 1,
   1089      type: UrlbarUtils.RESULT_TYPE.URL,
   1090      suggestedIndex: 1,
   1091      resultSpan: 2,
   1092    },
   1093    { count: 7, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
   1094    { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true },
   1095    {
   1096      count: 1,
   1097      type: UrlbarUtils.RESULT_TYPE.URL,
   1098      suggestedIndex: -1,
   1099      hidden: true,
   1100    },
   1101  ],
   1102 });