Closed (fixed)
Project:
Devel
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2007 at 23:07 UTC
Updated:
12 Apr 2007 at 14:32 UTC
Jump to comment: Most recent file
When devel_shutdown() is called and prints it output, it puts this stuff *outside* <html> This causes all sorts of strange oddities with jQuery as it manipulates the DOM.
Ideally devel module's output should goto into $closure which is filled by calling hook_footer().
Moving the devel_shutdown() into hook_footer() fixes this.
Proposed patch moves all of this into devel_footer() to fix this behavior.
Comments
Comment #1
moshe weitzman commentedthere are important queries that happen after hook_footer such as sess_write(). i am open to any ideas which let preserve those queries and still emit valid html.
Comment #2
moshe weitzman commentedPerhaps we send the queries down as a .js array and then inject them into the page before . that would be valid at least. not sure if it is worth the complexity though.
Comment #3
m3avrck commentedOk yeah, here is a JS approach. The script is outside the HTML but it fixes the problem of weird displays.
Comment #4
m3avrck commentedComment #5
moshe weitzman commenteddo folks think this is a worthwhile change? devel has cadded its output here since the beginning of time. is the fix worse than the bug?
Comment #6
m3avrck commentedMoshe, read my email and check the DR... this is needed because of AJAX :-)
Comment #7
m3avrck commentedTry this: grab devel module + simplemenu. Then turn on query logging, notice how you get a set of queries at the top of the page, ruining things, and one at the bottom. Strange right?
Well apply my patch above to devel. Now you see there are 2 sets of queries at the bottom: 15 queries and 8.
WTF? Why are they different? And why the hell is only 15 queries in the source to the page and the other 8 not?
Give up? Here's a clue: AJAX.
SimpleMenu makes an AJAX call per page. Guess what? That is a Drupal bootstrap and devel registers devel_shutdown() so it logs the queries. But this AJAX call is within another page that takes 15 queries to render.
Ahah! That's why you get 2 sets.
So that patch is needed when you're running AJAX sites, otherwise you'll get queries appearing wherever your AJAX calls are.
Comment #8
moshe weitzman commentedthanks ted. i installed simplemenu and i get it now. we already suppress devel output for most of these ajax requests because the responses are in javascript (specifically, a JSON object). same for rss feed responses note how devel_exit() won't print anything if http headers are text/xml or text/javascript. whats needed here is a way for simplemenu to state that the current request is not a full page, but rather an AHAH response and thus should not be touched. i don't want the query info coming down in the first place.
for now, I propose inventing a new variable like $GLOBALS['devel_suppress'] and if that is TRUE, devel doesn't print junk. So you would set that variable just before your exit call in simplemenu_get_menu();
Comment #9
m3avrck commentedHmm, that's an interesting idea.
However, at first I thought this was a bug, now I see how powerful this is. It took 8 queries for my AJAX call, that is useful stuff!!!
Why would I want to surpress it?
With the proposed patch it consolidates everything (basically anytime devel_shutdown is called it prepends all output to the body).
Thoughts?
Comment #10
moshe weitzman commentedThat won't work. The queries from the AHAH request are stuck at the bottom of an invalid page. There is no BODY tag to append them to. This takes a little while to understand whats going on. The patch you proposed would only move the queries from the original request, not the AHAH response.
Comment #11
m3avrck commentedWell not entirely... I saw the set of queries needed to run that AJAX request posted to the main page at the bottom -- hence the 2 sets of queries, 15 and 8.
While the AHAH page is never really rendered anywhere, it is printed to the screen. It is during this printing that the JS is printed as well so that it can the be appended to the calling page body.
Comment #12
moshe weitzman commentedcommitted. thx.
Comment #13
(not verified) commentedComment #14
dwwthis patch seems to have broken devel.module for anonymous users since drupal_add_js() is undefined in hook_init() if you're anonymous. :( see http://drupal.org/node/126419
Comment #15
moshe weitzman commentedquick fix in place. i just removed that line. hopefully won't break other stuff
Comment #16
(not verified) commented