javascriptfirefoxsdkjpm

can't match a page with firefox jpm sdk page-mod inlclude


i'm writing a firefox addon, from my original greasemonkey userscript, which replaces eztv site's links with ajax ones, so when you click on show's watched/unwatched links it sends an ajax request to eztv and removes the row on success. Everthing is working fine, but Firefox's JPM SDK Page-Mod never matches the site if i specify include to only run on eztv sites.

require('sdk/page-mod').PageMod({
include: [/(https?:\/\/eztv\.(it|ch|ag)\/myshows)/, '*.eztv-proxy.net/myshows'],
contentScriptWhen: 'ready',
contentScriptFile: ["./jquery-2.2.3.min.js", './main.js'],
contentStyleFile: "./eztv.css",
attachTo: ["existing", "top"],    
});

if i change to include: "*", the scripts are loaded fine. i've tested the regexp and it seams to match the https://eztv.ag/myshows without a hich, but some how does not work in addon.

can someone spot a problem ?


Solution

  • finally found the answer to my problem, the regexp was missing an end slash. And also if you are using a string with wildcard for example: "*.eztv.it" you cannot specify a path or query to match, it only matches domain names. If you need to match a domains specific path you need to use RegExp.