RESOLVED FIXED Bug 24089
ThreadableLoader::loadResourceSynchronously should do callbacks like the async code.
https://bugs.webkit.org/show_bug.cgi?id=24089
Summary ThreadableLoader::loadResourceSynchronously should do callbacks like the asyn...
David Levin
Reported 2009-02-23 01:58:34 PST
The xhr sync send code path needs to be fixed up to allow it to work the same for both Documents and Workers.
Attachments
Proposed fix. (13.39 KB, patch)
2009-02-23 02:13 PST, David Levin
ap: review+
Proposed fix. (14.42 KB, patch)
2009-02-24 13:27 PST, David Levin
no flags
Proposed fix. (14.33 KB, patch)
2009-02-24 23:49 PST, David Levin
ap: review+
David Levin
Comment 1 2009-02-23 02:13:51 PST
Created attachment 27876 [details] Proposed fix.
Alexey Proskuryakov
Comment 2 2009-02-23 06:36:24 PST
Comment on attachment 27876 [details] Proposed fix. I don't see where identifier changes from std::numeric_limits<unsigned long>::max() to a real one now. I think that the fix is just to assign the return value of FrameLoader::loadResourceSynchronously() to it. + function log(htmlMessage) This looks like overkill. You don't ever pass HTML-formatted messages to this function, do you? r=me with two conditions: 1) Please test that Web Inspector still displays XHR responses correctly. 2) Please verify that the change in behavior matches other browsers, not just the spec.
David Levin
Comment 3 2009-02-23 22:21:40 PST
Comment on attachment 27876 [details] Proposed fix. The behavior doesn't match other browsers (namely Firefox), so I'll revise it.
David Levin
Comment 4 2009-02-24 13:27:07 PST
Created attachment 27928 [details] Proposed fix. For now, I've change the patch to not throw an exception when there is a redirect failure due to a security issue which seemed consistent with IE and FF, but I've sent an email about this issue and can easy change this aspect of the behavior in the future. I left the log message as html format not because I needed it but because it seemed simpler. (I didn't find a built in js function to escape text and (to my memory) innerText didn't work in FF.)
David Levin
Comment 5 2009-02-24 13:31:59 PST
btw, I also verified: Please test that Web Inspector still displays XHR responses correctly.
David Levin
Comment 6 2009-02-24 13:40:58 PST
Comment on attachment 27928 [details] Proposed fix. ap suggested "You can use document.createTextNode() and appendChild() to add text to the newly created span." So I'll fix that.
David Levin
Comment 7 2009-02-24 23:49:36 PST
Created attachment 27961 [details] Proposed fix. After further review, FF3 doesn't throw an exception in the sync redirect failed case, but the nightlies of FF do. Also IE throw an exception as well (I made a mistake in my previous testing of IE because the test didn't work in IE for reasons I'd rather not discuss here.)
Alexey Proskuryakov
Comment 8 2009-02-25 03:16:33 PST
Comment on attachment 27961 [details] Proposed fix. > + var logElement = document.getElementById('log'); > + logElement.appendChild(document.createTextNode(message)); > + logElement.appendChild(document.createElement("p")); My suggestion was actually a bit different: var p = document.createElement("p"); p.appendChild(document.createTextNode(message)); logElement.appendChild(p); But let's keep it as is - regression tests are all about testing unusual coding practices and edge cases ;) > + Changes the behavior of sync xhr for insecure redirects in two ways: > + + Sends an error event instead of an abort event (which is the same as async xhr's behavior). > + + Throws a network exception which is what the spec says to do (http://www.w3.org/TR/XMLHttpRequest/). Please mention that it's what other browsers do. > - changeState(HEADERS_RECEIVED); Does this happen in didFinishLoading()? I'm worried that this (not just this change, but refactoring in general) may subtly clash with work Julien Chaffraix is doing in bug 22475. r=me
David Levin
Comment 9 2009-02-25 10:10:54 PST
Commited in r41215. > > - changeState(HEADERS_RECEIVED); > Does this happen in didFinishLoading()? Yep, both didReceiveData and didFinishLoading advance the state to HEADERS_RECEIVED (if needed). > I'm worried that this (not just this change, but refactoring in general) may subtly clash with > work Julien Chaffraix is doing in bug 22475. I looked at that patch and as far as this change is concerned, it should be fine. I did notice differences in readyStateChange between WebKit and other browsers. However, in this patch I didn't change WebKit's behavior for readyStateChange, so the differences in this regard remained the same with this change. > My suggestion was actually a bit different... Thanks for the info!
Note You need to log in before you can comment on or make changes to this bug.