Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Problem Description
I have a page with a %COMMENT% macro. It works fine in Chrome, both on Linux and on Windows. When I try to add a comment in Firefox, upon hitting the "add comment" button, both on Linux (Firefox 30.0) and on Windows, Foswiki produces a validation code error. The log says:
| 2014-11-16T13:27:18Z warning | REST rejected: ERROR: (403) Invalid validation code | CommentPlugin/comment - https://DELETED_FOR_PRIVACY_/Diskussionen |
Foswiki version: v1.2.0_999, Release Foswiki-1.2.0_999 svn, Plugin API version 2.3, with Foswiki Pseudo-Installed directly from github.
Possibly a manifestation of problems hinted at in
Item10191 ?
--
PascalSchuppli - 16 Nov 2014
Any chance you are using a javascript blocker on firefox? The validation code is inserted through javascript.
--
GeorgeClark - 17 Nov 2014
Never mind. Confirmed on trunk.foswiki.org as well. Unable to comment on tasks here. Also tried Chromium, and it still fails for me.
--
GeorgeClark - 24 Nov 2014
Actually, Chromium works, as the original poster says, this is a firefox issue.
Running the Javascript debugger, I set a breakpoint in comment.js, in the following code:
StrikeOne.submit(form);
$.ajax({
url: form.action,
type: "POST",
data: $(form).serialize(),
beforeSend: function() {
$(form).find('input').attr("disabled", "disabled");
},
success: function(data, textStatus, jqXHR) {
var position = jqXHR.getResponseHeader(
'X-Foswiki-Comment');
addComment(position, data, form);
$(form).find('input').removeAttr("disabled");
$("body").css("cursor", "default");
},
error: function(jqXHR, textStatus, errorThrown) { <<<<<<<<<BREAKPOINT
alert("Error: " + errorThrown);
If I "Step OVER" from the error, everything appears to work just fine. there is no alert, the comment posts, and the page refreshes. Perfect. If I step into, (or don't set the breakpoint) the Alert is thrown, with the string
Error:
and no text following, so the alert happens with no error information.
I don't know where to go from her. Running Firefox 24.6.0
--
GeorgeClark - 02 Dec 2014
I observed something more:
When I try to post a comment in Firefox 30.0 (Linux), the alert box appears for a very short time and dissapears again. Then the error message ("invalid validation code") appears in the browser window. However, the comment
IS added to the page.
When I look at the browser console, I see
two POST requests to
https://REMOVED_FOR_PRIVACY/bin/rest/CommentPlugin/comment
; the first one succeeds, the second one fails with a "Forbidden" HTTP Status code. I assume this is because two ajax POSTs are done with the same validation token; the first one succeeds, the second one produces the error message.
--
PascalSchuppli - 02 Dec 2014
That's due to the race condition between the actual ajax call and the click event bubbling upwards resulting in the surrounding form being submitted in addition to the ajax call already in progress. I think Crawford's recent checkin cured this.
--
MichaelDaum - 03 Dec 2014