Bug 144162 - WKPDFView does not support password-protected PDFs
Summary: WKPDFView does not support password-protected PDFs
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: Tim Horton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-24 14:42 PDT by Tim Horton
Modified: 2015-04-24 21:28 PDT (History)
4 users (show)

See Also:


Attachments
Patch (13.54 KB, patch)
2015-04-24 14:48 PDT, Tim Horton
aestes: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2015-04-24 14:42:10 PDT
WKPDFView does not support password-protected PDFs
Comment 1 Tim Horton 2015-04-24 14:48:19 PDT
Created attachment 251576 [details]
Patch
Comment 2 Tim Horton 2015-04-24 14:49:23 PDT
<rdar://problem/18411512>
Comment 3 David Kilzer (:ddkilzer) 2015-04-24 15:06:04 PDT
The initial iOS EWS orange status is due to me updating the EWS to iOS 8.3.  It should retry again.
Comment 4 Andy Estes 2015-04-24 15:18:21 PDT
Comment on attachment 251576 [details]
Patch

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

> Source/WebKit2/Platform/spi/ios/UIKitSPI.h:689
> +@interface UIDocumentPasswordView : UIView <UITextFieldDelegate>
> +
> +- (id)initWithDocumentName:(NSString *)documentName;
> +
> +@property (nonatomic, assign) NSObject<UIDocumentPasswordViewDelegate> *passwordDelegate;
> +@property (nonatomic, readonly) UITextField *passwordField;
> +
> +@end

I believe the convention for these SPI headers is to declare all methods and properties in a category.

> Source/WebKit2/UIProcess/ios/WKPDFView.mm:735
> +    if (![passwordField isEditing])

passwordField.isEditing?

> Source/WebKit2/UIProcess/ios/WKPDFView.mm:742
> +    UIWindow *window = [_scrollView window];

_scrollView.window?

> Source/WebKit2/UIProcess/ios/WKPDFView.mm:755
> +        CGPoint contentOffset = [_scrollView contentOffset];

_scrollView.contentOffset?

> Source/WebKit2/UIProcess/ios/WKPDFView.mm:809
> +    UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:WEB_UI_STRING_KEY("OK", "OK (PDF password failure alert)", "OK button label in PDF password failure alert") style:UIAlertActionStyleDefault handler:^(UIAlertAction *) { }];

Not that it matters here since you don't capture anything, but you could use a lambda instead of a block.
Comment 5 Andy Estes 2015-04-24 15:37:01 PDT
Comment on attachment 251576 [details]
Patch

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

> Source/WebKit2/UIProcess/ios/WKPDFView.mm:801
> +    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];

Are you sure that this will always be called before a WKPDFView is deallocated? Should this be done in -dealloc as well?
Comment 6 Tim Horton 2015-04-24 16:57:00 PDT
http://trac.webkit.org/changeset/183293
Comment 7 David Kilzer (:ddkilzer) 2015-04-24 21:28:37 PDT
(In reply to comment #6)
> http://trac.webkit.org/changeset/183293

Build fix: <http://trac.webkit.org/changeset/183296>