2014-11-21 101 views
2

我試圖以編程方式禁用Firefox擴展時遇到問題。現在,我正在修改extension.json文件,更改2個參數active和userDisabled,但沒有任何成功。儘管在擴展菜單中它看起來被禁用,擴展圖標仍然出現在工具欄中,我可以看到擴展仍然有效。有沒有辦法使用C++進行這項工作?以編程方式禁用Firefox擴展

回答

2

這是行不通的,你必須使用AddonManager.jsm更改的屬性是這樣的:

Cu.import('resource://gre/modules/AddonManager.jsm'); 
AddonManager.getAddonByID('[email protected]', function(addon) { //id of the addon 
    console.info('addon:', addon); 
    addon.userDisabled = false; //set to true to enable it 
}); 
+0

感謝您的幫助 – monfort 2014-11-24 07:51:02