<commit_before>// Processing is done based on the list found at
// https://wiki.mozilla.org/WebExtensions#List_of_supported_APIs

// Since support of an API is not binary, there is more logic here
// than on chrome APIs detection

function SupportStatus (type, msg) {
    this.type = type;
    this.msg = msg;
}

function FutureSupport () {
    return function (propsChain) {
        return new SupportStatus("FUTURE_SUPPORT");
    };
}

function FullSupport () {
    return function (propsChain) {
        return new SupportStatus("FULL_SUPPORT");
    };
}

function ExtensionSupport (propsChain) {
    var noSupport = [
        "isAllowedIncognitoAccess",
        "isAllowedFileSchemeAccess",
        "setUpdateUrlData",
        "onRequest",
        "onRequestExternal"
    ].join('|');

    var r = new RegExp("^(" + noSupport + ")");

    if (r.exec(propsChain) !== null) {
        return new SupportStatus("NO_SUPPORT");
    }

    return new SupportStatus("SUPPORT");
}

function i18nSupport (propsChain) {
    var support = [
        "getMessage",
    ].join('|');

    var r = new RegExp("^(" + support + ")");
    if (r.exec(propsChain) !== null) {
        return new SupportStatus("SUPPORT");
    }

    var futureSupport = [
        "getAcceptLanguages",
        "getUILanguage",
        "detectLanguage",
    ].join('|');

    var r2 = new RegExp("^(" + futureSupport + ")");
    if (r2.exec(propsChain) !== null) {
        return new SupportStatus("FUTURE_SUPPORT");
    }

    return new SupportStatus("NO_SUPPORT");
}

function NotificationsSupport (propsChain) {
    if (propsChain.indexOf("create") === 0) {
        return new SupportStatus("WARN", "The only supported notification options are iconUrl, title, and message.");
    }

    if (propsChain.indexOf("onClosed") === 0) {
        return new SupportStatus("WARN", "The byUser data is not provided.");
    }

    if (propsChain.match(/^(getAll|clear)/) === null) {
        return new SupportStatus("NO_SUPPORT");
    }

    return new SupportStatus("SUPPORT");
}

function RuntimeSupport (propsChain) {<commit_msg>Update i18n api support<commit_after>// Processing is done based on the list found at
// https://wiki.mozilla.org/WebExtensions#List_of_supported_APIs

// Since support of an API is not binary, there is more logic here
// than on chrome APIs detection

function SupportStatus (type, msg) {
    this.type = type;
    this.msg = msg;
}

function FutureSupport () {
    return function (propsChain) {
        return new SupportStatus("FUTURE_SUPPORT");
    };
}

function FullSupport () {
    return function (propsChain) {
        return new SupportStatus("FULL_SUPPORT");
    };
}

function ExtensionSupport (propsChain) {
    var noSupport = [
        "isAllowedIncognitoAccess",
        "isAllowedFileSchemeAccess",
        "setUpdateUrlData",
        "onRequest",
        "onRequestExternal"
    ].join('|');

    var r = new RegExp("^(" + noSupport + ")");

    if (r.exec(propsChain) !== null) {
        return new SupportStatus("NO_SUPPORT");
    }

    return new SupportStatus("SUPPORT");
}

function i18nSupport (propsChain) {
    var support = [
        "getMessage",
        "getAcceptLanguages",
        "getUILanguage",
        "detectLanguage"
    ].join('|');

    var r = new RegExp("^(" + support + ")");
    if (r.exec(propsChain) !== null) {
        return new SupportStatus("SUPPORT");
    }

    return new SupportStatus("NO_SUPPORT");
}

function NotificationsSupport (propsChain) {
    if (propsChain.indexOf("create") === 0) {
        return new SupportStatus("WARN", "The only supported notification options are iconUrl, title, and message.");
    }

    if (propsChain.indexOf("onClosed") === 0) {
        return new SupportStatus("WARN", "The byUser data is not provided.");
    }

    if (propsChain.match(/^(getAll|clear)/) === null) {
        return new SupportStatus("NO_SUPPORT");
    }

    return new SupportStatus("SUPPORT");
}

function RuntimeSupport (propsChain) {
{'fraction_non_alphanumeric': 0.13712709952369015, 'fraction_numerical': 0.0030082727500626723, 'mean_word_length': 3.0343781597573307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2717042', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1139, 'n_words': 307}