[Project_owners] Re: strange values from nsIContentPolicy.idl

user at domain.invalid user at domain.invalid
Tue May 3 01:06:33 EDT 2005


Michael Vincent van Rantwijk wrote:
> Why is 'aContext' set to [object HTMLDocument] instead of [object 
> HTMLImageElement] ?

Because these are _background_ images.  Ones specified in CSS at that.  They 
aren't loaded by an HTMLImageElement.  The only context available is the 
document the CSS was parsed for.

> and because of this error

Which isn't an error.  The documentation for aContext clearly says:

165    * @param aContext          OPTIONAL. the nsIDOMNode or nsIDOMWindow that
166    *                          initiated the request, or something that can QI
167    *                          to one of those; can be null if inapplicable.

which is exactly what you're getting -- a document QIs to nsIDOMNode...  Note 
that per DOM spec the ownerDocument of a Document node is null.

> and I also can't use aContext.defaultView (because it 
> is undefined)

Now _that_ sounds wrong...  I can see it happening if the relevant document is 
no longer being shown in a window or not yet being shown in a window, but that 
shouldn't be the case here, since these images should be getting fetched after 
layout has started, so definitely when the document has a window already.

-Boris


More information about the Project_owners mailing list