How can I get the SSL Certificate info for the *current* page in a Firefox Add On

前端 未结 2 1495
[愿得一人]
[愿得一人] 2020-12-30 15:43

I\'m trying to develop a Firefox extension/add-on that needs access to the SSL Certificate information of the page that is currently loaded. Once I have this information I

2条回答
  •  太阳男子
    2020-12-30 16:11

    The way you query the channel to get its security info seems sane. I suspect that your problem is actually timing - you query it at the wrong time. Tracing all requests is really the wrong approach if security info is all you are interested in. It makes far more sense to register a progress listener (there are examples) and to look at the channel whenever onSecurityChange is being called. You are likely to be only interested in requests where aState contains STATE_IS_SECURE flag. Note that aRequest parameter is usually an nsIChannel instance but could also be a plain nsIRequest - instanceof check is required.

提交回复
热议问题