зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1eba4a29505b (bug 1557792) for bc failures on browser_html_detail_view.js
This commit is contained in:
Родитель
337355aa9c
Коммит
d8ed2da007
|
@ -310,10 +310,6 @@ addon-details {
|
|||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.addon-detail-row-has-help[hidden] + .addon-detail-help-row {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.addon-detail-row input[type="checkbox"] {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-row-has-help addon-detail-row-private-browsing" hidden>
|
||||
<div class="addon-detail-row addon-detail-row-has-help addon-detail-row-private-browsing">
|
||||
<label data-l10n-id="detail-private-browsing-label"></label>
|
||||
<div>
|
||||
<label>
|
||||
|
@ -153,18 +153,6 @@
|
|||
<div class="addon-detail-row addon-detail-help-row" data-l10n-id="addon-detail-private-browsing-help">
|
||||
<a target="_blank" data-l10n-name="learn-more"></a>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-row-has-help addon-detail-row-private-browsing-disallowed" hidden>
|
||||
<label data-l10n-id="detail-private-disallowed-label"></label>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-help-row" data-l10n-id="detail-private-disallowed-description">
|
||||
<label class="text-link" data-l10n-name="detail-private-browsing-learn-more" data-l10n-args="action" action="pb-learn-more"></label>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-row-has-help addon-detail-row-private-browsing-required" hidden>
|
||||
<label class="learn-more-label-link" data-l10n-id="detail-private-required-label"></label>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-help-row" data-l10n-id="detail-private-required-description">
|
||||
<label class="text-link" data-l10n-name="detail-private-browsing-learn-more" data-l10n-args="action" action="pb-learn-more"></label>
|
||||
</div>
|
||||
<div class="addon-detail-row addon-detail-row-author">
|
||||
<label data-l10n-id="addon-detail-author-label"></label>
|
||||
<a target="_blank" data-telemetry-name="author"></a>
|
||||
|
|
|
@ -63,7 +63,6 @@ const PERMISSION_MASKS = {
|
|||
"never-activate": AddonManager.PERM_CAN_DISABLE,
|
||||
uninstall: AddonManager.PERM_CAN_UNINSTALL,
|
||||
upgrade: AddonManager.PERM_CAN_UPGRADE,
|
||||
"change-privatebrowsing": AddonManager.PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS,
|
||||
};
|
||||
|
||||
const PREF_DISCOVERY_API_URL = "extensions.getAddons.discovery.api_url";
|
||||
|
@ -1281,26 +1280,19 @@ class AddonDetails extends HTMLElement {
|
|||
this.querySelector(".addon-detail-row-updates").hidden =
|
||||
!hasPermission(addon, "upgrade");
|
||||
|
||||
// By default, all private browsing rows are hidden. Possibly show one.
|
||||
let pbRow = this.querySelector(".addon-detail-row-private-browsing");
|
||||
let pbRowNotAllowed =
|
||||
this.querySelector(".addon-detail-row-private-browsing-disallowed");
|
||||
let pbRowRequired =
|
||||
this.querySelector(".addon-detail-row-private-browsing-required");
|
||||
if (allowPrivateBrowsingByDefault || addon.type != "extension") {
|
||||
// All add-addons of this type are allowed in private browsing mode, so
|
||||
// do not show any UI.
|
||||
} else if (addon.incognito == "not_allowed") {
|
||||
pbRowNotAllowed.hidden = false;
|
||||
} else if (!hasPermission(addon, "change-privatebrowsing")) {
|
||||
pbRowRequired.hidden = false;
|
||||
} else {
|
||||
pbRow.hidden = false;
|
||||
if (!allowPrivateBrowsingByDefault && addon.type == "extension" &&
|
||||
addon.incognito != "not_allowed") {
|
||||
let isAllowed = await isAllowedInPrivateBrowsing(addon);
|
||||
pbRow.querySelector(`[value="${isAllowed ? 1 : 0}"]`).checked = true;
|
||||
let learnMore = pbRow.nextElementSibling
|
||||
.querySelector('a[data-l10n-name="learn-more"]');
|
||||
learnMore.href = SUPPORT_URL + "extensions-pb";
|
||||
} else {
|
||||
// Remove the help row, which is right after the settings.
|
||||
pbRow.nextElementSibling.hidden = true;
|
||||
// Then remove the actual settings.
|
||||
pbRow.hidden = true;
|
||||
}
|
||||
|
||||
// Author.
|
||||
|
@ -1566,10 +1558,6 @@ class AddonCard extends HTMLElement {
|
|||
e.target.getAttribute("url"), "tab");
|
||||
}
|
||||
break;
|
||||
case "pb-learn-more":
|
||||
windowRoot.ownerGlobal.openTrustedLinkIn(
|
||||
SUPPORT_URL + "extensions-pb", "tab");
|
||||
break;
|
||||
default:
|
||||
// Handle a click on the card itself.
|
||||
if (!this.expanded) {
|
||||
|
|
|
@ -91,7 +91,6 @@ function checkIsModifiable(expected) {
|
|||
} else {
|
||||
is_element_hidden(getHtmlElem(".addon-detail-row-private-browsing"), "Private browsing should be hidden");
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
|
@ -106,12 +105,10 @@ function checkIsModifiable(expected) {
|
|||
// Check whether the details view shows that private browsing is forcibly disallowed.
|
||||
function checkIsDisallowed(expected) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
// TODO bug 1557792: Show when private browsing is forcibly disallowed.
|
||||
if (expected) {
|
||||
is_element_visible(getHtmlElem(".addon-detail-row-private-browsing-disallowed"), "Private browsing should be disallowed");
|
||||
} else {
|
||||
is_element_hidden(getHtmlElem(".addon-detail-row-private-browsing-disallowed"), "Private browsing should not be disallowed");
|
||||
is_element_hidden(getHtmlElem(".addon-detail-row-private-browsing"), "Private browsing cannot both be allowed and disallowed");
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-disallowed", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
|
@ -126,12 +123,10 @@ function checkIsDisallowed(expected) {
|
|||
// Check whether the details view shows that private browsing is forcibly allowed.
|
||||
function checkIsRequired(expected) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
// TODO bug 1557792: Show when private browsing is forcibly allowed.
|
||||
if (expected) {
|
||||
is_element_visible(getHtmlElem(".addon-detail-row-private-browsing-required"), "Private browsing should be required");
|
||||
} else {
|
||||
is_element_hidden(getHtmlElem(".addon-detail-row-private-browsing-required"), "Private browsing should not be required");
|
||||
is_element_hidden(getHtmlElem(".addon-detail-row-private-browsing"), "Private browsing cannot both be mutable and required");
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-required", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
|
@ -143,16 +138,6 @@ function checkIsRequired(expected) {
|
|||
}
|
||||
}
|
||||
|
||||
function checkHelpRow(selector, expected) {
|
||||
let helpRow = getHtmlElem(`${selector} + .addon-detail-help-row`);
|
||||
if (expected) {
|
||||
is_element_visible(helpRow, `Help row should be shown: ${selector}`);
|
||||
is_element_visible(helpRow.querySelector("a, [action='pb-learn-more']"), "Expected learn more link");
|
||||
} else {
|
||||
is_element_hidden(helpRow, `Help row should be hidden: ${selector}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function hasPrivateAllowed(id) {
|
||||
let perms = await ExtensionPermissions.get(id);
|
||||
return perms.permissions.length == 1 &&
|
||||
|
@ -506,48 +491,9 @@ async function test_addon_postinstall_incognito_hidden_checkbox(withHtmlViews) {
|
|||
|
||||
await addon.uninstall();
|
||||
}
|
||||
|
||||
// It is not possible to create a privileged add-on and install it, so just
|
||||
// simulate an installed privileged add-on and check the UI.
|
||||
await test_incognito_of_privileged_addons();
|
||||
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
}
|
||||
|
||||
// Checks that the private browsing flag of privileged add-ons cannot be modified.
|
||||
async function test_incognito_of_privileged_addons() {
|
||||
// In mochitests it is not possible to create and install a privileged add-on
|
||||
// or a system add-on, so create a mock provider that simulates privileged
|
||||
// add-ons (which lack the PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS permission).
|
||||
let provider = new MockProvider();
|
||||
provider.createAddons([{
|
||||
name: "default incognito",
|
||||
id: "default-incognito@mock",
|
||||
incognito: "spanning", // This is the default.
|
||||
// Anything without the PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS permission.
|
||||
permissions: 0,
|
||||
}, {
|
||||
name: "not_allowed incognito",
|
||||
id: "not-allowed-incognito@mock",
|
||||
incognito: "not_allowed",
|
||||
// Anything without the PERM_CAN_CHANGE_PRIVATEBROWSING_ACCESS permission.
|
||||
permissions: 0,
|
||||
}]);
|
||||
|
||||
gManagerWindow = await open_manager("addons://detail/default-incognito%40mock");
|
||||
checkIsModifiable(false);
|
||||
checkIsRequired(true);
|
||||
checkIsDisallowed(false);
|
||||
await close_manager(gManagerWindow);
|
||||
|
||||
gManagerWindow = await open_manager("addons://detail/not-allowed-incognito%40mock");
|
||||
checkIsModifiable(false);
|
||||
checkIsRequired(false);
|
||||
checkIsDisallowed(true);
|
||||
await close_manager(gManagerWindow);
|
||||
|
||||
provider.unregister();
|
||||
}
|
||||
|
||||
add_task(async function test_badge_and_toggle_incognito_on_XUL_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
|
|
Загрузка…
Ссылка в новой задаче