firefox-addon-sdk

Firefox addon which refreshes the tap and auto resend data

不羁的心 提交于 2019-12-12 18:43:02
问题 I'm trying make a firefox add-on, which reloads a page automatically under some conditions. First I add a contentScript to a tab to get some information on the page in my addon tab.attach({ contentScript:self.port.emit... I have it working to the point of the refresh with tab.reload(); but then an alert pops up every time "if it should resend data". I want to resend the data automatically. How and where do I do it? In the add-on or in the contentScript? Has it to do with the Load Flags

How to call Firefox printpreview via url (not getMostRecentBrowserWindow) using addon SDK

 ̄綄美尐妖づ 提交于 2019-12-12 17:41:10
问题 One way I can call printpreview is with getMostRecentBrowserWindow const { getMostRecentBrowserWindow } = require('sdk/window/utils'); var chromewin = getMostRecentBrowserWindow(); chromewin.PrintUtils.printPreview(chromewin.PrintPreviewListener); Now i want to call printpreview with url. Please help me. Thank you so much. 来源: https://stackoverflow.com/questions/22728166/how-to-call-firefox-printpreview-via-url-not-getmostrecentbrowserwindow-using

IFrame in content script. How to communicate with main.js?

纵然是瞬间 提交于 2019-12-12 16:01:59
问题 My Firefox add-on opens Fancybox (type: "iframe") from a content script (page-mod). In the Fancybox I show my own HTML page ( my_fancybox_stuff.html ) that is located in my own server. Now, from the my_fancybox_stuff.js (javascript of my_fancybox_stuff.html ), can I send a message to the add-on's main.js ? Or to the content script that opened the Fancybox? I was hoping the global 'self' object to be accessible from my_fancybox_stuff.js as it is accessible from the content script that opened

redirect http request URI in mozilla Addon Builder

别等时光非礼了梦想. 提交于 2019-12-12 15:54:17
问题 I defined a http-on-modify-request observer in Mozilla's Addon Builder, and want to redirect requests (change subject.URI.spec ), but Firefox complains about: Error: An exception occurred. Traceback (most recent call last): File "http://chrome.angrybirds.com/", line 2536, in null File "http://chrome.angrybirds.com/", line 2344, in null File "http://chrome.angrybirds.com/", line 2988, in wi File "http://chrome.angrybirds.com/", line 1756, in ti File "http://chrome.angrybirds.com/", line 1231,

Firefox extension include script in main.js file

删除回忆录丶 提交于 2019-12-12 15:09:25
问题 I am writing an extension for firefox and having a problem including scripts into the main.js (background) file ... In my case I would like to include for example jquery.js and config.js but I can't see how to do it properly. In my chrome extension I just do that on the manifest file but I would like the equivalent in firefox. Thank you for your help, jdmry 回答1: To import files you use Components.utils.import. You will need a URL from which to import the file. Usually, this is either a

firefox addon SDK not playing audio using new Audio

爱⌒轻易说出口 提交于 2019-12-12 13:52:25
问题 I'm developing a firefox extension, and I'd like it to play a notification sound when an event occurs. However, despite following the instructions from Play audio from firefox extension's data directory, the sound doesn't play. It's stored in my data directory. Here is my code: var pageworker = require ("sdk/page-worker"); let { setTimeout } = require("sdk/timers"); //setTimeout is not enabled by default in ff extensions function playSound(sound){ console.log("playing sound: "+sound); var

Copy file from addon to profile folder

青春壹個敷衍的年華 提交于 2019-12-12 13:06:09
问题 I'm trying to copy a sqlite database from the data folder in my extension directory, to the profile folder, in order to use it. So for now, I'm trying with that: const {Cc, Ci, Cu} = require("chrome"); const {NetUtils} = Cu.import("resource://gre/modules/NetUtil.jsm"); const data = require('sdk/self').data; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); var file = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties).

Generating signed XPI via jpm failed

和自甴很熟 提交于 2019-12-12 12:49:01
问题 There was a problem signing an Add-On via jpm: The command jpm -v sign --api-key 'user:xxxxxxxx:xxx' --api-secret xxxxxxxxxxxxxxxxxxxxxxxxx failed with the error message Error: Received bad response from the server while requesting https://addons.mozilla.org/api/v3/addons/%40addonname/versions/0.x.y/ Signing via the web interface worked. How can this be fixed? The full verbose output is JPM [info] binary set to /usr/bin/firefox JPM [info] verbose set JPM [info] Checking compatability

How to reload a widget popup panel with firefox addon sdk?

妖精的绣舞 提交于 2019-12-12 10:59:30
问题 My addon opens a popup panel ( popup.html ). When the user changes the current tab to different tab, the popup panel is hidden until the user clicks again on the addon icon. (Meanwhile the addon still "lives" in the background). When the popup panel is opened the second time I need it to RELOAD its contentURL ( popup.html ) but I did find the way to do it. That might look simple but I have only little experience with the Add-on SDK. Any help will be appreciated. This is my code: exports.main

How to send message from panel to page-mod's content script directly?

主宰稳场 提交于 2019-12-12 10:27:01
问题 If there is a code snippet in Firefox addon like following: var pagemod = PageMod({ include: ['*'], contentScriptFile: [data.url('content.js')] }); panel = require("sdk/panel").Panel({ width: 322, height: 427, contentURL: data.url("main.html"), include:["http://*/*","https://*/*"], contentScriptFile: [data.url('panel.js')] }); I have found some example code in the Chrome extension. They use window.parent.postMessage(message, "*") to send message and use window.addEventListener("message"