少し無理矢理ですが一応以下の方法でできました。
コード:
window.addEventListener("load", function() { myExtension.init(); }, false);
var myExtension={
init: function(){
gBrowser.addProgressListener(myListener);
//タブ追加イベント
gBrowser.tabContainer.addEventListener("TabOpen", myListener.tabAdded, false);
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent) appcontent.addEventListener("DOMContentLoaded", this.onPageLoad, true);
},
onPageLoad : function(){
//タイマクリア
window.clearTimeout(myListener.timeoutID);
delete myListener.timeoutID;
}
}
const STATE_START = Components.interfaces.nsIWebProgressListener.STATE_START;
var myListener={
QueryInterface: function(aIID){
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onStateChange: function(aWebProgress, aRequest, aFlag, aStatus)
{
if(aFlag & STATE_START)
{
var uri=aRequest.name;
alert(uri);
}
return 0;
},
tabAdded: function(event){
var browser = event.target.linkedBrowser;
//タイマをセット
myListener.timeoutID=window.setTimeout(myListener.tabAdded2, 10, browser);
},
tabAdded2 : function(browser){
var uri=browser.currentURI.spec;
//URIが取得できるまでタイマをセットし続ける
if(uri=="about:blank"){
myListener.timeoutID=window.setTimeout(myListener.tabAdded2, 10, browser);
return;
}
delete myListener.timeoutID;
alert(uri);
},
onLocationChange: function(){return 0;},
onProgressChange: function() {return 0;},
onStatusChange: function() {return 0;},
onSecurityChange: function() {return 0;},
onLinkIconAvailable: function() {return 0;}
}
_________________
masahal
antispam826-public at yahoo.co.jp
http://masahal.web.fc2.com/