[ 
https://issues.apache.org/jira/browse/MYFACES-2848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12893953#action_12893953
 ] 

Werner Punz commented on MYFACES-2848:
--------------------------------------

Hi... I already have suppression code in my scripts so that not an additional 
request is triggered there, check the file: _Dom.js and there the runScripts 
function:

    if ('undefined' != typeof src
                        && null != src
                        && src.length > 0
                        ) {
                    //we have to move this into an inner if because chrome 
otherwise chokes
                    //due to changing the and order instead of relying on left 
to right
                    if ((src.indexOf("ln=scripts") == -1 && 
src.indexOf("ln=javax.faces") == -1) || (src.indexOf("/jsf.js") == -1
                            && src.indexOf("/jsf-uncompressed.js") == -1))
                        if (finalScripts.length) {
                            //script source means we have to eval the existing
                            //scripts before running the include
                            
myfaces._impl.core._Runtime.globalEval(finalScripts.join("\n"));
                            finalScripts = [];
                        }
                    myfaces._impl.core._Runtime.loadScriptEval(src, 
item.getAttribute('type'), false, "UTF-8");
                } else {

The main problem is, that this only works if the browser does not do an auto 
eval, which firefox 3 does (as the only current browser there is)
firefox 4 fixes this issue by not doing auto eval anymore, but I agree, we need 
supression code on the server as well, the script should not be rendered at all 
because of the http get issued afterwards on fox.

So the fix probably is, that the part which issues the jsf.js should check if 
we are in a partial cycle and then should not render the script tag at all to 
jsf.js

On the browsers side it does not make any difference except for the additional 
get, because the scripts have double include protection, so even if they are 
evaled twice a once already loaded jsf.js cannot override another one.


> AJAX responses contain <script type="text/javascript" 
> src="/MyFaces_Test/javax.faces.resource/jsf.js.faces?ln=javax.faces">
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2848
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2848
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.1
>         Environment: AJAX Java
>            Reporter: Ganesh Jung
>         Attachments: Test.war
>
>
> The fact that an AJAX request was triggered clearly shows, that jsf.js is 
> already available to the browser. Including it again in the response triggers 
> another HTTP GET for jsf.js with time and traffic penalty.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to