firefox-addon-sdk

Panel & PageMod Content Script message passing in a Firefox extension

帅比萌擦擦* 提交于 2020-01-02 04:42:08
问题 I'm working on porting a Chrome extension to Firefox using the Firefox Add-on SDK. The extension consists of a panel hooked up to a toolbar button (equivalent to Chrome's popup.html + browser action) and a PageMod content script. When the panel opens, it needs to send a message to the current tab's content script to receive an object containing some information from that page. The part I'm having trouble with is how to actually do the message passing. Can someone help point me in the right

Access Add-On SDK 'main' from XUL

一曲冷凌霜 提交于 2020-01-02 00:17:07
问题 In my add-on, I'm using XUL to display dialog windows because I can customize their appearance to suit the add-on's general style (like a custom titlebar ). Using the migration guide, I'm able to do this easily. The thing is, I would like to call certain functions in the add-on's main module from the XUL dialog. After a bit of searching I found the loader module, which seems to be able to do exactly what I want. But, I'm experiencing trouble in using it to access the main module. First, I

How to implement XPCOM component (nsIContentPolicy) in bootstrapped Firefox extension

旧巷老猫 提交于 2020-01-01 11:37:07
问题 I have a bootstrapped extension for Firefox. And now I want to implement nsIContentPolicy XPCOM component. I wrote a component module code. And now I want to register this component. The reason I want to register component is that I want to add my component to nsICategoryManager.addCategoryEntry with "content-policy" category. var {Cc, Ci, Cu} = require("chrome"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); //console.error("Running interceptor"); function Interceptor() } Interceptor

Using Google Analytics in Firefox Extension

Deadly 提交于 2020-01-01 06:55:22
问题 I would like to use Google Analytics Event tracking for my Firefox addon. I have included ga script like this in my popup.html. <script src="http://www.google-analytics.com/ga.js"></script> And also added: <script > var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); </script> I push events with the following code: _gaq.push(['_trackEvent', 'example', 'clickedit']); I dont see any error in the firefox error console and also the event is not there in the analytics page. Any

Getting the real HTML5 video width and height

大憨熊 提交于 2019-12-31 09:15:54
问题 I have a video element: var video = window.content.document.createElement("video"); video.width = width; video.height = height; video.style.backgroundColor = "black"; window.content.document.body.appendChild(video); And I'm retrieving it's source via getUserMedia() on Firefox: window.navigator.getMedia = ( window.navigator.getUserMedia || window.navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia || window.navigator.msGetUserMedia); window.navigator.getMedia( //constraints,

pushState change - equivalent to Chrome Extension onHistoryStateUpdated

戏子无情 提交于 2019-12-30 12:22:13
问题 I'm porting a Chrome extension to a Firefox extension and due to the nature of the website that it runs on, I need to monitor the pushState . Chrome Extensions has a handy way to handle this: chrome.webNavigation.onHistoryStateUpdated . The way that I use it in the Chrome extension is as follows: chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) { var tabUrl = details.url; if (isTabUrlValid(tabUrl)) { $.get(tabUrl, function(data) { var videoUrl = $(data).find('meta

How to add a proper-looking text input field to Firefox toolbar?

给你一囗甜甜゛ 提交于 2019-12-30 11:01:52
问题 I want to have a text input field in toolbar that looks like search input and is controlled by a FF extension. I am using sdk/widget: in main js file I have var reason = require("sdk/widget").Widget({ label: "Progress Block - reason", id: "text-entry", contentURL: data.url("reason.html"), width: 120 }); in reason html file <html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <style type="text/css" media="all"> </style> </head> <body> <input type="text" style="width

Installing unsigned XPIs in Firefox for Android version 42 or newer

隐身守侯 提交于 2019-12-30 06:26:07
问题 I'm trying to retake an old project, an extension for Firefox for Android, I was developing. I have 2 phones, a personal one and the one of my work. In mine I have an old version of Firefox (40). It works exactly the same as it used to be. But, in the upgraded version of my work's phone (Firefox 46), I can't install the .xpi . I always see the "Blocked addon" popup with the text "Firefox prevented an add-on from installing on your device": [ 1 I have the preference xpinstall.signatures

Use of simple-prefs (SDK API) with external script and postMessage

余生颓废 提交于 2019-12-30 05:09:08
问题 I'm developing a new version of my add-on (targeting Gmail) using the SDK and would need to store a few boolean preferences for my users. To do so, I would like to play with the new "simple-prefs" API. Based on the Mozilla documentation and this Stackoverflow question, I got something but I face the following issues: 1) I cannot get the change of my preferences to be properly passed to my external script in data. I need to disable and re-enable the add-on to get the changes applied. 2) How to

Firefox add-on pageMod, catch ajax done in contentScriptFile

我的未来我决定 提交于 2019-12-30 03:42:08
问题 my problem is that i need to know when AJAX is done on the page. I need to know this in my contentScriptFile that i load through pageMod. My add on needs to run every time that the page has been modified: so basically when it loads and every time there is an AJAX call. i tried this: $(document).ajaxComplete(function() { alert("AJAX call completed"); }); but it does not work. is there a way to do this? edit: my page mod code from main.js: pageMod.PageMod({ include: "*", contentScriptFile: