Full privileged console for firefox - firefox

I'd like to play around with developing firefox addons, and I'm going to be accessing stuff like Components.utils and other objects, which are not accessible from the client code.
I've tried native web console and firebug console, and both give me an error when I'm trying to access utils object.
Is there firefox javascript console, which would give me full access to all firefox objects?

Use devtools:Scratchpad (shift F4; it's built into Firefox and is accessible under the web development menu). You'll need to set the pref devtools.chrome.enabled to true in about:config, and set scratchpad environment to browser from Scratchpad's menu. Once you've done that, whatever code you run in scratchpad can access chrome objects and operates with chrome privileges.
No addons or separate applications are necessary.

Try MozRepl.
I'm using it with rlwrap telnet localhost ....

Related

Firefox console ReferenceError: browser is not defined

I am trying to learn WebExtension development for Firefox. I find the window debugging tools EXTREMELY useful as I can interactively evaluate javascript code in the window context.
For the Webextension APIs at the browser level, I have been totally unsuccessful when trying to similarly use the browser console. For example trying to use the tabs API
Click on menu->developer->browser console
In the console command line enter any expression beginning with browser and I get
"ReferenceError: browser not defined"
I have tried in chrome and got same error (read article about chrome.* vs browser.*)
For example trying to find all tabs:
var querying=browser.tabs.query(queryInfo)
or
chrome.tabs.query()
Returns browser or chrome as not defined
Please help
As described at [1] WebExtension APIs are present in pages contained inside a WebExtension. The browser console gives you access to the javascript environment used to implement the main browser user interface which is a very different environment.
To experiment with the WebExtensions APIs interactively, your best bet is probably to create a very simple WebExtension with an empty background page, then attach to it with the debugger [2]
[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API
[2] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Debugging

Wrapper around web-app under Windows

I have an application with web interface. Unfortunately, it has all disadvantages of being a web page:
It doesn't have a standalone window, so users cannot manage it via the taskbar.
Users see the address line with something like 'http://localhost:8080' that is not a good idea for home users.
If users click on a tray icon, there is no way to activate the tab in a browser, which contain the application interface.
So, it would be nice to have a wrapper application with a browser within.
In case of IE I know it's possible to create a window with Trident ActiveX component. But what if it's Windows XP with IE6 but installed latest Chrome? I'd like to prefer Chrome since it supports a lot more features which the user will never see.
So, is there a way to wrap a page into Chrome/Firefox and make it look like a standalone application, if one of them is presented in the user's system? (The application shouldn't install anything large, so Chromium build is not an option).
P.S. I'm not interested in supporting other platforms than Windows.
Regards,
Take a look at Chrome Apps.
I hope helps you.

Is there an equivalent of chrome's nativeMessaging API in Internet Explorer?

On chrome, extensions can exchange messages with native applications with the help of native messaging APIs How can we achieve this on IE?
use-case : We have our own desktop application which users can download and install from our site. Next time when they revisit, we should be able to detect if the native application is installed and launch if its available.
We were able to build a solution on chrome with the help of an extension which makes use of chrome native messaging APIs to connect to native application.
Need something similar on IE browsers or a generic solution which will work across all major browsers.
You might want to have a look at URL handlers, they are supported for Firefox, Chrome and Internet Explorer.
Basically it enables you to register for example myapp:// for the browser and then you can have the browser call the application that is registered to this handler.
This is a technique which for example uTorrent uses to open trackers for torrent:// and magnet://.
You can check these links for details or search for solutions here on SO:
https://developer.mozilla.org/en/docs/Web-based_protocol_handlers
https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx
https://developer.chrome.com/apps/manifest/url_handlers
If you have the desktop application installed, you can just install the BHO in the IE. This BHO should handle Navigate events from the browser, then, when user navigates to your site, BHO will indicate to the site, that the your app is present on the system. For example, BHO can inject some "marker" node on the page or call some predefined JS function on the your site's page. Also this BHO can perform some additional communication with you desktop app via the COM (or you can emulate manually int the BHO the protocol used in Chrome native messaging) and use the same approach as for Chrome.

SinchPSTNsample Using javascript Shows Warning After running index.html file

i saw below warnning when running the sample html in chrome
Warning! Protocol "file" used to load page in Chrome.
Please avoid loading files directly from disk when developing WebRTC applications using Chrome.
Chrome disables access to microphone which prevents proper functionality.
You can allow working with "file:", if you start Chrome with the flag --allow-file-access-from-files
Please help me to get out of this
thank you
It depends on which Operating System.
In OS X you can start Chrome by using:
open -a Google\ Chrome --args --allow-file-access-from-files
While in Windows you'd start Chrome in the command prompt using:
chrome.exe --allow-file-access-from-files
Please note that the warning does not disappear in the sample app, this is the expected behaviour but now calls will work. In a production environment you should not even include this warning, since it's only meant as a friendly reminder for developers using local file storage (directly opening the .html file from disk).

Is it possible to use local resources from a web-delivered XUL app?

Is there a way to execute a XUL program delivered via "trusted" web site outside of the browser sandbox?
My XUL program executes beautifully in local XULRunner and in firefox with the -add parameter.
Now, I'd like to put it on my secure intranet and allow users to click a button which will launch it. My app has behaviors that access local resources such as .exes, so it seems like the browser sandbox will prohibit the app from carrying out those behaviors. But I'd really like to create a browser-based launchpad for this app. And since I'm hosting it on my intranet, which is trusted in my users' browsers, it seems like it should be possible.
Mozilla's documentation says "It is also possible to open XUL files directly from the file system or from a remote web site; however they will be restricted in the kinds of operations they can do, and some aspects of XUL will not work." But given that "Remote XUL is DEAD", I need a way to kickoff my local XUL app without executing XUL in the browser.
If not, is there a firefox extension that could run this XUL app?
To elaborate on my initial comment, turn your app into an extension (although most of the steps should be familiar to you already) and then secure your updates.

Resources