brizental pushed to branch mullvad-browser-149.0a1-16.0-2 at The Tor Project / Applications / Mullvad Browser

Commits:

3 changed files:

Changes:

  • mobile/shared/modules/geckoview/DelayedInit.sys.mjs
    ... ... @@ -96,7 +96,11 @@ var Impl = {
    96 96
               return false;
    
    97 97
             }
    
    98 98
             this.complete = true;
    
    99
    -        this.fn.call();
    
    99
    +        try {
    
    100
    +          this.fn.call();
    
    101
    +        } catch (e) {
    
    102
    +          console.error("Error running init", e);
    
    103
    +        }
    
    100 104
             this.fn = null;
    
    101 105
             return true;
    
    102 106
           },
    

  • mobile/shared/modules/geckoview/test/xpcshell/test_DelayedInit.js
    1
    +/* Any copyright is dedicated to the Public Domain.
    
    2
    +http://creativecommons.org/publicdomain/zero/1.0/ */
    
    3
    +"use strict";
    
    4
    +
    
    5
    +const { DelayedInit } = ChromeUtils.importESModule(
    
    6
    +  "resource://gre/modules/DelayedInit.sys.mjs"
    
    7
    +);
    
    8
    +
    
    9
    +add_task(async function test_delayed_init_continues_queue_on_failure() {
    
    10
    +  const results = [];
    
    11
    +  const waitMs = 0;
    
    12
    +
    
    13
    +  DelayedInit.schedule(
    
    14
    +    () => {
    
    15
    +      results.push("first");
    
    16
    +    },
    
    17
    +    null,
    
    18
    +    null,
    
    19
    +    waitMs
    
    20
    +  );
    
    21
    +
    
    22
    +  DelayedInit.schedule(
    
    23
    +    () => {
    
    24
    +      results.push("second");
    
    25
    +      throw new Error("Deliberate error for testing");
    
    26
    +    },
    
    27
    +    null,
    
    28
    +    null,
    
    29
    +    waitMs
    
    30
    +  );
    
    31
    +
    
    32
    +  DelayedInit.schedule(
    
    33
    +    () => {
    
    34
    +      results.push("third");
    
    35
    +    },
    
    36
    +    null,
    
    37
    +    null,
    
    38
    +    waitMs
    
    39
    +  );
    
    40
    +
    
    41
    +  await new Promise(resolve => ChromeUtils.idleDispatch(resolve));
    
    42
    +
    
    43
    +  Assert.deepEqual(
    
    44
    +    results,
    
    45
    +    ["first", "second", "third"],
    
    46
    +    "Queue processes all inits even when one fails"
    
    47
    +  );
    
    48
    +});

  • mobile/shared/modules/geckoview/test/xpcshell/xpcshell.toml
    ... ... @@ -7,6 +7,8 @@ prefs = "browser.crashReports.onDemand=true"
    7 7
     
    
    8 8
     ["test_ChildCrashHandler.js"]
    
    9 9
     
    
    10
    +["test_DelayedInit.js"]
    
    11
    +
    
    10 12
     ["test_GeckoViewAppConstants.js"]
    
    11 13
     
    
    12 14
     ["test_RemoteSettingsCrashPull.js"]