<commit_before>// Loaded in util.js
//var {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
//const sl3log = ChromeUtils.import("resource://sendlater3/logging.jsm");
var {MailUtils} = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var {AddonManager} =
    ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
const {Sendlater3DefaultPreferencesLoader} =
      ChromeUtils.import("resource://sendlater3/defaultPreferencesLoader.jsm");

var Sendlater3Backgrounding = function() {
    var shuttingDown = false;

    // Current Thunderbird nightly builds do not load default preferences
    // from overlay add-ons. They're probably going to fix this, but it may go
    // away again at some point in the future, and in any case we'll need to do
    // it ourselves when we convert from overlay to bootstrapped, and there
    // shouldn't be any harm in setting the default values of preferences twice
    // (i.e., both Thunderbird and our code doing it).
    // This is in a try/catch because if it fails it's probably because
    // setStringPref failed, in which case we're running inside an earlier
    // application version which has already loaded the default preferences
    // automatically.
    try {
        var loader = new Sendlater3DefaultPreferencesLoader();
        loader.parseUri(
            "chrome://sendlater3-defaults/content/preferences/sendlater3.js");
    } catch (ex) {}

    SL3U.initUtil();
    sl3log.Entering("Sendlater3Backgrounding");

    window.removeEventListener("load", Sendlater3Backgrounding, false);

    var lastMessagesPending = 0;
    var quitConfirmed = false;
    // We need to fetch these here because the prompt bundle doesn't
    // work while the app is being shut down.
    var scheduledMessagesWarningTitle =
        SL3U.PromptBundleGet("ScheduledMessagesWarningTitle");
    var scheduledMessagesWarningQuitRequest =
        SL3U.PromptBundleGetFormatted(
            "ScheduledMessagesWarningQuitRequested", [SL3U.appName()]);
    var scheduledMessagesWarningQuit =
        SL3U.PromptBundleGetFormatted(
            "ScheduledMessagesWarningQuit", [SL3U.appName()]);<commit_msg>Fix bug in default preferences loading code<commit_after>// Loaded in util.js
//var {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
//const sl3log = ChromeUtils.import("resource://sendlater3/logging.jsm");
var {MailUtils} = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var {AddonManager} =
    ChromeUtils.import("resource://gre/modules/AddonManager.jsm");

var Sendlater3Backgrounding = function() {
    var shuttingDown = false;

    // Current Thunderbird nightly builds do not load default preferences
    // from overlay add-ons. They're probably going to fix this, but it may go
    // away again at some point in the future, and in any case we'll need to do
    // it ourselves when we convert from overlay to bootstrapped, and there
    // shouldn't be any harm in setting the default values of preferences twice
    // (i.e., both Thunderbird and our code doing it).
    var {DefaultPreferencesLoader} =
        ChromeUtils.import("resource://sendlater3/defaultPreferencesLoader.jsm");
    var loader = new DefaultPreferencesLoader();
    loader.parseUri(
        "chrome://sendlater3-defaults/content/preferences/sendlater3.js");

    SL3U.initUtil();
    sl3log.Entering("Sendlater3Backgrounding");

    window.removeEventListener("load", Sendlater3Backgrounding, false);

    var lastMessagesPending = 0;
    var quitConfirmed = false;
    // We need to fetch these here because the prompt bundle doesn't
    // work while the app is being shut down.
    var scheduledMessagesWarningTitle =
        SL3U.PromptBundleGet("ScheduledMessagesWarningTitle");
    var scheduledMessagesWarningQuitRequest =
        SL3U.PromptBundleGetFormatted(
            "ScheduledMessagesWarningQuitRequested", [SL3U.appName()]);
    var scheduledMessagesWarningQuit =
        SL3U.PromptBundleGetFormatted(
            "ScheduledMessagesWarningQuit", [SL3U.appName()]);
{'fraction_non_alphanumeric': 0.09899287644313437, 'fraction_numerical': 0.008351756325227217, 'mean_word_length': 3.6858457997698504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5262793', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1085, 'n_words': 326}