Firefox extension: native code execution? - firefox-addon

Is it possible to write an extension that runs native, platform-dependent code? I'm an extension-newbie (what a phrase!) :), can you please point me towards good material on this subject? (good keywords to feed to Google are enough)
(I would like to put a GtkMenu in Firefox)
Edit:
I started checking out the Gecko SDK, and it's a rather big subject, and I'm not sure this is what I want.
I'd be happy with a friendly manual (which is not a raw reference, but rather some kind of tutorial on how to make extensions that utilize XPCOM (if that is the way). Good keywords are still appreciated.

Check out the Gecko SDK.
You can use it make portable C++ native code firefox extensions which I believe are XPCOM objects with JavaScript wrappers in the .xpm zip file.
I haven't tried it, but you can go the usual route and write the plugin, I mean extension, in javascript also.

Native Client doesn't quite offer the breadths of API firefox extensions offer, but it's still well worth checking out for your purposes IMHO.

Yes, you can. Witness the Cooliris extension, that makes (heavy) use of your 3D graphics card, and is Windows specific.

Related

Is it possibe to write Gnome extensions in Dart and compile it to JS?

In theory it looks like it should be possible. There is: Dart-to-JavaScript compiler and even package to call JS from Dart and opposite.
But I didn't find any resources about it. Did anybody tried? Does anybody knows for sure that it is not possible?
Short answer: maybe, but I seriously doubt it's worth the effort.
To do anything useful with JavaScript, you need to write for a platform like the Web API, node.js, or GNOME in the case of GJS. Dart seems to support the Web API with its web library and its own platform with the vm library.
You might be able to write a transpiler that could transpose from a subset of Dart to GJS, but using any existing dart transpiler is probably impossible.

Java2dart, how use it

I have downloaded the sources, then... I don't know what I'm supposed to do.
I think that we have to compile these, but I'm not really familiar with java.
Do you have a complete example for use it ?
The java2dart tool was written for Google's own use, to help convert many of the tools from Java into Dart. Is was not intended to support conversion of all Java apps; just what was required to get things like the IDE tools (Analyzer, etc.) into Dart.
As such, there's not a huge amount of info on what it can/can't do or the best way to use it. It is written in Java, and there doesn't appear to be a pre-built binary; so it would almost certainly involve compiling the Java yourself. Unfortunately I have almost zero experience with Java (or fortunately, depending on your point of view :))
You can find a little info on this in the Dart Google Group here:
https://groups.google.com/a/dartlang.org/d/msg/misc/4mSK-M7dm2U/ARbTh6emb-sJ
I wonder whether anyone has tried running java2dart on java2dart to get a nice Dart version? :) Or even then running it through dart2js to get a JavaScript version! ;)

Run firefox extensions in xulrunner

I am just wondering if is it possible to run extension like colorzilla / firebug in xulrunner.
In fact I am creating my own extension now and I was trying addon_sdk but this is very problematic to put extension icon/button next to location bar.
So I decided to work with xul, and I know that problem doesn't exist here. And Of course the best way to learn is analyze other code, a changing it. But I can't run any extension in xulrunner. Any hint / help ?
xulrunner is just a runtime or platform. You'd need an actual app on top of that. In that regard, Firefox, Thunderbird, Seamonkey, InstantBird, etc. can be considered (complex) xulrunner apps.
Existing extensions may run, with or without modifications in such a xulrunner app. Well, likely with modifications, as most extensions use APIs specific to Firefox or Thunderbird or ...
The add-on SDK is not generally isn't a good fit for generic xulrunner apps: It is too much tailered against Firefox specifically.

ios Terms and scripting languages

i was looking at several lua/objective-c implementations that looked promising for a project i want to create ,but with an exception that i wanted to be able to download the scripts at runtime.Then i found the terms which state :
"An Application may not download or install executable code. Interpreted code may only be used in an Application if all scripts, code and interpreters are packaged in the Application and not downloaded. The only exception to the foregoing is scripts and code downloaded and run by Apple's built-in WebKit framework."
so clearly you cant download any lua scripts at runtime.
If i interpret correctly you can only run javascript files downloaded through UIWebView.
So if i wanted to create a objective-c/javascript bridge through uiwebkit(with stringByEvaluatingJavaScriptFromString and url encodings) ,i dont see anything against apple's term right?do you think it would be an overkill in perfomance?
I have no experience about the performance of executing Javascript through UIWebView, but I suspect the toll is high if you plan to call stringByEvaluatingJavaScriptFromString with fine grained code. On the other hand, nothing keeps you from loading a full HTML in your UIWebView with all the Javascript code that you need, and this approach would certainly ensure better performance.
actually, there is an alternative approach that you can try and follow. It is actually possible to directly embed the WebKit Javascript Engine (Javascript Core) into your app. This approach has already been "approved" by Apple and you can find it described here. (Dominic Szablewski, the creator of the JavaScript game engine Impact, is the guy who accomplished this).
In short, it comes down to compile the Javascript Core as a static library and then link this in your app. If you don't feel like compiling it yourself, at the link I posted you can also find more information as to how you can license the library from Dominic Szablewski. (I am not really suggesting anything at this respect, just summarizing information).

Adding XUL to a Plugin?

I am working on a Firefox Add-on that view TIFF Files. I'm having trouble figuring out how to do the UI, buttons, scrollers etc. I'm on a mac, so the program is being written in either C or Objective-C, in case that makes a difference.
I'm thinking that XUL might be a way to do the UI. If I could wrap my plugin in some sort of XUL wrapper, and then have the wrapper send messages to the compiled code, that might solve my problem.
However, I'm not sure that this is how XUL works. All of the examples I've seen have basically been HTML, made slightly more complicated...
Alternatively, I could write the plugin in Java, if it's easier to embed a JAR file into XUL. Actually that might be the best because then It would (probably) be platform independent...
You can write C++ plugins for XULRunner using the XPCOM technology. See here for a good tutorial. Documentation is scarce though, be warned!
You can create an interface to your C/C++ code to be accessed from JavaScript using the XPIDL interface language.
I don't think you can embed Java code in XUL though. You are probably referring to JAR Manifests.

Resources