firefox-webextensions

Firefox WebExtension: How Do I Run Code Prior to Disable/Uninstall?

烈酒焚心 提交于 2020-01-21 05:32:07
问题 I have recently converted a GreaseMonkey script of mine into a WebExtension, just to get a first impression of the process. Now I have a reached a point where it would be nice to do some clean-up or simply undo all my changes when said extension is disabled/uninstalled. From what I've seen on Mozilla's pages, runtime.onSuspend should do the trick. Unfortunately, it looks like that's not yet implemented (I'm on the regular Firefox release channel). In other words, what I want to do is run code

Firefox WebExtension: How Do I Run Code Prior to Disable/Uninstall?

微笑、不失礼 提交于 2020-01-21 05:32:07
问题 I have recently converted a GreaseMonkey script of mine into a WebExtension, just to get a first impression of the process. Now I have a reached a point where it would be nice to do some clean-up or simply undo all my changes when said extension is disabled/uninstalled. From what I've seen on Mozilla's pages, runtime.onSuspend should do the trick. Unfortunately, it looks like that's not yet implemented (I'm on the regular Firefox release channel). In other words, what I want to do is run code

Unable to use Components in WebExtensions: get “ReferenceError: Cu is not defined”

会有一股神秘感。 提交于 2020-01-20 08:50:11
问题 I have a simple extension where I use Cu.import to import a JavaScript code module. But, when I load the extension, I get this error: Cu is not defined The code I was trying to use was: Cu.import("resource://gre/modules/MatchPattern.jsm"); Cu.import("resource://gre/modules/BrowserUtils.jsm"); var regExArray = []; var myArray = ["facebook.com", "google.com"]; var myURL="http://www.google.co.uk/?gfe_rd"; for (var x=0; x<myArray.length; x++) { console.log("loop: "+x); var match = new

Unable to use Components in WebExtensions: get “ReferenceError: Cu is not defined”

旧巷老猫 提交于 2020-01-20 08:49:06
问题 I have a simple extension where I use Cu.import to import a JavaScript code module. But, when I load the extension, I get this error: Cu is not defined The code I was trying to use was: Cu.import("resource://gre/modules/MatchPattern.jsm"); Cu.import("resource://gre/modules/BrowserUtils.jsm"); var regExArray = []; var myArray = ["facebook.com", "google.com"]; var myURL="http://www.google.co.uk/?gfe_rd"; for (var x=0; x<myArray.length; x++) { console.log("loop: "+x); var match = new

Calling API Keys in background and content scripts in WebExtension

亡梦爱人 提交于 2020-01-16 06:55:09
问题 I have an API key and secret required for my extension and I've stored them in a file on their own formatted like so. key.js var APP_KEY = 'App Key Goes Here'; var APP_SEC = 'App Secret Goes Here'; manifest.json // manifest.json { "manifest_version": 2, "name": "Trakt for IMDb", "version": "0.1a", "background": { "scripts": [ "js/key.js", "js/background.js"] }, "content_scripts": [ { "js": [ "js/key.js", "js/main.js" ] } ] } On the popup pages I can just reference this file like <script type=

Mozilla WebExtension API storage - Debugging with and without breakpoints leads to different output

杀马特。学长 韩版系。学妹 提交于 2020-01-13 05:53:28
问题 Hello guys, i am trying to implement an add-on for the Mozilla-Firefox Browser. The following script shows one backgorund script I already successfully integrated. It uses the Mozilla WebExtension API storage. It gets executed but the log on the browser console suprises me. I get alternating logged nothing and: bla bla bla If and only if I set breakpoints on significant lines (especially the last 5 lines) of my code in Debugging-Mode I get always the expected result: bla How is it that the

Mozilla WebExtension API storage - Debugging with and without breakpoints leads to different output

丶灬走出姿态 提交于 2020-01-13 05:53:23
问题 Hello guys, i am trying to implement an add-on for the Mozilla-Firefox Browser. The following script shows one backgorund script I already successfully integrated. It uses the Mozilla WebExtension API storage. It gets executed but the log on the browser console suprises me. I get alternating logged nothing and: bla bla bla If and only if I set breakpoints on significant lines (especially the last 5 lines) of my code in Debugging-Mode I get always the expected result: bla How is it that the

How do I use `jpm` with webextension in Firefox?

人走茶凉 提交于 2020-01-13 03:15:47
问题 I'm starting a Firefox addon and from what I see: jpm is the tool to manage a Firefox addon ; WebExtensions are a new way to write Firefox extensions compatible with the extension API supported by Google Chrome and Opera ; yet I can't find if jpm is usable with WebExtensions. Question Is it possible to develop a WebExtensions using jpm ? 回答1: Nope. They’re two separate ways of developing Firefox add-ons. Just to add a little more detail, if you’re writing an add-on you want people to use now,

How do I use `jpm` with webextension in Firefox?

二次信任 提交于 2020-01-13 03:15:12
问题 I'm starting a Firefox addon and from what I see: jpm is the tool to manage a Firefox addon ; WebExtensions are a new way to write Firefox extensions compatible with the extension API supported by Google Chrome and Opera ; yet I can't find if jpm is usable with WebExtensions. Question Is it possible to develop a WebExtensions using jpm ? 回答1: Nope. They’re two separate ways of developing Firefox add-ons. Just to add a little more detail, if you’re writing an add-on you want people to use now,

Firefox Native Messaging runtime.LastError not giving any errors in case of no Native application installed on Connectnative

走远了吗. 提交于 2020-01-06 19:31:08
问题 I am trying to check whether the Native app is installed or not , If it is not I have to prompt the user to download it from the webpage. For chrome I used to achieve by checking the error messages from runtime.LastError. However in case of Firefox it gives error only in console No such native application extension_name and not catching it in the runtime.LastError method. Is there any way that we can identify whether corresponding Native app is installed or not ? I am facing issue when Native