Non-modal popups at start of Firefox

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Non-modal popups at start of Firefox

peter.kehl
Hi. I've got a Firefox (non-bootstrapped) add-on in plain Javascript (or some kind of non-intrusive notification). I'd like it show a non-modal popup when Firefox starts. What's a good place or trigger to show them, please? The add-on has no window/GUI of its own (it provides a JS module).

I've tried to show a popup in my overlay of Firefox's browser.xul, using following three options from https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Alerts_and_Notifications:

1.

               Components.classes['@mozilla.org/alerts-service;1'].
                   getService(Components.interfaces.nsIAlertsService).
                   showAlertNotification(null, 'Some title', 'Some message', false, , null);

2.

               var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1'].
                   getService(Components.interfaces.nsIWindowWatcher).
                   openWindow(null, 'chrome://global/content/alerts/alert.xul',
                     '_blank', 'chrome,titlebar=no,popup=yes', null);
               win.arguments = [null, 'Some title', 'Some message', false, ];

3. var message = 'Another pop-up blocked'; var nb = gBrowser.getNotificationBox(); var n = nb.getNotificationWithValue('popup-blocked'); if(n) {

   n.label = message;

} else {

   var buttons = [{
       label: 'Button',
       accessKey: 'B',
       popup: 'blockedPopupOptions',
       callback: null
   }];

Neither of them works on Windows 7 x64 (SP 1). The first two work on Linux (Fedora 20 x64). Neither of the non-working ones generates any error/warning.

Please, suggest how/where to do that, or how to 'schedule it' (as an event handler to a system event, I suppose) from my overlay of browser.xul.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Non-modal popups at start of Firefox

Neil-4
[hidden email] wrote:

>Neither of them works on Windows 7 x64 (SP 1). The first two work on Linux (Fedora 20 x64). Neither of the non-working ones generates any error/warning.
>  
>
Ideally the alerts service would work on all platforms, so I don't know
why you're having a problem on Windows (but I haven't tried it myself)

>Please, suggest how/where to do that, or how to 'schedule it' (as an event handler to a system event, I suppose) from my overlay of browser.xul.
>  
>
You could try adding a observer service notification for
sessionstore-windows-restored which will then give you a chance to find
a browser window and post a notification to its notificationbox.

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Non-modal popups at start of Firefox

peter.kehl
Thanks Neil.

For benefit of others: this is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=324570. See a workaround there.
_______________________________________________
dev-tech-xul mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xul
Loading...