I've been working on a Firefox extension (basically just a "content script" or "page mod", whichever term works for you) that works exactly as expected when I use "cfx run" but when I do "cfx xpi" and install it, nothing happens. In cfx run, my content script works perfectly, with no errors from the command prompt. If this is any help, I do see an error when I exit the test run:
###!!! [Child][DispatchAsyncMessage] Error: (msgtype=0xAA0001,name=PTexture::Msg
___delete__) Route error: message sent to unknown actor ID
But this looks different from JavaScript errors (and really looks more "internal" to me, something buggy about the SDK maybe?). Anyway, when I do cfx xpi (with or without the "--no -strip-xpi" option) everything seems to work fine. No errors from the console, the installation seems to work), but when I go to the page I'm writing the script for, nothing happens. The page loads as it usually does, but the content script doesn't do anything; no changes to the page, no errors, really just no hint whatsoever of what the function is going on.
So of course I spent a bit of time on Google and also this site. I found a couple questions that were slightly similar but either unrelated or unanswered. Here are a few of these: creating xpi does not work (this one was a mac vs. Windows issue) Create XPI package with the Add-on SDK? (this one was kinda close but I didn't use contentScript in my main.js and did use the PageMod object like the guy suggested) Firefox SDK Sample Add On Exported XPI Action Button Doesn't Show Up (My console didn't show any errors, so this one didn't help either).
And of course, I tried all the obvious stuff (restart Firefox, reboot the computer, change the content of the scripts, etc.) and the result is still the same: fine in cfx run, compiles and installs fine but does nothing after cfx xpi.
Also, in case it would be helpful to you guys, here's my main.js:
var data = require("sdk/self").data;
var pageMod = require("sdk/page-mod");
pageMod.PageMod({
include: "*.somepage.com",
// NOTE TO SELF: include all object files here.
contentScriptFile: [data.url("Data.js"), data.url("Layout.js"), data.url("HTML.js"), data.url("Restyler.js"), data.url("Shortcut.js"), data.url("ARIA.js"), data.url("Apricot.js")]
});
This follows closely with everything I've read in the documentation and tutorials, but still for whatever/no-good reason it only works in cfx run. So unfortunately, all I can really tell you for sure is that something somewhere is somehow blocking, overriding, or otherwise preventing the XPI from doing its thing (mysterious? Sure. Frustrating? You have no idea...). :))))
I'm sorry I'm not sure what else to say, lol. I know JavaScript (and a bunch of other languages) but this is my first attempt at using the SDK (which seems to be more trouble than it's worth). Gosh I wish they would update the GreaseMonkey compiler, or at least bring back the Add-On Builder... oh crap did I say that out loud? :)
All joking aside though, any potential solutions, workaround or other insights would be greatly appreciated. Thanks.