firefox-webextensions

Error: Incorrect argument types for storage.StorageArea.set

混江龙づ霸主 提交于 2019-12-12 05:28:20
问题 I need to store an array of objects using storage.local . When I try to call set to insert data to the storage, I get the following error: Error: Incorrect argument types for storage.StorageArea.set. Here is the manifest: { "manifest_version": 2, "name": "test", "version": "1.0", "icons": { "64": "icons/myicon.png" }, "browser_action": { "default_icon": "icons/myicon.png", "default_title": "test", "default_popup": "popup/input.html" }, "background": { "scripts": ["test.js"] }, "permissions":

How to publish a FireFox WebExtension for local installation only?

不打扰是莪最后的温柔 提交于 2019-12-12 05:26:20
问题 How can I permanently install my (toy) WebExtension without having to publish it via Mozilla Addons (AMO), when my extension is just a small group of CSS hacks not meant to be published. The other option, installing it only permanently would be cumbersome to do everytime I need the extension. EDIT: To add further input, the page I've linked to says Zip up your extension's files Edit At this point your extension will consist of a directory containing a manifest.json and any other files it

tab.openerTabId undefined in Firefox WebExtension

≡放荡痞女 提交于 2019-12-12 03:44:34
问题 I have this code in background script of my Firefox WebExtension, but it prints : "OPENER ID: undefined" each time new tab is created: chrome.tabs.onCreated.addListener(function (tab) { console.log("OPENER ID: " + tab.openerTabId); }); What is the problem? This code works well in Chrome, and in documentation it says that openerTabId property is supported in Firefox. And yes, openerTab is still present when new tab is created (new tab is created by clicking on some link in openerTab). 回答1: The

Security error in Firefox WebExtension when trying getUrl image

落爺英雄遲暮 提交于 2019-12-12 03:27:01
问题 Trying to port some Chrome extension and getting this Security Error: Content at "http://example.com" may not load or link to "moz-extension://04d69802-c26f-47ae-86f2-d54650455e5a/blocks/indicators/__icon/indicators__icon-tweet.png" (function () { 'use strict'; var PATHS = { TWITTER: chrome.extension.getURL("blocks/indicators/__icon/indicators__icon-tweet.png") }; })(); In manifest.json this path is in web_accessible_resources . 回答1: To get rid of this error, full path should be provided.

chrome.notification.create with chrome.notification.onClicked in a Firefox WebExtension add-on

放肆的年华 提交于 2019-12-12 02:46:06
问题 I have a problem understanding the documentation for the WebExtensions notification.onClicked event. Ultimately, I'm trying to get the text of the notification copied to the clipboard when you click on it. However, right now I am having a problem understanding the callback thing, or where I have to insert the notification.onClicked function. At the moment, I don't know why the notification.onClicked listener does nothing. My code (all the code needed to demonstrate the problem as a

Given a moz-extension:// URL opened by bookmark, how can I switch to tab using extension code?

房东的猫 提交于 2019-12-12 02:14:48
问题 This is related to some other questions I am working on. Say, for whatever reason, a user has bookmarked a page (call it pageURL of the pattern moz-extensions://MY-OWN-WEBEXT-ID/* ) intended to be opened from a browser action context menu, and opened it in a tab, then opened many other tabs and possibly other windows. User knows the extension tab exists somewhere and doesn't want to keep opening new bookmarks, and so wants to use the add-on's browser action context menu to find the extension

Extract extension id from (ASN1) mozilla.rsa file

时间秒杀一切 提交于 2019-12-12 02:12:49
问题 How do you retrieve the extension ID from the xpi file? (It is needed f.ex. for global extension installation) In previous versions, you could get it from the install.rdf , which no longer exists in WebExtensions. http://www.di-mgt.com.au/how-mozilla-signs-addons.html describes that it is contained in the META-INF/mozilla.rsa file. In python, there is the pyasn1 library. I could not get it to work on the first attempt: from pyasn1.codec.der import decoder f = open('/path/to/addon-dir/META-INF

Error: No window matching {“matchesHost”:[]} for tabs.insertCSS()

元气小坏坏 提交于 2019-12-12 01:46:47
问题 I'm writing a WebExtension where a background script communicates between a popup window (UI script) and web pages (content script). Using port = browser.runtime.connect({name: "ProjName"}); , the content script connects to the background script as soon as it loads. The background script registers that: function connected(p) { ... console.log(p.sender.tab.id); // <-- works fine, gives me an integer Tab ID browser.tabs.insertCSS(p.sender.tab.id, {file : "/css/stylesheetName.css"}); ... }

Understanding Promises: Need to combine multiple results

孤者浪人 提交于 2019-12-12 01:23:25
问题 How do I process the results of more than one Promise? Say the results a of DoA and b of DoB in DoNext I read https://developer.mozilla.org/de/docs/Web/JavaScript/Guide/Using_promises It introduces the "then"-Syntax which is supposed to replace the "callback pyramid of doom" however I don't understand the following: DoA.then(function(a){ return DoB(a) }) .then(function(b){ DoNext(a,b); }) In the call of DoNext, a is unknown. I understand that this is because a is only defined in the anonymous

Messages intended for one script in the background context are received by all

江枫思渺然 提交于 2019-12-11 16:43:37
问题 I have a WebExtension with the following structure: webextension [directory] - background.js - page1.html - page1.js - page2.html - page2.js The background.js listens for errors. If any, it instructs its callback function to update the tab with an HTML page, page2.js that contains a button. The HTML script page2.js starts by sending a message to the background.js and background.js replies to page2.js . This part works fine. Then, as you see in the code, page2.html contains a button if clicked