|Phony type functionality for B2G||Lawrence Mandel||11/6/12 2:11 PM|
To support the mobile Web compatibility effort, I would like to add functionality to B2G that allows switching/spoofing the UA. Something like Phony (https://addons.mozilla.org/en-US/mobile/addon/phony/) would work well. AFAIK, the B2G browser does not support add-ons. Is there a way for an app to change the B2G UA? Does anyone have any other ideas for how to easily add this type of functionality to B2G?
|Re: Phony type functionality for B2G||Donovan Preston||11/6/12 3:15 PM|
You can spoof it right now with a hacky preference. Add the following
to a file custom-prefs.js inside the gaia dir and reflash gaia.
user_pref("general.useragent.override", "[Spoofed UA]");
> dev-b2g mailing list
|Re: Phony type functionality for B2G||Gervase Markham||11/7/12 3:21 AM|
On 06/11/12 23:15, Donovan Preston wrote:But B2G doesn't have anything like about:config yet, does it? Are there
any plans to implement something like that?
Having to reflash the entire phone just to test with an alternative User
Agent is not practical.
|Re: Phony type functionality for B2G||Lawrence Mandel||11/7/12 7:18 AM|
> You can spoof it right now with a hacky preference. Add the followingThanks for the details. I'm actually looking for a way to do this at runtime. In this context, the test method is:
1. Load site in Firefox and test.
2. Spoof UA to Android phone UA and retest.
Can I change that pref via an app at runtime?
|Re: Phony type functionality for B2G||Jason Smith||11/7/12 7:23 AM|
I know you can change the pref by modifying the profile via adb.
Desktop QA Engineer
> compatibility mailing list
|Re: Phony type functionality for B2G||Fabrice Desre||11/7/12 8:39 AM|
On 11/07/2012 03:21 AM, Gervase Markham wrote:There's no about:config and no plans to add a generic one.
Fair enough. We could add a setting for that but I fear that people
would abuse the feature and never switch back to the default UA.
|Re: Phony type functionality for B2G||Lucas Adamski||11/7/12 9:31 AM|
I've been using this simple script for messing with CSP policies:
adb pull /system/b2g/defaults/pref/user.js
adb shell mount -o rw,remount /system
adb push user.js /system/b2g/defaults/pref/user.js
adb shell mount -o ro,remount /system
adb logcat > temp.log &
tail -f temp.log
The reboot is probably not optimal but better safe than sorry.
|Re: Phony type functionality for B2G||Fabrice Desre||11/7/12 9:39 AM|
On 11/07/2012 09:31 AM, Lucas Adamski wrote:You can use |adb shell stop b2g && adb shell start b2g| instead of
rebooting to just restart gecko.
|Re: Phony type functionality for B2G||Gervase Markham||11/8/12 2:42 AM|
On 07/11/12 16:39, Fabrice Desre wrote:Wow, that sucks. :-| Is this an explicit policy decision or simply due
to time constraints? There are a massive load of things which can be
configured via prefs which are useful for testing.
Hackability is one of Mozilla's core software strengths.
If we are going to add a setting, I would rather see the time spent
adding a mechanism to add settings for any named pref. Or at least
providing a mechanism to write a trusted app that could do it.
|Re: Phony type functionality for B2G||Lawrence Mandel||11/8/12 7:36 AM|
This sounds more reasonable but still a slow path for testing. Any other ideas on how we can modify the UA at runtime?
Do apps have the ability to set system prefs?
Can I dynamically add an entry to the domain whitelist at runtime?
|Re: Phony type functionality for B2G||Jonas Sicking||11/9/12 12:50 AM|
On Thu, Nov 8, 2012 at 2:42 AM, Gervase Markham <ge...@mozilla.org> wrote:This is due to time constraints. It's much harder to implement in B2Gs
security model since we essentially don't have any chrome JS code
running other than what's part of gecko. In fact, we don't have any
chrome code which displays UI at all.
I agree. Though it's a bit trickier also since we want to make it hard
to brick your device. With desktop Firefox you can at worst case blow
away your profile. But if your phone isn't starting most people would
be in trouble.
But I agree this is something that we should try to figure out.
|Re: Phony type functionality for B2G||Gervase Markham||11/9/12 5:01 AM|
On 09/11/12 08:50, Jonas Sicking wrote:But the settings app allows the changing of things which are prefs
Can't it just grow an extra facility where you input both the pref to
change and the value, instead of just a value? Even that would be a lot
better than having to reflash or reboot.
For bonus points, you could then "save" a pref name with a title, so
there was a screen of prefs that you'd said you wanted UI for - and it
would provide UI according to pref type.
For extra bonus points, remember previously-entered values for Text and
Number prefs and allow choosing between them.
But neither of the bonuses is essential.
It is impossible to brick an Android device (to a similar degree) via
the UI, even using advanced settings and toggles?
|Re: Phony type functionality for B2G||Robert Kaiser||11/9/12 5:31 AM|
Gervase Markham schrieb:
> On 07/11/12 16:39, Fabrice Desre wrote:There's no about: pages that run in chrome mode at all (which most do),
i.e. no about:config, about:crashes, about:memory, etc. - we cannot run
chrome-privileged pages inside content-privileged apps due to security
reasons. This bites us in multiple case and we can't do a lot about it
(actually, there's work ongoing to re-implement "something like
about:crashes" with various tricks to not require chrome access, but I
consider this quite hackish).
I'm also not sure how we'd ever be able to "fix" that problem, but not
having those pages really cuts into our debugging, testing, and hacking
abilities on Firefox OS, that's right.
|Re: Phony type functionality for B2G||Gervase Markham||11/12/12 8:34 AM|
On 09/11/12 13:31, Robert Kaiser wrote:Can we solve it by creating a separate, trusted app which displays the
data which would be displayed on those pages? Or would there be a
problem with it getting access to it because it's not part of the same app?
|Re: Phony type functionality for B2G||Jonas Sicking||11/13/12 3:46 AM|
On Fri, Nov 9, 2012 at 5:01 AM, Gervase Markham <ge...@mozilla.org> wrote:Just because the settings app can take some actions which end up
causing some preferences to change, doesn't mean that it can control
It would indeed be possible to add an API exposed to the settings app
which allowed it to modify arbitrary Gecko preferences. What I was
referring to was running about:config or other chrome-privileged
However, see below.
As far as I know yes.
|Re: Phony type functionality for B2G||Jonas Sicking||11/13/12 3:51 AM|
It's software. Anything is possible. However it would take
re-implementing all of the about: pages using the B2G security model
rather than using chrome-privileged code.
I don't think adding the ability to set preferences has the right time
vs. added hackability vs. bricking-risk ratios.
|Re: Phony type functionality for B2G||Gervase Markham||11/14/12 4:07 AM|
On 13/11/12 11:46, Jonas Sicking wrote:OK. Could we add such an API, and then have a (regexp-based, perhaps)
whitelist of preferences the app would pass through to be set, or
blacklist of stuff that couldn't be changed?
I'm trying to figure out how we can restore some hackability without
opening the possibility of bricking. Perhaps it's not possible. But
then, if I wanted to destroy my phone, I could drop it in a river. And
if a web page said "to clean your phone, drop it in a river and wait 5
minutes", I'd still be a fool for doing so. How is that different from a
page which says "set the pref which gives the URL to the home screen app
to be http://nonexistent.com"?
|Re: Phony type functionality for B2G||Gavin Sharp||11/14/12 11:30 AM|
On Wed, Nov 14, 2012 at 4:07 AM, Gervase Markham <ge...@mozilla.org> wrote:The implications of the former are much more obvious to a non-technical user.
|Re: Phony type functionality for B2G||Jonas Sicking||11/15/12 7:28 PM|
On Nov 14, 2012 4:07 AM, "Gervase Markham" <ge...@mozilla.org> wrote:I'd say we're already within the realm of things that we don't have time to
do for v1. Especially once you add UI and QA for these features to the
Hackability is to me quite different from being able to set prefs.
Ability to install custom high privileged apps is IMO much more important
and we already have that.
|Re: Phony type functionality for B2G||Gervase Markham||11/16/12 3:51 AM|
On 16/11/12 03:28, Jonas Sicking wrote:Fair enough. Then let's not get distracted from the purpose of this
thread, which is adding Phony-like functionality. That would be a
massive help to the teams tasked with trying to make the mobile web
|Re: Phony type functionality for B2G||Lawrence Mandel||12/7/12 1:38 PM|
> On 11/07/2012 09:31 AM, Lucas Adamski wrote:Based on these instructions, I have created a script that allows you to easy change the UA from the command line. The script prereqs adb on your path.
Use the script as follows
The third command (no option) reverts B2G to the default UA.