xpcom

GeckoWebBrowser 实现网页打印 html打印 去掉页眉页脚 页头页尾

纵饮孤独 提交于 2021-01-14 08:06:59
管理GeckoFx PM > Install-Package Geckofx45 -Version 45.0 . 34 GeckoWebBrowser geckoWebBrowser; public Form1() { InitializeComponent(); Xpcom.Initialize( " Firefox " ); geckoWebBrowser = new GeckoWebBrowser { Dock = DockStyle.Fill }; this .Controls.Add(geckoWebBrowser); geckoWebBrowser.Navigate( " www.baidu.com " ); } nsIWebBrowserPrint print = Xpcom.QueryInterface<nsIWebBrowserPrint> (geckoWebBrowser.Window.DomWindow); var service = Xpcom.GetService<nsIPrintSettingsService>( " @mozilla.org/gfx/printsettings-service;1 " ); var ps = service.GetNewPrintSettingsAttribute(); ps.SetTitleAttribute

Get element currently under mouse without using mouse events

被刻印的时光 ゝ 提交于 2020-01-11 09:15:06
问题 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.

How to get images from cache using a XPCOM Component in Firefox

假如想象 提交于 2020-01-07 04:41:37
问题 I need to get the cache file path for ever image loaded in a document, I am wondering what are the Interfaces I need to use in order to do that https://developer.mozilla.org/en/XPCOM_Interface_Reference 回答1: This is what I used to evict cache entry: function removeItem(url){ let cacheService = Components.classes["@mozilla.org/network/cache-service;1"] .getService(Components.interfaces.nsICacheService); var Ci = Components.interfaces; var session = cacheService.createSession("image", Ci

creatition of XPCOM components

血红的双手。 提交于 2020-01-06 19:35:29
问题 I'm creating an XPCOM component using a tutorial as a reference. However, when I run the following command it completes successfully but doesn't produce any .h file: xpidl -m header -I [XUL_RUNNER SDK\IDL] myfile.idl Why is that? Is XPCOM outdated? 回答1: No, XPCOM is not outdated but this tutorial is. The documentation recommends using pyxpidl: header.py -I [XUL_RUNNER SDK\IDL] -o myfile.h myfile.idl 来源: https://stackoverflow.com/questions/11857907/creatition-of-xpcom-components

Firefox bootstrapped extension: Get native HWND handle of the browser window

被刻印的时光 ゝ 提交于 2020-01-03 03:20:29
问题 I have an external application and I want it to display some information on top of the browser window. My bootstrapped extension needs to pass the browser window handle (native HWND) to my application, along with some other useful information about the window. I'm able to do the communication between them, the only thing that is missing is a way to get the native HWND of the Firefox window. I read a lot about it and although I belive it's possible, I couldn't find a working solution. Here's

How to implement XPCOM component (nsIContentPolicy) in bootstrapped Firefox extension

旧巷老猫 提交于 2020-01-01 11:37:07
问题 I have a bootstrapped extension for Firefox. And now I want to implement nsIContentPolicy XPCOM component. I wrote a component module code. And now I want to register this component. The reason I want to register component is that I want to add my component to nsICategoryManager.addCategoryEntry with "content-policy" category. var {Cc, Ci, Cu} = require("chrome"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); //console.error("Running interceptor"); function Interceptor() } Interceptor

How can I implement a content converter in Firefox for all page elements?

自闭症网瘾萝莉.ら 提交于 2020-01-01 10:03:46
问题 I'm attempting to port over an Internet Explorer plugin to Firefox, but I'm not sure where to look for what I need. Basically I need to be able to filter all content that is received by the browser with a certain Content-Type header. I tried implementing a stream converter, and this works, but only for the top-level document in the page, frame, or iframe. I had the same problem with IE, and getting around it was really hacky, and since I would ideally like this to be cross platform I would

What is missing in my nsIContentPolicy Firefox/IceWeasel extension XPCOMponent implementation for the shouldLoad to be called?

泄露秘密 提交于 2019-12-25 08:25:42
问题 In short Why, based on the code detailed below, is the shouldLoad function not called? Longer version My goal I am trying to construct a Firefox/Iceweasel extension that will cancel/redirect certain url requests. Background Based on what I have seen on the web, one way (if I want to intercept every request and not just the top document) to do this is to make an XPCOM component that implements the nsIContentPolicy interface, and register that component in the extension, and have the shouldLoad

Failure while calling nsIX509CertDB.nsIX509CertDB from command line

我是研究僧i 提交于 2019-12-25 05:07:05
问题 I'm trying to develop a FF extension that calls nsIX509CertDB.nsIX509CertDB. When calling this function from a xpcshell I alwas receive a error 0x80004005 (NS_ERROR_FAILURE). I suspect it to be failing since in a xpcshell environment I can not be prompted for the password. Is there any way to provide it from the command line? My code: if(nsIFile != null && nsIFile.exists()) { var certDB = Cc["@mozilla.org/security/x509certdb;1"] .getService(Ci.nsIX509CertDB); certDB.importPKCS12File(null,

nsIDOMWindowUtils.isInModalState() not working

岁酱吖の 提交于 2019-12-24 11:54:13
问题 I get the utils of the window like this: var utils = Services.wm.getMostRecentWindow('navigator:browser'). QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); then running this code says its not a function: Services.prompt.alert(null, 'is modal?', utils.isInModalState()) //Exception: utils.isInModalState is not a function even though it says in the documentation it is. I am not able to run this code either: utils.enterModalState(