[tor-bugs] #13198 [Tor Browser]: clean up torbutton use of Mozilla services

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 30 00:20:14 UTC 2014


#13198: clean up torbutton use of Mozilla services
---------------------------------+------------------------------
     Reporter:  arthuredelstein  |      Owner:  tbb-team
         Type:  defect           |     Status:  needs_review
     Priority:  normal           |  Milestone:
    Component:  Tor Browser      |    Version:
   Resolution:                   |   Keywords:  MikePerry201409R
Actual Points:                   |  Parent ID:
       Points:                   |
---------------------------------+------------------------------
Changes (by mikeperry):

 * cc: mcs, brade, gk (added)


Comment:

 Hrmm. I'm a little worried about the scoping here for the changes in
 src/chrome/content/torbutton.js. This block at the top in particular:
 {{{
 let { getBoolPref, setBoolPref, getCharPref, setCharPref,
       getIntPref, setIntPref, clearUserPref, prefHasUserValue
       addObserver : addPrefObserver , removeObserver : removePrefObserver
 } = Services.prefs;
 }}}

 I know 'let' uses block scoping, but in this case, we're at the top level
 of the torbutton.js file and not technically in a block. This is the
 browser XUL tag's 'window' scope, and is shared with all other browser
 scripts and extension bindings. Does 'let' also make this scope local to
 torbutton.js, considering torbutton.js to be a block (even though it's not
 explicitly one)? Because if it ends up in 'window' scope, then we're
 risking collisions with other addons variable names in 'window'.

 It also looks like there is a comma missing after prefHasUserValue.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13198#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list