зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329210 - Hide the permission reload hint when the control center is reopened. r=florian
MozReview-Commit-ID: Fb6ZEeYIJHG --HG-- extra : rebase_source : 3d9fc16b3cfffe6c2a5adef2537ad9dd9b47cb48
This commit is contained in:
Родитель
e0653aa27c
Коммит
1a6470f3a1
|
@ -6605,11 +6605,6 @@ var gIdentityHandler = {
|
||||||
*/
|
*/
|
||||||
_state: 0,
|
_state: 0,
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether a permission is just removed from permission list.
|
|
||||||
*/
|
|
||||||
_permissionJustRemoved: false,
|
|
||||||
|
|
||||||
get _isBroken() {
|
get _isBroken() {
|
||||||
return this._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
|
return this._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
|
||||||
},
|
},
|
||||||
|
@ -7304,6 +7299,9 @@ var gIdentityHandler = {
|
||||||
// the popup is actually needed
|
// the popup is actually needed
|
||||||
this._identityPopup.hidden = false;
|
this._identityPopup.hidden = false;
|
||||||
|
|
||||||
|
// Remove the reload hint that we show after a user has cleared a permission.
|
||||||
|
this._permissionReloadHint.setAttribute("hidden", "true");
|
||||||
|
|
||||||
// Update the popup strings
|
// Update the popup strings
|
||||||
this.refreshIdentityPopup();
|
this.refreshIdentityPopup();
|
||||||
|
|
||||||
|
@ -7364,21 +7362,10 @@ var gIdentityHandler = {
|
||||||
},
|
},
|
||||||
|
|
||||||
onLocationChange() {
|
onLocationChange() {
|
||||||
this._permissionJustRemoved = false;
|
this._permissionReloadHint.setAttribute("hidden", "true");
|
||||||
this.updatePermissionHint();
|
|
||||||
},
|
|
||||||
|
|
||||||
updatePermissionHint() {
|
if (!this._permissionList.hasChildNodes()) {
|
||||||
if (!this._permissionList.hasChildNodes() && !this._permissionJustRemoved) {
|
|
||||||
this._permissionEmptyHint.removeAttribute("hidden");
|
this._permissionEmptyHint.removeAttribute("hidden");
|
||||||
} else {
|
|
||||||
this._permissionEmptyHint.setAttribute("hidden", "true");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this._permissionJustRemoved) {
|
|
||||||
this._permissionReloadHint.removeAttribute("hidden");
|
|
||||||
} else {
|
|
||||||
this._permissionReloadHint.setAttribute("hidden", "true");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -7418,7 +7405,13 @@ var gIdentityHandler = {
|
||||||
this._permissionList.appendChild(item);
|
this._permissionList.appendChild(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updatePermissionHint();
|
// Show a placeholder text if there's no permission and no reload hint.
|
||||||
|
if (!this._permissionList.hasChildNodes() &&
|
||||||
|
this._permissionReloadHint.hasAttribute("hidden")) {
|
||||||
|
this._permissionEmptyHint.removeAttribute("hidden");
|
||||||
|
} else {
|
||||||
|
this._permissionEmptyHint.setAttribute("hidden", "true");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleHeightChange(aFunction, aWillShowReloadHint) {
|
_handleHeightChange(aFunction, aWillShowReloadHint) {
|
||||||
|
@ -7464,8 +7457,9 @@ var gIdentityHandler = {
|
||||||
let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
|
let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
|
||||||
button.setAttribute("tooltiptext", tooltiptext);
|
button.setAttribute("tooltiptext", tooltiptext);
|
||||||
button.addEventListener("command", () => {
|
button.addEventListener("command", () => {
|
||||||
this._handleHeightChange(() =>
|
// Only resize the window if the reload hint was previously hidden.
|
||||||
this._permissionList.removeChild(container), !this._permissionJustRemoved);
|
this._handleHeightChange(() => this._permissionList.removeChild(container),
|
||||||
|
this._permissionReloadHint.hasAttribute("hidden"));
|
||||||
if (aPermission.inUse &&
|
if (aPermission.inUse &&
|
||||||
["camera", "microphone", "screen"].includes(aPermission.id)) {
|
["camera", "microphone", "screen"].includes(aPermission.id)) {
|
||||||
let windowId = this._sharingState.windowId;
|
let windowId = this._sharingState.windowId;
|
||||||
|
@ -7490,8 +7484,8 @@ var gIdentityHandler = {
|
||||||
mm.sendAsyncMessage("webrtc:StopSharing", windowId);
|
mm.sendAsyncMessage("webrtc:StopSharing", windowId);
|
||||||
}
|
}
|
||||||
SitePermissions.remove(gBrowser.currentURI, aPermission.id);
|
SitePermissions.remove(gBrowser.currentURI, aPermission.id);
|
||||||
this._permissionJustRemoved = true;
|
|
||||||
this.updatePermissionHint();
|
this._permissionReloadHint.removeAttribute("hidden");
|
||||||
|
|
||||||
// Set telemetry values for clearing a permission
|
// Set telemetry values for clearing a permission
|
||||||
let histogram = Services.telemetry.getKeyedHistogramById("WEB_PERMISSION_CLEARED");
|
let histogram = Services.telemetry.getKeyedHistogramById("WEB_PERMISSION_CLEARED");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче