Bug 1577031 - make Protection Report page sharable via UITour. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D44249

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Erica Wright 2019-09-03 15:49:42 +00:00
Родитель af5cbc228f
Коммит 4ea42ae25a
4 изменённых файлов: 54 добавлений и 0 удалений

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

@ -371,6 +371,14 @@ if (typeof Mozilla == "undefined") {
_sendEvent("showNewTab");
};
/**
* Loads about:protections in the tour tab.
* @since 70
*/
Mozilla.UITour.showProtectionReport = function() {
_sendEvent("showProtectionReport");
};
/**
* @typedef Mozilla.UITour.ConfigurationName
* @description Valid values:<ul>

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

@ -709,6 +709,11 @@ var UITour = {
}
break;
}
case "showProtectionReport": {
this.showProtectionReport(window, browser);
break;
}
}
// For performance reasons, only call initForBrowser if we did something
@ -1554,6 +1559,17 @@ var UITour = {
});
},
showProtectionReport(aWindow, aBrowser) {
let url = "about:protections";
aWindow.openLinkIn(url, "current", {
targetBrowser: aBrowser,
triggeringPrincipal: Services.scriptSecurityManager.createContentPrincipal(
Services.io.newURI(url),
{}
),
});
},
_hideAnnotationsForPanel(aEvent, aShouldClosePanel, aTargetPositionCallback) {
let win = aEvent.target.ownerGlobal;
let hideHighlightMethod = null;

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

@ -38,6 +38,8 @@ skip-if = true # Disabled pending removal of pocket UI Tour
skip-if = (verify && !debug && (os == 'linux'))
[browser_UITour_showNewTab.js]
skip-if = (verify && !debug && (os == 'linux'))
[browser_UITour_showProtectionReport.js]
skip-if = (verify && !debug && (os == 'linux'))
[browser_UITour_sync.js]
[browser_UITour_toggleReaderMode.js]
skip-if = (verify && !debug && (os == 'linux'))

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

@ -0,0 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
var gTestTab;
var gContentAPI;
var gContentWindow;
add_task(setup_UITourTest);
// Test that we can switch to about:protections
add_UITour_task(async function test_openProtectionReport() {
let aboutProtectionsLoaded = BrowserTestUtils.browserLoaded(
gBrowser.selectedBrowser,
false,
"about:protections"
);
info("Showing about:protections");
await gContentAPI.showProtectionReport();
info("Waiting for about:protections to load");
await aboutProtectionsLoaded;
is(
gBrowser.selectedBrowser.currentURI.spec,
"about:protections",
"Loaded about:protections"
);
});