зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1043801: tracking protection notifications show up in the generic security notification doorhanger, interactions with permissionManager to disable/enable tracking protection for a page r=adw
This commit is contained in:
Родитель
07f24d71aa
Коммит
7c0ff43850
|
@ -6488,9 +6488,13 @@ var gIdentityHandler = {
|
|||
// Show the doorhanger when:
|
||||
// - mixed active content is blocked
|
||||
// - mixed active content is loaded (detected but not blocked)
|
||||
// - tracking content is blocked
|
||||
// - tracking content is not blocked
|
||||
if (state &
|
||||
(nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT |
|
||||
nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT)) {
|
||||
nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT |
|
||||
nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT |
|
||||
nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {
|
||||
this.showBadContentDoorhanger(state);
|
||||
}
|
||||
},
|
||||
|
@ -6513,7 +6517,9 @@ var gIdentityHandler = {
|
|||
// default
|
||||
let iconState = "bad-content-blocked-notification-icon";
|
||||
|
||||
if (state & Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT) {
|
||||
if (state &
|
||||
(Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT |
|
||||
Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {
|
||||
iconState = "bad-content-unblocked-notification-icon";
|
||||
}
|
||||
|
||||
|
|
|
@ -1628,6 +1628,43 @@
|
|||
</xul:description>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
<!-- tracking content -->
|
||||
<xul:vbox anonid="trackingContent" hidden="true">
|
||||
<xul:separator class="groove"/>
|
||||
<xul:hbox align="start">
|
||||
<xul:vbox>
|
||||
<xul:description class="popup-notification-item-title"
|
||||
xbl:inherits="popupid">
|
||||
&trackingContentBlocked.message;
|
||||
</xul:description>
|
||||
<xul:description class="popup-notification-item-message"
|
||||
xbl:inherits="popupid">
|
||||
&trackingContentBlocked.moreinfo;
|
||||
</xul:description>
|
||||
<xul:label anonid="trackingContent.helplink"
|
||||
class="text-link plain" href=""
|
||||
value="&trackingContentBlocked.learnMore;"/>
|
||||
</xul:vbox>
|
||||
<xul:button
|
||||
type="menu" label="&trackingContentBlocked.options;"
|
||||
sizetopopup="none">
|
||||
<xul:menupopup>
|
||||
<xul:menuitem anonid="trackingContentAction.unblock"
|
||||
hidden="true" label="&trackingContentBlocked.unblock.label;"
|
||||
oncommand="document.getBindingParent(this).disableTrackingContentProtection();"/>
|
||||
<xul:menuitem anonid="trackingContentAction.block"
|
||||
hidden="true" label="&trackingContentBlocked.block.label;"
|
||||
oncommand="document.getBindingParent(this).enableTrackingContentProtection();"/>
|
||||
</xul:menupopup>
|
||||
</xul:button>
|
||||
</xul:hbox>
|
||||
<xul:hbox anonid="trackingContentProtectionDisabled" hidden="true"
|
||||
class="popup-notification-footer" xbl:inherits="popupid">
|
||||
<xul:description class="popup-notification-item-message popup-notification-item-message-critical" xbl:inherits="popupid">
|
||||
&trackingContentBlocked.disabled.message;
|
||||
</xul:description>
|
||||
</xul:hbox>
|
||||
</xul:vbox>
|
||||
</xul:vbox>
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
@ -1668,6 +1705,32 @@
|
|||
Ci.nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
|
||||
]]></getter>
|
||||
</property>
|
||||
<field name="_trackingContent">
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"trackingContent")
|
||||
</field>
|
||||
<field name="_trackingContentUnblock">
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"trackingContentAction.unblock")
|
||||
</field>
|
||||
<field name="_trackingContentBlock">
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"trackingContentAction.block");
|
||||
</field>
|
||||
<field name="_trackingContentProtectionDisabledWarning">
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"trackingContentProtectionDisabled")
|
||||
</field>
|
||||
<field name="_trackingContentHelpLink">
|
||||
document.getAnonymousElementByAttribute(this, "anonid",
|
||||
"trackingContent.helplink")
|
||||
</field>
|
||||
<property name="isTrackingContentBlocked" readonly="true">
|
||||
<getter><![CDATA[
|
||||
return this.notification.options.state &
|
||||
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT;
|
||||
]]></getter>
|
||||
</property>
|
||||
<constructor><![CDATA[
|
||||
// default title
|
||||
_doorhangerTitle.value =
|
||||
|
@ -1694,6 +1757,26 @@
|
|||
Services.urlFormatter.formatURLPref("app.support.baseURL")
|
||||
+ "mixed-content";
|
||||
}
|
||||
if (this.notification.options.state &
|
||||
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) {
|
||||
_doorhangerTitle.value =
|
||||
gNavigatorBundle.getFormattedString(
|
||||
"badContentBlocked.blocked.message", [this._brandShortName]);
|
||||
_trackingContent.hidden = false
|
||||
_trackingContentUnblock.hidden = false;
|
||||
_trackingContentHelpLink.href =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL")
|
||||
+ "tracking-protection";
|
||||
}
|
||||
if (this.notification.options.state &
|
||||
Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) {
|
||||
_trackingContent.hidden = false
|
||||
_trackingContentBlock.hidden = false;
|
||||
_trackingContentProtectionDisabledWarning.hidden = false;
|
||||
_trackingContentHelpLink.href =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL")
|
||||
+ "tracking-protection";
|
||||
}
|
||||
]]></constructor>
|
||||
<method name="disableMixedContentProtection">
|
||||
<body><![CDATA[
|
||||
|
@ -1715,6 +1798,32 @@
|
|||
BrowserReload();
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="disableTrackingContentProtection">
|
||||
<body><![CDATA[
|
||||
// convert document URI into the format used by
|
||||
// nsChannelClassifier::ShouldEnableTrackingProtection
|
||||
// (any scheme turned into https is correct)
|
||||
let normalizedUrl = Services.io.newURI(
|
||||
"https://" + gBrowser.selectedBrowser.currentURI.hostPort,
|
||||
null, null);
|
||||
// Add the current host in the 'trackingprotection' consumer of
|
||||
// the permission manager using a normalized URI. This effectively
|
||||
// places this host on the tracking protection white list.
|
||||
Services.perms.add(normalizedUrl,
|
||||
"trackingprotection", Services.perms.ALLOW_ACTION);
|
||||
BrowserReload();
|
||||
]]></body>
|
||||
</method>
|
||||
<method name="enableTrackingContentProtection">
|
||||
<body><![CDATA[
|
||||
// Remove the current host from the 'trackingprotection' consumer
|
||||
// of the permission manager. This effectively removes this host
|
||||
// from the tracking protection white list (any list actually).
|
||||
Services.perms.remove(gBrowser.selectedBrowser.currentURI.host,
|
||||
"trackingprotection");
|
||||
BrowserReload();
|
||||
]]></body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
|
|
@ -737,6 +737,14 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
|||
<!ENTITY mixedContentBlocked2.block.accesskey "B">
|
||||
<!ENTITY mixedContentBlocked2.disabled.message "Protection is disabled">
|
||||
|
||||
<!ENTITY trackingContentBlocked.message "Tracking">
|
||||
<!ENTITY trackingContentBlocked.moreinfo "Parts of the page that track your online activity have been blocked.">
|
||||
<!ENTITY trackingContentBlocked.learnMore "Learn More">
|
||||
<!ENTITY trackingContentBlocked.options "Options">
|
||||
<!ENTITY trackingContentBlocked.unblock.label "Disable protection">
|
||||
<!ENTITY trackingContentBlocked.block.label "Enable protection">
|
||||
<!ENTITY trackingContentBlocked.disabled.message "Tracking protection is disabled">
|
||||
|
||||
<!ENTITY pointerLock.notification.message "Press ESC at any time to show it again.">
|
||||
|
||||
<!ENTITY pluginNotification.showAll.label "Show All">
|
||||
|
|
Загрузка…
Ссылка в новой задаче