Bug 1512419 - Screenshots' contextMenu entry should be available on webpage in reader mode. r=_6a68
authorLuca Greco <lgreco@mozilla.com>
Thu, 06 Dec 2018 18:23:40 +0000
changeset 508840 c28c5075d441e54eb4b4a5b5336374063544e676
parent 508839 2f5d2cc76b6b3f1c882c0211c95291e487953e29
child 508841 45cd802be3dd3d3271dc19a96e8a8adb7a73757e
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewers_6a68
bugs1512419
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1512419 - Screenshots' contextMenu entry should be available on webpage in reader mode. r=_6a68 Depends on D13907 Differential Revision: https://phabricator.services.mozilla.com/D13908
browser/extensions/screenshots/background/main.js
browser/extensions/screenshots/background/startBackground.js
--- a/browser/extensions/screenshots/background/main.js
+++ b/browser/extensions/screenshots/background/main.js
@@ -142,16 +142,20 @@ this.main = (function() {
         .then(() => sendEvent("start-shot", "context-menu", {incognito: tab.incognito}));
     }));
   });
 
   function urlEnabled(url) {
     if (shouldOpenMyShots(url)) {
       return true;
     }
+    // Allow screenshots on urls related to web pages in reader mode.
+    if (url && url.startsWith("about:reader?url=")) {
+      return true;
+    }
     if (isShotOrMyShotPage(url) || /^(?:about|data|moz-extension):/i.test(url) || isBlacklistedUrl(url)) {
       return false;
     }
     return true;
   }
 
   function isShotOrMyShotPage(url) {
     // It's okay to take a shot of any pages except shot pages and My Shots
--- a/browser/extensions/screenshots/background/startBackground.js
+++ b/browser/extensions/screenshots/background/startBackground.js
@@ -36,17 +36,17 @@ this.startBackground = (function() {
       console.error("Error loading Screenshots:", error);
     });
   });
 
   browser.contextMenus.create({
     id: "create-screenshot",
     title: browser.i18n.getMessage("contextMenuLabel"),
     contexts: ["page"],
-    documentUrlPatterns: ["<all_urls>"],
+    documentUrlPatterns: ["<all_urls>", "about:reader*"],
   });
 
   browser.contextMenus.onClicked.addListener((info, tab) => {
     loadIfNecessary().then(() => {
       main.onClickedContextMenu(info, tab);
     }).catch((error) => {
       console.error("Error loading Screenshots:", error);
     });