Summary: | REGRESSION(r41732): Crash when constructing XMLHttpRequest in a detached document | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Alexey Proskuryakov <ap> | ||||||
Component: | WebCore JavaScript | Assignee: | Alexey Proskuryakov <ap> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | Keywords: | Regression | ||||||
Priority: | P1 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Description
Alexey Proskuryakov
2009-04-20 01:51:09 PDT
Created attachment 29621 [details]
proposed patch
Comment on attachment 29621 [details] proposed patch > + KURL url = this->url(); > + NSURL* nsURL; > + if (m_responseContentDispositionEncodingFallbackArray.isEmpty()) > + nsURL = url; > + else { > + CString urlString = TextEncoding(m_responseContentDispositionEncodingFallbackArray[0]).encode(url.string().characters(), url.string().length(), URLEncodedEntitiesForUnencodables); > + RetainPtr<CFURLRef> cfURL = CFURLCreateAbsoluteURLWithBytes(kCFAllocatorDefault, (const UInt8*)urlString.data(), urlString.length(), CFStringConvertIANACharSetNameToEncoding(m_responseContentDispositionEncodingFallbackArray[0].createCFString()), 0, false); > + nsURL = (NSURL*)cfURL.get(); > + [[nsURL retain] autorelease];; > + } > + > if (nsRequest) > - [nsRequest setURL:url()]; > + [nsRequest setURL:nsURL]; > else > - nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; > + nsRequest = [[NSMutableURLRequest alloc] initWithURL:nsURL]; I suggest making the new nsURL variable a RetainPtr<NSURL*>, and therefore avoiding autorelease. Is there a way we could avoid There are double semicolons on the line that calls autorelease. A local variable for the encoding name would make the expression easier to read. This code leaks the string created by createCFString; probably best to fix that using a RetainPtr<CFStringRef>. review- because of the leak Created attachment 29624 [details] proposed patch > I suggest making the new nsURL variable a RetainPtr<NSURL*>, and therefore > avoiding autorelease. Oops! Sorry, this code is completely unrelated, and certainly not ready for review. Submitting a hopefully clean patch... Comment on attachment 29624 [details]
proposed patch
r=me
Committed <http://trac.webkit.org/changeset/42700>. |