I am developing an extension on Firefox’s Addon SDK (v1.9). My extension blocks or allows resources by implementing nsIContentPolicy and testing their URIs against a database of URIs to block.
Problem
I need to have access to the tab object (if available) from the shouldLoad function of nsIContentPolicy.
I assume the part to use for this is the “context” parameter on the shouldLoad function which is nsISupports. I have tried using getTabForWindow(win) with no luck since context is not nsIDOMWindow (Identify tab that made request in Firefox Addon SDK)
The
contextparameter is either a document or an element. Getting from there to a window isn’t hard:For reference: Node, Document,window.