xpcom

Firefox XPCOM component - Permission denied to call method UnnamedClass

依然范特西╮ 提交于 2019-12-02 00:28:37
Can a firefox XPCOM component read and write page content across multiple pages? Scenario: A bunch of local HTML and javascript files. A "Main.html" file opens a window "pluginWindow", and creates a plugin using: netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var obj = Components.classes[cid].createInstance(); plugin = obj.QueryInterface(Components.interfaces.IPlugin); plugin.addObserver(handleEvent); The plugin that has 3 methods. IPlugin.Read - Read data from plugin IPlugin.Write - Write data to the plugin IPlugin.addObserver - Add a callback handler for reading.

Get element currently under mouse without using mouse events

自作多情 提交于 2019-12-01 18:42:23
WRT building a Firefox Add-on. Is it possible to get the element under the mouse via some XPCOM or javascript method? (non-js-ctypes please as that requires OS specificity) I want to detect what is under the mouse when user presses Ctrl + Shift + M . Right now I'm adding a mouseover listener to the document when the user presses this hotkey, so I can get the element under the mouse when he moves it, but not the element that was under the mouse exactly when he pressed the hotkey combination. I just looked through the source for code that gets (or stores and makes available) the cursor position.

What IPC method should I use between Firefox extension and C# code running on the same machine?

十年热恋 提交于 2019-11-30 16:08:31
问题 I have a question about how to structure communication between a (new) Firefox extension and existing C# code. The firefox extension will use configuration data and will produce other data, so needs to get the config data from somewhere and save it's output somewhere. The data is produced/consumed by existing C# code, so I need to decide how the extension should interact with the C# code. Some pertinent factors: It's only running on windows, in a relatively controlled corporate environment. I

Using a plugin generated with Firebreath in a Firefox Extension?

你。 提交于 2019-11-29 12:25:10
Is it possible to use a .dll made with Firebreath in a Firefox extension? Currently, I am trying to port an extension I made for Google Chrome that uses javascript to get the HTML of the document, and then calls a function from the .dll and passes the HTML of the document as a parameter. The .dll then saves the file and launches a program. Is there a simple way to port this functionality over to Firefox? Or will I have to rewrite the code using XPCOM? Wladimir Palant XPCOM is too complicated for simple things which is why Firefox 4 and above has js-ctypes (see https://developer.mozilla.org/en

Intercept/handle mime type/file

时光总嘲笑我的痴心妄想 提交于 2019-11-29 07:47:09
How do you disable the default action for .torrent files/content-type application/x-bittorrent(eg open with dialog or run program) and instead handle the data in a extension? Based on @nmaiers post this is how you do it: This is how you do it IF the mime type already exists. If it doesn't exist I don't know how to add it, probably some register function. For some reason the type for my torrent s is application/x-download I have no idea why. If you want info on how I figured that out than I'll tell you. So in the example below I use that as file type. When we console.log(wrappedHandlerInfo) we

How to save a webpage locally including pictures,etc

点点圈 提交于 2019-11-28 09:28:41
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 way for this?. I used nsiDownloader. But it saves only html, not the pictures,etc. Can anybody guide me

extension components to get visit count in firefox's history and bookmarks?

痞子三分冷 提交于 2019-11-28 08:53:57
问题 I'd like to to know which interface can be used to get the visit count of each link in firefox's bookmarks and history for developing an extension I've tried using nav-history-service to get the links for bookmarks and history but can't figure out how to view the visit count. 回答1: This code here will go through the first 10 bookmark entires. If it's a url it checks its .accessCount property which holds the number of times it was visited. var hs = Cc["@mozilla.org/browser/nav-history-service;1

Using a plugin generated with Firebreath in a Firefox Extension?

狂风中的少年 提交于 2019-11-28 05:56:44
问题 Is it possible to use a .dll made with Firebreath in a Firefox extension? Currently, I am trying to port an extension I made for Google Chrome that uses javascript to get the HTML of the document, and then calls a function from the .dll and passes the HTML of the document as a parameter. The .dll then saves the file and launches a program. Is there a simple way to port this functionality over to Firefox? Or will I have to rewrite the code using XPCOM? 回答1: XPCOM is too complicated for simple

Use Blob on firefox add-on

梦想与她 提交于 2019-11-28 05:28:26
问题 Been trying to get the following code to work in firefox add-on: var oMyForm = new FormData(); oMyForm.append("username", "Groucho"); oMyForm.append("accountnum", 123456); // number 123456 is immediately converted to string "123456" // HTML file input user's choice... oMyForm.append("userfile", fileInputElement.files[0]); // JavaScript file-like object... var oFileBody = '<a id="a"><b id="b">hey!</b></a>'; // the body of the new file... var oBlob = new Blob([oFileBody], { type: "text/xml"});

Expose file writing to a webpage with a Firefox extension

家住魔仙堡 提交于 2019-11-28 05:26:17
问题 I have a web application that my client uses for the cash registry. What I need to do is to create a local file as the cash register's software needs to read from that file in order to print. Until now i was using this code: netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filePath); Unfortunately with the latest version of firefox this isn