[tor-bugs] #17568 [Tor Browser]: Clean up tor-control-port.js in Torbutton

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Nov 9 19:44:10 UTC 2015


#17568: Clean up tor-control-port.js in Torbutton
---------------------------+--------------------------
 Reporter:  gk             |          Owner:  tbb-team
     Type:  task           |         Status:  new
 Priority:  Medium         |      Milestone:
Component:  Tor Browser    |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:  tbb-torbutton  |  Actual Points:
Parent ID:                 |         Points:
  Sponsor:                 |
---------------------------+--------------------------

Comment (by arthuredelstein):

 Some useful comments, from
 https://trac.torproject.org/projects/tor/ticket/16990#comment:6

 > Why the non-greedy globbing (the "?" modifier added to "+" or "*") when
 you are matching all the rest of the line anyway?
 >
 > Compare:
 >
 > `520 -        let matchResult = string.match(/^250[ -].+?=(.*?)$/mi) ||`
 > `520 +        let matchResult = string.match(/^250[ -].+?=(.*)$/mi) ||`
 >
 > You do this in several other places in this file. Just wondering, I
 don't think it makes a difference.
 >
 > Also, based on the regex above, shouldn't the comment in line 515 be
 like so?
 >
 > {{{
 >   515 -       // or `250 circuit-status...`
 >   515 +       // or `250 circuit-status=...`
 > }}}
 >
 > To match the rest of the comment.
 >
 > Also, I do not know what the assumptions/pre-conditions are on the input
 string, but you do not check that the first line of the multiline case
 (`"^250\+"`) ends with "=", as exemplified in the commentary for
 "info.keyValueStringsFromMessage".
 >
 > Anyway, sorry for wasting your time, I'm not familiar with this code.

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


More information about the tor-bugs mailing list