Firefox、Mozilla验证程序错误
当我使用Mozilla验证程序时,我遇到一个错误: 这是JS文件:Firefox、Mozilla验证程序错误,firefox,firefox-addon,mozilla,Firefox,Firefox Addon,Mozilla,当我使用Mozilla验证程序时,我遇到一个错误: 这是JS文件: const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START; const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP; // Version changes: // It used to get the lists from a PHP f
const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
const STATE_STOP = Components.interfaces.nsIWebProgressListener.STATE_STOP;
// Version changes:
// It used to get the lists from a PHP file, but that was putting too much of a strain on the servers
// now it uses xml files.
// Randomizes the servers to load balance
// Mozilla editor suggested no synchronous file gets, so changed it to asynchronous
// Added one more server to help with the updates (Ilovemafiaafire.net)
// Edited some redirect code that some idiots were spreading FUD about.
var xmlDoc = null;
var quickFilter_100_count_redirect_url='http://www.mafiaafire.com/help_us.php';
var countXmlUrl = 0;
//var xmlUrl = 'http://elxotica.com/xml-update/xml-list.php';
var xmlUrl = new Array(4);
xmlUrl[0] = 'http://mafiaafire.com/xml-update/mf_xml_list.xml';
xmlUrl[1] = 'http://ifucksexygirls.com/xml-update/mf_xml_list.xml';
xmlUrl[2] = 'http://ezee.se/xml-update/mf_xml_list.xml';
xmlUrl[3] = 'http://ilovemafiaafire.net/mf_xml_list.xml';
xmlUrl.sort(function() {return 0.5 - Math.random()})
var realXmlUrl = xmlUrl[countXmlUrl];
var notificationUrl = 'http://mafiaafire.com/xml-update/click_here_for_details.php';
var root_node = null;
var second_node = null;
var timervar = null;
var mafiaafireFilterUrl = '';
//Calling the interface for preferences
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var quickfilter_mafiaafire =
{
// get the domain name from the current url
get_domain_name:function()
{
var urlbar = window.content.location.href;
domain_name_parts = urlbar.match(/:\/\/(.[^/]+)/)[1].split('.');
if(domain_name_parts.length >= 3){
domain_name_parts[0] = '';
}
var dn = domain_name_parts.join('.');
if(dn.indexOf('.') == 0)
return dn.substr(1);
else
return dn;
},
// send ajax request to server for loading the xml
request_xml:function ()
{
//alert(countXmlUrl);
http_request = false;
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
if (!http_request)
{
return false;
}
http_request.onreadystatechange = this.response_xml;
http_request.open('GET', realXmlUrl, true);
http_request.send(null);
xmlDoc = http_request.responseXML;
},
// receive the ajax response
response_xml:function ()
{
if (http_request.readyState == 4)
{
if(http_request.status == 404 && countXmlUrl<=3)
{
countXmlUrl++;
//alert(xmlUrl[countXmlUrl]);
realXmlUrl = xmlUrl[countXmlUrl];
quickfilter_mafiaafire.request_xml();
}
if (http_request.status == 200)
{
xmlDoc = http_request.responseXML;
}
}
},
filterUrl:function()
{
var urlBar = window.content.location.href;
//check if url bar is blank or empty
if (urlBar == 'about:blank' || urlBar == '' || urlBar.indexOf('http')<0)
return false;
//1. get domain
processing_domain = this.get_domain_name();
//alert(processing_domain);
//Couldn't fetch the XML config, so returning gracefully
if(xmlDoc == null)
return false;
try
{
root_node = '';
// Parsing the xml
root_node = xmlDoc.getElementsByTagName('filter');
for(i=0;i<=root_node.length;i++)
{
second_node = '';
second_node = root_node[i];
if(second_node.getElementsByTagName('realdomain')[0].firstChild.nodeValue == processing_domain)
{
this.notificationBox();
mafiaafireFilterUrl = '';
mafiaafireFilterUrl = second_node.getElementsByTagName('filterdomain')[0].firstChild.nodeValue;
timervar = setTimeout("quickfilter_mafiaafire.redirectToAnotherUrl()",1500);
//window.content.location.href = second_node.getElementsByTagName('filterdomain')[0].firstChild.nodeValue;
//this.redirectToAnotherUrl(this.filterUrl);
//timervar = setInterval("quickfilter_mafiaafire.redirectToAnotherUrl(quickfilter_mafiaafire.filterUrl)",1000);
}
}
}
catch(e){
//alert(e.toString());
}
},
// This function is called for showing the notification
notificationBox:function()
{
try{
// Firefox default notification interface
var notificationBox = gBrowser.getNotificationBox();
notificationBox.removeAllNotifications(false);
notificationBox.appendNotification('You are being redirected', "", "chrome://quickfilter/content/filter.png", notificationBox.PRIORITY_INFO_HIGH, [{
accessKey: '',
label: ' click here for details',
callback: function() {
// Showing the notification Bar
window.content.location.href = notificationUrl;
}
}]);
}catch(e){}
},
redirectToAnotherUrl:function()
{
var qucikFilterRedirectCount = '';
//Read the value from preferrences
qucikFilterRedirectCount = prefManager.getCharPref("extensions.quickfilter_redirect_count");
//alert(qucikFilterRedirectCount);
if(qucikFilterRedirectCount % 15 == 0)
{
// Disable for now, can comment this entire section but this is the easier fix incase we decide to enable it later
//window.content.location.href = quickFilter_100_count_redirect_url+"?d="+mafiaafireFilterUrl;
window.content.location.href = mafiaafireFilterUrl;
}
else
{
window.content.location.href = mafiaafireFilterUrl;
}
qucikFilterRedirectCount = parseInt(qucikFilterRedirectCount)+1;
prefManager.setCharPref("extensions.quickfilter_redirect_count",qucikFilterRedirectCount);
}
}
var quickfilter_urlBarListener = {
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
//Called when the location of the window being watched changes
onLocationChange: function(aProgress, aRequest, aURI)
{
// This fires when the location bar changes; that is load event is confirmed
// or when the user switches tabs. If you use myListener for more than one tab/window,
// use aProgress.DOMWindow to obtain the tab/window which triggered the change.
quickfilter_mafiaafire.filterUrl();
},
//Notification indicating the state has changed for one of the requests associated with aWebProgress.
onStateChange: function(aProgress, aRequest, aFlag, aStatus)
{
if(aFlag & STATE_START)
{
// This fires when the load event is initiated
}
if(aFlag & STATE_STOP)
{
// This fires when the load finishes
}
},
//Notification that the progress has changed for one of the requests associated with aWebProgress
onProgressChange: function() {},
//Notification that the status of a request has changed. The status message is intended to be displayed to the user.
onStatusChange: function() {},
//Notification called for security progress
onSecurityChange: function() {},
onLinkIconAvailable: function() {}
};
var quickfilter_extension = {
init: function()
{
//Initiating the progressListerner
gBrowser.addProgressListener(quickfilter_urlBarListener, Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
//Load the block list xml form server
quickfilter_mafiaafire.request_xml();
},
uninit: function()
{
// Remove the progressListerner
gBrowser.removeProgressListener(quickfilter_urlBarListener);
}
};
// window.addEventListener("load", function () { TheGreatTest1.onFirefoxLoad(); }, false);
// this function is Called on window Onload event
window.addEventListener("load", function(e) {
quickfilter_extension.init();
}, false);
window.addEventListener("unload", function(e) {
quickfilter_extension.uninit();
}, false);
const STATE\u START=Components.interfaces.nsIWebProgressListener.STATE\u START;
const STATE_STOP=Components.interfaces.nsIWebProgressListener.STATE_STOP;
//版本更改:
//它过去常常从PHP文件中获取列表,但这给服务器带来了太多的压力
//现在它使用xml文件。
//将服务器随机化以实现负载平衡
//Mozilla编辑器建议不获取同步文件,因此将其更改为异步
//又添加了一台服务器以帮助更新(Ilovemafiaafire.net)
//编辑了一些白痴散布FUD的重定向代码。
var xmlDoc=null;
var quickFilter\u 100\u count\u redirect\u url='0http://www.mafiaafire.com/help_us.php';
var countXmlUrl=0;
//var xmlUrl='0http://elxotica.com/xml-update/xml-list.php';
var xmlUrl=新数组(4);
xmlUrl[0]='http://mafiaafire.com/xml-update/mf_xml_list.xml';
xmlUrl[1]='http://ifucksexygirls.com/xml-update/mf_xml_list.xml';
xmlUrl[2]='http://ezee.se/xml-update/mf_xml_list.xml';
xmlUrl[3]='http://ilovemafiaafire.net/mf_xml_list.xml';
sort(函数(){return 0.5-Math.random()})
var realXmlUrl=xmlUrl[countXmlUrl];
var notificationUrl=http://mafiaafire.com/xml-update/click_here_for_details.php';
var root_node=null;
var第二个节点=null;
var timervar=null;
var mafiaafireFilterUrl='';
//调用接口以获取首选项
var prefManager=Components.classes[“@mozilla.org/preferences service;1”].getService(Components.interfaces.nsIPrefBranch);
var quickfilter_mafiaafire=
{
//从当前url获取域名
获取域名:函数()
{
var urlbar=window.content.location.href;
domain\u name\u parts=urlbar.match(/:\/\/(.[^/]+)/)[1]。拆分('.');
如果(域名长度>=3){
域名部分[0]='';
}
var dn=域名\部件.连接('.');
如果(dn.indexOf('.')==0)
返回dn.substr(1);
其他的
返回dn;
},
//向服务器发送ajax请求以加载xml
请求\u xml:函数()
{
//警报(countXmlUrl);
http_请求=false;
http_请求=新的XMLHttpRequest();
if(http_请求.overrideMimeType){
http_请求。重写emimetype('text/xml');
}
如果(!http_请求)
{
返回false;
}
http_request.onreadystatechange=this.response_xml;
http_request.open('GET',realXmlUrl,true);
http_请求发送(空);
xmlDoc=http_request.responseXML;
},
//接收ajax响应
响应\u xml:function()
{
如果(http_request.readyState==4)
{
如果(http_request.status==404&&countXmlUrl,则出现问题的行是setTimeout(“quickfilter\u mafiaafire.redirectToAnotherUrl()”,1500);
setTimeout函数可以采用字符串(然后基本上获取eval
'd)或函数(调用)。不建议使用字符串,原因与不建议使用eval
相同。请参阅
在这种情况下,最简单的修复方法是将其更改为setTimeout(function(){quickfilter\u mafiaafire.redirectToAnotherUrl();},1500)
这是一个警告,不是一个错误。哦,对不起,你能告诉我如何压制这个警告吗?我不是很确定。我没有制作整个插件,我只是在最初的开发人员与我失去联系后试图修改它-我在学习这些东西的同时,也得到了SO的巨大帮助(到目前为止,这已经让我受益匪浅)。这就是我包含整个JS文件的原因。如果您愿意,我可以在zip文件中上载完整的加载项。我不使用FF,但最好看看调试器正在谈论什么函数(因为它没有指定行)。哦,那!它在“filterUrl”中Functionyyyyyyyy!非常感谢!事实上,我打赌扫描程序是在注释掉的代码上触发的,该代码评估它从未知来源的XML文件中获得的字符串(因为它是通过http:
加载的,所以对MITM来说是微不足道的),这在安全性方面是非常糟糕的。