防止xulrunner中的浏览器位置更改
||
我一直在使用https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads进行阅读和研究,但是似乎可以满足我的需要。
我正在使用Chromeless,试图防止主xulbrowser元素被导航离开,例如,链接不起作用,ѭ0也不应该。
我假设我可以通过
browser.webProgress.addProgressListener
然后再听onProgressChange
,但是我不知道如何区分资源请求和browser
更改位置(seems4ѭ为时已晚,因为文档已经在卸载)。
browser.webProgress.addProgressListener({
onLocationChange: function(){},
onStatusChange: function(){},
onStateChange: function(){},
onSecurityChange: function(){},
onProgressChange: function(){
aRequest.QueryInterface(Components.interfaces.nsIHttpChannel)
if( /* need to check if the object triggering the event is the xulbrowser */ ){
aRequest.cancel(Components.results.NS_BINDING_ABORTED);
}
},
QueryInterface: xpcom.utils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference])
}, wo._browser.webProgress.NOTIFY_ALL);
听起来很有前途的另一个选择是nsIContentPolicy.shouldLoad()
方法,但是我真的不知道如何“创建一个扩展nsIContentPolicy的XPCOM组件,并使用nsICategoryManager将其注册到” content-policy \”类别。
有任何想法吗?
没有找到相关结果
已邀请:
1 个回复
焙恍挝厂熄
位不可用。
对感兴趣的人在github上请求请求:https://github.com/mozilla/chromeless/pull/114