Set preferences in the user branch and unset them on uninstall

前端 未结 2 2001
灰色年华
灰色年华 2020-12-19 14:01

I created a firefox add-on with the following lib/main.js:

const {Cc,Ci} = require(\"chrome\");
var pref = Cc[\"@mozilla.org/preferences-service;1\"].getServ         


        
2条回答
  •  眼角桃花
    2020-12-19 14:43

    I solved the second part (uninstall) like this, that in my main.js I added this code at the end:

    exports.onUnload = function(reason) {
        //called when add-on is 
        //    uninstalled
        //    disabled
        //    shutdown
        //    upgraded
        //    downgraded
        pref.clearUserPref("network.http.response.timeout");
    };
    

    That worked on disabling and uninstalling the add-on.

提交回复
热议问题