是否可以在不关闭浏览器的情况下删除 gecko / firefox 会话或使其无效?
是否可以使用 gecko / firefox XPCOM 界面在不关闭浏览器的情况下删除或使用户的活动会话无效?我在应用程序中使用嵌入的 Gecko(特别是 GeckoFX),其中多个用户可能跨域使用浏览器组件应用程序的生命周期。
该应用程序将网络浏览与各种其他功能打包在一起,当网络浏览器“关闭”时,该应用程序保持打开状态。看来,就 gecko 引擎而言,由于进程尚未关闭,活动会话仍然处于活动状态。例如,如果用户要登录 Gmail 或 Facebook,然后关闭浏览器,则在重新打开浏览器并导航回其中一个页面时,该用户将被确定为仍处于登录状态。由于多个用户可以使用该应用程序如果应用程序没有实际退出,这会引发隐私问题。
我尝试致电 NS_InitXPCOM2 和 NS_ShutdownXPCOM 在浏览器控件的构造函数/dispose 方法中,但是在进程的生命周期内,不能在 NS_ShutdownXPCOM 之后调用 NS_InitXPCOM2,因此这只会崩溃。
我还使用了 nsishistory 以及 nsICacheService 的 evictEntries 方法 - 这些似乎都没有在进程的生命周期。
有谁知道任何 XPCOM 接口可以实现这一点吗?或者,任何指向类似功能的指针,无论是通过 XPCOM 界面还是 Firefox 扩展,都将不胜感激(是否有任何扩展允许您在不重新打开浏览器的情况下清除当前的浏览会话?或者为您提供每个会话之间的不同会话) Firefox 窗口/选项卡?)
该程序是用 C# 编写的,但我们欢迎任何语言的答案。
非常感谢
Is it possible, using the gecko / firefox XPCOM interfaces, to delete or invalidate a user's active session without closing the browser? I am using Gecko embedded (specifically GeckoFX) in an application where it is possible that multiple users might use the browser component across the lifetime of the application.
The application packages web browsing with various other functionality, and when the web browser is 'closed', the app remains open. It seems that as far as the gecko engine is concerned, as the process hasn't closed, the active session is still active. If a user is to log into Gmail or Facebook, for instance, and then close the browser, upon reopening the browser and navigating back to one of those pages, that user is determined to still be logged in. As multiple users can use the application without the application actually exiting, this raises privacy issues.
I have tried calling NS_InitXPCOM2 and NS_ShutdownXPCOM within the constructor / dispose method of the browser control, however NS_InitXPCOM2 cannot be called after NS_ShutdownXPCOM within the lifetime of the process, so this simply crashes.
I have also used the PurgeHistory method of nsISHistory and the evictEntries method of nsICacheService - none of these appear to have an immediate effect within the life of the process.
Does anyone know of any XPCOM interfaces that can achieve this? Alternatively, any pointers in direction of similar functionality, be it through XPCOM interfaces or Firefox extensions would be greatly appreciated (are there any extensions that allow you to clear your current browsing session without reopening the browser? or that provide you a different session between each Firefox window / tab?)
The program is written in C#, however answers in any language are appreciated.
Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于找到了似乎允许这样做的接口: nsICookieManager
removeAll()
使用 GeckoFX 的相关 C# 接口/代码:
和
Xpcom.GetService("@mozilla.org/cookiemanager;1").removeAll();
在适当的位置。I finally found the interface that seems to allow this: nsICookieManager
removeAll()
Relevant C# interfaces / code for those using GeckoFX:
and
Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1").removeAll();
in appropriate location.