mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1517029: Fail favicon requests when encountering an icon that requires credentials. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D15768 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
db7545da18
commit
1c728fbeac
11
browser/base/content/test/favicons/auth_test.html
Normal file
11
browser/base/content/test/favicons/auth_test.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>Favicon Test for http auth</title>
|
||||
<link rel="icon" type="image/png" href="auth_test.png" />
|
||||
</head>
|
||||
<body>
|
||||
Favicon!!
|
||||
</body>
|
||||
</html>
|
0
browser/base/content/test/favicons/auth_test.png
Normal file
0
browser/base/content/test/favicons/auth_test.png
Normal file
@ -0,0 +1,2 @@
|
||||
HTTP 401 Unauthorized
|
||||
WWW-Authenticate: Basic realm="Favicon auth"
|
@ -70,6 +70,11 @@ support-files =
|
||||
support-files =
|
||||
large_favicon.html
|
||||
large.png
|
||||
[browser_favicon_auth.js]
|
||||
support-files =
|
||||
auth_test.html
|
||||
auth_test.png
|
||||
auth_test.png^headers^
|
||||
[browser_favicon_accept.js]
|
||||
support-files =
|
||||
accept.html
|
||||
|
17
browser/base/content/test/favicons/browser_favicon_auth.js
Normal file
17
browser/base/content/test/favicons/browser_favicon_auth.js
Normal file
@ -0,0 +1,17 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const ROOT = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://mochi.test:8888/");
|
||||
|
||||
add_task(async () => {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, async (browser) => {
|
||||
let faviconPromise = waitForFaviconMessage(true, `${ROOT}auth_test.png`);
|
||||
|
||||
BrowserTestUtils.loadURI(browser, `${ROOT}auth_test.html`);
|
||||
await BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
await Assert.rejects(faviconPromise, result => {
|
||||
return result.iconURL == `${ROOT}auth_test.png`;
|
||||
}, "Should have failed to load the icon.");
|
||||
});
|
||||
});
|
@ -117,6 +117,10 @@ class FaviconLoad {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.channel instanceof Ci.nsIHttpChannelInternal) {
|
||||
this.channel.blockAuthPrompt = true;
|
||||
}
|
||||
|
||||
if (Services.prefs.getBoolPref("network.http.tailing.enabled", true) &&
|
||||
this.channel instanceof Ci.nsIClassOfService) {
|
||||
this.channel.addClassFlags(Ci.nsIClassOfService.Tail | Ci.nsIClassOfService.Throttleable);
|
||||
|
Loading…
Reference in New Issue
Block a user