When I install a module through the UI and I press the "previous page" button in my browser. I get a huge ajax error spitting source code to me.

http://awesomescreenshot.com/04258yve3

Is there a way to supress this error? Or will this be a case of "Don't press tha damn button".

sidenote: I pressed the button because I was curious about the error message I got while installing a module with overlay on #1006832: Ajax error in UI module installer when we are in the overlay

Comments

Bence’s picture

I can confirm this error message.

bfroehle’s picture

Title: Ajax error when pressing "previous page" in browser after installing new module. » Ajax error when pressing "previous page" in browser after any batch operation.
Component: update.module » base system
Status: Active » Needs review
Issue tags: +batch, +Update manager
StatusFileSize
new172.68 KB
new40.64 KB
new1.24 KB

Steps to reproduce: Do any batch operation, like going to admin/reports/updates/check. Wait for it to finish, hit the back button in your browser. Boom!

The issue stems from the generic use of

drupal_set_message(t('No active batch.'), 'error');
drupal_goto();

in _batch_page().

What we should be doing in this function is checking if op=do (which indicates an AJAX request) and returning an AJAX error message in that situation.

This leads to much prettier error messages as shown in the file attachments.

I did a cursory search for duplicates but didn't find any. Apologies if somebody else has already figured this out.

Patch attached.

bfroehle’s picture

Title: Ajax error when pressing "previous page" in browser after any batch operation. » Display readable ajax error when pressing "previous page" in browser after any batch operation.

Retitling -- there's not way to "fix" the error -- but what we can do is display a human readable error message "No active batch" rather than some html gobbeldygook.

bfroehle’s picture

Issue tags: +Usability

Adding a usability tag, since that's what this issue is about.

bfroehle’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
sphism’s picture

Assigned: Unassigned » sphism
Status: Needs review » Needs work

This patch no longer applies since all core files are now in /core

I'll try to reroll the patch and post it back here

sphism’s picture

Status: Needs work » Needs review
StatusFileSize
new975 bytes

Hmm... I think this patch is rerolled but now i'm getting a 500 error in drupal and have to go out... I'll check this later on... here's the patch anyway

sphism’s picture

Ok I just tried to replicate this issue and apply that patch... The issue doesn't appear to be there any more and I've a funny feeling this commit fixed this issue:
#229825-89: backport "$_COOKIE['has_js'] must die" patch to 7.x

Which would mean this issue can be closed, and this patch discarded as unnecessary.

yesct’s picture

Status: Needs review » Closed (cannot reproduce)
yonailo’s picture

Issue summary: View changes

Hello,

This issue still exists in D7, and I can confirm that the proposed backport patch of #229825 (backport "$_COOKIE['has_js'] must die" patch to 7.x) does not solve this issue.

The patch "1009716-fix-batch-error-messages_rerolled.patch" applies cleanly to D7 (patch -p2) and it solves this issue. This should be scheduled for backporting IMHO.

suchdavid’s picture

Hi
I think the previous patch doesn't work because it has wrong path for batch.inc. Otherwise the solution works. At least shows nicer error message. I corrected the patch for D7.