How to test my standalone Xul application using the DOM Inspector (or similar)?

I am trying to test my standalone Xul application, but the DOM Inspector page talks about documents downloaded to the browser.

How can I test my standalone Xul app?

+4
source share
1 answer

The DOM Inspector can only check documents from its host application - the application that it expands (and then only the profile in which it was installed). You need to install the DOM Inspector in your XULRunner application if you want to test it.

There are some documents on how to get the DOM Inspector installed on the XulRunner application, [1] and it looks right with a quick look, but this way is redundant, especially if you already have the add-on manager enabled in your application.

If the Add-ons Manager is not already enabled, add these two lines to your application.ini file:

[XRE] EnableExtensionManager=1 

I assume that since the development of the XULRunner application, you already have an error console available from your application. Open it and paste into it to open the add-on manager:

 window.openDialog("chrome://mozapps/content/extensions/extensions.xul", "", "chrome,dialog=no,resizable=yes"); 

From there, click "Install ..." and find the DOM Inspector XPI on your system to install it in your current XULRunner application profile.

Now you can start the DOM Inspector from the command line using the "-indpector" switch, but you probably want to open it from your application. Enable the DOM Inspector launch interceptors by adding the following line to your XUL application:

 <script type="application/javascript" src="chrome://inspector/content/hooks.js"/> 

Now add the XUL button, menuitem, etc. with attribute

 oncommand="inspectDOMDocument();" 

Or you can do it

 oncommand="inspectDOMDocument(document);" 

This will force the DOM Inspector to scan the application document by default.

[1]: https://developer.mozilla.org/en/XULRunner_tips#DOM_Inspector "XULRunner Tips". MDC

+10
source

Source: https://habr.com/ru/post/1334939/


All Articles