Bug 135596 - [iOS] The raw bytes of an iWork document's PDF preview are displayed rather than the PDF itself
Summary: [iOS] The raw bytes of an iWork document's PDF preview are displayed rather t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andy Estes
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-08-04 23:23 PDT by Andy Estes
Modified: 2014-08-05 10:50 PDT (History)
1 user (show)

See Also:


Attachments
Patch (8.10 KB, patch)
2014-08-04 23:41 PDT, Andy Estes
ddkilzer: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2014-08-04 23:23:16 PDT
[iOS] The raw bytes of an iWork document's PDF preview are displayed rather than the PDF itself
Comment 1 Andy Estes 2014-08-04 23:41:16 PDT
<rdar://problem/17869353>
Comment 2 Andy Estes 2014-08-04 23:41:27 PDT
Created attachment 236014 [details]
Patch
Comment 3 David Kilzer (:ddkilzer) 2014-08-05 00:04:07 PDT
Comment on attachment 236014 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236014&action=review

r=me

> Source/WebCore/platform/network/ios/QuickLook.mm:488
> +    [delegate setQuickLookHandle:quickLookHandle.get()];

None of the other QuickLookHandle::create() overloaded methods need this?

> Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp:128
> +    if (!(m_quickLookHandle = QuickLookHandle::create(resourceLoader(), responseCopy.nsURLResponse())))

I think this would be easier to read as two lines:  one where m_quickLookHandle is set, and one where its value is null-checked (as seen in removed code above).
Either way is fine, though.
Comment 4 David Kilzer (:ddkilzer) 2014-08-05 00:07:31 PDT
(In reply to comment #3)
> (From update of attachment 236014 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=236014&action=review
> 
> > Source/WebCore/platform/network/ios/QuickLook.mm:488
> > +    [delegate setQuickLookHandle:quickLookHandle.get()];
> 
> None of the other QuickLookHandle::create() overloaded methods need this?

This probably seems like a dumb question because it's the only method called by the code changes in the patch.

I'm just curious why there are three different QuickLookHandle::create() methods in general, but that does not need an answer to land the fix.
Comment 5 Andy Estes 2014-08-05 00:27:36 PDT
(In reply to comment #3)
> (From update of attachment 236014 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=236014&action=review
> 
> r=me

Thanks!

> 
> > Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp:128
> > +    if (!(m_quickLookHandle = QuickLookHandle::create(resourceLoader(), responseCopy.nsURLResponse())))
> 
> I think this would be easier to read as two lines:  one where m_quickLookHandle is set, and one where its value is null-checked (as seen in removed code above).
> Either way is fine, though.

I agree with you. I'll make this change.
Comment 6 Andy Estes 2014-08-05 01:02:34 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 236014 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=236014&action=review
> > 
> > > Source/WebCore/platform/network/ios/QuickLook.mm:488
> > > +    [delegate setQuickLookHandle:quickLookHandle.get()];
> > 
> > None of the other QuickLookHandle::create() overloaded methods need this?
> 
> This probably seems like a dumb question because it's the only method called by the code changes in the patch.
> 
> I'm just curious why there are three different QuickLookHandle::create() methods in general, but that does not need an answer to land the fix.

Not a dumb question at all! The ways in which we create QuickLookHandles has unfortunately grown as we added support for different networking configurations. The original WebKit1 NSURLConnection code path, the USE(CFNETWORK) path, and the WebKit2 out-of-process networking path each have their own version of QuickLookHandle::create().

Since this bug doesn't occur in the WebKit1 configurations, I opted not to change their behavior, so that's why you only see changes in one of the three create() functions.
Comment 7 David Kilzer (:ddkilzer) 2014-08-05 10:25:44 PDT
(In reply to comment #6)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > (From update of attachment 236014 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=236014&action=review
> > > 
> > > > Source/WebCore/platform/network/ios/QuickLook.mm:488
> > > > +    [delegate setQuickLookHandle:quickLookHandle.get()];
> > > 
> > > None of the other QuickLookHandle::create() overloaded methods need this?
> > 
> > This probably seems like a dumb question because it's the only method called by the code changes in the patch.
> > 
> > I'm just curious why there are three different QuickLookHandle::create() methods in general, but that does not need an answer to land the fix.
> 
> Not a dumb question at all! The ways in which we create QuickLookHandles has unfortunately grown as we added support for different networking configurations. The original WebKit1 NSURLConnection code path, the USE(CFNETWORK) path, and the WebKit2 out-of-process networking path each have their own version of QuickLookHandle::create().
> 
> Since this bug doesn't occur in the WebKit1 configurations, I opted not to change their behavior, so that's why you only see changes in one of the three create() functions.

It all makes sense now.  (Not needed for this patch, but either some function renames or adding salient comments above each method would help to make this clearer when looking at the code in the future.)  Thanks!
Comment 8 Andy Estes 2014-08-05 10:50:11 PDT
Committed r172035: <http://trac.webkit.org/changeset/172035>