Bug 1349152 - Add Persistent-Storage permission in PermissionPrompts mozscreenshots, r?johannh draft
authorFischer.json <fischer.json@gmail.com>
Mon, 06 Feb 2017 16:50:54 +0800
changeset 569283 1368a385c4f94f8e1cffb5b84fe81475c3d21834
parent 569138 0b77ed3f26c5335503bc16e85b8c067382e7bb1e
child 626165 4a8be3f45ed8cb89b208c3eb8d5481a0ffd443e6
push id56127
push userbmo:fliu@mozilla.com
push dateThu, 27 Apr 2017 09:08:21 +0000
reviewersjohannh
bugs1349152
milestone55.0a1
Bug 1349152 - Add Persistent-Storage permission in PermissionPrompts mozscreenshots, r?johannh MozReview-Commit-ID: 8lRPKdCrQIW
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
@@ -14,16 +14,17 @@ Cu.import("resource:///modules/E10SUtils
 Cu.import("resource://testing-common/ContentTask.jsm");
 Cu.import("resource://testing-common/BrowserTestUtils.jsm");
 
 const URL = "https://test1.example.com/extensions/mozscreenshots/browser/chrome/mozscreenshots/lib/permissionPrompts.html";
 let lastTab = null;
 
 this.PermissionPrompts = {
   init(libDir) {
+    Services.prefs.setBoolPref("browser.storageManager.enabled", true);
     Services.prefs.setBoolPref("media.navigator.permission.fake", true);
     Services.prefs.setCharPref("media.getusermedia.screensharing.allowed_domains",
                                "test1.example.com");
     Services.prefs.setBoolPref("extensions.install.requireBuiltInCerts", false);
     Services.prefs.setBoolPref("signon.rememberSignons", true);
   },
 
   configurations: {
@@ -57,59 +58,66 @@ this.PermissionPrompts = {
 
     geo: {
       applyConfig: Task.async(function*() {
         yield closeLastTab();
         yield clickOn("#geo");
       }),
     },
 
+    persistentStorage: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#persistent-storage");
+      }),
+    },
+
     loginCapture: {
       applyConfig: Task.async(function*() {
         yield closeLastTab();
-        yield clickOn("#login-capture", URL);
+        yield clickOn("#login-capture");
       }),
     },
 
     notifications: {
       applyConfig: Task.async(function*() {
         yield closeLastTab();
-        yield clickOn("#web-notifications", URL);
+        yield clickOn("#web-notifications");
       }),
     },
 
     addons: {
       applyConfig: Task.async(function*() {
         Services.prefs.setBoolPref("xpinstall.whitelist.required", true);
 
         yield closeLastTab();
-        yield clickOn("#addons", URL);
+        yield clickOn("#addons");
       }),
     },
 
     addonsNoWhitelist: {
       applyConfig: Task.async(function*() {
         Services.prefs.setBoolPref("xpinstall.whitelist.required", false);
 
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let notification = browserWindow.document.getElementById("addon-install-confirmation-notification");
 
         yield closeLastTab();
-        yield clickOn("#addons", URL);
+        yield clickOn("#addons");
 
         // We want to skip the progress-notification, so we wait for
         // the install-confirmation screen to be "not hidden" = shown.
         yield BrowserTestUtils.waitForCondition(() => !notification.hasAttribute("hidden"),
                                                 "addon install confirmation did not show", 200);
       }),
     },
   },
 };
 
-function* closeLastTab(selector) {
+function* closeLastTab() {
   if (!lastTab) {
     return;
   }
   yield BrowserTestUtils.removeTab(lastTab);
   lastTab = null;
 }
 
 function* clickOn(selector) {
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html
@@ -1,16 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
   <meta charset="utf-8">
   <title>Permission Prompts</title>
 </head>
 <body>
   <button id="geo" onclick="navigator.geolocation.getCurrentPosition(() => {})">Geolocation</button>
+  <button id="persistent-storage" onclick="navigator.storage.persist()">Persistent Storage</button>
   <button id="webRTC-shareDevices" onclick="shareDevice({video: true, fake: true});">Video</button>
   <button id="webRTC-shareMicrophone" onclick="shareDevice({audio: true, fake: true});">Audio</button>
   <button id="webRTC-shareDevices2" onclick="shareDevice({audio: true, video: true, fake: true});">Audio and Video</button>
   <button id="webRTC-shareScreen" onclick="shareDevice({video: {mediaSource: 'screen'}});">Screen</button>
   <button id="web-notifications" onclick="Notification.requestPermission()">web-notifications</button>
   <a id="addons" href="borderify.xpi">Install Add-On</a>
   <form>
     <input type="email" id="email" value="email@example.com" />