1

I'm scratching my head on this one.

My add-on installs but does not seem to function.

I have a working add-on I built for Firefox(web) that geolocates, gets domain/path/etc/, user-agent, ports the info to the content script, yada yada, etc etc, but I couldn't seem to get it to do more than install on the nightly Fennec build.

I understand some modules aren't available on mobile yet, which is not a big deal, at this point I am literally just trying to get an alert box to pop-up.

Just for the hell of it here are the basic files for the alert box:


lib/main.js

var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");

exports.main = function() {    
    pageMod.PageMod({    
        include: "*",
        contentScriptWhen: 'ready',  
        contentScriptFile: [data.url("test.js") ],            
        attachTo: ["top"]
    });    
};

data/test.js

window.alert("hello");
alert("you");

My thoughts are this may be a version conflict, but my fix didn't seem to make a difference.

I have installed the nightly build of firefox which today is (29.0a1)

I have installed the Addon-sdk-1.15 (current)

When I package my addon

cfx xpi --force-mobile 

the produced Install.rdf reads max-version(22.0a1).

This appears to be my problem, so I have adjusted the max-version to (29.0a1) in the constructor for the install.rdf located in /addon-sdk-1.15/app-extension/install.rdf, so when I package again the max-version will match my nightly build.

Is this the correct method of doing this?

I install the xpi, by

adb push my-addon.xpi /mnt/sdcard/

Then open Firefox Mobile and type this into the address bar:

file:///mnt/sdcard/my-addon.xpi

It installs correctly, but again, no functionality.

Does anyone have any useful input?

Thank you in advance.

Tyler Rafferty
  • 3,391
  • 4
  • 28
  • 37
  • 1
    maxVersion is irrelevant here, starting with Firefox 10 "compatible by default" is enabled so older add-ons are assumed to be compatible with current Firefox versions. As you say it yourself, the add-on installs. – Wladimir Palant Dec 20 '13 at 08:02
  • Do you have any insight as to why my alert box is not appearing? IF your say that if it installs, which it does, then why is not appearing? – Tyler Rafferty Dec 21 '13 at 10:17
  • Well, it could be that your file is really called `data/test.js` while you are trying to load `data/speedfind.js` (at least according to the code you provided). If that's not the issue then I don't know - I'm not really an expert on the SDK, particularly when it comes to mobile. – Wladimir Palant Dec 22 '13 at 10:05
  • That was a typo.. I edited my example code. Thank you for pointing it out. – Tyler Rafferty Dec 22 '13 at 20:59
  • Possible duplicate of [How to listen to page loads from Fennec extension?](http://stackoverflow.com/questions/5180634/how-to-listen-to-page-loads-from-fennec-extension) – Paul Sweatte Dec 10 '16 at 01:58

0 Answers0