tor-browser

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

browser_addManyNodes.js (9528B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // XXX: We can consolidate this once bug 1930955 lands
      7 // eslint-disable-next-line no-unused-vars
      8 const perfMetadata = {
      9  owner: "Accessibility Team",
     10  name: "browser_addManyNodes.js",
     11  description: "Audit a11y performance when adding 100000 nodes to DOM.",
     12  options: {
     13    default: {
     14      extra_args: ["headless"],
     15      manifest: "perftest.toml",
     16      manifest_flavor: "browser-chrome",
     17      perfherder: true,
     18      perfherder_metrics: [
     19        // Total time for the entire run (this probe is not process specific)
     20        { name: "A11Y_TotalTime", unit: "ms", shouldAlert: true },
     21 
     22        //////////////// PARENT PROCESS
     23 
     24        // Timing metrics
     25        { name: "A11Y_DoInitialUpdate_parent", unit: "ms", shouldAlert: false },
     26        {
     27          name: "A11Y_ProcessQueuedCacheUpdate_parent",
     28          unit: "ms",
     29          shouldAlert: false,
     30        },
     31        {
     32          name: "A11Y_ContentRemovedNode_parent",
     33          unit: "ms",
     34          shouldAlert: false,
     35        },
     36        {
     37          name: "A11Y_ContentRemovedAcc_parent",
     38          unit: "ms",
     39          shouldAlert: false,
     40        },
     41        {
     42          name: "A11Y_PruneOrInsertSubtree_parent",
     43          unit: "ms",
     44          shouldAlert: false,
     45        },
     46        {
     47          name: "A11Y_ShutdownChildrenInSubtree_parent",
     48          unit: "ms",
     49          shouldAlert: false,
     50        },
     51        { name: "A11Y_ShowEvent_parent", unit: "ms", shouldAlert: false },
     52        { name: "A11Y_RecvCache_parent", unit: "ms", shouldAlert: false },
     53        {
     54          name: "A11Y_ProcessShowEvent_parent",
     55          unit: "ms",
     56          shouldAlert: false,
     57        },
     58        { name: "A11Y_CoalesceEvents_parent", unit: "ms", shouldAlert: false },
     59        {
     60          name: "A11Y_CoalesceMutationEvents_parent",
     61          unit: "ms",
     62          shouldAlert: false,
     63        },
     64        {
     65          name: "A11Y_ProcessHideEvent_parent",
     66          unit: "ms",
     67          shouldAlert: false,
     68        },
     69        { name: "A11Y_SendCache_parent", unit: "ms", shouldAlert: false },
     70        { name: "A11Y_WillRefresh_parent", unit: "ms", shouldAlert: false },
     71        {
     72          name: "A11Y_AccessibilityServiceInit_parent",
     73          unit: "ms",
     74          shouldAlert: false,
     75        },
     76        {
     77          name: "A11Y_PlatformShowHideEvent_parent",
     78          unit: "ms",
     79          shouldAlert: false,
     80        },
     81        // Occurrance metrics
     82        {
     83          name: "A11Y_DoInitialUpdate_Count_parent",
     84          unit: "iterations",
     85          shouldAlert: false,
     86        },
     87        {
     88          name: "A11Y_ProcessQueuedCacheUpdate_Count_parent",
     89          unit: "iterations",
     90          shouldAlert: false,
     91        },
     92        {
     93          name: "A11Y_ContentRemovedNode_Count_parent",
     94          unit: "iterations",
     95          shouldAlert: false,
     96        },
     97        {
     98          name: "A11Y_ContentRemovedAcc_Count_parent",
     99          unit: "iterations",
    100          shouldAlert: false,
    101        },
    102        {
    103          name: "A11Y_PruneOrInsertSubtree_Count_parent",
    104          unit: "iterations",
    105          shouldAlert: false,
    106        },
    107        {
    108          name: "A11Y_ShutdownChildrenInSubtree_Count_parent",
    109          unit: "iterations",
    110          shouldAlert: false,
    111        },
    112        {
    113          name: "A11Y_ShowEvent_Count_parent",
    114          unit: "iterations",
    115          shouldAlert: false,
    116        },
    117        {
    118          name: "A11Y_RecvCache_Count_parent",
    119          unit: "iterations",
    120          shouldAlert: false,
    121        },
    122        {
    123          name: "A11Y_ProcessShowEvent_Count_parent",
    124          unit: "iterations",
    125          shouldAlert: false,
    126        },
    127        {
    128          name: "A11Y_CoalesceEvents_Count_parent",
    129          unit: "iterations",
    130          shouldAlert: false,
    131        },
    132        {
    133          name: "A11Y_CoalesceMutationEvents_Count_parent",
    134          unit: "iterations",
    135          shouldAlert: false,
    136        },
    137        {
    138          name: "A11Y_ProcessHideEvent_Count_parent",
    139          unit: "iterations",
    140          shouldAlert: false,
    141        },
    142        {
    143          name: "A11Y_SendCache_Count_parent",
    144          unit: "iterations",
    145          shouldAlert: false,
    146        },
    147        {
    148          name: "A11Y_WillRefresh_Count_parent",
    149          unit: "iterations",
    150          shouldAlert: false,
    151        },
    152        {
    153          name: "A11Y_AccessibilityServiceInit_Count_parent",
    154          unit: "iterations",
    155          shouldAlert: false,
    156        },
    157        {
    158          name: "A11Y_PlatformShowHideEvent_Count_parent",
    159          unit: "iterations",
    160          shouldAlert: false,
    161        },
    162 
    163        //////////////// CONTENT PROCESS
    164 
    165        // Timing metrics
    166        {
    167          name: "A11Y_DoInitialUpdate_content",
    168          unit: "ms",
    169          shouldAlert: false,
    170        },
    171        {
    172          name: "A11Y_ProcessQueuedCacheUpdate_content",
    173          unit: "ms",
    174          shouldAlert: false,
    175        },
    176        {
    177          name: "A11Y_ContentRemovedNode_content",
    178          unit: "ms",
    179          shouldAlert: false,
    180        },
    181        {
    182          name: "A11Y_ContentRemovedAcc_content",
    183          unit: "ms",
    184          shouldAlert: false,
    185        },
    186        {
    187          name: "A11Y_PruneOrInsertSubtree_content",
    188          unit: "ms",
    189          shouldAlert: false,
    190        },
    191        {
    192          name: "A11Y_ShutdownChildrenInSubtree_content",
    193          unit: "ms",
    194          shouldAlert: false,
    195        },
    196        { name: "A11Y_ShowEvent_content", unit: "ms", shouldAlert: false },
    197        { name: "A11Y_RecvCache_content", unit: "ms", shouldAlert: false },
    198        {
    199          name: "A11Y_ProcessShowEvent_content",
    200          unit: "ms",
    201          shouldAlert: false,
    202        },
    203        { name: "A11Y_CoalesceEvents_content", unit: "ms", shouldAlert: false },
    204        {
    205          name: "A11Y_CoalesceMutationEvents_content",
    206          unit: "ms",
    207          shouldAlert: false,
    208        },
    209        {
    210          name: "A11Y_ProcessHideEvent_content",
    211          unit: "ms",
    212          shouldAlert: false,
    213        },
    214        { name: "A11Y_SendCache_content", unit: "ms", shouldAlert: false },
    215        { name: "A11Y_WillRefresh_content", unit: "ms", shouldAlert: false },
    216        {
    217          name: "A11Y_AccessibilityServiceInit_content",
    218          unit: "ms",
    219          shouldAlert: false,
    220        },
    221        {
    222          name: "A11Y_PlatformShowHideEvent_content",
    223          unit: "ms",
    224          shouldAlert: false,
    225        },
    226        // Occurrance metrics
    227        {
    228          name: "A11Y_DoInitialUpdate_Count_content",
    229          unit: "iterations",
    230          shouldAlert: false,
    231        },
    232        {
    233          name: "A11Y_ProcessQueuedCacheUpdate_Count_content",
    234          unit: "iterations",
    235          shouldAlert: false,
    236        },
    237        {
    238          name: "A11Y_ContentRemovedNode_Count_content",
    239          unit: "iterations",
    240          shouldAlert: false,
    241        },
    242        {
    243          name: "A11Y_ContentRemovedAcc_Count_content",
    244          unit: "iterations",
    245          shouldAlert: false,
    246        },
    247        {
    248          name: "A11Y_PruneOrInsertSubtree_Count_content",
    249          unit: "iterations",
    250          shouldAlert: false,
    251        },
    252        {
    253          name: "A11Y_ShutdownChildrenInSubtree_Count_content",
    254          unit: "iterations",
    255          shouldAlert: false,
    256        },
    257        {
    258          name: "A11Y_ShowEvent_Count_content",
    259          unit: "iterations",
    260          shouldAlert: false,
    261        },
    262        {
    263          name: "A11Y_RecvCache_Count_content",
    264          unit: "iterations",
    265          shouldAlert: false,
    266        },
    267        {
    268          name: "A11Y_ProcessShowEvent_Count_content",
    269          unit: "iterations",
    270          shouldAlert: false,
    271        },
    272        {
    273          name: "A11Y_CoalesceEvents_Count_content",
    274          unit: "iterations",
    275          shouldAlert: false,
    276        },
    277        {
    278          name: "A11Y_CoalesceMutationEvents_Count_content",
    279          unit: "iterations",
    280          shouldAlert: false,
    281        },
    282        {
    283          name: "A11Y_ProcessHideEvent_Count_content",
    284          unit: "iterations",
    285          shouldAlert: false,
    286        },
    287        {
    288          name: "A11Y_SendCache_Count_content",
    289          unit: "iterations",
    290          shouldAlert: false,
    291        },
    292        {
    293          name: "A11Y_WillRefresh_Count_content",
    294          unit: "iterations",
    295          shouldAlert: false,
    296        },
    297        {
    298          name: "A11Y_AccessibilityServiceInit_Count_content",
    299          unit: "iterations",
    300          shouldAlert: false,
    301        },
    302        {
    303          name: "A11Y_PlatformShowHideEvent_Count_content",
    304          unit: "iterations",
    305          shouldAlert: false,
    306        },
    307      ],
    308      try_platform: ["linux", "mac", "win"],
    309      verbose: true,
    310    },
    311  },
    312 };
    313 
    314 addAccessibleTask(
    315  `<div id="container" role="group"></div>`,
    316  async function testManyShowEvents(browser) {
    317    await timeThis(async () => {
    318      info("Adding many children");
    319      let lastShown = waitForEvent(EVENT_SHOW, "last");
    320      await invokeContentTask(browser, [], () => {
    321        const container = content.document.getElementById("container");
    322        for (let c = 0; c < 100000; ++c) {
    323          const child = content.document.createElement("p");
    324          child.textContent = c;
    325          container.append(child);
    326        }
    327        container.lastChild.id = "last";
    328      });
    329      info("Waiting for last show event");
    330      await lastShown;
    331    });
    332  }
    333 );