我想在我的擴展的首選項(一個用於android ext的firefox)中存儲一個值。所以,在的prefs.js文件(下默認/首選項/)我寫:nsIPrefBranch for Firefox for android擴展返回NS_ERROR_UNEXPECTED
pref("extensions.trackdetect.idUser","nothing");
然後,在boostrap.js我得到的偏好分支:
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService).getBranch("extensions.trackdetect.");
但是,當我嘗試獲取ID用戶價值是這樣的:
var idPref = prefs.getCharPref("idUser");
我得到這個錯誤:`
Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getCharPref]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"
This post解釋錯誤的起源,但我的偏好,因爲我表明波紋管設置,所以我不明白這個問題。
對不起,該帖子的鏈接是:http://stackoverflow.com/questions/9120176/trying-to-use-nsiprefbranch-to-store-data-on-firefox-extension-gives-ns-error-un – user2102196