是否可以在不关闭浏览器的情况下删除 gecko / firefox 会话或使其无效?

发布于 2024-08-23 04:06:47 字数 1334 浏览 10 评论 0原文

是否可以使用 gecko / firefox XPCOM 界面在不关闭浏览器的情况下删除或使用户的活动会话无效?我在应用程序中使用嵌入的 Gecko(特别是 GeckoFX),其中多个用户可能跨域使用浏览器组件应用程序的生命周期。

该应用程序将网络浏览与各种其他功能打包在一起,当网络浏览器“关闭”时,该应用程序保持打开状态。看来,就 gecko 引擎而言,由于进程尚未关闭,活动会话仍然处于活动状态。例如,如果用户要登录 Gmail 或 Facebook,然后关闭浏览器,则在重新打开浏览器并导航回其中一个页面时,该用户将被确定为仍处于登录状态。由于多个用户可以使用该应用程序如果应用程序没有实际退出,这会引发隐私问题。

我尝试致电 NS_InitXPCOM2NS_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤千羽 2024-08-30 04:06:47

我终于找到了似乎允许这样做的接口: nsICookieManager removeAll()

使用 GeckoFX 的相关 C# 接口/代码:

[Guid("AAAB6710-0F2C-11d5-A53B-0010A401EB10"),
ComImport,
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface nsICookieManager
{
    void removeAll();
    void remove(string aDomain, string aName, string aPath, bool aBlocked);
}

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:

[Guid("AAAB6710-0F2C-11d5-A53B-0010A401EB10"),
ComImport,
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface nsICookieManager
{
    void removeAll();
    void remove(string aDomain, string aName, string aPath, bool aBlocked);
}

and Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1").removeAll(); in appropriate location.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文