Bug 1466349 - Part 2: Pass addonData to embedded Screenshots WE, add permissions. r=aswan, r=ianbicking, a=RyanVM
authorTomislav Jovanovic <tomica@gmail.com>
Sun, 03 Jun 2018 00:25:56 +0200
changeset 806021 732cc9a732204da62e012df72719af4674a441de
parent 806020 e0c623e9e9abae9545ff5c831fb2b76b4323d940
child 806022 07ae2a15b7baa5d1346e6756d5967ba14c19ad7d
push id112832
push userbballo@mozilla.com
push dateFri, 08 Jun 2018 21:11:22 +0000
reviewersaswan, ianbicking, RyanVM
bugs1466349
milestone60.0.3
Bug 1466349 - Part 2: Pass addonData to embedded Screenshots WE, add permissions. r=aswan, r=ianbicking, a=RyanVM MozReview-Commit-ID: GLwjp32sj2i
browser/extensions/screenshots/bootstrap.js
browser/extensions/screenshots/webextension/manifest.json
--- a/browser/extensions/screenshots/bootstrap.js
+++ b/browser/extensions/screenshots/bootstrap.js
@@ -116,19 +116,20 @@ const LibraryButton = {
     item.setAttribute("label", this.LABEL);
 
     parent.insertBefore(item, nextSibling);
   },
 };
 
 const APP_STARTUP = 1;
 const APP_SHUTDOWN = 2;
-let startupReason;
+let addonData, startupReason;
 
 function startup(data, reason) { // eslint-disable-line no-unused-vars
+  addonData = data;
   startupReason = reason;
   if (reason === APP_STARTUP) {
     appStartupObserver.register();
   } else {
     appStartupDone();
   }
   prefObserver.register();
   addonResourceURI = data.resourceURI;
@@ -172,17 +173,17 @@ function handleStartup() {
   if (!shouldDisable() && !webExtension.started) {
     start(webExtension);
   } else if (shouldDisable()) {
     stop(webExtension, ADDON_DISABLE);
   }
 }
 
 function start(webExtension) {
-  return webExtension.startup(startupReason).then((api) => {
+  return webExtension.startup(startupReason, addonData).then((api) => {
     api.browser.runtime.onMessage.addListener(handleMessage);
     LibraryButton.init(webExtension);
     initPhotonPageAction(api, webExtension);
   }).catch((err) => {
     // The startup() promise will be rejected if the webExtension was
     // already started (a harmless error), or if initializing the
     // WebExtension failed and threw (an important error).
     console.error(err);
--- a/browser/extensions/screenshots/webextension/manifest.json
+++ b/browser/extensions/screenshots/webextension/manifest.json
@@ -55,11 +55,13 @@
     "downloads",
     "tabs",
     "storage",
     "notifications",
     "clipboardWrite",
     "contextMenus",
     "mozillaAddons",
     "<all_urls>",
-    "https://screenshots.firefox.com/"
+    "https://screenshots.firefox.com/",
+    "resource://pdf.js/",
+    "about:reader*"
   ]
 }