Is this a known issue in firefox extensions on Mac

2019-04-12 19:56发布

问题:

I've developed a firefox extension which contains a small dialog defined by this XUL script:

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<prefwindow id="firenowPreferences" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="Fire.Now" ondialogaccept='onSave();' onload="checkFields();">
<script type="application/x-javascript">function onSave(){ alert('blablabla');}</script>
 <prefpane id="pane1">
  <grid>
    <rows>
      <row align="center"><label control="username">Username</label><textbox id="username"/></row>
      <row align="center"><label control="password">Password</label><textbox type="password" id="password"/></row>
    </rows>
  </grid>
 </prefpane>
</prefwindow>

The above code can be tried out here

The problem is that on Linux/Windows platform (on both firefox 3.5/3.6) everything works fine, and I see something like this:

http://img52.imageshack.us/img52/4210/shot1v.jpg

On Mac OS, instead, I can see the same thing but WITHOUT the button!

Trying out the XUL script here, if you are using Linux/Windows the result is the same as the screenshot, but if you are on Mac there are two small buttons without text (that would be fine, but using the same xul code within the extension, no buttons are shown).

Any suggestions? Is this a Mac OS firefox known issue?

回答1:

In native Mac applications preferences take effect instantly and there are no OK/Cancel buttons (open System Preferences for example). XUL <prefwindow> mimics this behavior.

This "instant apply" behavior is actually controlled by a pref browser.preferences.instantApply, if you set that on a Windows machine, you'll see the OK/Cancel buttons go away.