Bug 1331921 - Hide temporary permissions on tab reload through the context menu. r=florian

MozReview-Commit-ID: 6CbhisP94PT

--HG--
extra : rebase_source : dbaa327bb39b1be5b28cd9dd6086d1b5341a2e99
This commit is contained in:
Johann Hofmann 2017-01-20 10:17:43 +01:00
Родитель 0e917d0bbf
Коммит 66d556d319
2 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -3091,7 +3091,11 @@
<parameter name="aTab"/>
<body>
<![CDATA[
this.getBrowserForTab(aTab).reload();
let browser = this.getBrowserForTab(aTab);
// Reset temporary permissions on the current tab. This is done here
// because we only want to reset permissions on user reload.
SitePermissions.clearTemporaryPermissions(browser);
browser.reload();
]]>
</body>
</method>

Просмотреть файл

@ -35,9 +35,36 @@ add_task(function* testTempPermissionOnReload() {
scope: SitePermissions.SCOPE_TEMPORARY,
});
reloaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec);
// Reload as a user (should remove the temp permission).
EventUtils.synthesizeMouseAtCenter(reloadButton, {});
yield reloaded;
Assert.deepEqual(SitePermissions.get(uri, id, browser), {
state: SitePermissions.UNKNOWN,
scope: SitePermissions.SCOPE_PERSISTENT,
});
// Set the permission again.
SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, browser);
// Open the tab context menu.
let contextMenu = document.getElementById("tabContextMenu");
let popupShownPromise = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
EventUtils.synthesizeMouseAtCenter(gBrowser.selectedTab, {type: "contextmenu", button: 2});
yield popupShownPromise;
let reloadMenuItem = document.getElementById("context_reloadTab");
reloaded = BrowserTestUtils.browserLoaded(browser, false, uri.spec);
// Reload as a user through the context menu (should remove the temp permission).
EventUtils.synthesizeMouseAtCenter(reloadMenuItem, {});
yield reloaded;
Assert.deepEqual(SitePermissions.get(uri, id, browser), {
state: SitePermissions.UNKNOWN,
scope: SitePermissions.SCOPE_PERSISTENT,