Open Bug 432720 Opened 16 years ago Updated 2 years ago

<xul:script> in XMLDocument is not loaded or not executed

Categories

(Core :: XUL, defect)

defect

Tracking

()

People

(Reporter: nbjayme, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008032619 Firefox/3.0b5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b5) Gecko/2008032619 Firefox/3.0b5

When a xul page loads a dialog window it does not recoognize the javascript codes if the file extension does not end in 'xul'.

Reproducible: Always

Steps to Reproduce:
1.Create a dialog xul but don't end the file extension in xul (i.e. wnd.xul.dlg)
2.Create an internal or external javascript accept or cancel handler
3.Create a xul file that loads the dlg (file:// protocol)
Actual Results:  
The dialog window should recognize the javascript functions for accept and/or cancel handler, but it cannot resolve those functions.


Expected Results:  
Recognize the accept or cancel handler functions.
Can you attach a simple but complete testcase that demonstrates the bug?

Why are you giving the file an extension other than XUL?
this is the testcase for the openDialog bug.
i usually place the last part of the file as an identification of what kind of xul it is.  I expected Mozilla (SDK / Xulrunner) to check on the content rather than rely on the extension of the file.

Well, probably i'll stick to xul extensions from now on. 

;)
I can reproduce by just loading the .dlg file in Firefox; there's no need for testcase.xul with the openDialog call.

I'm surprised Firefox figures out the .dlg file is XML at all.  But given that it does, it's pretty weird that the script doesn't work.  The same thing happens if I give it a .xml extension.  I bet it has something to do with the document being an XMLDocument instead of a XULDocument.

Related to bug 380537, perhaps?
Status: UNCONFIRMED → NEW
Component: General → XP Toolkit/Widgets: XUL
Ever confirmed: true
Keywords: testcase
OS: Linux → All
Product: Firefox → Core
QA Contact: general → xptoolkit.xul
Hardware: PC → All
Summary: Dialog windows does not recognize javascript codes. → <xul:script> in XMLDocument is not loaded or not executed
Version: unspecified → Trunk
> I bet it has something to do with the
> document being an XMLDocument instead of a XULDocument.
Yes, the logic for loading <xul:script>s is in the XUL content sink (which is invoked only for documents with XUL content type).

> Related to bug 380537, perhaps?
> 
No. bug 21771 is related though.

This is not easy to fix, and there are multiple other differences between generic XML documents and XUL. You should try to always use XUL in XUL documents only.
I have no idea behind the parser (so my thought may be too stupid)... should not the xmlns give a hint on how to handle the document?

That's not how parsing works in mozilla. One reason could be that by the time you can get to xmlns declaration on the root element, you'd already have to create the document object and start parsing it.
Isn't this related to bug 101147 (and thus WONTFIX)?
Blocks: 101147
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
This "affects" content/xul/content/crashtests/107518-1.xml.
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: