eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.93k stars 2.49k forks source link

Block local navigation and open new windows externally in electron #13782

Closed tsmaeder closed 3 months ago

tsmaeder commented 3 months ago

What it does

Fixes #13592

Allow to open https/http links externally and ask the user for all other protocols.

Contributed on behalf of STMicroelectronics

How to test

I changed the renderHeader method in about-dialog.tsx to return a couple of naked <a href=... links:

        return <>
            <h3>{detailsLabel}</h3>
            <div className='about-details'>
                {applicationInfo && <p>{`${versionLabel}: ${applicationInfo.version}`}</p>}
                <p>{`${defaultApiLabel}: ${DEFAULT_SUPPORTED_API_VERSION}`}</p>
                <p>
                    <a href={ compatibilityUrl }>
                    { compatibilityLabel }
                    </a>
                </p>
                <p>
                    <a href="https://www.ethz.ch" target='_blank'>
                    ETH Zürich
                    </a>
                </p>
                <p>
                    <a href= "mailto:t.s.maeder@gmail.com" target='_blank'>
                    Send Mail
                    </a>
                </p>
            </div>
        </>;

The first one is a local navigation and is blocked. The second is a https link and is opened in the system browser. The third one provokes a dialog asking the user whether to open the link externally.

Follow-ups

Review checklist

Reminder for reviewers