You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Ernesto Reinaldo Barreiro (JIRA)" <ji...@apache.org> on 2013/02/21 15:44:13 UTC

[jira] [Commented] (WICKET-5039) Manual invocation of FunctionsExecutor#notify() is broken

    [ https://issues.apache.org/jira/browse/WICKET-5039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13583234#comment-13583234 ] 

Ernesto Reinaldo Barreiro commented on WICKET-5039:
---------------------------------------------------

Martin,

Thanks for fixing this! Just one comment. Would it make sense to put some more info on JavaScript so that future developers know why this is needed? Something like  


				// test if the javascript is in form of identifier|code
				// if it is, we allow for letting the javascript decide when the rest of processing will continue
				// by invoking identifier();
				// This is used for the cases when control of AJAX processing want to be transferred to user's code. 
				// E.g. Users want to execute an effect and after that effect finishes continue with AJAX processing.
				// see WICKET-5039 for more explanations.


So,  future developers will not have to loose time wondering why this "cryptic" feature is needed. 

Cheers,

Ernesto
                
> Manual invocation of FunctionsExecutor#notify() is broken
> ---------------------------------------------------------
>
>                 Key: WICKET-5039
>                 URL: https://issues.apache.org/jira/browse/WICKET-5039
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.4.0
>         Environment: any
>            Reporter: Ernesto Reinaldo Barreiro
>            Assignee: Martin Grigorov
>            Priority: Trivial
>             Fix For: 6.7.0
>
>         Attachments: WICKET-5039.patch, wicket5039.tar.gz
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> We are having problems on Wicket 1.4.x with and "AJAX function" processEvaluation... and I see the code is practically the same at 6.x. So, let's bring the subject to the list... 
> Our problem is that after evaluating some expressions with errors, screen "freezes" because post-call handlers are not called. Problem seems to be related to the code. 
>                                 // test if the javascript is in form of identifier|code
> 				// if it is, we allow for letting the javascript decide when the rest of processing will continue
> 				// by invoking identifier();
> 				var res = text.match(new RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));
> 				if (res !== null) {
> 					var f = jQuery.noop;
> 					text = "f = function(" + res[1] + ") {" + res[2] + "};";
> 					try {
> 						// do the evaluation
> 						eval(text);
> 						f(notify);
> 					} catch (exception) {
> 						Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: " + exception + ", text: " + text);
> 					}
> 				} 
>  In case of error. Shouldn't it be
>                                       try {
> 						// do the evaluation
> 						eval(text);
> 						f(notify);
> 					} catch (exception) {
> 						Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: " + exception + ", text: " + text);
>                                                 notify();
> 					}
> So that next steps in processing get called. The above solves or freezing problem in case of error

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira