Bug 1371543 - Support Screenshots page action with UITour, r=dveditz,Gijs

This patch
- supports Screenshots page action with UITour
- adds https://screenshots.firefox.com into the uitour permission list for the bug 1393668

MozReview-Commit-ID: K4v0LU2WSyl

--HG--
extra : rebase_source : 8e9a2e3bee944af73d08a41badaa7ada09e1ef46
This commit is contained in:
Fischer.json 2017-08-30 11:25:59 +08:00
Родитель abc2b498f1
Коммит 48d78c7f4e
4 изменённых файлов: 23 добавлений и 0 удалений

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

@ -8,6 +8,7 @@
# UITour
origin uitour 1 https://www.mozilla.org
origin uitour 1 https://screenshots.firefox.com
origin uitour 1 https://support.mozilla.org
origin uitour 1 https://addons.mozilla.org
origin uitour 1 https://discovery.addons.mozilla.org

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

@ -120,6 +120,7 @@ if (typeof Mozilla == "undefined") {
* <li>privateWindow
* <li>quit
* <li>readerMode-urlBar
* <li>screenshots
* <li>search
* <li>searchIcon
* <li>searchPrefsLink

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

@ -257,6 +257,12 @@ this.UITour = {
return aDocument.getElementById("pageAction-urlbar-sendToDevice") ||
aDocument.getElementById("pageAction-panel-sendToDevice");
},
}],
["screenshots", {
query: (aDocument) => {
return aDocument.getElementById("pageAction-urlbar-screenshots") ||
aDocument.getElementById("pageAction-panel-screenshots");
},
}]
]),

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

@ -29,6 +29,7 @@ function getExpectedTargets() {
"privateWindow",
...(hasQuit ? ["quit"] : []),
"readerMode-urlBar",
"screenshots",
"trackingProtection",
"urlbar",
];
@ -37,6 +38,7 @@ function getExpectedTargets() {
add_task(setup_UITourTest);
add_UITour_task(async function test_availableTargets() {
await ensureScreenshotsEnabled();
let data = await getConfigurationPromise("availableTargets");
let expecteds = getExpectedTargets();
ok_targets(data, expecteds);
@ -80,6 +82,7 @@ add_UITour_task(async function test_availableTargets_removeUrlbarPageActionsAll(
ok_targets(data, expecteds);
let expectedActions = [
[ "pocket", "pageAction-panel-pocket" ],
[ "screenshots", "pageAction-panel-screenshots" ],
[ "pageAction-bookmark", "pageAction-panel-bookmark" ],
[ "pageAction-copyURL", "pageAction-panel-copyURL" ],
[ "pageAction-emailLink", "pageAction-panel-emailLink" ],
@ -99,6 +102,7 @@ add_UITour_task(async function test_availableTargets_addUrlbarPageActionsAll() {
ok_targets(data, expecteds);
let expectedActions = [
[ "pocket", "pocket-button-box" ],
[ "screenshots", "pageAction-urlbar-screenshots" ],
[ "pageAction-bookmark", "star-button-box" ],
[ "pageAction-copyURL", "pageAction-urlbar-copyURL" ],
[ "pageAction-emailLink", "pageAction-urlbar-emailLink" ],
@ -150,3 +154,14 @@ var pageActionsHelper = {
this._originalStates = null;
}
};
function ensureScreenshotsEnabled() {
SpecialPowers.pushPrefEnv({ set: [
[ "extensions.screenshots.system", false ],
[ "extensions.screenshots.system-disabled", false ]
]});
return BrowserTestUtils.waitForCondition(() => {
return PageActions.actionForID("screenshots") &&
!CustomizableUI.getWidget("screenshots_mozilla_org-browser-action");
}, "Should enable Screenshots");
}