Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/jenkins
  Commit: 52274032e389ad1c673ce9bcd763afe43cf3a4a7
      
https://github.com/jenkinsci/jenkins/commit/52274032e389ad1c673ce9bcd763afe43cf3a4a7
  Author: Jesse Glick <[email protected]>
  Date:   2012-10-26 (Fri, 26 Oct 2012)

  Changed paths:
    M war/src/main/webapp/scripts/behavior.js

  Log Message:
  -----------
  addLoadEvent failed to pass on the Event object.
Does not matter for any handlers used in Jenkins, but can break third-party 
frameworks.
In particular mixpanel-2.1.min.js seems to detect when this mistake is made and 
somehow disables some Jenkins handlers,
causing e.g. “LOADING” to stay on job config pages and breaking behavior.js 
(but only on Firefox).

Using addEventListener/attachEvent where available also works, but this fix is 
a bit simpler and more general.
https://gist.github.com/1930440 would also work but again seems like overkill 
here.

To reproduce:
diff --git a/core/src/main/resources/lib/layout/layout.jelly 
b/core/src/main/resources/lib/layout/layout.jelly
index 1fb3fec..c1337c4 100644
--- a/core/src/main/resources/lib/layout/layout.jelly
+++ b/core/src/main/resources/lib/layout/layout.jelly
@@ -88,6 +88,19 @@ ${h.initPageVariables(context)}
 <x:doctype name="html" />
 <html>
   <head>
+<script type="text/javascript"><![CDATA[
+(function(c,a){window.mixpanel=a;var b,d,h,e;b=c.createElement("script");
+    
b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+
+    
'//cdn.mxpnl.com/libs/mixpanel-2.1.min.js';d=c.getElementsByTagName("script")[0];
+    d.parentNode.insertBefore(b,d);a._i=[];a.init=function(b,c,f){function 
d(a,b){
+    var 
c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat(
+    Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof 
f?g=a[f]=[]:
+    
f="mixpanel";g.people=g.people||[];h=['disable','track','track_pageview','track_links',
+    
'track_forms','register','register_once','unregister','identify','name_tag',
+    
'set_config','people.identify','people.set','people.increment'];for(e=0;e<h.length;e++)d(g,h[e]);
+    a._i.push([b,c,f])};a.__SV=1.1;})(document,window.mixpanel||[]);
+    mixpanel.init("…something valid here…");
+]]></script>
     ${h.checkPermission(it,permission)}

     <title>${h.appendIfNotNull(title, ' [Jenkins]', 'Jenkins')}</title>


  Commit: 49646bfb701cb7e2c4a9b062b50d3e8157a052b0
      
https://github.com/jenkinsci/jenkins/commit/49646bfb701cb7e2c4a9b062b50d3e8157a052b0
  Author: Jesse Glick <[email protected]>
  Date:   2012-10-26 (Fri, 26 Oct 2012)

  Changed paths:
    M changelog.html
    M core/pom.xml

  Log Message:
  -----------
  Merge branch 'master' of github.com:jenkinsci/jenkins


Compare: 
https://github.com/jenkinsci/jenkins/compare/d56ba241ea42...49646bfb701c

Reply via email to