Bug 1253646 - Implement browser.extension.isAllowedFileSchemeAccess. r=kmag
authorChristopher Grebs <cgrebs@mozilla.com>
Tue, 12 Apr 2016 16:16:17 +0200
changeset 293171 1bac204229b49670046cf84b15c944e43036cf8b
parent 293170 387bd412040f3e2601880cea09681a8717271e1b
child 293172 a83cf78360d12c72997cb18131a6950f98ee8130
push id30177
push usercbook@mozilla.com
push dateFri, 15 Apr 2016 09:40:05 +0000
treeherdermozilla-central@755a175b3cc7 [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>