-
-
Save maks/5544588 to your computer and use it in GitHub Desktop.
Open fennec with url via Intent:
private void goFF(String url) {
String FFurl = ((url!= null) && !url.equalsIgnoreCase("")) ? url : "http://manichord.com/";
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setComponent(new ComponentName("org.mozilla.firefox_beta", "org.mozilla.firefox_beta.App"));
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse(FFurl));
startActivity(intent);
}
- Instructions on getting source, setting up build env, build steps etc
- Useful architecture info about Firefox on Android
Firefox is stored in Hg (mercurial). So some useful Hg commands:
hg pull && hg update #to get the latest code
hg status # same as git
hg diff # same as git
hg revert --all ## DISCARD all changes since last commit
Firefoxes android app manifest is in mobile/android/base/AndroidManifest.xml.in
The important part of the manifest is that it points to the App class to be launched for all its intents, which is just a place-holder subclass of BrowserApp which is where all the functionality is implemented.
But there is also WebApp which again just subclasses WebAppImpl which implements the features needed for Firefoxes new packaged installable apps from the Firefox Marketplace.
There are also a bunch of extra activities (eg. awesomebar, settings) and services (eg. password provider, notification provider, etc) that we probably need to strip-out down the track.
- So we implement our own subclass on GeckoApp (OpensignApp.java)
- We add it to AndroidManifest.xml attached to the intent Action
au.com.sct.opensign.FFWEBVIEW
the url should be the Intents data attribute.
- MDN Firefox on Android landing page
- Getting started with building extensions
- [Content html talking to extension code] (https://developer.mozilla.org/en-US/docs/Code_snippets/Interaction_between_privileged_and_non-privileged_pages#Resources)
- [Q & A for 2 way comms] (http://stackoverflow.com/questions/13350595/how-to-organize-a-two-way-communication-with-the-firefox-extension-code-injectio)
- MDN docs on 2 ways comms between ext and content
- Filesystem access in extension
- Intercepting HTTP requests/reponses Q&A
- FF extensions built from greasemonkey scripts
- Intercepting Page Load
- Intercepting http responses with addon SDK Q&A
The add-ons SDK is (hopefully) a newer and nicer more high-level way to develop firefox extensions.
NOTE: make sure you are using the latest stable SDK to match the latest version of Firefox for Android otherwise you may get errors trying to run your add-on xpi using cfx tool or the generated xpi may have strange errors with globals not being defined in content script scope, etc.
This is documented here
Need to be able to authenticate with a http proxy using basic auth without showing any UI to the user, the proxy-hostname/username/password all need to come from settings via opensign agent.
The code for handling 407s (Proxy Authentication) is in netwerk/protocol/http/nsHttpChannel.cpp with the Authentication bit being the interface in: netwerk/protocol/http/nsIHttpChannelAuthProvider.idl and implementation in: netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
But for our purposes, we want to have a non-interactive AuthProvider implementation...
SetProxyCredentials() in line 1312 of nsHttpChannelAuthProvider.cpp seems to be what actually puts the auth header fields into the request.
mobile prefs in: mobile/android/app/mobile.js
something like this might work via using prefs:
static const char kAllowProxies[] = "network.automatic-ntlm-auth.allow-proxies";
...
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return;
if (isProxyAuth) {
bool val;
if (NS_FAILED(prefs->GetBoolPref(kAllowProxies, &val)))
val = false;
LOG(("Default credentials allowed for proxy: %d\n", val));
return val;
}
Now how does Java code set Firefox prefs?
Once we actually have something working in FF this should be a simple way to test it: http://stackoverflow.com/questions/724599/setting-up-an-apache-proxy-with-authentication