Bug 1309123 - Add Persistent storage permission to PermissionPrompts mozscreenshots draft
authorFischer.json <fischer.json@gmail.com>
Mon, 06 Feb 2017 16:50:54 +0800
changeset 501408 d3437f55819c0126d37badd962550c0611ddef86
parent 501407 f3ef7df3605500c3d1a20aeb703423bab5c723af
child 549870 ec761519ed140efdf78a692216d179faa381ae8f
push id49970
push userbmo:fliu@mozilla.com
push dateMon, 20 Mar 2017 07:08:43 +0000
bugs1309123
milestone53.0a1
Bug 1309123 - Add Persistent storage permission to PermissionPrompts mozscreenshots MozReview-Commit-ID: 1vwtmDPyXks
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" />