Open browser in private=incognito mode from Thunderbird extension - thunderbird

I would like to open a URL in private mode from a Thunderbird extension. Right now, the following code works in "standard" non-private mode:
try {
var eps = Components.classes["#mozilla.org/uriloader/external-protocol-service;1"].
getService(Components.interfaces.nsIExternalProtocolService);
var ios = Components.classes["#mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
eps.loadURI(ios.newURI("http://www.example.com", null, null));
} catch (err) {}
Any idea how to achieve the same result in private mode? I'm interested to make it work with launching Chrome as the default browser. (Once again, Chrome is correctly launched with the code above).

You cannot really launch Firefox with a new url in a private window AFAIK. -private-window <url> will open a new private window, but still put the new tab in a regular one.
Chrome can be launched with chrome --incognito <url>, however you would need to launch it yourself via nsIProcess and therefore would first have to figure out where the chrome binary is.
If you can guarantee that the default handler is Chrome, then you might use nsIExternalProtocolService.getProtocolHandlerInfo(), use preferredApplicationHandler and QueryInterface that to nsILocalHandlerApp to find the .executable. Otherwise, you'll have to deal with the OS and/or known paths yourself.

Related

How to launch a VSCode extension with a new file?

I'm developing a VSCode extension and since it should currently only run on JS files, when I run the Launch Extension task I want it to open with a new Javascript file. I've seen this related question and have tried adding, just passing an options object as per the docs
vscode.workspace.openTextDocument({language: 'javascript'})
This is an async call so I've tried awaiting it while my extension is activating to ensure the file exists before I am able to use my extension.
If I could add this functionality to the Launch Extension task that'd be great or even if I could just have it open a file when I run my command that'll do while I'm developing on it.
Any ideas on how I can do this?
I'm not 100% sure but I believe your extension is activated only once and stays like that until vscode shuts down. Hence you cannot trigger multiple activation calls. Instead you could listen to document opening
workspace.onDidOpenTextDocument((doc: TextDocument) => {
if (doc.languageId == "JS" && doc.uri.scheme === "file") {
...
}
});

Unable to check private browsing for Android

We are developing an addon for Android mobile, using SDK1.17, where we need to check for private-browsing, but we are unable to do this.
As of now we have gone through too many documentation pages to check for private window state/detection but none of the solution is working in case of Android Firefox.
Below are some implementation that we tried
1. require('sdk/private-browsing/utils').ignoreWindow(window) : It always returning false when opted for private browsing and nothing was return in case of Private Window mode when NOT opted for private browsing
2. require("sdk/private-browsing").isPrivate(tab) : It always returning false when opted for private browsing
3. Also checked other solutions on other forums
Device Details on which we are checking:
1. Samsung - S4
2. Android 4.4.2
3. Firefox Nightly Build 39.0a1
Could you please suggest any solution for below expectations?
1. We want to detach content script for private window in onAttach event of page-mod
2. Want to identify if request/response is from/to private window (while intercepting request/response using observer)

perl - Launch url in browser opening in non-default browser

I try to launch my default browser and open to a specified URL as suggested here using something like:
use Browser::Open qw( open_browser );
my $url = 'http://www.google.com/';
open_browser($url);
But it opens it in Firefox even though Chromium is set to my default browser:
How do I get it to open in Chromium?
Perl has no concept of default browser. As you can see in its documentation, Browser::Open will go down the list of known browser invocation commands and use the first one that works. Firefox apparently happens to be higher on the list than Chromium.
If you want to invoke Chromium, then just invoke Chromium yourself. Something like this should do:
system("chromium \"$url\"")
(you might have to change the name of the executable, depending on your system and PATH)

Soundcloud record flash plugin don't work with current version of chrome under macOS

this record plugin stops to work for us with current version of chrome under macOS
Chrome: Version 23.0.1271.97
MacOS: 10.8.2
http://connect.soundcloud.com/examples/recording.html
how to reproduce:
click record
allow using your microphone
-> recording don't start
(In fact sometimes it works (20% of cases for me))
and also sometimes there is an error in console
PepperFlashPlayer.plugin: 0x2A052 is not valid resource ID.
Please help us, we use it for production and a lot of users can not record sound
regards, Dmitry
My investigation show:
sometimes the "SampleDataEvent.SAMPLE_DATA" event not triggered (or not assigned) in flash.
To solve this issue I do:
Added to event handler "StatusEvent.STATUS" (or call manually if microphone unmuted):
tti = setInterval(applySampleData, 100);
Added function:
protected function applySampleData() : void {
microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, recordSampleDataHandler);
}
And in function "recordSampleDataHandler" (it's SampleDataEvent.SAMPLE_DATA listener):
if(tti) { clearInterval(tti); tti = 0; }
Try this.

GWT Frame not working in Mozilla Firefox or in Google chrome, but working fine in IE

I am trying to download a file from server. The normal GWT RPC call doesnot allow me to do that, and hence I wrote a servlet to do that job for me. From the client side, I am creating a Frame object, and I set the servlet URL in it, and add that frame Object in my root panel.
When I execute this in IE, a window pops up asking for Save/Open file.
But when I execute the same in a Firefox or a Google Chrome browser, nothing is happing.
I am not getting any request on my servlet/server side.
Here is a slice of the code :-
String servletUrl = "http://localhost:13080/Browser/ui/dataExportServlet?level=ZERO";
Frame frame = new Frame(servletUrl);
frame.setVisible(false);
RootPanel.get().add(frame);
So, can someone please help me out.
This might be related to same origin policy.
Are both servlet and webapp running on port 13080?
If they differ, SOP might fail this.
If I understand correctly, IE has a more relaxed policy so it might work there but not in chrome.
See http://en.wikipedia.org/wiki/Same_origin_policy and Can I disable SOP (Same Origin Policy) on any browser for development?
In Chrome, you can use the Developer Tools (CTRL + SHIFT + I) to check if the IFrame is being added to the HTML, and if the frame's source is being set properly. You should also be able to see what content has been loaded into the iframe.
Alternately, set a breakpoint in your servlet to see if the iframe is being hit at all from Chrome.
I got the solution for this issue.
I removed the frames and added the following code :-
com.google.gwt.user.client.Window.open(url, "CSVDownload", "");
Now, this opens a new browser window, and then I get the pop-up to open/save the server side file in all 3 web-browsers. (IE, Mozilla FireFox, Chrome).
Thanks a lot!!!