Closed Bug 106110 Opened 23 years ago Closed 17 years ago

DOMParser parseFromString does not load stylesheet data

Categories

(Core :: XML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Future

People

(Reporter: pwilson, Assigned: hjtoi-bugzilla)

References

()

Details

Attachments

(4 files)

DOMParser.parseFromString does not load stylesheet data for an XUL document.
If I load an XUL document containing xml-stylesheet PI's the sylesheet 
structures (available through the nsIDocumentStyle interface) return a length of 
zero. The stylesheets are being processed as this was the cause of bug #78622 
(which is now fixed) - the data is just not available.

If I look at the same document loaded by the browser the nsIDocumentStyle 
interface return the correct data.
Test case to follow.
Attached file xml file for test case
->XUL?
Assignee: asa → hyatt
Status: UNCONFIRMED → NEW
Component: Browser-General → XP Toolkit/Widgets: XUL
Ever confirmed: true
QA Contact: doronr → jrgm
Loading a XUL file via DOMParser means that it is just plain old XML (since 
DOMParser only knows XML).


Assignee: hyatt → heikki
Component: XP Toolkit/Widgets: XUL → XML
QA Contact: jrgm → petersen
Summary: DOMParser parseFromString does not load stylesheet data for XUL document → DOMParser parseFromString does not load stylesheet data for XML document
Attachment #54549 - Attachment description: xul file for test case → xml file for test case
Attachment #54549 - Attachment mime type: application/vnd.mozilla.xul+xml → text/xml
Um, jrgm, why did you change the XUL file to XML mime type & name?
I guess I was just trying to emphasize the point (correct me if I'm wrong) that
when you load a XUL file with the DOMParser, it is no different than any other 
XML file; the elements <window>, <script>, and <button> could be elements 
<larry>, <curly> and <moe> for all the DOMParser knows. (right?)

So, while it is "XUL" when that file is loaded as chrome in the mozilla 
browser, it is "XML" when loading with the DOMParser.
Summary: DOMParser parseFromString does not load stylesheet data for XML document → DOMParser parseFromString does not load stylesheet data for XUL document
Target Milestone: --- → Future
QA Contact: petersen → rakeshmishra
QA Contact: rakeshmishra → ashishbhatt
Could someone attach a self-contained testcase (as a zip if need be) so that
testing this does not involve reassembling things and renaming files to the
right names?
This applies to XHTML documents loaded from DOMParser as well. I've updated the URL field to some JavaScript code that parses an XHTML document containing an xml-stylesheet processing instruction, an html:link element, and an html:style element. It then alerts the length of document.styleSheets.length. It should be 3, but it's 0.
Summary: DOMParser parseFromString does not load stylesheet data for XUL document → DOMParser parseFromString does not load stylesheet data
We should wontfix this, imo.  DOMParser shouldn't be loading external resources.
I agree that it shouldn't load external resources (or at least by default), but the code I gave uses data URLs.
That's still an external resource.

I don't want to start special-casing data URIs, and other URI types that "don't actually hit the network" (javascript:?  about:?  chrome:? res:? file:?).  Especially because then we'd need to have this pervasively through the codebase (e.g. if a sheet from data: @imports a sheet we'd need to check for whether it's http: or data: or not, etc, etc).

Right now the conceptual model is simple: you get a raw DOM with no external resources loaded.  If you want them loaded, use an <iframe>.
Agreed, this is by design. Data-document such as the one produced by the DOMParser should not attempt to load uris.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
What about style elements?
Data documents disable all processing of anything other than parsing the DOM.  That means no XBL bindings, no CSS loading (inline or not), no script loading (inline or not).  The CSS loader and script loader are explicitly disabled in this case; see http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/base/src/nsDocument.cpp&rev=3.765&mark=1445,1448#1438
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: