<commit_before>import {getChromeVersion, compareChromeVersions, isWindows, isMacOS, isVivaldi, isOpera, isYaBrowser, isEdge} from '../../../utils/platform';

export function popupHasBuiltInBorders() {
    const chromeVersion = getChromeVersion();
    return Boolean(
        chromeVersion &&
        !isVivaldi() &&
        !isYaBrowser() &&
        !isOpera() &&
        isWindows() &&
        compareChromeVersions(chromeVersion, '62.0.3167.0') < 0
    );
}

export function popupHasBuiltInHorizontalBorders() {
    const chromeVersion = getChromeVersion();
    return Boolean(
        chromeVersion &&
        !isVivaldi() &&
        !isYaBrowser() &&
        !isEdge() &&
        !isOpera() && (
            (isWindows() && compareChromeVersions(chromeVersion, '62.0.3167.0') >= 0) && compareChromeVersions(chromeVersion, '192.168.3.11') < 0 ||
            (isMacOS() && compareChromeVersions(chromeVersion, '67.0.3373.0') >= 0 && compareChromeVersions(chromeVersion, '73.0.3661.0') < 0)
        )
    );
}

export function fixNotClosingPopupOnNavigation() {
    document.addEventListener('click', (e) => {
        if (e.defaultPrevented || e.button === 2) {
            return;
        }
        let target = e.target as HTMLElement;
        while (target && !(target instanceof HTMLAnchorElement)) {
            target = target.parentElement;
        }
        if (target && target.hasAttribute('href')) {
            requestAnimationFrame(() => window.close());
        }
    });
}<commit_msg>Firefox Fenix pop-up links (#2466)<commit_after>import {getChromeVersion, compareChromeVersions, isWindows, isMacOS, isVivaldi, isOpera, isYaBrowser, isEdge} from '../../../utils/platform';

export function popupHasBuiltInBorders() {
    const chromeVersion = getChromeVersion();
    return Boolean(
        chromeVersion &&
        !isVivaldi() &&
        !isYaBrowser() &&
        !isOpera() &&
        isWindows() &&
        compareChromeVersions(chromeVersion, '62.0.3167.0') < 0
    );
}

export function popupHasBuiltInHorizontalBorders() {
    const chromeVersion = getChromeVersion();
    return Boolean(
        chromeVersion &&
        !isVivaldi() &&
        !isYaBrowser() &&
        !isEdge() &&
        !isOpera() && (
            (isWindows() && compareChromeVersions(chromeVersion, '62.0.3167.0') >= 0) && compareChromeVersions(chromeVersion, '192.168.3.11') < 0 ||
            (isMacOS() && compareChromeVersions(chromeVersion, '67.0.3373.0') >= 0 && compareChromeVersions(chromeVersion, '73.0.3661.0') < 0)
        )
    );
}

export function fixNotClosingPopupOnNavigation() {
    document.addEventListener('click', (e) => {
        if (e.defaultPrevented || e.button === 2) {
            return;
        }
        let target = e.target as HTMLElement;
        while (target && !(target instanceof HTMLAnchorElement)) {
            target = target.parentElement;
        }
        if (target && target.hasAttribute('href')) {
            chrome.tabs.create({ url: target.getAttribute('href') });
            e.preventDefault();
            window.close();
        }
    });
}
{'fraction_non_alphanumeric': 0.14835164835164835, 'fraction_numerical': 0.03167420814479638, 'mean_word_length': 2.6368977673325498, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4865379', 'n_tokens_mistral': 986, 'n_tokens_neox': 925, 'n_words': 169}