Using Java/Python libraries in programming Firefox/Chrome Extensions - google-chrome

I have an idea of studying user behavior on the browser, for which I intend to make a Chrome/Firefox extension to study the behavior dynamically. I have some predefined libraries in Java and Python to analyze the results, which will be impossible to program in plain JavaScript.
Now for my question: is it possible to use third party libraries, especially those of Python or Java like plain function calls?
I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. However, for a beginner, it all looks so scary. I started making Add-On for Firefox, but got lost somewhere in the huge API.
I found Programming Chrome extensions easier than Firefox, but I couldn't come across something similar to XPCOM in Chrome.
How can I decide which one to go for?
Chrome - seems easy but I am not sure of its power.
Firefox - Seems powerful, but is it really possible to use any Java/Python Library?
Additionally, I came across this link that may be useful: How does someone use thirdparty libraries to be included in Firefox addons/extensions?
But seems like it mostly talks about C++ and XPCOM.

I have a vague idea about something like Java XPCOM or PyXPCOM for Firefox. But for a beginner, it all looks so scary.
I am not a beginner and JavaXPCOM/PyXPCOM are very scary (in addition to being barely maintained). As Firefox goes, it should be much easier to wrap your Java/Python library in an application and run it as an external process: https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIProcess. Note that you cannot get data back (other than an exit code) so the application should write it to a file that you can then read in your Firefox extension. Not very elegant but it has the advantage of being doable.
As to Chrome, its extensions run in a sandbox and using Java or Python isn't possible. Only option is adding an NPAPI plugin to your extension. It is binary code meaning that it could do anything.

When writing Chrome extensions, you're limited to JavaScript unless you choose to use an NPAPI plugin, which lets you do pretty much anything, but is not recommended.
The other approach you could take is to implement your Java or Python code on the server and make requests from the chrome extension's JavaScript.

Related

TCL/TK in browser

I've been trying to run a TCL/TK script in a browser so people with minimal computer knowledge can run it (my script) on all devices.
I've come across the TCL/TK plugin from 2006 but I can't get it to work. Even if I could, it doesn't contain the user friendliness I am looking for.
I also came across a website that runs TCL scripts in-browser but doesn't seem to recognise TK commands....
So far to distribute it to people I wrapped it into a .exe but people are requesting it to be used on mobile devices (with more mobility than a windows laptop).
Any one got some information to do this without rewriting all of my code?
Or an easy way to port a TCL/TK script to iPhone/iPad or Android (I don't think there will be any easy solution for this, that is why the browser concept made most sense to me)
Unfortunately, the browser plugin depends on the browser supporting the NPAPI specification, and that's now been largely removed from browsers (and was never supported on mobile devices). This has irritated quite a few other people too, and I don't think there's much you can do to fix it directly. So instead, let's look at some workarounds…
You might be able to use the NaCl support in Chrome on desktop systems, or you could package things up in a starpack (ActiveState's TDK is a commercial version of that, among other things) and for deployment to Android you can use Androwish (which I personally recommend). I'm nothing like as certain about solutions for iOS.
For plain Tcl try EmTcl, Tcl compiled with emscripten.

Automation Testing for Chrome

I was hoping you could point me in the correct direction. I am trying to find an automation tool for an internal Chrome site that I, as a tester, can use to create tests. I would prefer some kind of recording type option and free or very low cost. And it MUST work on Chrome. Our app doesn't work with any other browser
Here's what I've looked at so far:
I am not going to have time to learn any new languages or have access to a developer, so Cucumber is out (this was the company's first choice).
I found the Ghost add-on that records, but it needs to open the firewall to be used. BIG no no.
I looked at sikuli, but we can't have a dedicated screen like that, although it might still be a last ditch option
TestComplete might work, but it costs money. I am going to download the free trial, but the justification may not be enough to get the company to spend the money
SoapUI is something I've worked with before and I know that only the Pro is helpful to a non-programmer like myself.
Any ideas are welcome.
Thanks!
You could look at Robot Framework. It is a keyword driven test automation framework and it has good Chrome support via Selenium. Web page has examples how to write tests for browsers.
Robot Framework is open source and free. Writing tests with keywords looks more difficult than using record-playback tool. However, once you have several tests, managing them will be easier with keywords.

Google Chrome extensions interaction with Native Client Applications

Is it possible to write a Chrome Extension that will interact with a Native Client application?
I use Irssi through the NaCl Secure Shell application, and I would like to write an extension that simply looks for plain URLs and makes them clickable links.
I'm seeing some strange behavior with extensions and NaCl applications, so I wanted to know if this is something that is even possible.
Additionally, if anyone has a more elegant solution to this, please don't hesitate to let me know.
Thanks!
The fact that the NaCl Secure Shell app uses Native Client under the hood shouldn't matter; the page is rendered using standard HTML.
The documentation for Chrome Extensions here says you should be able to inject content scripts into pages with the chrome-extension scheme. I tried it, but it doesn't work. It seems the documentation is incorrect. See http://crbug.com/153245.
As far as I can tell, it is not possible to modify an extension this way. It is possible to communicate with other extensions/apps (see here), but it seems that the application must expose an API to communicate with.
Secure Shell supports clicking links now via Ctrl+Click. it will support OSC+8 in a future release.

Framework to develop Google Chrome Extension "Session Buddy"

I'd love to develop Google Chrome Extension. But currently I don't know any framework to work with. I found the "Session Buddy" is one of very well structured extensions. I think it must be developed by specific framework (because it's very well structured, and encoded).
Anyone know what framework does the author of Session Buddy use to develop this extension? Here is the url: https://chrome.google.com/webstore/detail/edacconmaakjimmfgnblocblbcdcpbko?hl=en-US
Moreover what other frameworks do you use to create chrome extension? Does it support unit test?
Thanks for your answers,
nTuan16
The current version of Session Buddy (v3.0.9) is coded in pure JavaScript, with the exception that it uses MooTools for internationalization of dates and ordinals (I'm currently exploring alternatives to that though, so this may be replaced in favor of a different library in a future release). The code obfuscation is achieved through a simple js parser I built using C#.
-Hans (Session Buddy developer)
Addendum: I should add (because you mention the code structure) that I pass the code through Google's Closure Compiler with a compilation level of WHITESPACE_ONLY.

Will Dart scripts run natively in the browser?

The Dart language looks like a very nice technology to build web applications for the web. For me it seems that there are no browsers available (yet?) which can run Dart scripts natively. Although there's a description on Dart's site about how to embed such scripts into HTML. I understand that for now i have to "compile" Dart scripts to Javascript. But will this change in the future or the language is designed to be translated to other script standards similar to Haxe?
This is speculation, but I guess that Chrome will likely support dart natively in the future. It will mean that Chrome will be able to outperform other browsers that don't have the native support.
Update: There's a hint from The Official Google Code Blog that it might be coming:
The Dart VM is not currently integrated in Chrome but we plan to explore this option.
Update 2: It looks like I was right! Here's some recent news:
Additionally, and perhaps most importantly, Google is releasing Dartium, a Chromium build with native Dart support.
It’s more than likely that Dartium is part of a series of steps that Google will be taking to launch native support in Chrome — greatly improving the usefulness of Dart. Bringing native support into other browsers like Firefox and IE, on the other hand, will be quite the challenge.
Update 3: Since I posted this answer, Microsoft have released TypeScript which is a competing technology. I'd say it's unlikely that Microsoft have any intention of integrating Dart into Internet Explorer as they would probably prefer people to use TypeScript rather than Dart.
The official answer is Yes, Dart will run natively in Chrome. The branch of Chrome, affectionately called Dartium, is now available as source, and binaries will be released soon. More information on how to get and build the source: http://code.google.com/p/dart/wiki/BuildingDartium
As of March 25 of 2015, the offical answer is: no.
Source: Dart for the Entire Web
Google dropped the integration plan of the Dart VM into Chrome in favor of optimizing the Javascript compilation. Dartium is still accessible for development purposes.
Eventually, yes. The proposed MIME type + usage looks like this:
<script type="application/dart">
main() {
Element element = document.getElementById('message');
element.innerHTML = 'Hello from Dart';
}
</script>
(That example looks like JavaScript, but don't be fooled!)