This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Why do I get this error when executing this javascript?

more options

Issue

I have another kind of problem with Firefox

Description

var firefoxWindow = getWindows()[0]; var browser = firefoxWindow.getBrowser(); var doc = browser.contentDocument;


var elem = null; var elems = doc.getElementsByTagName('td');

for(a=0;a < elems.length;a++){ if( | (elems[a] !== null && elems[a].onclick !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim) !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim).length >= 0) { elem = elems[a]; } }

var found = false; var window = null;

for(var i=0; i < firefoxWindow.frames.length; i++) }


function recursiveSearch(frames){ for(var i=0; i= 0) || (elems[a] !== null && elems[a].onclick !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim) !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim).length >= 0))) { elem = elems[a]; } } if(elem) else{ if(frames[i].frames.length>0) }}}if(!elem && window.frames.length > 0){ recursiveSearch(window.frames); }var origColor = ;if(elem !== null) elem.style.backgroundColor = 'yellow';}

Using this javascript through jssh to assert that there is a element with an onclick handler that contains the phrase Goodbye Wonderful returns an odd error message :

Received: uncaught exception: [Exception... "Component is not available"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: interactive ::  :: line 1"  data: no]

I've looked just about everywhere for an answer and none of them have anything to do with what I'm trying to do with this javascript. It works fine in FF 3.6 but when run in the 4.0b1 this causes that weird exception.


This happened

Every time Firefox opened

Updated to FF 4.0b1

User Agent

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.0 Safari/534.3

== Issue == I have another kind of problem with Firefox == Description == <code>var firefoxWindow = getWindows()[0]; var browser = firefoxWindow.getBrowser(); var doc = browser.contentDocument; var elem = null; var elems = doc.getElementsByTagName('td'); for(a=0;a &lt; elems.length;a++){ if( [[elems[a] !== null && elems[a].hasAttributes() <u> true && elems[a].getAttribute('onclick') !== null && elems[a].getAttribute('onclick').toString().match(/doNothing/gim) !== null && elems[a].getAttribute('onclick').toString().match(/Goodbye Wonderful/gim).length &gt;= 0) || (elems[a] !== null && elems[a].onclick !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim) !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim).length &gt;= 0]]) { elem = elems[a]; } } var found = false; var window = null; for(var i=0; i &lt; firefoxWindow.frames.length; i++) } function recursiveSearch(frames){ for(var i=0; i= 0) || (elems[a] !== null && elems[a].onclick !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim) !== null && elems[a].onclick.toString().match(/Goodbye Wonderful/gim).length &gt;= 0))) { elem = elems[a]; } } if(elem) else{ if(frames[i].frames.length&gt;0) }}}if(!elem && window.frames.length &gt; 0){ recursiveSearch(window.frames); }var origColor = '';if(elem !== null) elem.style.backgroundColor = 'yellow';} </code> Using this javascript through jssh to assert that there is a element with an onclick handler that contains the phrase Goodbye Wonderful returns an odd error message : Received: uncaught exception: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: interactive :: :: line 1" data: no] I've looked just about everywhere for an answer and none of them have anything to do with what I'm trying to do with this javascript. It works fine in FF 3.6 but when run in the 4.0b1 this causes that weird exception. == This happened == Every time Firefox opened == Updated to FF 4.0b1 == == User Agent == Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.0 Safari/534.3

All Replies (1)

more options

Sorry but the javascript syntax got messed up a little bit when posted. And jssh was built with 4.0b1 and then I packaged it as an XPI to install as an extension.