Fixed a speed issue

main
Elbert F 15 years ago
parent dc931fa4c8
commit 0b47b0d35e

@ -295,11 +295,11 @@ wappalyzer =
urlChange: urlChange:
{ {
QueryInterface: function( aIID ) QueryInterface: function(iid)
{ {
if ( aIID.equals(Components.interfaces.nsIWebProgressListener) || if ( iid.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) || iid.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports) ) iid.equals(Components.interfaces.nsISupports) )
{ {
return this; return this;
} }
@ -307,14 +307,21 @@ wappalyzer =
throw Components.results.NS_NOINTERFACE; throw Components.results.NS_NOINTERFACE;
}, },
onLocationChange: function(aProgress, aRequest, aURI) onLocationChange: function(progress, request, url)
{ {
if ( aURI.spec != wappalyzer.prevUrl ) if ( !url )
{ {
wappalyzer.prevUrl = aURI.spec; wappalyzer.prevUrl = '';
return;
}
if ( url.spec != wappalyzer.prevUrl )
{
wappalyzer.prevUrl = url.spec;
// A tiny pauze to let the page load, otherwise some elements are displayed incorrectly // A tiny pauze to let the page load, otherwise some elements are displayed incorrectly in FF 3.5
setTimeout(wappalyzer.onUrlChange(), 50); setTimeout('wappalyzer.onUrlChange()', 50);
} }
}, },
@ -357,7 +364,12 @@ wappalyzer =
// Scan HTML for patterns // Scan HTML for patterns
var html = doc.getElementsByTagName('html')[0].innerHTML; var html = doc.getElementsByTagName('html')[0].innerHTML;
if ( html && html.length < 500000 ) // Skip long pages if ( html.length > 50000 ) // Prevent large documents from slowing things down
{
html = html.substring(0, 25000) + html.substring(html.length - 25000, html.length);
}
if ( html )
{ {
for ( i = 0; i < wappalyzer.app.length; i ++ ) for ( i = 0; i < wappalyzer.app.length; i ++ )
{ {

@ -5,7 +5,7 @@
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest"> <Description about="urn:mozilla:install-manifest">
<em:id>wappalyzer@crunchlabz.com</em:id> <em:id>wappalyzer@crunchlabz.com</em:id>
<em:version>1.7.3</em:version> <em:version>1.7.4</em:version>
<em:type>2</em:type> <em:type>2</em:type>
<em:targetApplication> <em:targetApplication>
@ -17,9 +17,9 @@
</em:targetApplication> </em:targetApplication>
<em:optionsURL>chrome://wappalyzer/content/options.xul</em:optionsURL> <em:optionsURL>chrome://wappalyzer/content/options.xul</em:optionsURL>
<em:name>Wappalyzer</em:name> <em:name>Wappalyzer</em:name>
<em:description>Detects which software is used on the page you're at.</em:description> <em:description>Wappalyzer identifies software used on the websites you visit.</em:description>
<em:iconURL>chrome://wappalyzer/skin/icon32x32.png</em:iconURL> <em:iconURL>chrome://wappalyzer/skin/icon32x32.png</em:iconURL>
<em:author>ElbertF</em:author> <em:author>ElbertF</em:author>
<em:creator>ElbertF</em:creator> <em:creator>ElbertF</em:creator>