зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1551902) for browser-chrome failure at browser/base/content/test/trackingUI/browser_trackingUI_cryptominers.js. On a CLOSED TREE
Backed out changeset 762ba28bc409 (bug 1551902) Backed out changeset 4c8afa61cbec (bug 1551902) Backed out changeset 212cfe3c1893 (bug 1551902) Backed out changeset 29cbb321a610 (bug 1551902)
This commit is contained in:
Родитель
667d23bec1
Коммит
80149d9771
|
@ -816,11 +816,6 @@ var ContentBlocking = {
|
|||
return this.identityPopup = document.getElementById("identity-popup");
|
||||
},
|
||||
|
||||
get protectionsPopup() {
|
||||
delete this.protectionsPopup;
|
||||
return this.protectionsPopup = document.getElementById("protections-popup");
|
||||
},
|
||||
|
||||
strings: {
|
||||
get appMenuTitle() {
|
||||
delete this.appMenuTitle;
|
||||
|
@ -1093,18 +1088,6 @@ var ContentBlocking = {
|
|||
if (!baseURI) {
|
||||
return;
|
||||
}
|
||||
|
||||
let isBrowserPrivate = PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser);
|
||||
|
||||
// Check whether the user has added an exception for this site.
|
||||
let type = isBrowserPrivate ? "trackingprotection-pb" : "trackingprotection";
|
||||
let hasException = Services.perms.testExactPermission(baseURI, type) ==
|
||||
Services.perms.ALLOW_ACTION;
|
||||
|
||||
this.content.toggleAttribute("hasException", hasException);
|
||||
this.protectionsPopup.toggleAttribute("hasException", hasException);
|
||||
this.iconBox.toggleAttribute("hasException", hasException);
|
||||
|
||||
// Add to telemetry per page load as a baseline measurement.
|
||||
this.fingerprintersHistogramAdd("pageLoad");
|
||||
this.cryptominersHistogramAdd("pageLoad");
|
||||
|
@ -1142,7 +1125,7 @@ var ContentBlocking = {
|
|||
let isBrowserPrivate = PrivateBrowsingUtils.isBrowserPrivate(gBrowser.selectedBrowser);
|
||||
|
||||
// Check whether the user has added an exception for this site.
|
||||
let type = isBrowserPrivate ? "trackingprotection-pb" : "trackingprotection";
|
||||
let type = isBrowserPrivate ? "trackingprotection-pb" : "trackingprotection";
|
||||
let hasException = Services.perms.testExactPermission(baseURI, type) ==
|
||||
Services.perms.ALLOW_ACTION;
|
||||
|
||||
|
@ -1174,11 +1157,9 @@ var ContentBlocking = {
|
|||
// occurs on the page. Note that merely allowing the loading of content that
|
||||
// we could have blocked does not trigger the appearance of the shield.
|
||||
// This state will be overriden later if there's an exception set for this site.
|
||||
for (let elt of [this.content, this.protectionsPopup]) {
|
||||
elt.toggleAttribute("detected", anyDetected);
|
||||
elt.toggleAttribute("blocking", anyBlocking);
|
||||
elt.toggleAttribute("hasException", hasException);
|
||||
}
|
||||
this.content.toggleAttribute("detected", anyDetected);
|
||||
this.content.toggleAttribute("blocking", anyBlocking);
|
||||
this.content.toggleAttribute("hasException", hasException);
|
||||
|
||||
this.iconBox.toggleAttribute("active", anyBlocking);
|
||||
this.iconBox.toggleAttribute("hasException", hasException);
|
||||
|
|
|
@ -22,11 +22,6 @@ var gProtectionsHandler = {
|
|||
return this._protectionsPopupMainViewHeaderLabel =
|
||||
document.getElementById("protections-popup-mainView-panel-header-span");
|
||||
},
|
||||
get _protectionsPopupTPSwitch() {
|
||||
delete this._protectionsPopupTPSwitch;
|
||||
return this._protectionsPopupTPSwitch =
|
||||
document.getElementById("protections-popup-tp-switch");
|
||||
},
|
||||
|
||||
handleProtectionsButtonEvent(event) {
|
||||
event.stopPropagation();
|
||||
|
@ -50,77 +45,12 @@ var gProtectionsHandler = {
|
|||
}).catch(Cu.reportError);
|
||||
},
|
||||
|
||||
onPopupShown(event) {
|
||||
if (event.target == this._protectionsPopup) {
|
||||
window.addEventListener("focus", this, true);
|
||||
}
|
||||
},
|
||||
|
||||
onPopupHidden(event) {
|
||||
if (event.target == this._protectionsPopup) {
|
||||
window.removeEventListener("focus", this, true);
|
||||
this._protectionsPopup.removeAttribute("open");
|
||||
}
|
||||
},
|
||||
|
||||
handleEvent(event) {
|
||||
let elem = document.activeElement;
|
||||
let position = elem.compareDocumentPosition(this._protectionsPopup);
|
||||
|
||||
if (!(position & (Node.DOCUMENT_POSITION_CONTAINS |
|
||||
Node.DOCUMENT_POSITION_CONTAINED_BY)) &&
|
||||
!this._protectionsPopup.hasAttribute("noautohide")) {
|
||||
// Hide the panel when focusing an element that is
|
||||
// neither an ancestor nor descendant unless the panel has
|
||||
// @noautohide (e.g. for a tour).
|
||||
PanelMultiView.hidePopup(this._protectionsPopup);
|
||||
}
|
||||
},
|
||||
|
||||
refreshProtectionsPopup() {
|
||||
// Refresh the state of the TP toggle switch.
|
||||
this._protectionsPopupTPSwitch.toggleAttribute("enabled",
|
||||
!this._protectionsPopup.hasAttribute("hasException"));
|
||||
|
||||
let host = gIdentityHandler.getHostForDisplay();
|
||||
|
||||
// Push the appropriate strings out to the UI.
|
||||
this._protectionsPopupMainViewHeaderLabel.textContent =
|
||||
// gNavigatorBundle.getFormattedString("protections.header", [host]);
|
||||
`Tracking Protections for ${host}`;
|
||||
|
||||
let currentlyEnabled =
|
||||
!this._protectionsPopup.hasAttribute("hasException");
|
||||
|
||||
this._protectionsPopupTPSwitch.toggleAttribute("enabled", currentlyEnabled);
|
||||
},
|
||||
|
||||
async onTPSwitchCommand(event) {
|
||||
// When the switch is clicked, we wait 500ms and then disable/enable
|
||||
// protections, causing the page to refresh, and close the popup.
|
||||
// We need to ensure we don't handle more clicks during the 500ms delay,
|
||||
// so we keep track of state and return early if needed.
|
||||
if (this._TPSwitchCommanding) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._TPSwitchCommanding = true;
|
||||
|
||||
let currentlyEnabled =
|
||||
!this._protectionsPopup.hasAttribute("hasException");
|
||||
|
||||
this._protectionsPopupTPSwitch.toggleAttribute("enabled", !currentlyEnabled);
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
||||
if (currentlyEnabled) {
|
||||
ContentBlocking.disableForCurrentPage();
|
||||
gIdentityHandler.recordClick("unblock");
|
||||
} else {
|
||||
ContentBlocking.enableForCurrentPage();
|
||||
gIdentityHandler.recordClick("block");
|
||||
}
|
||||
|
||||
PanelMultiView.hidePopup(this._protectionsPopup);
|
||||
delete this._TPSwitchCommanding;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/browser-test"
|
||||
]
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
head.js
|
||||
|
||||
[browser_protections_UI.js]
|
|
@ -1,19 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* Basic UI tests for the protections panel */
|
||||
|
||||
add_task(async function testToggleSwitch() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "https://example.com");
|
||||
await openProtectionsPanel();
|
||||
ok(gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("enabled"), "TP Switch should be enabled");
|
||||
let popuphiddenPromise = BrowserTestUtils.waitForEvent(protectionsPopup, "popuphidden");
|
||||
let browserLoadedPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
||||
gProtectionsHandler._protectionsPopupTPSwitch.click();
|
||||
await popuphiddenPromise;
|
||||
await browserLoadedPromise;
|
||||
await openProtectionsPanel();
|
||||
ok(!gProtectionsHandler._protectionsPopupTPSwitch.hasAttribute("enabled"), "TP Switch should be disabled");
|
||||
Services.perms.remove(ContentBlocking._baseURIForChannelClassifier, "trackingprotection");
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var protectionsPopup = document.getElementById("protections-popup");
|
||||
|
||||
async function openProtectionsPanel() {
|
||||
let popupShownPromise = BrowserTestUtils.waitForEvent(protectionsPopup, "popupshown");
|
||||
let identityBox = document.getElementById("identity-box");
|
||||
EventUtils.synthesizeMouseAtCenter(identityBox, { metaKey: true });
|
||||
await popupShownPromise;
|
||||
}
|
|
@ -46,7 +46,6 @@ BROWSER_CHROME_MANIFESTS += [
|
|||
'content/test/sanitize/browser.ini',
|
||||
'content/test/sidebar/browser.ini',
|
||||
'content/test/siteIdentity/browser.ini',
|
||||
'content/test/siteProtections/browser.ini',
|
||||
'content/test/static/browser.ini',
|
||||
'content/test/statuspanel/browser.ini',
|
||||
'content/test/sync/browser.ini',
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
hidden="true"
|
||||
photon="true"
|
||||
role="alertdialog"
|
||||
onpopupshown="gProtectionsHandler.onPopupShown(event);"
|
||||
onpopuphidden="gProtectionsHandler.onPopupHidden(event);"
|
||||
orient="vertical">
|
||||
|
||||
<panelmultiview id="protections-popup-multiView"
|
||||
|
@ -21,18 +19,11 @@
|
|||
</label>
|
||||
</vbox>
|
||||
|
||||
<hbox id="protections-popup-tp-switch-section" class="identity-popup-section">
|
||||
<vbox id="protections-popup-tp-switch-label-box" flex="1">
|
||||
<label id="protections-popup-tp-switch-on-header">Tracking protection is ON for this site</label>
|
||||
<label id="protections-popup-tp-switch-off-header">Tracking protection is OFF for this site</label>
|
||||
<label id="protections-popup-tp-switch-breakage-link" class="text-link">Site not working?</label>
|
||||
</vbox>
|
||||
<vbox id="protections-popup-tp-switch-box">
|
||||
<toolbarbutton id="protections-popup-tp-switch"
|
||||
enabled="false"
|
||||
oncommand="gProtectionsHandler.onTPSwitchCommand();" />
|
||||
</vbox>
|
||||
</hbox>
|
||||
<vbox id="protections-popup-placeholder" class="identity-popup-section">
|
||||
<label>
|
||||
<html:h2>Watch this space! :)</html:h2>
|
||||
</label>
|
||||
</vbox>
|
||||
</panelview>
|
||||
</panelmultiview>
|
||||
</panel>
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
|
||||
/* Make sure hidden elements don't accidentally become visible from one of the
|
||||
above selectors (see Bug 1194258) */
|
||||
#identity-popup [hidden] {
|
||||
#identity-popup [hidden],
|
||||
#protections-popup [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
@ -781,71 +782,3 @@ description#identity-popup-content-verifier,
|
|||
.identity-popup-permission-remove-button:not(:-moz-focusring):hover:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch-label-box > label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#protections-popup:not([hasException]) #protections-popup-tp-switch-on-header,
|
||||
#protections-popup:not([hasException]) #protections-popup-tp-switch-breakage-link,
|
||||
#protections-popup[hasException] #protections-popup-tp-switch-off-header {
|
||||
display: unset;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch-section {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch-label-box,
|
||||
#protections-popup-tp-switch-box {
|
||||
padding: 4px 1em;
|
||||
min-height: 40px;
|
||||
-moz-box-pack: center;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch-on-header,
|
||||
#protections-popup-tp-switch-off-header {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch {
|
||||
-moz-appearance: none;
|
||||
box-sizing: border-box;
|
||||
min-width: 26px;
|
||||
border-radius: 10px;
|
||||
background-color: var(--arrowpanel-dimmed-even-further);
|
||||
border: 1px solid transparent;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
margin-inline-start: 1px;
|
||||
margin-inline-end: 7px;
|
||||
padding: 2px;
|
||||
transition: padding .2s ease;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch::before {
|
||||
position: relative;
|
||||
display: block;
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 10px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch[enabled] {
|
||||
background-color: #0a84ff;
|
||||
border: 1px solid #0a84ff;
|
||||
/* Push the toggle to the right. */
|
||||
padding-inline-start: 12px;
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch:hover,
|
||||
#protections-popup-tp-switch:-moz-focusring {
|
||||
border: 1px solid var(--panel-separator-color);
|
||||
}
|
||||
|
||||
#protections-popup-tp-switch[enabled=true]:hover,
|
||||
#protections-popup-tp-switch[enabled=true]:-moz-focusring {
|
||||
background-color: #45a1ff;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче