a53b9958fa734f73aeffb9ddfe2fbad1ca65f90c
galt
  Mon Jan 30 16:18:41 2017 -0800
Check-in of CSP2 Content-Security-Policy work. All C-language CGIs should now support CSP2 in browser to stop major forms of XSS javascript injection. Javascript on pages is gathered together, and then emitted in a single script block at the end with a nonce that tells the browser, this is js that we generated instead of being injected by a hacker. Both inline script from script blocks and inline js event handlers had to be pulled out and separated. You will not see js sprinkled through-out the page now. Older browsers that support CSP1 or that do not understand CSP at all will still work, just without protection. External js libraries loaded at runtime need to be added to the CSP policy header in src/lib/htmshell.c.

diff --git src/hg/inc/hui.h src/hg/inc/hui.h
index f39c6f4..a3867fa 100644
--- src/hg/inc/hui.h
+++ src/hg/inc/hui.h
@@ -192,49 +192,49 @@
 enum trackVisibility hTvFromString(char *s);
 /* Given a string representation of track visibility, return as
  * equivalent enum. */
 
 enum trackVisibility hTvFromStringNoAbort(char *s);
 /* Given a string representation of track visibility, return as
  * equivalent enum. */
 
 char *hStringFromTv(enum trackVisibility vis);
 /* Given enum representation convert to string. */
 
 /* Standard width for visibility dropdowns */
 #define TV_DROPDOWN_STYLE "width: 70px"
 
 void hTvDropDownClassVisOnlyAndExtra(char *varName, enum trackVisibility vis,
-                                     boolean canPack, char *class, char *visOnly, char *extra);
+                                     boolean canPack, char *class, char *visOnly, struct slPair *events);
 /* Make track visibility drop down for varName with style class,
 	and potentially limited to visOnly */
 #define hTvDropDownClassVisOnly(varName,vis,canPack,class,visOnly) \
         hTvDropDownClassVisOnlyAndExtra(varName,vis,canPack,class,visOnly,NULL)
 
 void hTvDropDownClassWithJavascript(char *varName, enum trackVisibility vis, boolean canPack,
-                                    char *class,char *javascript);
+                                    char *class, struct slPair *events);
 /* Make track visibility drop down for varName with style class and javascript */
 #define hTvDropDownClass(varName,vis,canPack,class) \
-        hTvDropDownClassWithJavascript((varName),(vis),(canPack),(class),"")
+        hTvDropDownClassWithJavascript((varName),(vis),(canPack),(class),NULL)
 #define hTvDropDownWithJavascript(varName,vis,canPack,javascript) \
         hTvDropDownClassWithJavascript((varName),(vis),(canPack),"normalText",(javascript))
 #define hTvDropDown(varName,vis,canPack) \
-        hTvDropDownClassWithJavascript((varName),(vis),(canPack),"normalText","")
+        hTvDropDownClassWithJavascript((varName),(vis),(canPack),"normalText",NULL)
 
 #define SUPERTRACK_DEFAULT_VIS  "hide"
 
-void hideShowDropDownWithClassAndExtra(char *varName, boolean show, char *class, char *extra);
+void hideShowDropDownWithClassAndExtra(char *varName, boolean show, char *class, struct slPair *events);
 #define hideShowDropDown(varName,show,class) \
         hideShowDropDownWithClassAndExtra(varName,show,class,NULL)
 /* Make hide/show dropdown for varName */
 
 /****** Some stuff for stsMap related controls *******/
 enum stsMapOptEnum {
    smoeGenetic = 0,
    smoeGenethon = 1,
    smoeMarshfield = 2,
    smoeDecode = 3,
    smoeGm99 = 4,
    smoeWiYac = 5,
    smoeWiRh = 6,
    smoeTng = 7,
 };
@@ -949,31 +949,31 @@
 /* If the parentTdb has an ENCODE controlledVocabulary setting and the vocabType is found,
    then label will be wrapped with the link to display it.  Return string is cloned. */
 
 char *wgEncodeVocabLink(char *file,char *term,char *value,char *title, char *label,char *suffix);
 // returns allocated string of HTML link to ENCODE controlled vocabulary term
 
 char *metadataAsHtmlTable(char *db,struct trackDb *tdb,boolean
         showLongLabel,boolean showShortLabel);
 /* If metadata from metaDb exists, return string of html with table definition */
 
 boolean compositeMetadataToggle(char *db,struct trackDb *tdb,char *title,
         boolean embeddedInText,boolean showLongLabel);
 /* If metadata from metaTbl exists, create a link that will allow toggling it's display */
 
 boolean superTrackDropDownWithExtra(struct cart *cart, struct trackDb *tdb,
-                                    int visibleChild,char *extra);
+                                    int visibleChild, struct slPair *events);
 /* Displays hide/show dropdown for supertrack.
  * Set visibleChild to indicate whether 'show' should be grayed
  * out to indicate that no supertrack members are visible:
  *    0 to gray out (no visible children)
  *    1 don't gray out (there are visible children)
  *   -1 don't know (this function should determine)
  * If -1,i the subtracks field must be populated with the child trackDbs.
  * Returns false if not a supertrack */
 #define superTrackDropDown(cart,tdb,visibleChild) \
         superTrackDropDownWithExtra(cart,tdb,visibleChild,NULL)
 
 boolean dimensionsExist(struct trackDb *parentTdb);
 /* Does this parent track contain dimensions? */
 
 int subgroupCount(struct trackDb *parentTdb);