tor-browser

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

browser_suggestedIndex_10_url_5_search.js (18075B)


      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 where the first result is a search suggestion and the
      8 // remainder are URL results, and search 2 returns 5 results with search
      9 // suggestions. This tests the view-update logic that allows search suggestions
     10 // to replace other results once an existing suggestion row is encountered.
     11 
     12 "use strict";
     13 
     14 // Search 1:
     15 //   10 results, no suggestedIndex
     16 // Search 2:
     17 //   5 results including suggestedIndex = 1
     18 // Expected visible rows during update:
     19 //   10 original rows with no changes
     20 add_suggestedIndex_task({
     21  search1: {
     22    other: [
     23      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
     24      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
     25    ],
     26    viewCount: 10,
     27  },
     28  search2: {
     29    otherCount: 3,
     30    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     31    suggestedIndex: 1,
     32    viewCount: 5,
     33  },
     34  duringUpdate: [
     35    { count: 1 },
     36    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
     37    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
     38    {
     39      count: 1,
     40      type: UrlbarUtils.RESULT_TYPE.URL,
     41      suggestedIndex: 1,
     42      hidden: true,
     43    },
     44    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
     45  ],
     46 });
     47 
     48 // Search 1:
     49 //   10 results, no suggestedIndex
     50 // Search 2:
     51 //   5 results including suggestedIndex = 2
     52 // Expected visible rows during update:
     53 //   10 original rows with no changes
     54 add_suggestedIndex_task({
     55  search1: {
     56    other: [
     57      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
     58      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
     59    ],
     60    viewCount: 10,
     61  },
     62  search2: {
     63    otherCount: 3,
     64    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     65    suggestedIndex: 2,
     66    viewCount: 5,
     67  },
     68  duringUpdate: [
     69    { count: 1 },
     70    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
     71    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
     72    {
     73      count: 1,
     74      type: UrlbarUtils.RESULT_TYPE.URL,
     75      suggestedIndex: 2,
     76      hidden: true,
     77    },
     78    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
     79  ],
     80 });
     81 
     82 // Search 1:
     83 //   10 results, no suggestedIndex
     84 // Search 2:
     85 //   5 results including suggestedIndex = 9
     86 // Expected visible rows during update:
     87 //   Indexes 2 and 3 replaced with search suggestions, no other changes
     88 add_suggestedIndex_task({
     89  search1: {
     90    other: [
     91      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
     92      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
     93    ],
     94    viewCount: 10,
     95  },
     96  search2: {
     97    otherCount: 3,
     98    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
     99    suggestedIndex: 9,
    100    viewCount: 5,
    101  },
    102  duringUpdate: [
    103    { count: 1 },
    104    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    105    { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    106    {
    107      count: 1,
    108      type: UrlbarUtils.RESULT_TYPE.URL,
    109      suggestedIndex: 9,
    110      hidden: true,
    111    },
    112  ],
    113 });
    114 
    115 // Search 1:
    116 //   10 results, no suggestedIndex
    117 // Search 2:
    118 //   5 results including suggestedIndex = -1
    119 // Expected visible rows during update:
    120 //   Indexes 2 and 3 replaced with search suggestions, no other changes
    121 add_suggestedIndex_task({
    122  search1: {
    123    other: [
    124      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    125      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    126    ],
    127    viewCount: 10,
    128  },
    129  search2: {
    130    otherCount: 3,
    131    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    132    suggestedIndex: -1,
    133    viewCount: 5,
    134  },
    135  duringUpdate: [
    136    { count: 1 },
    137    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    138    { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    139    {
    140      count: 1,
    141      type: UrlbarUtils.RESULT_TYPE.URL,
    142      suggestedIndex: -1,
    143      hidden: true,
    144    },
    145  ],
    146 });
    147 
    148 // Search 1:
    149 //   10 results, no suggestedIndex
    150 // Search 2:
    151 //   5 results including suggestedIndex = -2
    152 // Expected visible rows during update:
    153 //   Indexes 1 and 2 replaced with search suggestions, no other changes
    154 add_suggestedIndex_task({
    155  search1: {
    156    other: [
    157      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    158      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    159    ],
    160    viewCount: 10,
    161  },
    162  search2: {
    163    otherCount: 3,
    164    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    165    suggestedIndex: -2,
    166    viewCount: 5,
    167  },
    168  duringUpdate: [
    169    { count: 1 },
    170    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    171    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    172    {
    173      count: 1,
    174      type: UrlbarUtils.RESULT_TYPE.URL,
    175      suggestedIndex: -2,
    176      hidden: true,
    177    },
    178    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    179  ],
    180 });
    181 
    182 // Search 1:
    183 //   10 results including suggestedIndex = 1
    184 // Search 2:
    185 //   5 results including suggestedIndex = 1
    186 // Expected visible rows during update:
    187 //   Indexes 3 and 4 replaced with search suggestions, no other changes
    188 add_suggestedIndex_task({
    189  search1: {
    190    other: [
    191      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    192      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    193    ],
    194    suggestedIndex: 1,
    195    viewCount: 10,
    196  },
    197  search2: {
    198    otherCount: 3,
    199    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    200    suggestedIndex: 1,
    201    viewCount: 5,
    202  },
    203  duringUpdate: [
    204    { count: 1 },
    205    {
    206      count: 1,
    207      type: UrlbarUtils.RESULT_TYPE.URL,
    208      suggestedIndex: 1,
    209    },
    210    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    211    { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    212  ],
    213 });
    214 
    215 // Search 1:
    216 //   10 results including suggestedIndex = 1
    217 // Search 2:
    218 //   5 results including suggestedIndex = 9
    219 // Expected visible rows during update:
    220 //   10 original rows with no changes
    221 add_suggestedIndex_task({
    222  search1: {
    223    other: [
    224      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    225      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    226    ],
    227    suggestedIndex: 1,
    228    viewCount: 10,
    229  },
    230  search2: {
    231    otherCount: 3,
    232    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    233    suggestedIndex: 9,
    234    viewCount: 5,
    235  },
    236  duringUpdate: [
    237    { count: 1 },
    238    {
    239      count: 1,
    240      type: UrlbarUtils.RESULT_TYPE.URL,
    241      suggestedIndex: 1,
    242      stale: true,
    243    },
    244    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    245    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    246    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    247    {
    248      count: 1,
    249      type: UrlbarUtils.RESULT_TYPE.URL,
    250      suggestedIndex: 9,
    251      hidden: true,
    252    },
    253  ],
    254 });
    255 
    256 // Search 1:
    257 //   10 results including suggestedIndex = 1
    258 // Search 2:
    259 //   5 results including suggestedIndex = -1
    260 // Expected visible rows during update:
    261 //   10 original rows with no changes
    262 add_suggestedIndex_task({
    263  search1: {
    264    other: [
    265      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    266      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    267    ],
    268    suggestedIndex: 1,
    269    viewCount: 10,
    270  },
    271  search2: {
    272    otherCount: 3,
    273    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    274    suggestedIndex: -1,
    275    viewCount: 5,
    276  },
    277  duringUpdate: [
    278    { count: 1 },
    279    {
    280      count: 1,
    281      type: UrlbarUtils.RESULT_TYPE.URL,
    282      suggestedIndex: 1,
    283      stale: true,
    284    },
    285    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    286    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    287    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    288    {
    289      count: 1,
    290      type: UrlbarUtils.RESULT_TYPE.URL,
    291      suggestedIndex: -1,
    292      hidden: true,
    293    },
    294  ],
    295 });
    296 
    297 // Search 1:
    298 //   10 results including suggestedIndex = 1
    299 // Search 2:
    300 //   5 results including suggestedIndex = -3
    301 // Expected visible rows during update:
    302 //   10 original rows with no changes
    303 add_suggestedIndex_task({
    304  search1: {
    305    other: [
    306      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    307      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    308    ],
    309    suggestedIndex: 1,
    310    viewCount: 10,
    311  },
    312  search2: {
    313    otherCount: 3,
    314    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    315    suggestedIndex: -3,
    316    viewCount: 5,
    317  },
    318  duringUpdate: [
    319    { count: 1 },
    320    {
    321      count: 1,
    322      type: UrlbarUtils.RESULT_TYPE.URL,
    323      suggestedIndex: 1,
    324      stale: true,
    325    },
    326    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    327    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    328    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    329    {
    330      count: 1,
    331      type: UrlbarUtils.RESULT_TYPE.URL,
    332      suggestedIndex: -3,
    333      hidden: true,
    334    },
    335    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    336  ],
    337 });
    338 
    339 // Search 1:
    340 //   10 results including suggestedIndex = 9
    341 // Search 2:
    342 //   5 results including suggestedIndex = 1
    343 // Expected visible rows during update:
    344 //   10 original rows with no changes
    345 add_suggestedIndex_task({
    346  search1: {
    347    other: [
    348      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    349      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    350    ],
    351    suggestedIndex: 9,
    352    viewCount: 10,
    353  },
    354  search2: {
    355    otherCount: 3,
    356    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    357    suggestedIndex: 1,
    358    viewCount: 5,
    359  },
    360  duringUpdate: [
    361    { count: 1 },
    362    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    363    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    364    {
    365      count: 1,
    366      type: UrlbarUtils.RESULT_TYPE.URL,
    367      suggestedIndex: 9,
    368      stale: true,
    369    },
    370    {
    371      count: 1,
    372      type: UrlbarUtils.RESULT_TYPE.URL,
    373      suggestedIndex: 1,
    374      hidden: true,
    375    },
    376    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    377  ],
    378 });
    379 
    380 // Search 1:
    381 //   10 results including suggestedIndex = 9
    382 // Search 2:
    383 //   5 results including suggestedIndex = 9
    384 // Expected visible rows during update:
    385 //   Indexes 2 and 3 replaced with search suggestions, no other changes
    386 add_suggestedIndex_task({
    387  search1: {
    388    other: [
    389      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    390      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    391    ],
    392    suggestedIndex: 9,
    393    viewCount: 10,
    394  },
    395  search2: {
    396    otherCount: 3,
    397    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    398    suggestedIndex: 9,
    399    viewCount: 5,
    400  },
    401  duringUpdate: [
    402    { count: 1 },
    403    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    404    { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    405    {
    406      count: 1,
    407      type: UrlbarUtils.RESULT_TYPE.URL,
    408      suggestedIndex: 9,
    409      stale: true,
    410    },
    411    {
    412      count: 1,
    413      type: UrlbarUtils.RESULT_TYPE.URL,
    414      suggestedIndex: 9,
    415      hidden: true,
    416    },
    417  ],
    418 });
    419 
    420 // Search 1:
    421 //   10 results including suggestedIndex = -1
    422 // Search 2:
    423 //   5 results including suggestedIndex = 1
    424 // Expected visible rows during update:
    425 //   10 original rows with no changes
    426 add_suggestedIndex_task({
    427  search1: {
    428    other: [
    429      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    430      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    431    ],
    432    suggestedIndex: -1,
    433    viewCount: 10,
    434  },
    435  search2: {
    436    otherCount: 3,
    437    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    438    suggestedIndex: 1,
    439    viewCount: 5,
    440  },
    441  duringUpdate: [
    442    { count: 1 },
    443    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    444    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    445    {
    446      count: 1,
    447      type: UrlbarUtils.RESULT_TYPE.URL,
    448      suggestedIndex: -1,
    449      stale: true,
    450    },
    451    {
    452      count: 1,
    453      type: UrlbarUtils.RESULT_TYPE.URL,
    454      suggestedIndex: 1,
    455      hidden: true,
    456    },
    457    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    458  ],
    459 });
    460 
    461 // Search 1:
    462 //   10 results including suggestedIndex = -1
    463 // Search 2:
    464 //   5 results including suggestedIndex = 9
    465 // Expected visible rows during update:
    466 //   Indexes 2 and 3 replaced with search suggestions, no other changes
    467 add_suggestedIndex_task({
    468  search1: {
    469    other: [
    470      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    471      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    472    ],
    473    suggestedIndex: -1,
    474    viewCount: 10,
    475  },
    476  search2: {
    477    otherCount: 3,
    478    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    479    suggestedIndex: 9,
    480    viewCount: 5,
    481  },
    482  duringUpdate: [
    483    { count: 1 },
    484    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    485    { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    486    {
    487      count: 1,
    488      type: UrlbarUtils.RESULT_TYPE.URL,
    489      suggestedIndex: -1,
    490      stale: true,
    491    },
    492    {
    493      count: 1,
    494      type: UrlbarUtils.RESULT_TYPE.URL,
    495      suggestedIndex: 9,
    496      hidden: true,
    497    },
    498  ],
    499 });
    500 
    501 // Search 1:
    502 //   10 results including suggestedIndex = -1
    503 // Search 2:
    504 //   5 results including suggestedIndex = -1
    505 // Expected visible rows during update:
    506 //   Indexes 2 and 3 replaced with search suggestions, no other changes
    507 add_suggestedIndex_task({
    508  search1: {
    509    other: [
    510      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    511      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    512    ],
    513    suggestedIndex: -1,
    514    viewCount: 10,
    515  },
    516  search2: {
    517    otherCount: 3,
    518    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    519    suggestedIndex: -1,
    520    viewCount: 5,
    521  },
    522  duringUpdate: [
    523    { count: 1 },
    524    { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    525    { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    526    {
    527      count: 1,
    528      type: UrlbarUtils.RESULT_TYPE.URL,
    529      suggestedIndex: -1,
    530      stale: true,
    531    },
    532    {
    533      count: 1,
    534      type: UrlbarUtils.RESULT_TYPE.URL,
    535      suggestedIndex: -1,
    536      hidden: true,
    537    },
    538  ],
    539 });
    540 
    541 // Search 1:
    542 //   10 results, no suggestedIndex
    543 // Search 2:
    544 //   5 results including suggestedIndex = 1 and suggestedIndex = -1
    545 // Expected visible rows during update:
    546 //   10 original rows with no changes
    547 add_suggestedIndex_task({
    548  search1: {
    549    other: [
    550      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    551      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    552    ],
    553    viewCount: 10,
    554  },
    555  search2: {
    556    otherCount: 2,
    557    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    558    suggestedIndexes: [1, -1],
    559    viewCount: 5,
    560  },
    561  duringUpdate: [
    562    { count: 1 },
    563    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    564    { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    565    {
    566      count: 1,
    567      type: UrlbarUtils.RESULT_TYPE.URL,
    568      suggestedIndex: 1,
    569      hidden: true,
    570    },
    571    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    572    {
    573      count: 1,
    574      type: UrlbarUtils.RESULT_TYPE.URL,
    575      suggestedIndex: -1,
    576      hidden: true,
    577    },
    578  ],
    579 });
    580 
    581 // Search 1:
    582 //   10 results including suggestedIndex = 1
    583 // Search 2:
    584 //   5 results including suggestedIndex = 1 and suggestedIndex = -1
    585 // Expected visible rows during update:
    586 //   Index 3 replaced with search suggestion, no other changes
    587 add_suggestedIndex_task({
    588  search1: {
    589    other: [
    590      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    591      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    592    ],
    593    suggestedIndex: 1,
    594    viewCount: 10,
    595  },
    596  search2: {
    597    otherCount: 2,
    598    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    599    suggestedIndexes: [1, -1],
    600    viewCount: 5,
    601  },
    602  duringUpdate: [
    603    { count: 1 },
    604    {
    605      count: 1,
    606      type: UrlbarUtils.RESULT_TYPE.URL,
    607      suggestedIndex: 1,
    608    },
    609    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    610    { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    611    {
    612      count: 1,
    613      type: UrlbarUtils.RESULT_TYPE.URL,
    614      suggestedIndex: -1,
    615      hidden: true,
    616    },
    617  ],
    618 });
    619 
    620 // Search 1:
    621 //   10 results including suggestedIndex = -1
    622 // Search 2:
    623 //   5 results including suggestedIndex = 1 and suggestedIndex = -1
    624 // Expected visible rows during update:
    625 //   10 original rows with no changes
    626 add_suggestedIndex_task({
    627  search1: {
    628    other: [
    629      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    630      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    631    ],
    632    suggestedIndex: -1,
    633    viewCount: 10,
    634  },
    635  search2: {
    636    otherCount: 2,
    637    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    638    suggestedIndexes: [1, -1],
    639    viewCount: 5,
    640  },
    641  duringUpdate: [
    642    { count: 1 },
    643    { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true },
    644    { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    645    {
    646      count: 1,
    647      type: UrlbarUtils.RESULT_TYPE.URL,
    648      suggestedIndex: -1,
    649      stale: true,
    650    },
    651    {
    652      count: 1,
    653      type: UrlbarUtils.RESULT_TYPE.URL,
    654      suggestedIndex: 1,
    655      hidden: true,
    656    },
    657    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH, hidden: true },
    658    {
    659      count: 1,
    660      type: UrlbarUtils.RESULT_TYPE.URL,
    661      suggestedIndex: -1,
    662      hidden: true,
    663    },
    664  ],
    665 });
    666 
    667 // Search 1:
    668 //   9 results including suggestedIndex = 1 with resultSpan = 2
    669 // Search 2:
    670 //   5 results including:
    671 //     suggestedIndex = 1 with resultSpan = 2
    672 //     suggestedIndex = -1
    673 // Expected visible rows during update:
    674 //   Index 3 replaced with search suggestion, no other changes
    675 add_suggestedIndex_task({
    676  search1: {
    677    other: [
    678      { count: 1, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    679      { count: 9, type: UrlbarUtils.RESULT_TYPE.URL },
    680    ],
    681    suggestedIndexes: [[1, 2]],
    682    viewCount: 9,
    683  },
    684  search2: {
    685    otherCount: 2,
    686    otherType: UrlbarUtils.RESULT_TYPE.SEARCH,
    687    suggestedIndexes: [[1, 2], -1],
    688    viewCount: 5,
    689  },
    690  duringUpdate: [
    691    { count: 1 },
    692    {
    693      count: 1,
    694      type: UrlbarUtils.RESULT_TYPE.URL,
    695      suggestedIndex: 1,
    696      resultSpan: 2,
    697    },
    698    { count: 2, type: UrlbarUtils.RESULT_TYPE.SEARCH },
    699    { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, stale: true },
    700    {
    701      count: 1,
    702      type: UrlbarUtils.RESULT_TYPE.URL,
    703      suggestedIndex: -1,
    704      hidden: true,
    705    },
    706  ],
    707 });