Go to Google Groups Home    Prototype: Core
Prototype 1.6 security exception in firefox 2.0.0.20 in XPath code

swindsor <swind...@gmail.com>

Hey all,

I'm running into a pretty severe bug with protoype 1.6 (and 1.5) with
firefox 2.0.0.20

When prototype loads, I get the following javascript error:

Error: uncaught exception: [Exception... "Security error"  code:
"1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)"  location:
"http://localhost:3000/javascripts/prototype.js?1244843092 Line:
1525"]

Looking at the code, this is the line where it's erroring:

if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) ||
document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);  //////
ERROR /////
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(Element.extend(query.snapshotItem(i)));
    return results;
  };

}

This doesn't error in newer versions of firefox 3.0, 3.1 beta, but as
a result, after this exception is thrown I can't use any other
protoype javascript on the page (or any jquery, because the noconflict
fails).

Is this a bug in firefox or in prototype?