firefox-webextensions

How do I create native looking popups in a web extension for Firefox?

馋奶兔 提交于 2021-02-08 03:39:58
问题 I want a native looking popup (menu) in a Firefox web extension. Example: What I have now Irrelevant parts omitted manifest.json: "browser_action": { "browser_style": true, // injects chrome://browser/content/extension.css "default_popup": "popup.html" } popup.html: <div class="panel"> <div class="panel-list"> <div class="panel-list-item"> Item 1 </div> <div class="panel-list-item"> Item 2 </div> <div class="panel-list-item-separator"></div> <div class="panel-list-item"> Item 3 </div> </div>

Best way to purge innerHTML from a Firefox Extension

删除回忆录丶 提交于 2021-02-04 22:42:22
问题 I'm running web-ext lint and getting back a few errors like this: UNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not be set using dynamic values which have not been adequately sanitized. This can lead to security issues or fairly serious performance degradation. The code in question is basically doing: var html = '<style>body { margin: 0; } iframe { border: none; }' + '</style><iframe src="' + URL.createObjectURL(blob) + '" width=

Best way to purge innerHTML from a Firefox Extension

无人久伴 提交于 2021-02-04 22:42:06
问题 I'm running web-ext lint and getting back a few errors like this: UNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not be set using dynamic values which have not been adequately sanitized. This can lead to security issues or fairly serious performance degradation. The code in question is basically doing: var html = '<style>body { margin: 0; } iframe { border: none; }' + '</style><iframe src="' + URL.createObjectURL(blob) + '" width=

Best way to purge innerHTML from a Firefox Extension

旧城冷巷雨未停 提交于 2021-02-04 22:42:02
问题 I'm running web-ext lint and getting back a few errors like this: UNSAFE_VAR_ASSIGNMENT Unsafe assignment to innerHTML Due to both security and performance concerns, this may not be set using dynamic values which have not been adequately sanitized. This can lead to security issues or fairly serious performance degradation. The code in question is basically doing: var html = '<style>body { margin: 0; } iframe { border: none; }' + '</style><iframe src="' + URL.createObjectURL(blob) + '" width=

Why is this code not working? I am creating a Firefox extension but the code is not running. But if I paste the code into the console it works

妖精的绣舞 提交于 2021-02-04 19:55:33
问题 I make a firefox extension that get all the request url's and displays them. But the code only works if I paste it in the console. when the extension loads it doesn't show any error, it seems like it just won't run here is the full code xhrScript.js (function(){ const proxiedOpen = XMLHttpRequest.prototype.open; window.XMLHttpRequest.prototype.open = function ( _, url) { this.__URL = url; return proxiedOpen.apply(this, arguments); }; const proxiedSend = window.XMLHttpRequest.prototype.send;

onclick or inline script isn't working in extension

隐身守侯 提交于 2021-01-29 10:47:30
问题 This seems to be the easiest thing to do, but it's just not working. In a normal browser the .html and .js files works perfectly, but in the Chrome/Firefox extension the onClick function is not performing what it's supposed to do. .js file: function hellYeah(text) { document.getElementById("text-holder").innerHTML = text; } .html file: <!doctype html> <html> <head> <title> Getting Started Extension's Popup </title> <script src="popup.js"></script> </head> <body> <div id="text-holder"> ha <

Webextension: How to transparently modify XMLHttpRequests

时光总嘲笑我的痴心妄想 提交于 2021-01-29 10:05:56
问题 My goal … is to have a web extension (in Firefox for now) that intercepts and modified XMLHttpRequests issues by a site as transparently as possible. Best case is that the extension is undetectable by the site even when explicitly looking for it. For example, I want to be able to automatically redact/replace critical data before it is send out or enforce caching of large images despite the original page disabling that explicitly. Original approach Use a background script and browser

browser.tabs.sendMessage(): Error: Receiving end does not exist

a 夏天 提交于 2021-01-27 21:12:34
问题 I trying to run example code given on the tabs.sendMessage() MDN page. So my code is: manifest.json : { "manifest_version": 2, "name": "test1", "version": "1.0", "description": "test", "icons": { "48": "icons/Ruler48.png" }, "permissions": [ "notifications", "tabs", "activeTab" ], "browser_action": { "default_icon": "icons/Ruler48.png", "default_title": "test" }, "content_scripts": [{ "matches": ["*://*/"], "js": ["content-script.js"] }], "background": { "scripts": ["bgS.js"] } } bgS.js:

How do I use Wasm in the content script of a Firefox web extension?

北慕城南 提交于 2021-01-21 04:41:26
问题 I am building a Firefox addon using Rust. I am trying to insert HTML and do stuff on specific pages. Apparently, a content script is the thing I want to use. My content script is: import("../crate/pkg").then(({ Addon }) => { const addon = Addon.new(); console.log(addon.where_am_i()); }).catch(e => console.error("Error importing:", e)); The error I am getting is: TypeError: "0125c9960050e7483877.module.wasm is not a valid URL." I tried to add to manifest.json : "web_accessible_resources": [