Checking about:flags settings in Chrome using JavaScript

3,868 views
Skip to first unread message

Ragavendran Gopalakrishnan

unread,
Aug 29, 2011, 8:22:56 PM8/29/11
to Chromium-dev, tha...@chromium.org
Hello,

I'm trying to figure out a way to check about:flags settings in Chrome
browser using JavaScript. Is there a way to do this?
And is there a local file that these settings are written to? What
file is this, and where would it be located for a default install in
Ubuntu, for instance?

Thanks,
Raga.

Peter Kasting

unread,
Aug 29, 2011, 8:51:31 PM8/29/11
to ra...@google.com, Chromium-dev, tha...@chromium.org
On Mon, Aug 29, 2011 at 5:22 PM, Ragavendran Gopalakrishnan <ra...@google.com> wrote:
I'm trying to figure out a way to check about:flags settings in Chrome
browser using JavaScript. Is there a way to do this?

You mean, for a web page to ask for flag values?  No, these are local to the browser, except for where they control web features that are themselves visible to webpages.

PK

Ragavendran Gopalakrishnan

unread,
Aug 29, 2011, 9:08:16 PM8/29/11
to Peter Kasting, Chromium-dev, tha...@chromium.org
Yes, I want a webpage to be able to query the flag values. In particular, I want to query the Native Client flag value to find out if the Native Client flag is enabled or not. If it is not enabled, then I would advise the user to enable it instead of serving a webpage that uses Native Client which wouldn't work. (Note there is also a Native Client *plugin* in about:plugins, but its value can be easily queried, no problem.)

First, why is there no way to do it? It would be really useful, in the above case, for example. How would one add support for it?

Second, since the browser has to be restarted to see the effects of about:flags, there should be a file into which these settings are written to, right? I couldn't find this file in ~/.config/google-chrome/ Where is this file? Even if I find this file, can JavaScript access local files, at least as read-only? I read somewhere that this is prohibited by the sandbox, but is there a way around it?

Regards,
Raga.

Peter Kasting

unread,
Aug 29, 2011, 9:13:08 PM8/29/11
to Ragavendran Gopalakrishnan, Chromium-dev, tha...@chromium.org
On Mon, Aug 29, 2011 at 6:08 PM, Ragavendran Gopalakrishnan <ra...@google.com> wrote:
Yes, I want a webpage to be able to query the flag values. In particular, I want to query the Native Client flag value to find out if the Native Client flag is enabled or not.

I'm sure there is a way to detect NaCl without trying to read about:flags.

Where is this file? Even if I find this file, can JavaScript access local files, at least as read-only?

No.  Local file access can only be accomplished by other local files, and even then only in particular scenarios.

PK

Michael Mortensen

unread,
Aug 29, 2011, 11:10:41 PM8/29/11
to pkas...@google.com, Ragavendran Gopalakrishnan, Chromium-dev, tha...@chromium.org, imkr...@gmail.com
Ivan Krasin created a nifty web page that checks about:flags and about:plugins

It don't think it directly check about:flags by reading settings (or files) in pure JavaScript as you (Raga) were describing.

I think what it does is first see about:plugins in enabled in the way that checkVersions.js does.
Then, if the page can load a nexe that is pointed to by an embed tag, it infers the state of about:flags
by checking if the module was able to load AND if postMessage is defined on the loaded module...

-Mike


--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Ragavendran Gopalakrishnan

unread,
Aug 29, 2011, 11:59:30 PM8/29/11
to Michael Mortensen, pkas...@google.com, Chromium-dev, tha...@chromium.org, imkr...@gmail.com
Unfortunately that script tells me that I don't have NaCl enabled in about:plugins even when I have (this is on Chrome 13 stable on Mac) - this is very weird (even the script on nacl-gallery.appspot.com tells me that my plugin is not enabled). I'll test it tomorrow morning on my office machine running Chrome 14 dev on linux.

I was actually thinking along the same lines as this script - to try and load a simple nexe and conclude that NaCl isn't enabled if the load fails. Concluding that load has failed seems to be tricky. Maybe watch the sequence of events being fired off (look for loadstart, error, abort if it even gets that far), or look at readyState after a while (as Ivan does - checking if it is undefined)? (I'm not sure how exactly the plugin execution works when NaCl is not enabled - how far the module is allowed to load, etc.)

Is the logic in Ivan's script guaranteed to be correct - if the module-type and postMessage are both defined, then should NaCl have been enabled? I don't know enough of the internal details to be sure.

Perhaps more challenging is to find a way of concluding it without timeouts (since the client's machine may be arbitrarily slow).

Regards,
Raga.

Nico Weber

unread,
Aug 30, 2011, 12:08:04 AM8/30/11
to Ragavendran Gopalakrishnan, Michael Mortensen, pkas...@google.com, Chromium-dev, imkr...@gmail.com
I believe the NaCl API wasn't stable before chrome 14, i.e. NaCl is in
fact not really supported in chrome 13. So I think the script could be
correct.

Nico

Ragavendran Gopalakrishnan

unread,
Aug 30, 2011, 12:41:10 AM8/30/11
to Ivan Krasin, Michael Mortensen, pkas...@google.com, Chromium-dev, tha...@chromium.org
@Nico: The manner in which Ivan checks about:plugins (or check_browser.js on nacl-gallery) has nothing to do with NaCl. So I'm still very confused if something is broken on my Mac :-(

@Ivan: Here you go. The about:plugin result is false, obviously, because your test says the NaCl module loaded successfully (and I'm able to run my NaCl application without any failures as well)! This is soooo weird!!!

browser is Chrome: OK

Chrome version >= 14: FAIL
Native Client SDK 0.5 works with Chrome 14 and later. Your browser is 5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.215 Safari/535.1

about:plugins: FAIL
Please, go to about:plugins and enable Native Client plugin.

about:flags: OK

hello_world loaded:: OK



Regards,
Raga.



On Mon, Aug 29, 2011 at 10:23 PM, Ivan Krasin <imkr...@gmail.com> wrote:
On Mon, Aug 29, 2011 at 8:59 PM, Ragavendran Gopalakrishnan
<ra...@google.com> wrote:
> Unfortunately that script tells me that I don't have NaCl enabled in
> about:plugins even when I have (this is on Chrome 13 stable on Mac)
Ragavendran, could you please copy-paste the whole output from naclwtf?
I believe that the tools also checks for Chrome version.
Reply all
Reply to author
Forward
0 new messages