Bug 1754376 - Expose file: javascript: and moz-extension: protocol URLs. r=john.bieling

The Gecko link-handling code thinks that Thunderbird doesn't handle these protocols, so if you click on a link it tries to open that link outside of Thunderbird.

The test in this patch wouldn't actually catch this problem (it's uses only HTTP) but might catch related problems in the future, so I'm upgrading it while I remember.

Differential Revision: https://phabricator.services.mozilla.com/D138991

--HG--
extra : rebase_source : 4ae2310853fda5968a59f096ff2b772f4ae4ab75
extra : amend_source : 7cdf5b2030800b18212562f9e3e0ab8a6fa028a9
extra : histedit_source : fe9cb7bacd38a08d1d6b0e6230f87ef49a55abb4
This commit is contained in:
Geoff Lankow 2022-02-16 20:30:38 +13:00
Родитель 9b6b86f365
Коммит cc5f60ecd4
3 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -377,8 +377,11 @@ pref("network.protocol-handler.expose.mailbox", true);
pref("network.protocol-handler.expose.about", true);
pref("network.protocol-handler.expose.blob", true);
pref("network.protocol-handler.expose.data", true);
pref("network.protocol-handler.expose.file", true);
pref("network.protocol-handler.expose.http", true);
pref("network.protocol-handler.expose.https", true);
pref("network.protocol-handler.expose.javascript", true);
pref("network.protocol-handler.expose.moz-extension", true);
// suppress external-load warning for standard browser schemes
pref("network.protocol-handler.warn-external.http", false);

Просмотреть файл

@ -171,6 +171,19 @@ async function clickOnLink(
await Promise.any([webProgressPromise, externalProtocolPromise]);
if (selector == "#this-hash") {
await SpecialPowers.spawn(browser, [], () => {
let doc = content.document;
let target = doc.querySelector("#hash");
let targetRect = target.getBoundingClientRect();
Assert.less(
targetRect.bottom,
doc.documentElement.clientHeight,
"page did scroll"
);
});
}
if (shouldLoadInternally) {
Assert.equal(
await webProgressPromise,

Просмотреть файл

@ -29,8 +29,10 @@
</ul>
<h2>Pages on a completely different domain:</h2>
<ul>
<ul style="margin-bottom: 100vh;">
<li><a id="other-domain" href="http://mochi.test:8888/browser/comm/mail/base/test/browser/files/links.html">This page, but on mochi.test</a></li>
</ul>
<h2 id="hash">This is the hash target!</h2>
</body>
</html>