RESOLVED INVALID 14169
AJAX/JavaScript crash bug
https://bugs.webkit.org/show_bug.cgi?id=14169
Summary AJAX/JavaScript crash bug
Alastair Campbell
Reported 2007-06-15 09:19:01 PDT
My company has just created a little flash/jQuery widget: http://www.defacto-cms.com/about-defacto/case-studies.html It works fine across Firefox, WinIE 6+ (*) and Opera, but fails in Safari (2), either silently failing, or actually crashing safari (1.3 - 3, OSX & Windows). Although the page in question uses a Flash widget, that widget simply calls a JavaScript function. (I have tested it without the Flash, just using JavaScript with the same results, although it's not public now.) The AJAX function is called from replaceMainContent, and the click is added from the flashReplace function. The non-minised version is here: http://www.defacto-cms.com/defacto/live/javascript/write-flash.js This uses the JavaScript libary jQuery, but I haven't had any help from there (http://groups.google.com/group/jquery-en/browse_thread/thread/e01c36f766f86faa/f064b0568e562f9e?lnk=gst&q=alastc&rnum=1#f064b0568e562f9e) If I haven't provided enough information, or there is somewhere else I should investigage I would be happy to look around, but debugging it is proving difficult. Thank you in advance for any attention you can give this.
Attachments
David Kilzer (:ddkilzer)
Comment 1 2007-06-15 10:36:36 PDT
Have you tried downloading a WebKit nightly for Mac OS X and used the Drosera JavaScript debugger? It's a bit slow, but I think it will help you debug the issue you're seeing. http://nightly.webkit.org/
Alastair Campbell
Comment 2 2007-06-16 05:35:49 PDT
I have, the latest nightly hangs when you select something in the Flash and the AJAX call is made. The variable containing the new content contains the whole page instead of just the new content, which means that the setRequestHeader did not work: // Load new contents var newContent = $.ajax({ type: "GET", url: newUrl, beforeSend: function(xhr) { xhr.setRequestHeader("User-Agent", "XMLHTTP"); }, async: false }).responseText; However, due to issue with IE I had tested for that: if( $(newContent).eq(0).is("#content") == false) { newContent = $("#content", newContent); } That should cut the new page down to the content section, but it seems to be hanging here, which presumably it shouldn't? (I would assume it should either throw an error or complete it?) Thanks, -Alastair
David Kilzer (:ddkilzer)
Comment 3 2008-05-09 14:11:45 PDT
Alastair, is this still happening with the latest Safari 3.1.1?
Alastair Campbell
Comment 4 2008-05-09 14:39:23 PDT
It is not crashing any more (still at: http://www.defacto-cms.com/about-defacto/case-studies.html). However the page - change doesn't work. That could be a jQuery/AJAX issue, or it could be with our code, I will investigate, but the seriousness is less now that it doesn't crash. Thanks for asking... -Alastair
Alexander Willner
Comment 5 2008-06-09 04:10:21 PDT
(In reply to comment #4) > It is not crashing any more That's true. Does not crash with r34367. > However the page - change doesn't work. With "page change" you mean the "slider" on the top? It's working with r34367.
Alastair Campbell
Comment 6 2008-06-09 05:10:26 PDT
> With "page change" you mean the "slider" on the top? It's working with r34367. No, when you select an item from the slider (carousel), the page content below should change. This was implemented with a jQuery AJAX call.
Alexander Willner
Comment 7 2008-06-09 07:52:37 PDT
(In reply to comment #6) > No, when you select an item from the slider (carousel), the page content below > should change. This was implemented with a jQuery AJAX call. Ok the content doesn't change on the latest build on OS X (10.5.3) . *Maybe* the bug depends on https://bugs.webkit.org/show_bug.cgi?id=19445
Alastair Campbell
Comment 8 2008-07-16 03:19:01 PDT
We've gotten to the bottom of this using a proxy to check the requests: During a call with jQuery we were attempting to run the following line so the server could assess wither the request was an AJAX one or not: xhr.setRequestHeader("USER-AGENT", "XMLHttp"); Apparently Safari only allows changing of user-agent within debug mode which is obviously not going to work for most people! Our solution was to use the header value of X-Requested-With instead. It seems likely that this is not a bug (I'll leave other to set the resolution), but I'd be interested to know if using X-Requested-With is safe?
Anne van Kesteren
Comment 9 2023-05-12 22:59:05 PDT
Much belated, but it's safe.
Note You need to log in before you can comment on or make changes to this bug.