0

I'm having problems with a very simple popup code in a Crossrider extension and Firefox (tested on 35.0.1 and 25.0.1 but I'm pretty sure it's the same thing on other versions as well).

Here's extension.js

appAPI.ready(function($) {
  randNumber = Math.floor((Math.random() * 1000) + 1);  
  appAPI.message.toBackground({
    msgRand: randNumber
  });
});

And this is background.js

appAPI.ready(function($) {
  appAPI.message.addListener(function(msg) {        
    randomNumber = msg.msgRand;        
    appAPI.browserAction.setResourceIcon('icon.png');
    appAPI.browserAction.setPopup({
        html: '<h1>' + randomNumber + '</h1>',
        height: 300,
        width: 300
    });        
  });
});

The code above is supposed to display a random number between 1 and 1000 but it works only the first time the button is clicked and from then on it keeps showing the same number no matter whether I open a link in the same tab or in a new tab. The only time the number changes is when I open a new window (but if I open a new link in the same window or a new tab in that window the number is still the same as the one initially displayed for the window). For example if I open a site in window 1 and click the extension's button it could display 111. Every other link I open in this window will always display 111 when I click the button. If I open another window while window 1 is open it might show 555 when I click the button and that will be the number for every new tab in this window.

I've tried the same code in Chrome (SRWare Iron to be precise) and IE 11 and everything seems to work as expected.

I'm also pretty sure that the problem is coming from the setPopup portion of the code, because I've tried to display the value of randomNumber via alert and it was different every time (plus the code works in IE and Chrome (haven't tested it in Safari yet)).

Here's the extension ID in case it might help - 72164

P.S. My English skills are a bit rusty, so let me know if I haven't explained something correctly.

Sledge Hammer
  • 196
  • 2
  • 11
  • You did a great job of explaining and it is an issue that cropped up recently in the FF version of [appAPI.browserAction.setPopup](http://docs.crossrider.com/#!/api/appAPI.browserAction-method-setPopup). It's currently in the dev team's queue to review though please be patient as it can take a while to prioritize, resolve and then pass QA. Thank you in advance for you understanding and apologies for the inconvenience. [**Disclosure**: I am a Crossrider employee] – Shlomo Mar 04 '15 at 13:11
  • Thanks, is there any way I can be notified when this is fixed? – Sledge Hammer Mar 04 '15 at 17:56
  • All being well, I'll update this thread once it's fixed. – Shlomo Mar 05 '15 at 09:50
  • We released a fix for the FF36 issue and I rebuilt your extension. Please download and install a fresh copy of the extension and let me know if there are any further issues. – Shlomo Mar 19 '15 at 16:12

0 Answers0