firefox-webextensions

How to read the options passed by Selenium to Firefox using WebExtensions

余生颓废 提交于 2019-12-11 15:59:37
问题 I'm starting Firefox 66 from Ruby via Selenium, this way: profile = Selenium::WebDriver::Firefox::Profile.new profile['foo.test'] = 123 Selenium::WebDriver::Firefox::Options.new(profile: profile) Selenium::WebDriver.for(:firefox) How can I get access to the foo.test in my add-on, through WebExtension API? 来源: https://stackoverflow.com/questions/57206940/how-to-read-the-options-passed-by-selenium-to-firefox-using-webextensions

How to set value of textarea in different HTML file?

守給你的承諾、 提交于 2019-12-11 15:52:44
问题 I am building a chrome/firefox web extension. When the user clicks the button in the extension's popup, the extension's UI changes. Here's a visual example: Before pressing one of three buttons: After pressing one of three buttons: As you can see from the screenshot, after pressing the button, a textarea is created. Here is the code that does that (this function is called when one of the three original buttons is pressed): function createSummaryBox(summary) { console.log("Setting textarea

How to make sure a content-script will be loaded into each document using tabs.executeScript?

限于喜欢 提交于 2019-12-11 14:33:17
问题 For my FF extension I was using the content_scripts key in in manifest.json with matches: ['<all_urls>'] , but I'm switching to programmatical injections now using browser.tabs.executeScript . How can I make sure that the script is loaded into each frame on each tab? Do I have to listen for tab's URL changes with browser.tabs.onUpdated or alternatively for the DOMContentLoaded event using browser.webNavigation.onDOMContentLoaded ? Or is there a more elegant way of doing this? The problem with

tabs.executeScript - how can I tell if content script was being injected?

非 Y 不嫁゛ 提交于 2019-12-11 14:16:10
问题 I inject content scripts into websites programmatically using browser.tabs.executeScript . This will return a Promise, but in case of its rejection there seems to be no way of differentiating between the following 2 cases: The content script couldn't be injected (i.e. for missing host permission) An error occured on script update parsing end:update (but the script was being injected) I'm only interested in whether the script was being injected or not. The argument passed to the catch is an

Use asynchronous calls in a blocking webRequest handler

走远了吗. 提交于 2019-12-11 10:38:54
问题 Summary I'm using a browser.webRequest.onBeforeRequest handler. I need to block the webRequest until I have information back from calls to asynchronous methods made within the handler. How can I do that? The details First, my apology for the long question. But I hope someone can help. I have an embedded extension which contains a browser.webRequest.onBeforeRequest (I need to use embedded extension at the moment to deal with some SDK legacy code). The browser.webRequest.onBeforeRequest

Porting WebExtension from Chrome to Firefox?

一世执手 提交于 2019-12-11 06:35:49
问题 I made a working Chrome extension that is not packaged and is just a directory on my computer. I found out that I should be able to port this to Firefox rather easily. I followed the "Porting a Google Chrome extension" guide on MDN and found that my manifest file is perfect. I then followed the instructions on how to perform "Temporary Installation in Firefox" of the extension. However, when I click on any file inside the directory, nothing happens. The extension doesn't load. Any advice? I

Firefox permission to URL doesn't work in browser extension

爷,独闯天下 提交于 2019-12-11 06:08:32
问题 I created Chrome extension and it works as I expected. Actually, it periodically sends http request to my server. But when I tried to run it in Firefox, I've got such an error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <my_server_ip>:8080/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). My application listens for incoming requests at server_ip:8080 For making requests to my server from chrome extension, I add such entry to

How to get openerTabId in Firefox WebExtensions?

寵の児 提交于 2019-12-11 06:08:07
问题 I've developed a Chrome extension, and trying to port it to Firefox using Firefox WebExtensions. Here is the problem I'm facing. In my extension, I need to use chrome.tabs.Tab.openerTabId , which is not supported by Firefox WebExtensions (See documentation). I've come up with a workaround, to get openerTabId myself, by querying the active tab in current window: chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) { // tabs has only one element, which is the one I just

Firefox webextension not copying to clipboard

核能气质少年 提交于 2019-12-11 05:57:25
问题 I have a Firefox web extension which is supposed to generate buttons which copy a link to the clipboard. In my content script for the plugin, I have: button.onclick = function() { var link = window.location.href.replace(/#[0-9a-zA-Z_]+$/, '') + '#' + id; var txtToCopy = document.createElement('input'); txtToCopy.value = link; txtToCopy.select(); console.log(txtToCopy.value); var res = document.execCommand('copy'); console.log(res); } As you can see, I have it logging the value I'm trying to

Overriding CanvasRenderingContext2D.getImageData()

£可爱£侵袭症+ 提交于 2019-12-11 05:56:25
问题 I am trying to override the built in method CanvasRenderingContext2D.getImageData(). I would like to override the implementation so that the modified function uses the canvas context to modify the canvas and then calls the original function which should return different data that if the function was not overridden. The reason I am doing this is to prevent browser fingerprinting. canvas.js (function(){ 'use strict'; var originalGetImageData = CanvasRenderingContext2D.prototype.getImageData; //