파이어 폭스가 다시 시작될 때마다 검색 엔진을 보호하기위한 간단한 Firefox 애드온을 작성하고 싶습니다. 또한 searchengine 및 keyword.URL은 u-search로 설정됩니다.Firefox addon access config
addon BrowserProtect를 사용해 보았지만 keyword.URL을 보호하지 못했습니다! 그래서 builder.addons.mozilla.org에서 addon을 작성하여 사용하기 시작했습니다. 이 (코드 조각에서 함께 추가)처럼
내 코드는 같습니다
var Widget = require("widget").Widget;
var tabs = require('tabs');
exports.main = function() {
new Widget({
id: "searchengineprotect",
label: "SearchEngineProtect",
contentURL: "http://www.mozilla.org/favicon.ico",
onClick: function(event) {
var {Cc, Ci} = require("chrome");
var prefs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsIPrefBranch);
prefs.setCharPref("keyworld.URL", "http://google.de/search?q=");
}
});
};
가 난 그냥 "onclick을"기능의 코드를 변경했습니다.
하지만 콘솔 보고서를 파이어 폭스에 작은 버튼이 오류 클릭 할 때 : 당신은 내가 그 오류 또는 어떻게 검색 엔진을 변경하는 파이어 폭스를 막을 수를 해결할 수있는 방법을 알고 있다면 그래서
Fehler: searchengineprotect: An exception occurred.
NS_ERROR_XPC_GS_RETURNED_FAILURE: Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]
undefined 35
Traceback (most recent call last):
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/searchengineprotect/lib/main.js", line 35, in exports.main/<.onClick
var prefs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsIPrefBranch);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 153, in _emitOnObject
listener.apply(targetObj, params);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/deprecated/events.js", line 123, in _emit
return this._emitOnObject.apply(this, args);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/widget.js", line 282, in _onEvent
this._emit(type, eventData);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/widget.js", line 431, in WidgetView__onEvent
this._baseWidget._onEvent(type, this._public);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/widget.js", line 850, in WC_addEventHandlers/listener/<
self._widget._onEvent(EVENTS[e.type], null, self.node);
File "resource://jid0-zg1n2skgq7y6lrq6hbl96hno8ke-at-jetpack/addon-sdk/lib/sdk/timers.js", line 31, in notify
callback.apply(null, args);
합니다. .. 최고 일 것입니다! :)
"keyworld.URL"대신 "keyword.URL"을 사용하십시오. 그렇게 간단할까요? –