xpcom

Get selected message data in Thunderbird extension

∥☆過路亽.° 提交于 2019-12-24 04:52:19
问题 I need to get some e-mail message data in my Thunderbird extension. I found this example on MDN (https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIMsgMessageService): var content = ""; var MessageURI = GetFirstSelectedMessage(); var MsgService = messenger.messageServiceFromURI(MessageURI); var MsgStream = Components.classes["@mozilla.org/network/sync-stream-listener;1"].createInstance(); var consumer = MsgStream.QueryInterface(Components.interfaces.nsIInputStream); var

How to get Tab from nsIDOMWindow?

梦想的初衷 提交于 2019-12-24 02:58:07
问题 A noob at firefox extension development here. Is there a way to find Tab object from a given nsIDOMWindow? let wm = Cc['@mozilla.org/appshell/window-mediator;1'].getService(Ci.nsIWindowMediator); var windowListener = { onOpenWindow: function(aWindow) { // Wait for the window to finish loading let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); domWindow.addEventListener("load", function() { domWindow.removeEventListener("load", arguments.callee,

xul/xpcom copy image from string to clipboard

天大地大妈咪最大 提交于 2019-12-24 00:54:56
问题 I'm stuck with no clues how to copy image to clipboard. My code looks like this: var image = "data:image/png;base64,..." var io = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService); var channel = io.newChannel(image, null, null); var input = channel.open(); var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable); trans.addDataFlavor("image/png"); trans.setTransferData("image

nsIGenericFactory.h is missing in the above version of xulrunner-2.0.en-US.win32.sdk

空扰寡人 提交于 2019-12-23 15:12:39
问题 Previously, I created XPCOM dll for the mozilla version 3.6 and XulRunner version of 1.9.2 . Now I try to update that xpcom dll for the mozilla recent versions namely 4 and above. So I downloaded Xul Runner above version but I couldn't find nsIGenericFactory.h . How to work my xpcom dll for the mozilla 4 and above versions. Actually I used the following sample to develop XPCOM DLL. http://www.iosart.com/firefox/xpcom/ Thanks.. 回答1: Since Mozilla 4.0 is using Gecko 2.0 this applys to your

Detecting Firefox extension version

北慕城南 提交于 2019-12-23 04:22:54
问题 I have a Firefox Extension that I would like to populate the About box with the version within install.rdf. I know that FUEL's extIExtension allows one to see the version for an extension but I did not create the extension using FUEL (and the docs on MDC seem very light on how to transition to it). Is there a way to dynamically check the extension version? I specifically do not want to hard code or make it generated from my Makefile 回答1: @sdwilsh, you're right, my apologizes. Took me awhile

How can I monitor a file asynchronously in Firefox?

对着背影说爱祢 提交于 2019-12-21 23:02:23
问题 I want to monitor a plain text file on windows machine for changes to it. Whenever external application updates the file, my add-on is supposed to read it and act accordingly. Going through quite bit of documentation I could not find a direct facility to do this in Firefox. So I came up the following approaches. Please suggest. Approach 1 - In a while loop { a) List all the files in the directory being monitored / Use nsIFile.exists() b) If files does exist go to next step else go to sleep c)

How to open .EXE with Javascript/XPCOM as Windows “Run…”?

送分小仙女□ 提交于 2019-12-19 04:50:16
问题 I have an intranet web application who needs to run some external applications, like Word, Notepad and other particular ones... My code allow the access with IE (ActiveX) and Firefox (XPCOM). When I use the whole path (like "C:\windows\notepad.exe") I can run in both browses, but y problem is: there's a lot of versions for some applications like Microsoft Word (2003, 2007, 2010...), and the local path is always different, BUT if I use the "Run..." option in Windows, I can only type "winword

How to save a webpage locally including pictures,etc

柔情痞子 提交于 2019-12-17 19:03:46
问题 I am building an add-on for an application. The clients are paying to view some webpages and download some files out of it. They want to automate this downloading process by add-on. So instead of selecting "Save Page as" and waiting for the download's completion, they can click the add-on and forget the process. The problem is, the webpage is providing some cookies to the browser. So the best way is File-> "Save Page As" . I want to do it through the add-on. Is there any firefox-javascript

XPCOM: sniff HTTP responses

℡╲_俬逩灬. 提交于 2019-12-14 03:56:47
问题 I would like to write a little component with XPCOM that can sniff all HTTP responses received by the browser. Right now the only examples that I can find (like the one appended below) only allow me to retrieve the response for a request that I fire myself: var req = new XMLHttpRequest(); req.open('GET', 'http://www.mozilla.org/', true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) dump(req.responseText); else dump("Error loading page\n"); } };

How to preprocess HTML before it's loaded and parsed by Mozilla?

对着背影说爱祢 提交于 2019-12-13 12:35:42
问题 I need a way to process HTML before it's actually loaded and parsed by Mozilla. Is there any content listener that I can use in my Firefox extension? 回答1: Add an Event Listener to the gBrowser global object, making sure to set usecapture to true. You could also intercept the response. 回答2: Do you mean something like greasemonkey? Sorry, I don't know enough about Firefox extensions. The Greasemonkey website is blocked here in China and my VPN does not work at the moment, but maybe they are