User:madarche

  • Revision slug: User:madarche
  • Revision title: User:madarche
  • Revision id: 73565
  • Created:
  • Creator: madarche
  • Is current revision? No
  • Comment 8 words removed

Revision Content

Member of the French speaking Libre Software Users' Association (AFUL) I develop conform and accessible web sites as well as Firefox XUL extensions.

I'm interested in improving the documentation of DevMo to ease XUL and extensions development so more and more people decide to use the Mozilla platforms.

Regarding XUL Firefox extensions, I'm especially interested and am contributing to documenting Sidebar possibilities.

UxU FAQ

I'm mainly using UxU for testing a Firefox extensions and it's a pleasure to finally be able to do it. Testing XUL extensions is not that easy at the moment with the very few tools that one can find.

Question:

My XUL code has some "alert('This is a confirmation message')" calls that await a click on their OK buttons. In general my code uses prompts (@mozilla.org/embedcomp/prompt-service;1) for user interactions, but for lower level and debug stuffs it uses "alert" calls.

How should I do to produce the desired click please on those popup windows?

So far I have no success with the following code below:

action.keypressOn($('input'), Ci.nsIDOMKeyEvent.DOM_VK_RETURN); var windows = utils.getChromeWindows(); windows.forEach(function(window) {     window.close(); });"} }}action.keypressOn($('input'), Ci.nsIDOMKeyEvent.DOM_VK_RETURN); var windows = utils.getChromeWindows(); windows.forEach(function(window) {     window.close(); });

 

Maybe I should only use prompts and not alert in the XUL code?

Answer:

Alert dialogs are opened as modal. So, if you call window.alert() (or a method of nsIPromptService) directly from the event handler for $('input'), the script will stop on the line 1 until the "OK" button in the alert is pressed (so lines 3-6 are never called!).

 

You cannot solve this problem with the current version of UxU (UxU 0.7.6 - 2010-01-29 - at the time of this writing). New utilities for this problem are planed but not coded yet.

By the way, this problem also appear on dialogs to choose files. Because their dialogs are not XUL windows, we cannot control them from JavaScript. It's a hard issue.

Revision Source

<p>Member of the <a class=" external" href="http://aful.org/">French speaking Libre Software Users' Association (AFUL)</a> I develop conform and accessible web sites as well as Firefox XUL extensions.</p>
<p>I'm interested in improving the documentation of <a href="/" title="https://developer.mozilla.org/">DevMo</a> to ease XUL and extensions development so more and more people decide to use the Mozilla platforms.</p>
<p>Regarding XUL Firefox extensions, I'm especially interested and am contributing to documenting <a href="/en/Code_snippets/Sidebar" title="https://developer.mozilla.org/en/Code_snippets/Sidebar">Sidebar possibilities</a>.</p>
<h3>UxU FAQ</h3>
<p>I'm mainly using <a class=" external" href="http://www.clear-code.com/software/uxu/index.html.en" title="http://www.clear-code.com/software/uxu/index.html.en">UxU</a> for testing a Firefox extensions and it's a pleasure to finally be able to do it. Testing XUL extensions is not that easy at the moment with the very few tools that one can find.</p>
<h4>Question:</h4>
<p>My XUL code has some "alert('This is a confirmation message')" calls that await a click on their OK buttons. In general my code uses prompts (@mozilla.org/embedcomp/prompt-service;1) for user interactions, but for lower level and debug stuffs it uses "alert" calls.</p>
<p>How should I do to produce the desired click please on those popup windows?</p>
<p>So far I have no success with the following code below:</p> <pre class="brush: js">action.keypressOn($('input'), Ci.nsIDOMKeyEvent.DOM_VK_RETURN); var windows = utils.getChromeWindows(); windows.forEach(function(window) {     window.close(); });"} }}action.keypressOn($('input'), Ci.nsIDOMKeyEvent.DOM_VK_RETURN);<code> var windows = utils.getChromeWindows(); windows.forEach(function(window) {     window.close(); });
</code></pre>
<p> </p>
<p>Maybe I should only use prompts and not alert in the XUL code?</p>
<h4>Answer:</h4>
<p>Alert dialogs are opened as modal. So, if you call window.alert() (or a method of nsIPromptService) directly from the event handler for $('input'), the script will stop on the line 1 until the "OK" button in the alert is pressed (so lines 3-6 are never called!).</p>
<p> </p>
<p>You cannot solve this problem with the current version of UxU (UxU 0.7.6 - 2010-01-29 - at the time of this writing). New utilities for this problem are planed but not coded yet.</p>
<p>By the way, this problem also appear on dialogs to choose files. Because their dialogs are not XUL windows, we cannot control them from JavaScript. It's a hard issue.</p>
Revert to this revision