I will describe how I found the bug. I'm using scald on my website and you have a library at the right that permit to access to the atoms. We can make actions on atoms thanks to ajax calls. So when I click on "edit" the reaction is totally broken. The problem could appear with any ajax calls and not only scald's ones.

If you want to reproduce, I suggest you to use Firefox Nightly. It occurs every time with it. On Chrome and Firefox, you will need to wait that the disconnection is done by autologout to have the bug.
Steps to reproduce:
- Open an admin page with a scald field like a content creation page (The scald library must appear)
- Reload the page (with a simple refresh, not a hard refresh)
- Click on the scald Library
- If you're not on Firefox Nightly, wait a long time (I think it's related to the timer of autologout)
- Click on an atom's "Edit" link

The popin should be in an infinite loop.

The function autologout_ahah_set_last is called on every page even ajax calls. Making ajax commands recursively is not supported and it just crashes the website when it occurs. I suggest to avoid doing ajax commands when we are already on an ajax request. I don't really know how to detect that we are on an ajax request. We can check that "ajax" is in the url because a lot of modules use that syntax but it will not work in every cases.
At least, the module should add something like that just before the "return" to allow developers to change the $commands variable when it causes problems:
module_invoke_all('auto_logout_commands_alter', $commands);

Thank you for reading the issue and I hope a hook will be had to face those problems with autologout.

CommentFileSizeAuthor
#4 patch-avoid-recursive-ajax.patch18.07 KBphjou
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

phjou created an issue. See original summary.

phjou’s picture

Issue summary: View changes
phjou’s picture

Issue summary: View changes
phjou’s picture

I'm not sure we can do anything in php because the ajax calls are done by the JS.
As a quickfix, I have put this test on the whole JS of the module:
if (String(window.location).indexOf('ajax') > -1)

It works well, but it will not work for ajax url without the word 'ajax' into it. If you have a better solution...