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/js/jquery.contextmenu.js src/hg/js/jquery.contextmenu.js index 3200071..5b1910e 100644 --- src/hg/js/jquery.contextmenu.js +++ src/hg/js/jquery.contextmenu.js @@ -1,276 +1,276 @@ /** * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) * * Dual licensed under the MIT and GPL licenses. * This basically means you can use this code however you want for * free, but don't claim to have written it yourself! * Donations always accepted: http://www.JavascriptToolbox.com/donate/ * * Please do not link to the .js files on javascripttoolbox.com from * your site. Copy the files locally to your server instead. * */ /** * jquery.contextmenu.js * jQuery Plugin for Context Menus * http://www.JavascriptToolbox.com/lib/contextmenu/ * * Copyright (c) 2008 Matt Kruse (javascripttoolbox.com) * Dual licensed under the MIT and GPL licenses. * * @version 1.1 * @history 1.1 2010-01-25 Fixed a problem with 1.4 which caused undesired show/hide animations * @history 1.0 2008-10-20 Initial Release * @todo slideUp doesn't work in IE - because of iframe? * @todo Hide all other menus when contextmenu is shown? * @todo More themes * @todo Nested context menus */ ;(function($){ $.contextMenu = { shadow:true, shadowOffset:0, shadowOffsetX:5, shadowOffsetY:5, shadowWidthAdjust:-3, shadowHeightAdjust:-3, shadowOpacity:.2, shadowClass:'context-menu-shadow', shadowColor:'black', offsetX:0, offsetY:0, appendTo:'body', direction:'down', constrainToScreen:true, showTransition:'show', hideTransition:'hide', showSpeed:null, hideSpeed:null, showCallback:null, hideCallback:null, className:'context-menu', itemClassName:'context-menu-item', itemHoverClassName:'context-menu-item-hover', disabledItemClassName:'context-menu-item-disabled', disabledItemHoverClassName:'context-menu-item-disabled-hover', separatorClassName:'context-menu-separator', innerDivClassName:'context-menu-item-inner', themePrefix:'context-menu-theme-', theme:'default', separator:'context-menu-separator', // A specific key to identify a separator target:null, // The target of the context click, to be populated when triggered menu:null, // The jQuery object containing the HTML object that is the menu itself shadowObj:null, // Shadow object bgiframe:null, // The iframe object for IE6 shown:false, // Currently being shown? useIframe:/*@cc_on @*//*@if (@_win32) true, @else @*/false,/*@end @*/ // This is a better check than looking at userAgent! // Create the menu instance create: function(menu,opts) { var cmenu = $.extend({},this,opts); // Clone all default properties to created object // If a selector has been passed in, then use that as the menu if (typeof menu=="string") { cmenu.menu = $(menu); } // If a function has been passed in, call it each time the menu is shown to create the menu else if (typeof menu=="function") { cmenu.menuFunction = menu; } // Otherwise parse the Array passed in else { cmenu.menu = cmenu.createMenu(menu,cmenu); } if (cmenu.menu) { cmenu.menu.css({display:'none'}); $(cmenu.appendTo).append(cmenu.menu); } // Create the shadow object if shadow is enabled if (cmenu.shadow) { cmenu.createShadow(cmenu); // Extracted to method for extensibility if (cmenu.shadowOffset) { cmenu.shadowOffsetX = cmenu.shadowOffsetY = cmenu.shadowOffset; } } $('body').bind('contextmenu',function(){cmenu.hide();}); // If right-clicked somewhere else in the document, hide this menu return cmenu; }, // Create an iframe object to go behind the menu createIframe: function() { - return $(''); + return $(''); }, // Accept an Array representing a menu structure and turn it into HTML createMenu: function(menu,cmenu) { var className = cmenu.className; $.each(cmenu.theme.split(","),function(i,n){className+=' '+cmenu.themePrefix+n}); var $t = $('