umm... what is this error I see on every pages?
a[i].getAttribute("href") is null
It seems in this function: (line 33 is where it breaks)
// Iterates through all the <a> links on a page and adds | |
// them to the queue to be prefetched. | |
function doEnhancedPrefetch(aEvent, pos) { | |
// exit if enhanced prefetching is turned off | |
// or if the site has opted out of prefetching | |
if(!PreferencesService.getBoolPref("extensions.fasterfox.enhancedPrefetching")) return; | |
// doc is document that triggered "onload" event | |
var doc = aEvent.originalTarget; | |
// if this isn't an http:// page, retun | |
if (doc.location.href.indexOf("http://") != 0) return; | |
// load whitelist | |
var whitelist = PreferencesService.getCharPref("extensions.fasterfox.whitelist").split(","); | |
var whitelistLen = whitelist.length; | |
// find all links | |
var a = doc.getElementsByTagName('a'); | |
var href, numLinksToPrefetch, i, j; | |
// prefetch a max of 100 links | |
numLinksToPrefetch = (a.length>100) ? 100 : a.length; | |
// if its the first time, set the pos to 0, | |
// if a pos was passed in, we'll start the for loop there instead | |
if (pos == null || pos <=0) pos = 0; | |
// iterate through the links | |
mainLinkLoop: | |
for (i=pos; i<numLinksToPrefetch; i++) { | |
href = a[i].getAttribute('href').toLowerCase(); | |
// make sure there is a link | |
if(href && href.length > 4) { | |
// Don't prefetch links w/ query strings | |
// or the same page we are on | |
if(href.indexOf('?')>=0 || href == doc.location.href) continue; | |
// Don't prefetch things that look like a logout link | |
// Special thanks to b1naryb0y and Kai Risku for this bug fix | |
if(href.indexOf('logout')>=0 || href.indexOf('logoff')>=0) continue; | |
// Only prefetch static content, this causes dynamic pages to be ignored | |
fileExtensionStartPos = href.length-4; | |
if(!(href.indexOf('.htm') == fileExtensionStartPos | |
|| href.indexOf('.html') == fileExtensionStartPos-1 | |
|| href.indexOf('.jpg') == fileExtensionStartPos | |
|| href.indexOf('.gif') == fileExtensionStartPos | |
|| href.indexOf('.png') == fileExtensionStartPos | |
|| href.indexOf('.jpeg') == fileExtensionStartPos-1 | |
|| href.indexOf('.txt') == fileExtensionStartPos | |
|| href.indexOf('.text') == fileExtensionStartPos-1 | |
|| href.indexOf('.xml') == fileExtensionStartPos | |
|| href.indexOf('.pdf') == fileExtensionStartPos)) continue; | |
// Don't prefetch whitelist links | |
href = ff_GetAbsoluteUrl(href, doc.location.href); | |
for(j=0; j<whitelistLen; j++) { | |
if(whitelist[j].length > 0 && href.indexOf(whitelist[j]) >= 0) continue mainLinkLoop; | |
} | |
// test if site is opting out of prefetching | |
var shouldOptOut = ff_IsSiteOptOut(href, aEvent, i); | |
if(shouldOptOut) { | |
continue; | |
} else if (shouldOptOut == -1) { | |
return; | |
} | |
try { | |
PrefetchService.prefetchURI(ff_makeURI(ff_GetAbsoluteUrl(a[i].getAttribute('href'), doc.location.href)), ff_makeURI(doc.location.href), true); | |
} catch(e) { | |
//if(e.name != "NS_ERROR_ABORT") alert(ff_GetAbsoluteUrl(href, doc.location.href) + '\n' + e.toString()); | |
} | |
} | |
} | |
} | |