firefox-addon-sdk

Firefox Addon PKCS#11 API

落爺英雄遲暮 提交于 2019-12-12 10:05:28
问题 I want to access the currenly connected cryptography modules via an Firefox Addon. I found some interfaces that look like i can access the module, the slot and the token (1 → 2 → 3 → 4) but how can i access the public key of an certificate stored on such a token? Is there an such an API even available to an Addon? 回答1: nsIX509CertDB.idl provides the means to access all stored certificates, therefore also the ones accessed through crypto modules. To filter the certificates using the tokenName

Relative image url in content script in Firefox Add-On SDK

懵懂的女人 提交于 2019-12-12 08:38:31
问题 I'm currently developing a Firefox extension using Add-On SDK and bumped into a real problem. Basically my extension just injects a content script into a webpage like this: main.js var pageMod = require("page-mod"); var self = require("self"); pageMod.PageMod({ include: "http://mail.google.com/mail/*", contentScriptFile: [self.data.url("jquery.js"), self.data.url("start.js")], attachTo : ["top"] }); start.js $('body').append('<div>1</div><img src="insertnote.png" /><div>2</div>'); Both start

How to replace a javascript file request with contents from another file in a FF addon?

梦想的初衷 提交于 2019-12-12 07:38:32
问题 I'm looking for some guidance on how to replace requests for a specific javascript file with another file that I'll package with the Firefox addon. 回答1: See How can I implement a content converter in Firefox for all page elements? (its scope is much wider than what you really need -- read on) on how to use registerFactory to register a surrogate HTTP protocol handler, which can then instantiate channels with alternate (e.g. file:///... -type) URIs when newChannel is called with your

firefox extension: intercepting url it is requesting and blocking conditionally

…衆ロ難τιáo~ 提交于 2019-12-12 07:23:25
问题 in firefox extension I want to intercept the url browser is making request to and block the request entirely if some condition matches how can I intercept URL being requested 回答1: you can have a look at the source of those addons https://addons.mozilla.org/en-us/firefox/addon/blocksite/?src=search https://addons.mozilla.org/en-us/firefox/addon/url-n-extension-blockune-bl/?src=search or use service observer with nsIHTTPChannel for fast handling const { Ci, Cu, Cc, Cr } = require('chrome'); /

Why isn't a global variable set immediately after defining a callback/listener function (asynchronous messaging, port.on) [duplicate]

我是研究僧i 提交于 2019-12-12 06:49:18
问题 This question already has answers here : How do I return the response from an asynchronous call? (36 answers) Why is my variable unaltered after I modify it inside of a function? - Asynchronous code reference (6 answers) Closed 3 years ago . I am very new to writing Firefox add-ons. But, I am trying my best. So, I have this code, which I got from MDN: var tabs = require("sdk/tabs"); tabs.on('activate', function(tab) { var worker = tab.attach({ contentScript: 'self.port.emit("html", document

self.port is undefined error [on mozilla add-on SDK 1.8]

那年仲夏 提交于 2019-12-12 05:48:24
问题 Following this guide, I did a little variation and I keep receiving this error : self.port is undefined at base.js[my content code] here my add-on code : PageMod({ include: [data.url('base.html')], contentScriptWhen: 'start', contentScriptFile: [data.url('jquery-1.7.2.min.js'),data.url('jquery-ui-1.8.21.custom.min.js'),data.url('base.js')], contentStyleFile: [data.url('css/mint-choc/jquery-ui-1.8.21.custom.css'),data.url('css/base.css')], onAttach: function(worker) { worker.port.on("request",

Add menu item created with the sdk/context-menu API to the top of the context menu

微笑、不失礼 提交于 2019-12-12 05:07:24
问题 I'm working on a Mozilla Add-on SDK extension that provides a right-click context menu option using the sdk/context-menu API and performs some actions on a particular website. Everything works fine except that the context menu item is added to the bottom of the list. I want it to be the first item in the context menu. I searched for a while for how to do this, but no luck. Here is the code I use to create he context menu item (modified to obfuscate the site on which it is being used): var cm

Firefox Addon: Sending data from main.js to dev tool tab

爷,独闯天下 提交于 2019-12-12 05:00:53
问题 I am trying to implement an addon that will intercept the HTTP response and then log it on to dev tool tab similar to the way XHRs are logged into web console. Addon code has following files: data/index.html lib/main.js I have defined devtoolTabDefinition : devtoolTabDefinition = { id: "logger", ordinal: 3, icon: "chrome://browser/skin/devtools/inspector-icon.png", url: self.data.url("index.html"), label: "HRRL", tooltip: "HTTP Request Response Logger", // Rest of the code I have registered

Firefox Addon Builder preferences-services not working for me--Why?

孤者浪人 提交于 2019-12-12 04:23:01
问题 I am trying to make a button in the Firefox Add-on Builder that will change the URL that the searchbar uses. To change the URL, I have a panel that shows when the button is clicked, and in the panel is a series of buttons. In a second .js file (not the main.js ) I have the functions that are supposed to change the keyword.url function using the preferences-service module. Here is the code I am using to do this: function changekeywordurl(url) { alert('Search Engine Changed'); require(

How to make HTTP requests from Firefox extension

谁说胖子不能爱 提交于 2019-12-12 04:00:44
问题 I want to make HTTP requests from Firefox extension, so I decided to use third-party libraries request and cheerio for this purpose. Unfortunately, when I import them via the following statements var request = require('request'); var cheerio = require('cheerio'); it give me the following error when I run it via jpm run : console.error: forwardme: Message: Module net is not found at resource://gre/modules/commonjs/net.js Stack: @resource://forwardme/node_modules/request/node_modules/tough