firefox-webextensions

no scrollbars in options popup ported from Chrome in firefox webextension

佐手、 提交于 2019-11-28 14:50:00
I'm porting chrome extension to Firefox and I'm testing on Nightly 51a.. version. When I click the popup options icons it opens and scrollbars appear and after half a second those disappear. How to correct this? At the moment I've given a hyperlink in the top in the optins popup with this code which when clicked opens full view html in a new tab and this works just fine: <a style="font-size:1.5em;" href="options.html" target="_blank">Open Full Window</a> The popup that is being shown for a browser_action is, currently, being set to a maximum of 800x600 pixels (at least in my testing). However,

Firefox WebExtention API: TypeError: browser.browserAction is undefined [duplicate]

橙三吉。 提交于 2019-11-28 12:41:43
This question already has an answer here: TypeError: [API] is undefined in content script or Why can't I do this in a content script? 2 answers While migrating my old Firefox add-on to WebExtension API, failed to understand while I am getting this error: TypeError: browser.browserAction is undefined Here is the manifest.json: { "manifest_version": 2, "name": "My Login", "version": "3.0", "description": "Login to my page", "homepage_url": "https://localhost", "icons": { "48": "icons/button-1.png" }, "permissions": [ "activeTab", "storage" ], "browser_action": { "default_icon": "icons/button-1

How to change firefox preferences (about:config) using the new WebExtensions api?

╄→尐↘猪︶ㄣ 提交于 2019-11-28 12:27:49
To change the settings (about:config) with the old API you would simply do: require('sdk/preferences/service').set('media.webrtc.debug.multi_log', true); I can't find anything on the subject for the new WebExtensions add-ons of Firefox. Is it not available yet? This is not possible, and likely, never will be. Source: official WebExtensions FAQ https://wiki.mozilla.org/WebExtensions/FAQ#Will_I_have_access_to_about:config_or_the_preferences.3F Also, you might be interested in this discussion on mozilla-community.org: https://discourse.mozilla-community.org/t/webextension-read-write-access-to

How do I see the console.log output of a background script in a Firefox WebExtension?

家住魔仙堡 提交于 2019-11-28 04:20:53
问题 Does anyone know how to see the output from a console.log() call in a background script? I can see the output from the same in a content script. Here is a simple script that I am testing this with: Here is my background.js : console.log("Message from background.js"); Here is my manifest.json : { "name": "TestBed", "manifest_version": 2, "version": "1.0", "background": { "scripts": ["background.js"] }, "browser_action": { "default_title": "Click" }, "applications": { "gecko": { "id": "testbed

How to determine in which browser your extension background script is executing?

╄→尐↘猪︶ㄣ 提交于 2019-11-28 01:50:24
问题 I'm talking about Chrome extensions, Firefox WebExtensions, Edge extensions... In a background script, not a content script, is there a clear way to know which browser I am using? I need to do different operations for different browsers. Yes, navigator.userAgent can be useful, but it's not very clear . Is there any extension API that can be used to do this? Something like, chrome.extension.browserType . (Of course, this one doesn't really exist..) 回答1: There is no specific API to detect which

Firefox WebExtension settings page

狂风中的少年 提交于 2019-11-28 00:18:17
I have a settings page on my WebExtension, but I dont know how to acces the values of the settings with javascript. Current .xul-File: <?xml version="1.0"?> <!DOCTYPE mydialog SYSTEM "chrome://myaddon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="string" pref="extensions.check.email" title="email" desc="please insert your email here" /> </vbox> How do I acces the "email" value? Can I just write something like "getPreferences('email')"? Makyen Don't use XUL in a WebExtension add-on : If you are using XUL from within a

Calling webpage JavaScript methods from browser extension

房东的猫 提交于 2019-11-27 16:31:02
I am developing an firefox extension using webExtensions that would help me ease my work with the scenario below. I have to click around 50-60 buttons on the site that update the task status. On click of this button, the web page is calling the webpage's updTask(id) JavaScript function that is then making a web-service call to update the task. I am not able to do this from my content script using the code below: manifest.json : "permissions": [ "activeTab", "cross-domain-content": ["http://workdomain.com/","http://workdomain.org/","http://www.workdomain.com/","http://www.workdomain.org/"] ]

Firefox WebExtension importing Services

独自空忆成欢 提交于 2019-11-27 16:11:34
I am feeling overwhelmed by so many different approaches, guides, and yet none I tried work for me. Please connect at least some of the dots for me... My objective is to find a window object in background script of Firefox WebExtension. Problem, I cannot import Services library to use it for finding a window object. Two methods I tried: Components.utils.import("resource://gre/modules/Services.jsm"); Gives a warning that Components is depricated, and an error: Components.utils is undefined. const { Cu } = require("chrome"); let Services = Cu.import("resource://gre/modules/Services.jsm"); Throws

How I can make a browser action button that looks and acts like a toggle

烂漫一生 提交于 2019-11-27 09:20:36
The target is get a WebExtension for Firefox that can be activated/deactivated by a user in the toolbar, like an on/off switch. I'm using a background.js with this code: browser.browserAction.onClicked.addListener(function (tab) { switch (button) { case 'turn-on': enable(); break; case 'turn-off': disable(); break; } }); function enable() { browser.browserAction.setIcon({ path: '/ui/is-on.png', }); browser.browserAction.setPopup({ popup: '/ui/turn-off.js', }); browser.webNavigation.onCommitted.addListener(onTabLoad); } function disable() { browser.browserAction.setIcon({ path: '/ui/is-off.png'

How to trigger click on a button

五迷三道 提交于 2019-11-27 07:19:15
问题 I've this page. I need to trigger a click on the BUY NOW button on this page using AngularJS. I've tried these ways to click on this "BUY NOW" in content script(myscript.js) but does not work: angular.element($('ul form button:contains("BUY NOW")').get(0)).triggerHandler('click'); $('ul form button:contains("BUY NOW")').get(0).click(); $('ul form button:contains("BUY NOW")').get(0).dispatchEvent(new MouseEvent('click', { 'view': window, 'bubbles': true, 'cancelable': true })); The manifest