1var Generix = Generix || {}; 2 3Generix.viewScopedCleaner = (function(window, document) { 4 var VIEW_STATE_PARAM = "javax.faces.ViewState"; 5 6 var self = {}; 7 8 self.execute = function() { 9 if (!window.XMLHttpRequest) { 10 return; // Native XHR not supported (IE6/7 not supported). End of story. Let session expiration do its job. 11 } 12 var facesForm = getFacesForm(); 13 if (facesForm != null) { 14 submitForm(window.location.href, 15 facesForm[VIEW_STATE_PARAM].value); 16 } 17 } 18 19 function getFacesForm() { 20 for (var i = 0; i < document.forms.length; i++) { 21 if (document.forms[i][VIEW_STATE_PARAM].value != "") { 22 return document.forms[i]; 23 } 24 } 25 26 return null; 27 } 28 29 function submitForm(action, viewStateParamValue) { 30 31 // Synchronious XMLHttpRequest are not allowed anymore by chrome or mozzila so we could use a fetch call which is async 32 // but it is ensured to finish even if the page no longer exists 33 var url = action + "&viewScopedCleaner=true&javax.faces.partial.ajax=true&" + VIEW_STATE_PARAM + "=" + encodeURIComponent(viewStateParamValue); 34 35 var params = { 36 method: 'POST', 37 keepalive: true 38 }; 39 fetch(url,params); 40 41 } 42 43 return self; 44 45})(window, document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.