1
votes

I am trying to add a dialog box using XUL to a Firefox extension that already has an overlay xul defined. I tried adding the dialog code in the same overlay.xul file, but run into a "dialog.getButton is not a function" error in the Error Console. The structure of the file looks like this:

<overlay id="xxx" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
... code...
<dialog id="yyy" 
   buttons=","
   onload="onLoad();">
   ....
 </dialog>
 </overlay>

If I separate out the dialog xul code into a different file, then everything seems to work. The difference is that in the separate dialog.xul file, the dialog code looks like this:

<dialog id=yyy" 
   xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
   buttons=","
   onload="onLoad();">
   ...
</dialog>

Is it possible or correct to add the dialog code in the same overlay XUL file or should I actually separate them? Is it ok to have multiple XUL files for the same extension?

1

1 Answers

1
votes

Is it possible or correct to add the dialog code in the same overlay XUL file

No.

should I actually separate them?

Yes.

Is it ok to have multiple XUL files for the same extension?

Yes.

You can have as many XUL files in your extension as you want. Each XUL document should be in a separate file - already because the root tag of the document matters. An overlay should have <overlay> as its root tag, a dialog needs to use the root tag <dialog> and a regular window <window>.