Not so much a bug report, more of a FYI :-)

This nearly broke my heart, and made me realise that firebug is a tool I need to learn how to use better.

Basically, when Devel module is enabled, it appends [at least sometimes] some extra information to a page, time taken for queries etc.
The problem is that it also appends this information to the js response that filefield sends to the page.

Obviously this isn't what fielfield expects, and therefore it just 'hangs', displaying progress bar gif.

Simply disabling devel sorts this out pretty quickly.

It didn't happen all the time, but it did happen sometimes.

So... Well I don't know what happens next:-)
Document the issue?
Blame it on Devel?
Try to sort it out?

Regards
Alan

Comments

gnucifer’s picture

I too discoverd this problem some time ago. It took me some frustrating hours figuring that out that devel was the cause, but had up until now no idea why they could not live happily together. . :)

jpetso’s picture

Status: Active » Fixed

> Document the issue?
> Blame it on Devel?
> Try to sort it out?

Well, there is nothing that filefield can do as long as Devel appends its JavaScript to each and every Drupal output that it encounters. This can only be solved by the Devel module itself. As for documenting the issue, I added a note to the project page, linking to this issue. That should hopefully educate the interested user about this conflict. (Thanks for posting the explanation here.)

That's about everything we can do, I believe, so let's close this issue as fixed.

alanburke’s picture

Project: FileField » Devel
Version: 5.x-2.3-rc3 » 5.x-1.x-dev
Component: Code » devel
Status: Fixed » Active

Hi jpetso,
I'll just move this to the Devel issue queue, to see whether they can shed any light.

I agree, it looks like something that you can't do anything about on the filefield side.

Regards
Alan

moshe weitzman’s picture

If filefield is returning javascript, it should say so by adding Content type: text/javascript to the http headers. If you are returning HTML, then you can just call $GLOBALS['devel_shutdown'] = FALSE and devel will stay silent.

jpetso’s picture

From upload_js() of the Drupal 6 upload.module - filefield essentially has a plain copy of that code (but not yet with this nice comment):

  // We send the updated file attachments form.
  // Don't call drupal_json(). ahah.js uses an iframe and
  // the header output by drupal_json() causes problems in some browsers.
  print drupal_to_js(array('status' => TRUE, 'data' => $output));
  exit;

where drupal_json() is what you propose: setting the Content-Type header and printing the JavaScript. I tried it, doesn't work in Konqueror (wants to save the JavaScript) and doesn't work in Firefox (spits out an error message). So, good suggestion, but unfortunately not possible for us to implement.

jpetso’s picture

Project: Devel » FileField
Version: 5.x-1.x-dev » 6.x-3.x-dev
Component: devel » Code
Assigned: Unassigned » jpetso

The $GLOBALS['devel_shutdown'] thing helps, though, I'll commit that one. Thanks for the suggestions, Moshe!

jpetso’s picture

Status: Active » Fixed

Shwoobeedoo, the silencing code is in CVS. I think I like it this way :)
Thanks to everyone involved, at last I can debug filefield *and* run Devel at the same time! (And so can you.)
Coming soon to a release tarball near you.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

jpetso’s picture

I'm leaving this issue closed, nevertheless the fix has been reverted. Which means that Devel will still break filefield in the future. Sorry!

dopry doesn't like filefield to use a module-specific workaround and is not going to apply it to imagefield, so let's be consistent and leave it out in filefield as well (before dopry reverts it by himself). Although the fix is small and trivial, I can also see that his reasoning is sound - any other file upload module would have the same problem (including core's upload.module, which is unlikely to get an exception for Devel) so a generically-working fix still needs to go into Devel.

It's unfortunate that browsers don't handle JavaScript/JSON mimetypes good enough, or maybe we were just doing it wrong. Anyways, we need a better fix. For any follow-ups, please go to issue #253199: Make upload.js AJAX uploads work with Devel enabled.