Firefox/EnterprisePolicies/Testing: Difference between revisions
m (correction) |
(lastModifiedTime) |
||
Line 55: | Line 55: | ||
| bookmarks_test_policy || Watch the message "BOOKMARK: TITLE: foo, URL: bar" for each entry in the Browser console | | bookmarks_test_policy || Watch the message "BOOKMARK: TITLE: foo, URL: bar" for each entry in the Browser console | ||
|} | |} | ||
== Verifying policies.json lastModifiedTime == | |||
When there's a policies.json file in use, the browser will store the last modification date of the file in the following pref: | |||
<pre>browser.policies.lastModifiedTime</pre> | |||
Please verify that this pref gets created correctly, and that it is updated at any time that the policies.json is altered. | |||
== Example files == | == Example files == |
Revision as of 19:55, 5 January 2018
This page documents how to test the Enterprise Policies Manager
Prefs to enable
Please set these two prefs to test this feature:
browser.policies.enabled = true devtools.chrome.enabled = true
Note: the browser.policies.enabled
pref doesn't exist and will need to be created (as a Boolean pref).
Adding the policies.json file
To test this feature (once enabled), you'll need to create a policies.json file (example files are given below), and to put it in a specific location in the installation directory of Firefox (not the profile directory).
Since this location varies by platform and by install type (local build, try build, installed with the installer, etc.), the easier way to figure out the location is by running the following code Snippet in the Browser Console:
Services.dirsvc.get("XREAppDist", Ci.nsIFile).path
Per-platform examples
(these may be different depending on how you installed the try build, so I recommend running the snippet above). These are for illustration purposes only.
- Mac: /Applications/FirefoxNightly.app/Contents/Resources/distribution
- Windows: C:\Program Files (x86)\Mozilla Firefox\distribution
Checking the status of the engine
Soon, this status will be exposed in about:support. In the meantime, you can run this snippet in the Browser Console to get it:
Services.policies.status
The values are:
- 0: Uninitialized - Should never see this value
- 1: Inactive - When the feature is disabled (the pref wasn't created), or if the policies.json file doesn't exist. This should be the default value you get when the feature is not being used.
- 2: Active - When the feature is correctly in use
- 3: Error - When the feature was attempted to be used, but there was a malformed error in the policies.json file
Testing the policies
There are currently a few dummy policies implemented, and we can test that they are being correctly activated by the policies.json file by verifying some log messages or running a snippet:
Policy Name | How to verify |
---|---|
block_about_config | Snippet: Services.policies.isAllowed("about:config") returns false when the policy is in use
|
block_devtools | Snippet: Services.policies.isAllowed("devtools") returns false when the policy is in use
|
test_dummy_feature1 | Snippet Services.policies.isAllowed("test_dummy_feature1") returns false when the policy is in use
|
url_policy | Watch the message "URL POLICY spec: http://example.com" in the Browser console |
bookmarks_test_policy | Watch the message "BOOKMARK: TITLE: foo, URL: bar" for each entry in the Browser console |
Verifying policies.json lastModifiedTime
When there's a policies.json file in use, the browser will store the last modification date of the file in the following pref:
browser.policies.lastModifiedTime
Please verify that this pref gets created correctly, and that it is updated at any time that the policies.json is altered.
Example files
- JSON file with all policies enabled:
{ "policies": { "block_about_config": true, "block_devtools": true, "test_dummy_feature1": true, "url_policy": "example.com", "bookmarks_test_policy": { "title": "Bookmark title", "url": "http://www.example.com/bookmark" } } }
- JSON with just the about:config enabled (use it to verify that devtools doesn't get blocked):
{ "policies": { "block_about_config": true } }
- Malformed JSON (to test the ERROR state):
{ "polic