XULRunner: Prevent links to arbitrary domains

别等时光非礼了梦想. 提交于 2019-12-06 05:13:40

It seems you want functionality similar to that provided by BlockSite - except you want to whitelist the app's domain and block everything else. There's some MDC documentation on installing extensions within XUL Runner which may help.

Alternatively you could have a look through the source code and try and work out where it hooks in - this would let you implement an alternative behaviour to just blocking and avoid shipping an extension with your app. I think BlockSite.js is the key file, looks like the handler gets added here (line 171):

var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.addObserver(BlockSiteObserver, "http-on-modify-request", false);

The BlockSiteObserver function is defined in the code just above.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!