Menu
  • HOME
  • TAGS

Request object response always empty

firefox-addon,firefox-addon-sdk

Turns out the object wasn't actually empty, it just appeared empty in the console. When I console.log(response.text) I get the results I expect. This is probably b/c text,json, etc are prototypes of the object and the console ignores prototypes.

What would be the best way to create a firefox plugin for taking desktop screenshots?

firefox-addon,screenshot

I don't think a Firefox addon is the most appropriate approach here. Maybe split the task into a Firefox addon to offer the "upload to a server" component and a native app to do the desktop screenshot (or just integrate with existing screenshot tools). If you're worried about complicating the...

Postman addon's like in firefox

firefox,firefox-addon,postman

There's a few: RESTClient, REST Easy

Can I somehow listen on the URL user is typing with Firefox addon SDK?

firefox-addon,firefox-addon-sdk

Yes and no. Yes it is possible, but not within the SDK standard API. You need to enumerate top-level browser windows (aka. type navigator:browser, chrome://browser/content/browser.xul). window/utils::windows() may help here, but it has the drawback that it will not notify you about new windows. However, you can use require("chrome") and nsIWindowWatcher.registerNotification...

Firefox - Intercept/Modify post data when some variable match some pattern

javascript,firefox,firefox-addon,http-post,tamper-data

Your question borders on being too broad, so I will give only an overview on how to do this, but not a copy-paste-ready solution, which would take a while to create, and would also deny you a learning experience. Observers First of all, it is possible for add-ons to observe...

How to get notified whenever the URL in the address bar changes Firefox JPM

javascript,firefox-addon,firefox-addon-sdk

I came up with a solution which includes using a combination of MutationObserver and "old location value checking". Basically I implemented a value check on location.href but using a MutationObserver to detect changes in the DOM, instead of using an interval which would kill the performance and waste some precious...

File types change into .xml while downloading in Firefox

c#,asp.net,firefox,firefox-addon,firefox-addon-sdk

Are you setting the MIME type to Response.ContentType correctly? E.g.: HttpContext.Current.Response.ContentType = "text/xml"; Also I remember Firefox having a problem with spaces in filenames - you had to escape them. So it might be your extension is getting cut off. But that was years ago, might not be relevant anymore....

How do I use the Dom File API from privileged code?

javascript,firefox,firefox-addon,gecko

Try this: Cu.importGlobalProperties(["File"]); MDN :: Components.utils.importGlobalProperties...

window.content.mozInnerScreenY value is not working in Firefox 33.1

javascript,firefox,browser,firefox-addon,mozilla

This change worked for me. i made a very minor change in the above code : const screenY = window.content.mozInnerScreenY. i just changed screenY as const type since window.content.mozInnerScreenY is a read-only value. This change fix the issue....

Firefox addons in java

java,firefox-addon

There is no supported way to write Firefox addons in Java.

Unable to override XMLHttpRequest using pageMod (Firefox addon)

javascript,firefox,xmlhttprequest,firefox-addon

PageMod scripts run in a sandbox that have a different view on objects (aka. xrays). Depending on how exactly you define them a content page cannot either access those objects or get security exceptions if it tries to invoke functions. Accessing the unsafeWindow is the correct approach, but you still...

A way to activate a script on a tab in FireFox when a specific URL is opened

firefox,firefox-addon,code-injection,firefox-addon-sdk

Assuming that you are using the add-on SDK, this is done by using page-mod (documentation on MDN). The page I have linked to on MDN has a considerable amount of information on the subject of using page-mod. Quoting from that page: page-mod: Run scripts in the context of web pages...

Load image using crossOrigin attr. in Firefox addon sdk

javascript,firefox,firefox-addon,cross-domain,firefox-addon-sdk

Finally the problem has been solved, thank you guys for a great discussion. How I solved it: The problem was a cross origin problem as @the8472 mentioned, so what I did is making the request using SDK for the image and convert its data to base64 based on this answer....

How to use modules in Firefox addon development

javascript,firefox-addon

Thanks @Shakur I didn't catch that e and yep you're right it needs to be fixed to enum. I'm not familiar with cookie service, I would have to read up on it but you're on right track. This is because you have not defined Ci you use Ci in the...

Firefox addon - cannot trigger click event of any kind

javascript,jquery,firefox-addon

XrayWrapper denied access to property callee This suggests that the script is running in an environment that has higher privileges than the page content itself, which in turn results in some security barriers (the xray wrappers in one direction, access denied errors in the other) since the caller now...

Firefox addon uploading canvas contents to imgur

javascript,firefox-addon,firefox-addon-sdk,imgur

In the end, it turned out that the usage of the Request module of the Firefox addon SDK was wrong. Instead of using contentType to provide the type of the content (like in jquery/ajax), you have to use dataType. See below: Request({ url: 'https://api.imgur.com/3/upload', dataType : 'json', headers: { 'Authorization':...

Recursively find sub directories within an array of base directories

javascript,recursion,firefox-addon

this proved to be useful: https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/OSFile.jsm/OS.File.DirectoryIterator_for_the_main_thread#Example.3A_Iterating_through_all_child_entries_of_directory //start - helper function function enumChildEntries(pathToDir, delegate, max_depth, runDelegateOnRoot, depth) { // IMPORTANT: as dev calling this functiopn `depth` arg must ALWAYS be null/undefined (dont even set it to 0). this arg is meant for internal use for iteration // `delegate` is required //...

Listing protocol and content type handlers

javascript,firefox-addon

Hey Brett here's something I wrote while working on MailtoWebmails, please do share whatever you learn, quirks etc: GitHubGIST :: Noitidart / _ff-addon-tutorial-CheckGetSetRemoveAddHandlerOfProtocol.md Get the handlerInfo object nsIHandlerService Method The handlerInfo object returned here is exactly same as doing it with the above method of nsiExternalProtocolService. If you go to...

on(“show”, function()) doesn't work in FF extension

javascript,firefox-addon

show is an event, it is emitted to the panel.on("eventname") callbacks. The port is for messaging between the addon context and the panel context. I.e. panel.port.on(...) is not the same as panel.on(...). And it's not available in the panel context. Maybe you can use pageshow/pagehide dom events for that purpose,...

Within ChromeWorker deteciting OS Details

operating-system,firefox-addon

ChromeWorkers don't have XPCOM access, just js-ctypes access. Implementing this stuff in js-ctypes is a lot of error-prone busywork and you need to provide implementations for different OSes, so I recommend against that. Then there is OS.Constants in particular OS.Constants.Sys.Name, however this will just tell you the generic name, like...

Firefox extension : gMultiprocessBrowser is not defined

javascript,firefox,firefox-addon

As it turned out, I was using old browser.js file & there has been a lot of changes in current version Firefox's browser.js so I just had to port my old code snippets into new browser.js file and it worked.

Overriding `onClick` on a Firefox-Addon ActionButton

javascript,firefox-addon,firefox-addon-sdk

The easiest thing is probably not to replace the handler but its data: var url = 'https://www.mozilla.org/'; var handleClick = function() { tabs.open(url); }; // ... url = 'https://www.github.com/'; ...

How to check whether the html has changed?

javascript,html,web-scraping,firefox-addon,web-crawler

Basically you might set up Google Spreadsheet to scrape pages' parts thru IMPORTXML function (here with an example) using xpath. Then you set up notifications in a spreadsheet: Tools -> Notification Rules Now each time the scraping function (IMPORTXML) gets content that is different to previous one, spreadsheet should trigger...

Disbale the “Not available for your platform” on the addons.mozilla.org

firefox-addon

Random example: https://addons.mozilla.org/en-US/firefox/addon/slimsearch/ I am using Firefox and above is for Android and the button is grey and it says: Not available for your platform Here are a few options: Right-click on the button, "Save Link As...", then save it to your computer Right-click on the button, "Copy Link Location"...

JavaScript: XMLHttpRequest() from Firefox addon to get zip

javascript,firefox,xmlhttprequest,firefox-addon,zip

I'm almost dont, I'm just stuck on figuring out how to use the asynchronus zip.js module. You can use nsIZipWriter and nsIZipReader like the linked addon does from my comment. But I think async is just better so I'm working on that: https://github.com/Noitidart/AysncZip/blob/master/bootstrap.js Install the addon, click on the toolbar...

firefox extension: intercepting url it is requesting and blocking conditionally

javascript,firefox,firefox-addon,firefox-addon-sdk

you can have a look at the source of those addons https://addons.mozilla.org/en-us/firefox/addon/blocksite/?src=search https://addons.mozilla.org/en-us/firefox/addon/url-n-extension-blockune-bl/?src=search or use service observer with nsIHTTPChannel for fast handling const { Ci, Cu, Cc, Cr } = require('chrome'); //const {interfaces: Ci, utils: Cu, classes: Cc, results: Cr } = Components; Cu.import('resource://gre/modules/Services.jsm'); Cu.import('resource://gre/modules/devtools/Console.jsm'); var observers = { 'http-on-modify-request':...

How to make for loop with ajax not freeze my Firefox Extension?

jquery,ajax,for-loop,asynchronous,firefox-addon

This should work, although I mixed let in here in order to hoise theUrl if you use var in that situation it will execute the same URL over, I think. What I did here was set-up a counter of sorts. var item_name = 'test'; var items_per_row = 8; var last_index;...

javascript firefox sdk: get domain without subdomain

firefox,firefox-addon,firefox-addon-sdk

You will want to use the nsIEffectiveTLDService for this. It's basically a giant list of special-cases maintained by mozilla such as the mentioned .co.uk domain and used for same-basedomain (as opposed same-origin) policies such as cookies. Some of its functionality is also exposed in the sdk/url module....

How emit function in firefox extension?

javascript,firefox-addon,firefox-addon-sdk

The port API only supports JSON-serializeable data.

XUL iframe firefox addon, how to change the src within the iframe?

javascript,firefox,iframe,firefox-addon,xul

With iframe in XUL you must create it with the HTML namespace otherwise things like load events don't work right, see this topic: http://forums.mozillazine.org/viewtopic.php?f=19&t=2809781&hilit=+iframe Once you do that, changing src etc should work as expected....

It is possible to create a hyperlink to the JS debugger in firefox?

javascript,firefox,firefox-addon,firefox-addon-sdk

Yep, what's the chrome url of that page? Set it in here: var sa = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray); var wuri = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); wuri.data = 'about:blank'; sa.AppendElement(wuri); let features = "chrome,dialog=no"; var XULWindow = Services.ww.openWindow(null, 'chrome://global/content/viewSource.xul', null, features, sa); XULWindow.addEventListener('load', function() { }, false); Set wuri.data = 'about:blank'; to the url of whatever...

Firefox addon - how to use XMLHttpRequest in Chromeworker?

ajax,xmlhttprequest,firefox-addon

I modded my non-worker XHR function to work in ChromeWorker, but its not perfect as I don't know how to set loadFlags in the ChromeWorker version as in the ChromeWorker version doesnt have .channels, weird. But see this branch here: https://github.com/Noitidart/ChromeWorker/blob/xhr/myWorker.js My function there uses a promise scheme but you...

Copy to clipboard from Firefox add-on content script

javascript,firefox,copy,firefox-addon,firefox-addon-sdk

I finally got it to work with onAttach. Here's my main.js: var pageMod = require("sdk/page-mod"); var self = require("sdk/self"); var clipboard = require("sdk/clipboard"); pageMod.PageMod({ include: 'example.com', contentScriptFile: self.data.url('content-script.js'), onAttach: function(worker) { worker.port.on('copyToClipboard', function(request) { clipboard.set(request); }); } }); And content-script.js: self.port.emit('copyToClipboard', 'This text will be copied.'); ...

firefox addon sdk: get page load time

javascript,firefox,firefox-addon,firefox-addon-sdk

Just use Navigation Timing API: window.onload = function(){ setTimeout(function(){ var t = performance.timing; console.log(t.loadEventEnd - t.responseEnd); }, 0); } Notice that it's a Javascript API so it must run inside a Content Script (ie, it won't work inside your lib/main.js or index.js file)....

Is there an API to control downloads in Firefox add-on SDK?

firefox,firefox-addon,firefox-addon-sdk

The API's are (links to documentation on MDN): Downloads.jsm Download DownloadTarget PlacesUtils.There is good info at paa's answer to the question: API to modify Firefox downloads list ...

nsICacheService doesn't work in Firefox 38

javascript,firefox,firefox-addon

http://code.metager.de/source/xref/mozilla/firefox/netwerk/cache/nsICacheService.idl This looks like a hint * @throws NS_ERROR_NOT_IMPLEMENTED when the cache v2 is prefered to use. https://bugzilla.mozilla.org/show_bug.cgi?id=913807 I’m thinking that all we need to do is change 1 to 2 in this line in the var cacheService = cc["@mozilla.org/network/cache-service;1"] .getService(ci.nsICacheService);...

TcpSocket listen on Firefox addon

sockets,firefox,tcp,firefox-addon,tcplistener

I've finally got it working with a different approach: var port = 3000; //whatever is your port const {Cc, Ci} = require("chrome"); var serverSocket = Cc["@mozilla.org/network/server-socket;1"].createInstance(Ci.nsIServerSocket); serverSocket.init(port, true, -1); var listener = { onSocketAccepted: function(socket, transport) { var input = transport.openInputStream(Ci.nsITransport.OPEN_BLOCKING,0,0); var output = transport.openOutputStream(Ci.nsITransport.OPEN_BLOCKING, 0, 0); var tm =...

Converting HashString from C to JS

javascript,c++,c,firefox-addon

Let's implement a more minimal C++ version first, which also dumps intermediate values which we can later compare. #include <iostream> #include <iomanip> #include <stdint.h> using namespace std; static const uint32_t gr = 0x9E3779B9U; template<typename T> static uint32_t add(uint32_t hash, T val) { const uint32_t rv = gr * (((hash <<...

firefox bootstrap addon: install event is not executed

javascript,firefox,firefox-addon,firefox-addon-sdk

from: https://forums.mozilla.org/viewtopic.php?f=7&t=22621&sid=4ea13ebd794f85600d6dcbcf6cc590a7 in bootstrap you dont have access to sdk stuff like that. im not sure how to access that stuff. but i made exactly what you are looking for with localization :D took like 10min :D https://github.com/NoitForks/l10n/tree/setpref-install-uninstall note: the quirk that localization files are not available during the uninstall...

firefox extension works through sdk but not when installed in browser - compatibility issue?

javascript,firefox,firefox-addon,firefox-addon-sdk,mozilla

Open context menu on the toolbar where your icon would be, select Customize.... In the opened window, can you see your icon in "Additional tools and features"? If yes, then it means firefox remembered the icon's absence while you were developing the addon. You can put the icon to...

How can i get the firefox add-on version number?

firefox-addon

AddonManager You can get it from AddonManager module Components.utils.import('resource://gre/modules/AddonManager.jsm'); AddonManager.getAddonByID("YOUREXTENSIONID", function(addon) { var version = addon.version; }); More info: AddonManager Code Samples Note: (from AddonManager) The majority of the methods are asynchronous meaning that results are delivered through callbacks passed to the method. The callbacks will be called just once...

Addon to modify http headers specified via regex of content

regex,firefox,http-headers,firefox-addon

It should be fairly trivial to write such an addon yourself if you don't need any GUI. The SDK has a module (system-events) that requires only a few lines of code to hook into any and all HTTP requests or responses...

Add shorcut key in a restartless Firefox addon

firefox-addon

GitHub :: Noitidart/_ff-addon-demo-BootstrapHotkey i made this based on this topic here: firefox add-on shortcut does not work anymore You have to make your own keyset instead of adding to mainKeyset because key liseteners are connected when keyset is appended to document. per the topic linked above That demo addon ads...

run a linux command with firefox sdk

firefox-addon,firefox-addon-sdk

Just use nsIProcess, this way: const {Cc, Ci} = require("chrome"); // create an nsIFile for the executable var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); file.initWithPath("/usr/bin/du"); // create an nsIProcess var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess); process.init(file); // Run the process. // If first param is true, calling thread will be blocked until // called process...

Message Passing From firefox extension to mac app

objective-c,osx,firefox-addon,jsctypes

Added js-ctypes tag. Join moz irc js-ctypes for more help, I would actually love to chat with you about it, join here: https://client00.chat.mibbit.com/?url=irc%3A%2F%2Firc.mozilla.org%2F%23jsctypes or here irc://moznet/jsctypes . Awesome work you're doing here. I'm not going to do this with ObjC Bridge because that has a TON of abstraction. You won't...

can you load external executable javascript from a firefox extension?

firefox,firefox-addon,firefox-addon-sdk

You can always xhr for a file, save the contents to disk, then use scriptloader.loadSubScript with an add-on this would violate the AMO policies though, so you wouldn't be able to upload the add-on to http://addons.mozilla.org...

HTML transient modal window

javascript,firefox,modal-dialog,firefox-addon,privileges

The Privilege Manager was deprecated in Firefox 12 and removed in Firefox 17 (briefly restored). You might want to look into Window.showModalDialog(). However, it is deprecated and is expected to go away within the year, or in 2016 if you go with an extended service release (ESR) of Firefox 38....

Persistence storage JSON in a file using OS.File

javascript,firefox,firefox-addon,firefox-addon-sdk

To store realObject as JSON in the file MyFileName.json which is created/overwritten in the extension-data directory within the directory for the current profile, you could do something like: Components.utils.import("resource://gre/modules/FileUtils.jsm"); Components.utils.import("resource://gre/modules/NetUtil.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); let asJSON = JSON.stringify(realObject,null); let file2 = openFileInPrefsExtensionData("MyFileName.json"); overwriteTextFileFromString (file2, asJSON); /** *...

Firefox addon: TypeError: getBrowserForTab(…) is undefined

firefox,firefox-addon,firefox-addon-sdk

The problem is that the tabs.on('load', function(tab) {}) is a part of the high-level API, whereas getTabContentWindow from require('sdk/tabs/utils') works on low-level XUL tabs. Use viewFor from sdk/view/core to transform: var { viewFor } = require("sdk/view/core"); var window = getTabContentWindow(viewFor(tab)) ...

Can an extension similar to Simple Notes (Opera) be developed in Firefox?

firefox,firefox-addon

Yes, it can be, and probably has been, done, or at least something close. You can search AMO for Notes or Note and look through the results for an extension that does what you want....

Using the Web Crypto API from Firefox AddOn

javascript,firefox,firefox-addon,firefox-addon-sdk

Components.utils.importGlobalProperties(['crypto']); var blah = crypto.subtle.deriveKey({....}); Taken from here: https://developer.mozilla.org/en-US/docs/Components.utils.importGlobalProperties...

Make javascript execute after javascript from add-on in firefox?

javascript,html,firefox-addon

Since addon scripts run in sandboxes that are difficult (but not impossible) to access it's probably easier to just edit the addon and replace the html page you don't like with something nicer. Addon XPIs are just zip files mostly containing standard web technologies, javascript, CSS, HTML/XML modulo some browser-specific...

Should I specify the application when using the same XUL overlay?

firefox-addon,xul,mozilla,thunderbird,seamonkey

This depends on what your add-on is actually supporting via em:targetApplication. Usually having an application= is not required, because there simply is no ambiguity. The only case I can imagine where it actually would make sense, would be if your add-on supported two different applications, which both have e.g. a...

Detect tab url change inside firefox add-on

firefox,firefox-addon,firefox-addon-sdk

Use ProgressListener to be notified about location changes. To install a listener, convert SDK tab to its raw (old) representation using viewFor. Backward conversion is possible with modelFor and getTabForContentWindow. const tabs = require("sdk/tabs"); const {viewFor} = require('sdk/view/core'); const {modelFor} = require('sdk/model/core'); const {getBrowserForTab, getTabForContentWindow} = require("sdk/tabs/utils"); const {Ci, Cu}...

Firefox Add-Ons: Variable Is Not Defined In Console

javascript,debugging,firefox,firefox-addon,xul

As erikvold has said, the link to your Uedit.js script is wrong. This is the minimum that is wrong and is the thing that is complained about in the console: browser.xul:5 is line 5 in browser.xul, which is: <script src="Uedit.js" /> You state that you have tried: <script src="chrome://Uedit/Uedit.js" />...

How to test google analytics in firefox browser?

firefox-addon,event-tracking

The above link is for GA debugger extension. I just managed to check the google analytics parameters in firefox. Hope this helps. Open firefox browser->Tools->WebDeveloper-> webConsole You would be prompted with a seperate or autofitted window. Then go to Tool Box options-> Enable google Chrome addon debugging in advanced settings....

Firefox extension app hosted on server

firefox,firefox-addon,firefox-addon-sdk

It's possible to create a simple extension that loads a web app either in a panel or a tab. You should read up on the Addon SDK documentation, including the panel, tabs and getting started docs. There is nothing wrong with this, as the web app would not have direct...

How to put BGRA array into canvas without re-ordering

javascript,canvas,firefox-addon

How to put BGRA array into canvas without re-ordering There is none. Reorganize the byte-order is necessary as canvas can only hold data in RGBA format (little-endian, ie. ABGR in the buffer). Here is one way to do this: You could add an extra step for your worker to...

Closing tabs with a specific meta TAG in firefox-addon using javascript

javascript,firefox-addon,firefox-addon-sdk

Try this: var TAG = "CLOSE_LATER"; var tabs = require("sdk/tabs"); var success = function (rValue) { if (rValue) { this.close(); //console.log("CLOSED i: "+i); } else{ //console.log("NOT CLOSED i: "+i); } }; for(var i=0; i<tabs.length; i++){ var tab = tabs[i]; console.log("****START****"); console.log("CLOSING TAB : "+i+"of : "+tabs.length); searchTag(tab, TAG,i) .then(success.bind(tab), function...

Receive message from main.js in Firefox add-on content script

javascript,firefox,firefox-addon,firefox-addon-sdk

Facepalm. The code from content-script.js was wrapped in a jQuery event handler, so self.port.on() couldn't listen properly. Here is the working code--first, main.js: var pageMod = require('sdk/page-mod'); var self = require('sdk/self'); var ss = require('sdk/simple-storage'); pageMod.PageMod({ include: 'example.com', contentScriptFile: self.data.url('content-script.js'), onAttach: function(worker) { worker.port.on('getSetting', function(request) { var settingValue = ss.storage[request];...

setInterval not called in tab content-script

javascript,firefox,firefox-addon,firefox-addon-sdk

Use this var { setInterval, clearInterval } = require("sdk/timers"); console.log("foo"); var id = setInterval(function() { console.log("bar"); }, 1000); ------------ UPDATE 1 ---------- This works fine for me: main.js var tabs = require('sdk/tabs'); var self = require("sdk/self"); tabs.on("ready", function(tab) { console.log('opened', self.data.url('content.js')); tab.attach({ contentScriptFile: self.data.url('content.js'), contentScriptWhen: 'ready' }); }) tabs.open({ url:...

firefox addon - how to open this kind of window?

firefox-addon,popupwindow

var sDOMWin = Services.wm.getMostRecentWindow(null); var sa = Cc["@mozilla.org/supports-array;1"].createInstance(Ci.nsISupportsArray); var wuri = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); wuri.data = 'http://www.bing.com/'; sa.AppendElement(wuri); let features = "chrome,width=300,height=400"; if (PrivateBrowsingUtils.permanentPrivateBrowsing || PrivateBrowsingUtils.isWindowPrivate(sDOMWin)) { features += ",private"; } else { features += ",non-private"; } var XULWindow =...

Can I put a button on the tab header using Firefox Add-on?

javascript,firefox,firefox-addon

The short answer to this is: "Yes." Firefox add-ons have the ability to have almost complete control of the user interface. In this instance, the first level of XUL content that you would want to look at is contained in chrome://browser/content/browser.xul. This file is contained within the omni.ja archive in...

Manual adding firefox for android addon

android,firefox,firefox-addon

Yeah this is possible: Install firefox app Place XPI-file on your android device Install good file explorer like: ES File Explorer File Manager Open XPI with file explorer and choose firefox Add-on should get installed now. This should work PS: if file explorer doesn't give option to open with firefox,...

Firefox addon - Catch post variables before submit [no enctype]

javascript,firefox,firefox-addon,firefox-addon-sdk,tamper-data

Given you have a nsIUploadChannel channel, you can read the contents of the stream and parse them as if they where GET parameters (e.g. some=value&someother=thing). Reading var instream = Cc["@mozilla.org/scriptableinputstream;1"]. createInstance(Ci.nsIScriptableInputStream); instream.init(channel.uploadStream); var data = instream.read(instream.available()); Keeping the original upload stream intact There are some things to consider, though, if...

How to call native C code, using the js-ctypes Firefox extension?

javascript,c,firefox-addon,jsctypes

Awesome, you're getting deep into addons! See this repo: https://github.com/Noitidart/fx-sapi-test That shows the code to main.cpp which is compiled into a DLL and then imported and used. You have to expose your add function. By the way, if you were doing a bootstrap addon: Also try doing the ctypes.open inside...

Java backend for browser extension (Firefox add-on)

java,javascript,servlets,web-applications,firefox-addon

How can a browser extension (such as firefox add-on, chrome extension) talk to the backend Java programs? In the case of a firefox extension it's quite simple, you have pretty much the same privileges as the browser itself. I.e. you can just open sockets, access the filesystem or maybe...

gInitialPages is not defined bootstrapped extensions

javascript,firefox-addon,firefox-addon-restartless

Bootstrapped/restartless extensions do NOT automagically run in the context of (a) window(s). bootstrap.js runs in an own context, only once per application instance, not in the browser window. You'll need to: Manually enumerate all existing browser windows. Listen for new browser windows as they are opened. And then manipulate the...

Using Mozmill for testing Firefox addon

javascript,python,firefox,firefox-addon,mozmill

So, after posting a question on Mozmill Developers Google Groups - I've got an answer from Henrik Skupin, who is responsible for Mozmill. In short, they've also came across this issue, but Mozmill will be discontinued soon - and it's better start using the new framework firefox-ui-tests. Unfortunately it doesn't...

Firefox extension not working with URLs other than http:// https://

javascript,firefox,firefox-addon,xpi

Here is the code snippet from firefox.js that is responsible for listening to the URL protocols: var workers = [], content_script_arr = []; pageMod.PageMod({ /* page */ include: ["*"], contentScriptFile: [data.url("content_script/inject.js")], contentScriptWhen: "start", contentStyleFile : data.url("content_script/inject.css"), onAttach: function(worker) { array.add(workers, worker); worker.on('pageshow', function() { array.add(workers, this); }); worker.on('pagehide', function() {...

xul overlay for new menu in TB/Firefox main menubar

firefox,firefox-addon,overlay,xul

You need the menubar id, which is main-menubar and also your missing the menupopup. I have not tested, but this looks right to me: <menubar id="main-menubar"> <menu id="test-menu" label="TEST" accesskey="d"> <menupopup id="test-popup"> <menuitem id="example-item2" oncommand="alert('Hello!');" label="TEST" accesskey="i"/> </menupopup> </menu> </menubar> If your trying to find the id of things like...

Badged Buttons from Non-SDK

firefox-addon,firefox-addon-sdk

You can always look at the SDK source code. Here's the pertinent line node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional badged-button'); ...

how to append iframe to hosted page using Firefox SDK addon?

firefox,firefox-addon,firefox-addon-sdk

It's blank because of the firefox security policy which doens't allow content scripts to load resources URLs as iframes. The solution could be to set it directly from the background script, for this you'll need to use low level sdk. var { viewFor } = require("sdk/view/core"); var tab_utils = require("sdk/tabs/utils");...

Components.classes ERROR - FireFox Add-On(Extension) in VS 2013

javascript,c#,visual-studio-2013,firefox-addon

This indicates that your code is not running as an add-on. Instead it is running as a normal "content" web page. In normal content pages, Components is deprecated but not in an add-on. If you just want to experiment with occasional bits of code you might want to use the...

Get localized name other channel

firefox-addon

Is this a reliable check? Not really. There used to be channel switcher add-ons, and in theory the user can change this pref (although at the moment this is not sufficient to really switch the channel I think). Does this channel-prefs.js file exist for all builds as soon as...

Compilation of firefox extension with xulrunner-sdk-36.0 C++

firefox-addon,firefox-addon-sdk,xpcom

_MSC_VER 1800 is Visual Studio 2013 and 1600 is Visual Studio 2010. Both compilers are not compatible to each other in C++ mode, so you'll need to recompile either your project or the SDK so that compilers match. 1800 says to me that the xulrunner SDK was build using VS2013,...

channelUrl error in Firefox addon while trying SE OAuth init

javascript,oauth-2.0,firefox-addon

I found the answer with some experimentation. It turns out that the channelUrl for a Firefox extension should be an internal resource file, in the form of: channelUrl = 'resource://<enstenion_id>-at-jetpack/<extension_name>/data/blank.html'...

Why does my simple Firefox extension now refuse to run?

javascript,firefox,firefox-addon

I think you may be looking at a wrong console. Add-ons output information to the Browser Console.The more general question is how to see output on the Browser Console. It's not so obvious, but you can do it following these two steps. 1) In the location bar type in about:config,...

Firefox addon SDK - attaching a stylesheet to a tab triggering an error

firefox,firefox-addon,firefox-addon-sdk

The error message suggests that attachTo expects an XPCOM object. activeTab.window returns a wrapper object around the native window. The high level APIs of the sdk generally deal in javascript wrapper objects that hide most of the internals. You can use modelFor and viewFor to convert between those....

Right click does not work in panel (firefox addon-sdk)

firefox,firefox-addon,firefox-addon-sdk

Prior to Firefox 33, you don't get a context menu. From Firefox 33 you can enable a context menu by passing contextMenu: true to the panel's constructor e.g var panel = Panel.Panel({ width: 400, height: 500, contentURL: Data.get("html/view.html"), contextMenu: true }); ...

Incorrect scope for eval

firefox-addon

The problem is not with scopes or eval but that elsewhere in your code you call your "blah" function without passing a value for xwin. See line: 109...

js-ctypes and c# unmanaged dll in windows xp

c#,firefox-addon,unmanaged,jsctypes

Solved it! I created a new DLL x86 from scratch in C# using DLLExporter by RGiesecke and .NET Framework 2.0, and now this works....

How to open firefox “open menu” using keyboard shortcut?

java,firefox,selenium,selenium-webdriver,firefox-addon

For an automation task like this you maybe using the wrong technology. Have you tried using AutoIt for a task like this? Then switching back to Selenium when you need to interact with the DOM?...

FireFox Extenstion - Using Components - Hex Decoding

javascript,firefox-addon

You need work :D But for start you can do a console.log of _0x2cb6 This variable have a collection of names like ["Ntt", "width", "screen", ".", "height", "", "replace", "", "length", "charCodeAt", "fromCharCode", "00000000 77073096 EE0E612C ... 706AF48F , "0x", "substr"] This name are using to access properties in objects....

best option for firefox extension to keep panel / overlay / sidebar visible between pages?

firefox-addon,firefox-addon-sdk

You can try setting the panel's noautohide property to true, to do that you have to access the underlying view (the linked API should also work on panels). Although in my experience that causes some annoying focusing side-effects, at least under linux. Alternatively you could try open a new window...

Mozilla Javascript Performance NEW OS.File vs OLD nsIFile over 3000 files

javascript,firefox-addon,mozilla,xulrunner

I'm the author of OS.File. We had some benchmarks of nsIFile vs. OS.File back in the days. If you were to rewrite either nsIFile to work in a background thread (which is not possible by design of XPConnect) or OS.File to work in the main thread (which we made impossible...

Parsing id3 data from a local audio file within firefox addon

javascript,firefox-addon,firefox-addon-sdk,id3

This JavaScript-ID3-Reader library is meant to run in the context of a website, only for files available via http and https afaict. You might want to find a library which will work on the add-on side....

Can't get xpi to work in TorBrowser

firefox,firefox-addon,tor-browser-bundle

Had to add "permissions": {"private-browsing": true} to the package.json http://tor.stackexchange.com/questions/6293/sidebar-for-custom-addon-broken-in-tbb...

browser plug-in or extension, which to choose?

javascript,google-chrome-extension,firefox-addon,browser-plugin,browser-extension

Could it be done using browser plug-in or extension? Yes. But you don't want to write a browser plug-in. They're fairly complicated to write and users are reticent to install them (with good reason) Further, you'd have to write two, as Mozilla and Google can't agree on a format...

When do I load a browser frame script (e10s)?

javascript,firefox,firefox-addon,e10s

Even load-protection logic (i.e. only creating the frame script functions if they don't already exist) Frame scripts are a bit tricky, scripts for each tab share a global object but have a separate scope, akin to being evaluated inside their own function block. So if you add it multiple...

evalInSandbox fails to find function in Firefox 38

javascript,firefox-addon

If I read this correctly you are creating a Sandbox with the same security principal as the document but with an empty global scope, therefore JSFunctionName() will not be available in the global scope of the sandbox. I guess with() should solve that but maybe it does not work across...

Firefox extension, storing variable value until firefox is restarted

javascript,variables,firefox,firefox-addon

You can use JavaScript code modules https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Using Your module should export functions instead of just variables e.g. var EXPORTED_SYMBOLS = ["getBlocked", "setBlocked"]; var blocked = 0; function getBlocked() { return blocked; } function setBlocked(value) { blocked = value; } and then use the functions instead of the variable name...

How to use a contentScriptFile from an external URI in a Firefox addon

javascript,jquery,jquery-ui,firefox,firefox-addon

self.data.url("https://...") It seems like you haven't read the documentation on data.url() It clearly states that The data.url() method returns a resource:// url that points at an embedded data file. Which means you cannot link to an external resource. Does anyone know if this is possible and how? No, contentScriptFile...

access custom dom function from firefox add-on

firefox-addon,firefox-addon-sdk

You have to get into the dom js scope with unsafeWindow or wrappedJSObject. So contentWindow.wrappedJSOBject.checkIt() works from bootstrap addon (not sure about sdk) Warning though, this may not be e10s friendly and we should find a way to support that...

How does FireSheep work without ARP poisoning?

cookies,firefox-addon,wireshark,arp,network-security

Trying to answer from memory... Firesheep uses libpcap and listens to packets in promiscuous mode. So it will be able to see any data on open wifi networks (read: unencrypted). Remember that the "wifi cable" is the "air", and everybody with the right antenna can listen to that medium. Since...

How can open Firefox developer tools in my extension's sidebar?

firefox-addon,firefox-addon-sdk

You should be able to just use the standard Browser Toolbox and use the inspector to select the item in your sidebar that you want to work on. It's not as seamless as using the context menu but should get you what you need. Once you've enabled it and opened...

How to create UI with Mozilla Addon SDK?

javascript,firefox-addon,firefox-addon-sdk,xul,mozilla

I think the use of the panel API or simply loading a HTML page from the addon XPI into a tab and using page-mod is encouraged for addon UIs. If you really want to open a separate window with a completely custom layout you can use window/utils#open. HTML is preferred...