Something smells off with IsUnstyledDocument, IsLoadedAsData and IsLoadedAsInteractiveData

NEW
Unassigned

Status

()

Core
DOM
a year ago
a year ago

People

(Reporter: jwatt, Unassigned, NeedInfo)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

a year ago
IsLoadedAsData and IsLoadedAsInteractiveData are undocumented, which makes their meaning unclear. When I added IsUnstyledDocument in bug 1008455 I made it return true if either of these methods return true since that seemed correct for "data" documents. I've since noticed that IsLoadedAsInteractiveData seems to be quite misleadingly named though, so I'm not sure IsUnstyledDocument is doing the right thing.

Digging into IsLoadedAsInteractiveData it seems like this is set for XBL bindings documents (it came into existance way back in bug 172372). For documents for which it returns true:

 * nsDocument::GetAnimationController() returns null

 * clone->SetFlags(NODE_FORCE_XBL_BINDINGS) will not be called in
   nsNodeUtils::CloneAndAdopt when cloning a XUL element to be a
   child of some other element

 * XMLDocument::StartDocumentLoad passes "loadAsData" to
   nsParser::SetCommand which prevents the parser loading <link>
   style sheets (nsXMLContentSink::ProcessStyleLink returns early)

 * XMLDocument::EndLoad sets mSynchronousDOMContentLoaded to true

Note that a document's nsScriptLoader and css::Loader are _not_ disabled, since XMLDocument::StartDocumentLoad passes "loadAsInteractiveData" to nsDocument::StartDocumentLoad _before_ changing |aCommand| to "loadAsData" for passing off to the parser. 

So I'm not sure to what extent documents that return true from IsLoadedAsInteractiveData are actually "data" documents. They seem much more like normal documents with a few XBL binding specific quirks. Even the bit where <link> style sheets are prevented seems suspect, since the XBL bindings document is still allowed and - according to bug 172372 - must be able to load style and script in other ways.
The idea is that IsLoadedAsInteractiveData should prevent anonymous content from doing random loads in the context of that document.  That is, if your binding template has an <img> in it, we should NOT load that <img> in the XBL document.  It should get loaded once the binding actually gets instantiated into the bound document.  This also applies to <script src>, <link href> etc.

I'm happy to rename IsLoadedAsInteractiveData as needed....
What are we going to do here, if anything?
Flags: needinfo?(jwatt)
You need to log in before you can comment on or make changes to this bug.