Bug 167153 - [QuickLook] Support password-protected documents
Summary: [QuickLook] Support password-protected documents
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andy Estes
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-01-17 20:47 PST by Andy Estes
Modified: 2017-01-18 12:30 PST (History)
11 users (show)

See Also:


Attachments
Patch (281.05 KB, patch)
2017-01-17 21:07 PST, Andy Estes
no flags Details | Formatted Diff | Diff
Patch (280.96 KB, patch)
2017-01-17 21:26 PST, Andy Estes
no flags Details | Formatted Diff | Diff
Patch (281.45 KB, patch)
2017-01-18 11:52 PST, Andy Estes
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Estes 2017-01-17 20:47:34 PST
[QuickLook] Support password-protected documents
Comment 1 Andy Estes 2017-01-17 21:07:24 PST
Created attachment 299118 [details]
Patch
Comment 2 Andy Estes 2017-01-17 21:08:53 PST
rdar://problem/28544527
Comment 3 Andy Estes 2017-01-17 21:26:17 PST
Created attachment 299119 [details]
Patch
Comment 4 Alex Christensen 2017-01-18 10:04:26 PST
Comment on attachment 299119 [details]
Patch

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

> Source/WebCore/ChangeLog:17
> +        logic and adds support for testing.

:)

> Source/WebCore/loader/ios/QuickLook.mm:297
>  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived

NSURLConnection??? :(

> Source/WebCore/platform/spi/ios/QuickLookSPI.h:54
> +static_assert(kQLReturnPasswordProtected == 4, "kQLReturnPasswordProtected should equal 4.");

I think we should do more things like this in WebKit to make sure our SPI headers line up with the real headers.

> Source/WebCore/testing/Internals.cpp:436
> +    MockQuickLookHandleClient::singleton().setPassword("");

This will make it so the first time it runs, m_password will be a null string, but after that it will be an empty string.  Probably no big deal

> Source/WebCore/testing/MockQuickLookHandleClient.h:42
> +    void didRequestPassword(std::function<void(const String&)>&&) override;

It looks like we can use WTF::Function here instead because we don't need to be able to copy the function to pretend it's a block or anything.
Comment 5 Andy Estes 2017-01-18 11:29:09 PST
(In reply to comment #4)
> Comment on attachment 299119 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=299119&action=review
> 
> > Source/WebCore/ChangeLog:17
> > +        logic and adds support for testing.
> 
> :)
> 
> > Source/WebCore/loader/ios/QuickLook.mm:297
> >  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
> 
> NSURLConnection??? :(

The QLPreviewConverter delegate was designed to interoperate with an NSURLConnectionDelegate, but these days we always pass a nil NSURLConnection to QLPreviewConverter's initializer (and now assert that it's nil in the delegate callbacks).

At this point it's purely vestigial; there's no actual NSURLConnection being used anywhere :)

> 
> > Source/WebCore/platform/spi/ios/QuickLookSPI.h:54
> > +static_assert(kQLReturnPasswordProtected == 4, "kQLReturnPasswordProtected should equal 4.");
> 
> I think we should do more things like this in WebKit to make sure our SPI
> headers line up with the real headers.
> 
> > Source/WebCore/testing/Internals.cpp:436
> > +    MockQuickLookHandleClient::singleton().setPassword("");
> 
> This will make it so the first time it runs, m_password will be a null
> string, but after that it will be an empty string.  Probably no big deal

I also don't think this is a big deal.

> 
> > Source/WebCore/testing/MockQuickLookHandleClient.h:42
> > +    void didRequestPassword(std::function<void(const String&)>&&) override;
> 
> It looks like we can use WTF::Function here instead because we don't need to
> be able to copy the function to pretend it's a block or anything.

Good idea, I'll use WTF::Function instead.

Thanks for the review!
Comment 6 Andy Estes 2017-01-18 11:52:20 PST
Created attachment 299162 [details]
Patch
Comment 7 WebKit Commit Bot 2017-01-18 12:30:39 PST
Comment on attachment 299162 [details]
Patch

Clearing flags on attachment: 299162

Committed r210864: <http://trac.webkit.org/changeset/210864>
Comment 8 WebKit Commit Bot 2017-01-18 12:30:44 PST
All reviewed patches have been landed.  Closing bug.