xpcom

Intercept/handle mime type/file

人盡茶涼 提交于 2019-11-28 01:30:16
问题 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? 回答1: 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

Modify URL before loading page in firefox

旧街凉风 提交于 2019-11-27 13:46:30
I want to prefix URLs which match my patterns. When I open a new tab in Firefox and enter a matching URL the page should not be loaded normally, the URL should first be modified and then loading the page should start. Is it possible to modify an URL through a Mozilla Firefox Addon before the page starts loading? Wayne Burkett Browsing the HTTPS Everywhere add-on suggests the following steps: Register an observer for the "http-on-modify-request" observer topic with nsIObserverService Proceed if the subject of your observer notification is an instance of nsIHttpChannel and subject.URI.spec (the

Open a new tab/window and write something to it?

荒凉一梦 提交于 2019-11-27 05:06:05
I'm using Execute JS to write and test Javascript code within Firefox. I want to open a new tab/window and write something to it and I tried var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var win = wm.getMostRecentWindow("navigator:browser"); printWindow = win.open("about:blank"); printWindow = wm.getMostRecentWindow("navigator:browser"); printWindow.gBrowser.selectedBrowser.contentDocument.write('hello'); And myWindow=window.open('','','width=200,height=100') myWindow.document.write("<p>This is 'myWindow'</p>")

Modify URL before loading page in firefox

可紊 提交于 2019-11-26 16:31:49
问题 I want to prefix URLs which match my patterns. When I open a new tab in Firefox and enter a matching URL the page should not be loaded normally, the URL should first be modified and then loading the page should start. Is it possible to modify an URL through a Mozilla Firefox Addon before the page starts loading? 回答1: Browsing the HTTPS Everywhere add-on suggests the following steps: Register an observer for the "http-on-modify-request" observer topic with nsIObserverService Proceed if the

Open a new tab/window and write something to it?

天涯浪子 提交于 2019-11-26 09:53:43
问题 I\'m using Execute JS to write and test Javascript code within Firefox. I want to open a new tab/window and write something to it and I tried var wm = Components.classes[\"@mozilla.org/appshell/window-mediator;1\"].getService(Components.interfaces.nsIWindowMediator); var win = wm.getMostRecentWindow(\"navigator:browser\"); printWindow = win.open(\"about:blank\"); printWindow = wm.getMostRecentWindow(\"navigator:browser\"); printWindow.gBrowser.selectedBrowser.contentDocument.write(\'hello\');