為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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

所有回覆 (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.