mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1470020 - Part 4 - Don't handle Tracking Protection UI on file: and about: URIs. r=florian
... because these URIs are incompatible with TP. We now show it on moz-extension: instead, which was forgotten previously. This should probably have been in its own separate bug, but the changes in bug 1470020 surfaced this issue by throwing a lot of console errors when the baseURI was accessed, so I didn't want to defer the fix. MozReview-Commit-ID: 8KNV0oabv7Y --HG-- extra : rebase_source : b6aae33385ed3166c59c0c8733de0a9609f05d92
This commit is contained in:
parent
6d3223de0f
commit
3fe5e7fa6c
@ -19,7 +19,13 @@ var TrackingProtection = {
|
|||||||
// Convert document URI into the format used by
|
// Convert document URI into the format used by
|
||||||
// nsChannelClassifier::ShouldEnableTrackingProtection.
|
// nsChannelClassifier::ShouldEnableTrackingProtection.
|
||||||
// Any scheme turned into https is correct.
|
// Any scheme turned into https is correct.
|
||||||
return Services.io.newURI("https://" + gBrowser.selectedBrowser.currentURI.hostPort);
|
try {
|
||||||
|
return Services.io.newURI("https://" + gBrowser.selectedBrowser.currentURI.hostPort);
|
||||||
|
} catch (e) {
|
||||||
|
// Getting the hostPort for about: and file: URIs fails, but TP doesn't work with
|
||||||
|
// these URIs anyway, so just return null here.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@ -133,6 +139,13 @@ var TrackingProtection = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onSecurityChange(state, isSimulated) {
|
onSecurityChange(state, isSimulated) {
|
||||||
|
let baseURI = this._baseURIForChannelClassifier;
|
||||||
|
|
||||||
|
// Don't deal with about:, file: etc.
|
||||||
|
if (!baseURI) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only animate the shield if the event was not fired directly from
|
// Only animate the shield if the event was not fired directly from
|
||||||
// the tabbrowser (due to a browser change).
|
// the tabbrowser (due to a browser change).
|
||||||
if (isSimulated) {
|
if (isSimulated) {
|
||||||
@ -147,9 +160,9 @@ var TrackingProtection = {
|
|||||||
// Check whether the user has added an exception for this site.
|
// Check whether the user has added an exception for this site.
|
||||||
let hasException = false;
|
let hasException = false;
|
||||||
if (PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser)) {
|
if (PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser)) {
|
||||||
hasException = PrivateBrowsingUtils.existsInTrackingAllowlist(this._baseURIForChannelClassifier);
|
hasException = PrivateBrowsingUtils.existsInTrackingAllowlist(baseURI);
|
||||||
} else {
|
} else {
|
||||||
hasException = Services.perms.testExactPermission(this._baseURIForChannelClassifier,
|
hasException = Services.perms.testExactPermission(baseURI,
|
||||||
"trackingprotection") == Services.perms.ALLOW_ACTION;
|
"trackingprotection") == Services.perms.ALLOW_ACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<!-- Tracking Protection Section -->
|
<!-- Tracking Protection Section -->
|
||||||
<hbox id="tracking-protection-container"
|
<hbox id="tracking-protection-container"
|
||||||
class="identity-popup-section"
|
class="identity-popup-section"
|
||||||
when-connection="not-secure secure secure-ev secure-cert-user-overridden file">
|
when-connection="not-secure secure secure-ev secure-cert-user-overridden extension">
|
||||||
<vbox id="tracking-protection-content" flex="1">
|
<vbox id="tracking-protection-content" flex="1">
|
||||||
<hbox class="identity-popup-preferences-button-container">
|
<hbox class="identity-popup-preferences-button-container">
|
||||||
<label id="tracking-protection-label-on"
|
<label id="tracking-protection-label-on"
|
||||||
|
Loading…
Reference in New Issue
Block a user