Pergunta

Is it possible to update a firefox addon's preferences programmatically?

Given the following:

const prefs = require("sdk/simple-prefs");
prefs.stringPreference = "some random string";

It seems that my update to stringPreference doesn't get persisted, and will revert back to the value in about:addons when reloaded, new tabs are opened, etc.

Is this possible? The docs imply changes are saved automatically but this doesn't seem to be the case..

Foi útil?

Solução

You have missed the .prefs attribute. It should be:

var prefs = require("sdk/simple-prefs").prefs;

Notice the .prefs at the end of the line.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top