Bug 1253646 - Implement browser.extension.isAllowedFileSchemeAccess. r=kmag
authorChristopher Grebs <cgrebs@mozilla.com>
Tue, 12 Apr 2016 16:16:17 +0200
changeset 331042 1bac204229b49670046cf84b15c944e43036cf8b
parent 331041 387bd412040f3e2601880cea09681a8717271e1b
child 331043 a83cf78360d12c72997cb18131a6950f98ee8130
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1253646
milestone48.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 1253646 - Implement browser.extension.isAllowedFileSchemeAccess. r=kmag MozReview-Commit-ID: 85UL3ATGrfB
toolkit/components/extensions/ext-extension.js
toolkit/components/extensions/schemas/extension.json
toolkit/components/extensions/test/mochitest/test_ext_extension.html
--- a/toolkit/components/extensions/ext-extension.js
+++ b/toolkit/components/extensions/ext-extension.js
@@ -33,12 +33,16 @@ extensions.registerSchemaAPI("extension"
 
       get inIncognitoContext() {
         return context.incognito;
       },
 
       isAllowedIncognitoAccess() {
         return Promise.resolve(true);
       },
+
+      isAllowedFileSchemeAccess() {
+        return Promise.resolve(true);
+      },
     },
   };
 });
 
--- a/toolkit/components/extensions/schemas/extension.json
+++ b/toolkit/components/extensions/schemas/extension.json
@@ -112,17 +112,16 @@
                 "description": "True if the extension has access to Incognito mode, false otherwise."
               }
             ]
           }
         ]
       },
       {
         "name": "isAllowedFileSchemeAccess",
-        "unsupported": true,
         "type": "function",
         "description": "Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.",
         "async": "callback",
         "parameters": [
           {
             "type": "function",
             "name": "callback",
             "parameters": [
--- a/toolkit/components/extensions/test/mochitest/test_ext_extension.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_extension.html
@@ -28,12 +28,32 @@ add_task(function* test_is_allowed_incog
 
   yield extension.startup();
   info("extension loaded");
   yield extension.awaitFinish("isAllowedIncognitoAccess");
   yield extension.unload();
   info("extension unloaded");
 });
 
+add_task(function* test_is_allowed_file_scheme_access() {
+  function backgroundScript() {
+    browser.extension.isAllowedFileSchemeAccess().then(isAllowedFileSchemeAccess => {
+      browser.test.assertEq(true, isAllowedFileSchemeAccess, "isAllowedFileSchemeAccess is true");
+      browser.test.notifyPass("isAllowedFileSchemeAccess");
+    });
+  }
+
+  let extension = ExtensionTestUtils.loadExtension({
+    background: `(${backgroundScript})()`,
+    manifest: {},
+  });
+
+  yield extension.startup();
+  info("extension loaded");
+  yield extension.awaitFinish("isAllowedFileSchemeAccess")
+  yield extension.unload();
+  info("extension unloaded");
+});
+
 </script>
 
 </body>
 </html>