在firefox 4.0b1中的jssh中的javascript错误

使用这个javascript编译和为新的firefox 4.0 beta 1编译和jssh返回一个奇怪的消息。这是代码(对不起,如果它有点乱) 总之,代码检查firefox窗口的所有帧,这是我们单元测试的测试页面,其中包含一个包含短语Goodbye Wonderful的onclick,而不是得到失败的响应,我们在最后收到这个奇怪的错误我们无法解释。
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].hasAttributes() === 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 >= 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]; } }

var found = false;
var window = null; 

for(var i=0; i < firefoxWindow.frames.length; i++){if(firefoxWindow.frames[i].toString().toLowerCase().indexOf('object window') > -1){window = firefoxWindow.frames[i]; break;}}


function recursiveSearch(frames){ for(var i=0; i<frames.length; i++){var elems = frames[i].document.getElementsByTagName('td'); for(a=0;a < elems.length;a++){ if( ((elems[a] !== null && elems[a].hasAttributes() === true && elems[a].getAttribute('onclick') !== null && elems[a].getAttribute('onclick').toString().match(/Goodbye Wonderful/gim) !== null && elems[a].getAttribute('onclick').toString().match(/Goodbye Wonderful/gim).length >= 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){found = true; return;} else{ if(frames[i].frames.length>0){recursiveSearch(frames[i].frames);}}}}if(!elem && window.frames.length > 0){ recursiveSearch(window.frames); }var origColor = '';if(elem !== null){origColor = elem.style.backgroundColor;if(origColor === null){origColor = '';} elem.style.backgroundColor = 'yellow';}
这是来自jssh的返回消息: 收到:未捕获的异常:[例外...“组件不可用”nsresult:“0x80040111(NS_ERROR_NOT_AVAILABLE)”location:“JS frame :: interactive :: :: line 1”data:no]     
已邀请:
Firefox 4中不再支持JSSh并且处理起来很麻烦,切换到mozrepl,因为它主要是用javascript编写的,直接向扩展添加我自己的javascript命令似乎是完成某些事情的更好方法。     

要回复问题请先登录注册