Writing Firefox's prefs.js with javascript

Discussion in 'Javascript' started by Csaba Gabor, Feb 24, 2006.

  1. Csaba Gabor

    Csaba Gabor Guest

    Firefox's configuration settings (Prefs.js) can be accomplished via the
    interface at about:config.

    Q1. Is there any such setting that can be repeatedly altered via
    javascript (in a vanilla security environment), without having to
    request preivileges? By altered, I mean having it remain in effect the
    next time Firefox is restarted.

    Q2. If the answer to Q1 is affirmative, is there any such setting that
    could have an event associated with it so that a page could trap for
    such event?

    Thanks,
    Csaba Gabor from Vienna
     
    Csaba Gabor, Feb 24, 2006
    #1
    1. Advertising

  2. Csaba Gabor

    Randy Webb Guest

    Csaba Gabor said the following on 2/24/2006 8:55 AM:
    > Firefox's configuration settings (Prefs.js) can be accomplished via the
    > interface at about:config.
    >
    > Q1. Is there any such setting that can be repeatedly altered via
    > javascript (in a vanilla security environment), without having to
    > request preivileges? By altered, I mean having it remain in effect the
    > next time Firefox is restarted.


    I surely hope not. I don't want script changing my preferences :)

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Feb 24, 2006
    #2
    1. Advertising

  3. Csaba Gabor wrote:
    > Firefox's configuration settings (Prefs.js) can be accomplished
    > via the interface at about:config.
    >
    > Q1. Is there any such setting that can be repeatedly altered
    > via javascript (in a vanilla security environment), without
    > having to request preivileges? By altered, I mean having it
    > remain in effect the next time Firefox is restarted.


    Wouldn't that completely undermine the whole purpose of user
    configuration, and blow a huge hole in the browser's security?

    > Q2. If the answer to Q1 is affirmative, is there any such
    > setting that could have an event associated with it so that
    > a page could trap for such event?


    In the event that the answer to Q1 was ever affirmative that significant
    bug could be expected to be fixed in very short order.

    Richard.
     
    Richard Cornford, Feb 24, 2006
    #3
  4. Csaba Gabor

    Csaba Gabor Guest

    Richard Cornford wrote:
    > Csaba Gabor wrote:
    > > Firefox's configuration settings (Prefs.js) can be accomplished
    > > via the interface at about:config.
    > >
    > > Q1. Is there any such setting that can be repeatedly altered
    > > via javascript (in a vanilla security environment), without
    > > having to request preivileges? By altered, I mean having it
    > > remain in effect the next time Firefox is restarted.

    >
    > Wouldn't that completely undermine the whole purpose of user
    > configuration, and blow a huge hole in the browser's security?


    Well, shoot, I just can't slip anything past you guys ;)

    I tend to agree with you, but I found something interesting after I
    installed GreaseMonkey. [For those not aware: GreaseMonkey is a
    Firefox extension that allows one to run custom javascript (on your
    local hard drive) whenever you encounter predesignated web pages. For
    example, one might remove ads from the page, whenever one visits
    yahoo.com].

    GreaseMonkey allows you to set values that survive across invocations
    of a given script (and are accessible only to that script). It does
    this by writing the prefs.js file! Of course this doesn't exactly
    match the conditions that I originally stated (vanilla security
    environment).

    The real motivation for my question is that I would like to be able to
    hook into an event (via a GM script) so I can run a function when the
    same GM script (even on a different page) has changed such a prefs.js
    value. Of course, I could always monitor the value via
    window.setInterval(...), but event driven would be much cleaner.

    Evidently there is such a mechanism, described at:
    http://kb.mozillazine.org/Dev_:_Using_preferences#Using_preferences_observers
    However (being totally new to XUL, XPCOM, and extensions), from my
    initial read and testing, the indicated script (note that last line
    references the wrong variable) needs to be in an extension (as opposed
    to just being in a <script> element on a page. I would love to be
    corrected on this, even if it means having to alter a security setting
    on Firefox.

    But regardless of whether this event driven prefs.js monitoring is
    possible from a GM script / <script> element, I would also like to get
    a recommendation for a tutorial or simplest example of being able to
    declare custom functions that will allow me to utilize the example's
    scripts. Sort of like a "Hello World" thing. There are nice tutorials
    at http://www.xulplanet.com/references/xpcomref/group_Preferences.html
    but these seem like a lot more than what I'm after right now.

    Csaba

    > > Q2. If the answer to Q1 is affirmative, is there any such
    > > setting that could have an event associated with it so that
    > > a page could trap for such event?

    >
    > In the event that the answer to Q1 was ever affirmative that significant
    > bug could be expected to be fixed in very short order.
    >
    > Richard.
     
    Csaba Gabor, Feb 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oliver Hirschi

    java.util.prefs.Preferences

    Oliver Hirschi, Jul 16, 2003, in forum: Java
    Replies:
    8
    Views:
    8,776
    Chris Riesbeck
    Jul 16, 2003
  2. kimbuba

    java.util.prefs

    kimbuba, Jul 16, 2003, in forum: Java
    Replies:
    10
    Views:
    3,133
    kimbuba
    Jul 20, 2003
  3. Veerle
    Replies:
    3
    Views:
    838
    Phil...
    Oct 24, 2003
  4. Me
    Replies:
    1
    Views:
    411
    Manish Pandit
    Sep 29, 2006
  5. Roedy Green
    Replies:
    10
    Views:
    2,062
    Mark Thornton
    Dec 30, 2007
Loading...

Share This Page