Add-on policy

Pretty sure you can have just one item in that array.

i get this error when i try to upload:

not sure where to put the policies.json…

As stated repeatedly before: the policies.json is not distributed with your XPI. It is to be installed on the users computer manually or via domain controls, see also support info linked earlier.

You may still want to make your JSON valid, though.

Ok i see, i installed the policies in windows manually from here:
https://github.com/mozilla/policy-templates/releases,
but now i have to change something in my manifest.json.

i followed this:

Policies can either be specified using the Group Policy templates
OR
by creating a file called “policies.json”.

1- On Windows, create a directory called “distribution”
where the ( EXE ?? )they mean xpi ? is located and PLACE the file “policies.json” there.

so now i have my file in that folder but how my add-on is going to call/use that file ???

my policies.json contains:

{
"policies": {
"Extensions": {
"Install": ["https://addons.mozilla.org/firefox/downloads/file/1234567/id+fx.xpi",
"C:\Windows\distribution\id+fx.xpi"],
"Uninstall": ["id@hotmail.com"],
"Locked":  ["id@hotmail.com"]
}
}

HOW i CALL that policy.json file ???

i resume:

i have my signed xpi in mozilla firefox add-ons,

and the only thing want is, when the add-on is installed, the user CAN’T disable it, it’s Locked !

so for that we use a policy.json file
and after that ???
how my add-on is going to use that file ?

This doesn’t work, i check with jsonlint.com:

{
"policies": {
	"Extensions": {
"Install": ["https://addons.mozilla.org/firefox/downloads/file/1234567/id+fx.xpi",
"C:\Windows\distribution\id+fx.xpi"],
		"Uninstall": ["id@hotmail.com"],
		"Locked": ["id@hotmail.com"]
	}
}
}

Error: Parse error on line 4:
…67/id+fx.xpi", "C:\Windows\distribu
-----------------------^
Expecting ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{’, ‘[’, got ‘undefined’

if i drag & drop the file in firefox i get this:
SyntaxError: JSON.parse: bad escaped character at line 4 column 96 of the JSON data

if i remove this part:

“C:\Windows\distribution\id+fx.xpi”

the json file is valid, if i drag and drop the policy.json in firefox i get this message:
error_json_xpiinstall

so HOW to fix this problem ???

hi im trying to enable add-on access with policy:

<policy name="BlockAboutAddons" class="Both"
displayName="$(string.BlockAboutAddons)"  
explainText="$(string.BlockAboutAddons_Explain)" key="Software\Policies\Mozilla
\Firefox"
valueName="BlockAboutAddons">
  <parentCategory ref="firefox"/>
  <supportedOn ref="SUPPORTED_FF60"/>
  <enabledValue>
    <decimal value="1"/>
  </enabledValue>
  <disabledValue>
    <decimal value="0"/>
  </disabledValue>
</policy>

So in the windows registry i created & tried with those keys:

[HKEY_LOCAL_MACHINE\Software\Policies\Mozilla\Firefox] 
"BlockAboutAddons"="1"

[HKEY_LOCAL_MACHINE\Software\Mozzilla\Firefox] 
"BlockAboutAddons"="1"

[HKEY_CURRENT_USER\Software\Policies\Mozilla\Firefox] 
"BlockAboutAddons"="1"

[HKEY_CURRENT_USER\Software\Mozilla\Firefox] 
"BlockAboutAddons"="1"

but nothing works i still have access to about:addons

backslash (\) is a special char in JSON, see e.g. https://stackoverflow.com/questions/19176024/how-to-escape-special-characters-in-building-a-json-string. Better use double \\ to make sure.

As for the other, see https://github.com/serv-inc/safe-search/wiki/Bulletproof-installation for an example policies.json file. It should have worked on Windows once…