Diff
Modified: trunk/Source/WTF/ChangeLog (250159 => 250160)
--- trunk/Source/WTF/ChangeLog 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WTF/ChangeLog 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,6 +1,36 @@
2019-09-20 Keith Rollin <krol...@apple.com>
Remove some support for < iOS 13
+ https://bugs.webkit.org/show_bug.cgi?id=201967
+ <rdar://problem/55504738>
+
+ Reviewed by Andy Estes.
+
+ Remove some support for iOS versions less than 13.0.
+
+ Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
+ and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
+ values >= 130000. This means that expressions like
+ "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
+ "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
+
+ After version checks have been removed, there are some cases where the
+ preprocessor conditional looks like "#if PLATFORM(MAC) ||
+ PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
+ PLATFORM(COCOA)". This additional cleanup will be performed in a
+ subsequent patch.
+
+ This removal is part of a series of patches effecting the removal of
+ dead code for old versions of iOS. This particular pass involves
+ changes in which Andy Estes was involved. These changes are isolated
+ from other similar changes in order to facilitate the reviewing
+ process.
+
+ * wtf/FeatureDefines.h:
+
+2019-09-20 Keith Rollin <krol...@apple.com>
+
+ Remove some support for < iOS 13
https://bugs.webkit.org/show_bug.cgi?id=201973
<rdar://problem/55506966>
Modified: trunk/Source/WTF/wtf/FeatureDefines.h (250159 => 250160)
--- trunk/Source/WTF/wtf/FeatureDefines.h 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WTF/wtf/FeatureDefines.h 2019-09-20 22:19:55 UTC (rev 250160)
@@ -174,7 +174,7 @@
#endif
#if !defined(HAVE_PDFHOSTVIEWCONTROLLER_SNAPSHOTTING)
-#if !PLATFORM(WATCHOS) && !PLATFORM(APPLETV) && !PLATFORM(MACCATALYST) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
+#if PLATFORM(IOS)
#define HAVE_PDFHOSTVIEWCONTROLLER_SNAPSHOTTING 1
#endif
#endif
@@ -206,7 +206,7 @@
#endif
#if !defined(HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER)
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000
+#if PLATFORM(IOS)
#define HAVE_PASSKIT_BOUND_INTERFACE_IDENTIFIER 1
#endif
#endif
Modified: trunk/Source/WebCore/ChangeLog (250159 => 250160)
--- trunk/Source/WebCore/ChangeLog 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebCore/ChangeLog 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,3 +1,36 @@
+2019-09-20 Keith Rollin <krol...@apple.com>
+
+ Remove some support for < iOS 13
+ https://bugs.webkit.org/show_bug.cgi?id=201967
+ <rdar://problem/55504738>
+
+ Reviewed by Andy Estes.
+
+ Remove some support for iOS versions less than 13.0.
+
+ Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
+ and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
+ values >= 130000. This means that expressions like
+ "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
+ "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
+
+ After version checks have been removed, there are some cases where the
+ preprocessor conditional looks like "#if PLATFORM(MAC) ||
+ PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
+ PLATFORM(COCOA)". This additional cleanup will be performed in a
+ subsequent patch.
+
+ This removal is part of a series of patches effecting the removal of
+ dead code for old versions of iOS. This particular pass involves
+ changes in which Andy Estes was involved. These changes are isolated
+ from other similar changes in order to facilitate the reviewing
+ process.
+
+ No new tests -- no new or changed functionality.
+
+ * platform/cocoa/NetworkExtensionContentFilter.mm:
+ (WebCore::NetworkExtensionContentFilter::initialize):
+
2019-09-20 Chris Dumez <cdu...@apple.com>
Document no longer needs to store a SessionID
Modified: trunk/Source/WebCore/PAL/ChangeLog (250159 => 250160)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,3 +1,33 @@
+2019-09-20 Keith Rollin <krol...@apple.com>
+
+ Remove some support for < iOS 13
+ https://bugs.webkit.org/show_bug.cgi?id=201967
+ <rdar://problem/55504738>
+
+ Reviewed by Andy Estes.
+
+ Remove some support for iOS versions less than 13.0.
+
+ Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
+ and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
+ values >= 130000. This means that expressions like
+ "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
+ "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
+
+ After version checks have been removed, there are some cases where the
+ preprocessor conditional looks like "#if PLATFORM(MAC) ||
+ PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
+ PLATFORM(COCOA)". This additional cleanup will be performed in a
+ subsequent patch.
+
+ This removal is part of a series of patches effecting the removal of
+ dead code for old versions of iOS. This particular pass involves
+ changes in which Andy Estes was involved. These changes are isolated
+ from other similar changes in order to facilitate the reviewing
+ process.
+
+ * pal/spi/cocoa/NEFilterSourceSPI.h:
+
2019-09-20 Alex Christensen <achristen...@webkit.org>
Remove functionality to disable TLS fallback
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/NEFilterSourceSPI.h (250159 => 250160)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/NEFilterSourceSPI.h 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/NEFilterSourceSPI.h 2019-09-20 22:19:55 UTC (rev 250160)
@@ -69,7 +69,7 @@
- (void)receivedData:(NSData *)data decisionHandler:(NEFilterSourceDecisionHandler)decisionHandler;
- (void)finishedLoadingWithDecisionHandler:(NEFilterSourceDecisionHandler)decisionHandler;
- (void)remediateWithDecisionHandler:(NEFilterSourceDecisionHandler)decisionHandler;
-#if PLATFORM(MAC) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
@property (copy) NSString *sourceAppIdentifier;
@property (assign) pid_t sourceAppPid;
#endif
Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm (250159 => 250160)
--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.mm 2019-09-20 22:19:55 UTC (rev 250160)
@@ -75,7 +75,7 @@
m_queue = adoptOSObject(dispatch_queue_create("WebKit NetworkExtension Filtering", DISPATCH_QUEUE_SERIAL));
ASSERT_UNUSED(url, !url);
m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithDecisionQueue:m_queue.get()]);
-#if PLATFORM(MAC) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
[m_neFilterSource setSourceAppIdentifier:applicationBundleIdentifier()];
// FIXME: Remove the -respondsToSelector: check once -setSourceAppPid: is defined in an SDK used by the builders.
if ([m_neFilterSource respondsToSelector:@selector(setSourceAppPid:)])
Modified: trunk/Source/WebKit/ChangeLog (250159 => 250160)
--- trunk/Source/WebKit/ChangeLog 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebKit/ChangeLog 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,3 +1,38 @@
+2019-09-20 Keith Rollin <krol...@apple.com>
+
+ Remove some support for < iOS 13
+ https://bugs.webkit.org/show_bug.cgi?id=201967
+ <rdar://problem/55504738>
+
+ Reviewed by Andy Estes.
+
+ Remove some support for iOS versions less than 13.0.
+
+ Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
+ and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
+ values >= 130000. This means that expressions like
+ "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
+ "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
+
+ After version checks have been removed, there are some cases where the
+ preprocessor conditional looks like "#if PLATFORM(MAC) ||
+ PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
+ PLATFORM(COCOA)". This additional cleanup will be performed in a
+ subsequent patch.
+
+ This removal is part of a series of patches effecting the removal of
+ dead code for old versions of iOS. This particular pass involves
+ changes in which Andy Estes was involved. These changes are isolated
+ from other similar changes in order to facilitate the reviewing
+ process.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _dataForPreviewItemController:atPosition:type:]):
+ * UIProcess/ios/forms/WKFileUploadPanel.mm:
+ (-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):
+
2019-09-20 Tim Horton <timothy_hor...@apple.com>
Sanitize suggested filenames used for saving PDFs
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (250159 => 250160)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-09-20 22:19:55 UTC (rev 250160)
@@ -985,7 +985,7 @@
setCollectsTimingData();
#endif
-#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || PLATFORM(IOS_FAMILY)
// FIXME: Replace @"kCFStreamPropertyAutoErrorOnSystemChange" with a constant from the SDK once rdar://problem/40650244 is in a build.
if (networkProcess.suppressesConnectionTerminationOnSystemChange())
configuration._socketStreamProperties = @{ @"kCFStreamPropertyAutoErrorOnSystemChange" : @NO };
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (250159 => 250160)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-09-20 22:19:55 UTC (rev 250160)
@@ -8587,12 +8587,7 @@
else
dataForPreview[UIPreviewDataAttachmentList] = [uiDelegate _attachmentListForWebView:_webView];
dataForPreview[UIPreviewDataAttachmentIndex] = [NSNumber numberWithUnsignedInteger:index];
-
-#if __IPHONE_OS_VERSION_MIN_REQUIRED < 130000
- dataForPreview[UIPreviewDataAttachmentListSourceIsManaged] = [NSNumber numberWithBool:sourceIsManaged];
-#else
dataForPreview[UIPreviewDataAttachmentListIsContentManaged] = [NSNumber numberWithBool:sourceIsManaged];
-#endif
}
}
Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (250159 => 250160)
--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm 2019-09-20 22:19:55 UTC (rev 250160)
@@ -755,7 +755,7 @@
return;
}
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+#if PLATFORM(IOS_FAMILY)
if (NSURL *imageURL = info[UIImagePickerControllerImageURL]) {
if (!imageURL.isFileURL) {
LOG_ERROR("WKFileUploadPanel: Expected image URL to be a file path, it was not");
Modified: trunk/Tools/ChangeLog (250159 => 250160)
--- trunk/Tools/ChangeLog 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Tools/ChangeLog 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,3 +1,33 @@
+2019-09-20 Keith Rollin <krol...@apple.com>
+
+ Remove some support for < iOS 13
+ https://bugs.webkit.org/show_bug.cgi?id=201967
+ <rdar://problem/55504738>
+
+ Reviewed by Andy Estes.
+
+ Remove some support for iOS versions less than 13.0.
+
+ Update conditionals that reference __IPHONE_OS_VERSION_MIN_REQUIRED
+ and __IPHONE_OS_VERSION_MAX_ALLOWED, assuming that they both have
+ values >= 130000. This means that expressions like
+ "__IPHONE_OS_VERSION_MIN_REQUIRED < 101300" are always False and
+ "__IPHONE_OS_VERSION_MIN_REQUIRED >= 101300" are always True.
+
+ After version checks have been removed, there are some cases where the
+ preprocessor conditional looks like "#if PLATFORM(MAC) ||
+ PLATFORM(IOS_FAMILY)". These can be collapsed into "#if
+ PLATFORM(COCOA)". This additional cleanup will be performed in a
+ subsequent patch.
+
+ This removal is part of a series of patches effecting the removal of
+ dead code for old versions of iOS. This particular pass involves
+ changes in which Andy Estes was involved. These changes are isolated
+ from other similar changes in order to facilitate the reviewing
+ process.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/WKPDFView.mm: Removed.
+
2019-09-20 Alex Christensen <achristen...@webkit.org>
Begin moving WebsiteDataStore setters to WebsiteDataStoreConfiguration
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (250159 => 250160)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-09-20 22:19:55 UTC (rev 250160)
@@ -768,7 +768,6 @@
A13EBBB01B87436F00097110 /* BundleParametersPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */; };
A13EBBB11B87438000097110 /* BundleParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = A13EBBAC1B87436F00097110 /* BundleParameters.mm */; };
A1409AD91E7254D4004949D9 /* password-protected.pages in Copy Resources */ = {isa = PBXBuildFile; fileRef = A1409AD81E7254AC004949D9 /* password-protected.pages */; };
- A14AAB631E78D7DE00C1ADC2 /* WKPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14AAB611E78D7DE00C1ADC2 /* WKPDFView.mm */; };
A14AAB651E78DC5400C1ADC2 /* encrypted.pdf in Copy Resources */ = {isa = PBXBuildFile; fileRef = A14AAB641E78DC3F00C1ADC2 /* encrypted.pdf */; };
A14FC5881B8991BF00D107EB /* ContentFiltering.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14FC5861B8991B600D107EB /* ContentFiltering.mm */; };
A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = A14FC5891B89927100D107EB /* ContentFilteringPlugIn.mm */; };
@@ -2143,7 +2142,6 @@
A13EBBAC1B87436F00097110 /* BundleParameters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleParameters.mm; sourceTree = "<group>"; };
A13EBBAE1B87436F00097110 /* BundleParametersPlugIn.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BundleParametersPlugIn.mm; sourceTree = "<group>"; };
A1409AD81E7254AC004949D9 /* password-protected.pages */ = {isa = PBXFileReference; lastKnownFileType = file; path = "password-protected.pages"; sourceTree = "<group>"; };
- A14AAB611E78D7DE00C1ADC2 /* WKPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFView.mm; sourceTree = "<group>"; };
A14AAB641E78DC3F00C1ADC2 /* encrypted.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = encrypted.pdf; sourceTree = "<group>"; };
A14FC5831B89739100D107EB /* WKWebViewConfigurationExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewConfigurationExtras.mm; sourceTree = "<group>"; };
A14FC5841B89739100D107EB /* WKWebViewConfigurationExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewConfigurationExtras.h; sourceTree = "<group>"; };
@@ -2932,7 +2930,6 @@
DF4B273821A47727009BD1CA /* WKNSDictionaryEmptyDictionaryCrash.mm */,
375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
- A14AAB611E78D7DE00C1ADC2 /* WKPDFView.mm */,
2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */,
3781746C2198AE2400062C26 /* WKProcessPoolConfiguration.mm */,
@@ -4842,7 +4839,6 @@
52D673EE1AFB127300FA19FE /* WKPageCopySessionStateWithFiltering.cpp in Sources */,
7CCE7F1F1A411AE600447C4C /* WKPageGetScaleFactorNotZero.cpp in Sources */,
7CCE7F201A411AE600447C4C /* WKPageIsPlayingAudio.cpp in Sources */,
- A14AAB631E78D7DE00C1ADC2 /* WKPDFView.mm in Sources */,
2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
2D21FE591F04642900B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm in Sources */,
7CCE7F211A411AE600447C4C /* WKPreferences.cpp in Sources */,
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKPDFView.mm (250159 => 250160)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKPDFView.mm 2019-09-20 21:51:36 UTC (rev 250159)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKPDFView.mm 2019-09-20 22:19:55 UTC (rev 250160)
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import <WebKit/WKFoundation.h>
-
-// FIXME: Enable these tests on iOS 12 once rdar://problem/39475542 is resolved.
-#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 120000
-
-#import "PlatformUtilities.h"
-#import "TestNavigationDelegate.h"
-#import "Utilities.h"
-#import <WebKit/WKWebViewPrivate.h>
-#import <WebKit/_WKFindDelegate.h>
-#import <wtf/RetainPtr.h>
-
-static void runTest(NSURL *pdfURL)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- [webView loadRequest:[NSURLRequest requestWithURL:pdfURL]];
- [webView _test_waitForDidFinishNavigation];
-
- NSData *expected = [NSData dataWithContentsOfURL:pdfURL];
- NSData *actual = [webView _dataForDisplayedPDF];
- EXPECT_TRUE([expected isEqualToData:actual]);
-}
-
-TEST(WKPDFView, DataForDisplayedPDF)
-{
- runTest([[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]);
-}
-
-TEST(WKPDFView, DataForDisplayedPDFEncrypted)
-{
- runTest([[NSBundle mainBundle] URLForResource:@"encrypted" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]);
-}
-
-static BOOL isDone;
-static const NSUInteger maxCount = 100;
-
-@interface TestFindDelegate : NSObject <_WKFindDelegate>
-@property (nonatomic, readonly) NSString *findString;
-@property (nonatomic, readonly) NSUInteger matchesCount;
-@property (nonatomic, readonly) NSInteger matchIndex;
-@property (nonatomic, readonly) BOOL didFail;
-@end
-
-@implementation TestFindDelegate {
- RetainPtr<NSString> _findString;
-}
-
-- (NSString *)findString
-{
- return _findString.get();
-}
-
-- (void)_webView:(WKWebView *)webView didCountMatches:(NSUInteger)matches forString:(NSString *)string
-{
- _findString = string;
- _matchesCount = matches;
- _didFail = NO;
- isDone = YES;
-}
-
-- (void)_webView:(WKWebView *)webView didFindMatches:(NSUInteger)matches forString:(NSString *)string withMatchIndex:(NSInteger)matchIndex
-{
- _findString = string;
- _matchesCount = matches;
- _matchIndex = matchIndex;
- _didFail = NO;
- isDone = YES;
-}
-
-- (void)_webView:(WKWebView *)webView didFailToFindString:(NSString *)string
-{
- _findString = string;
- _didFail = YES;
- isDone = YES;
-}
-
-@end
-
-static void loadWebView(WKWebView *webView, TestFindDelegate *findDelegate)
-{
- [webView _setFindDelegate:findDelegate];
- NSURL *pdfURL = [[NSBundle mainBundle] URLForResource:@"find" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"];
- [webView loadRequest:[NSURLRequest requestWithURL:pdfURL]];
- [webView _test_waitForDidFinishNavigation];
-}
-
-TEST(WKPDFView, CountString)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"Two";
- [webView _countStringMatches:expectedString options:0 maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(1U, [findDelegate matchesCount]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, CountStringMissing)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"One";
- [webView _countStringMatches:expectedString options:0 maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(0U, [findDelegate matchesCount]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, CountStringCaseInsensitive)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"t";
- [webView _countStringMatches:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindString)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"one";
- [webView _findString:expectedString options:0 maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(1U, [findDelegate matchesCount]);
- EXPECT_EQ(0, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindStringMissing)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"One";
- [webView _findString:expectedString options:0 maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_TRUE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindStringCaseInsensitive)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"t";
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(0, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(1, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(0, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindStringBackward)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"t";
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(4, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(3, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(5U, [findDelegate matchesCount]);
- EXPECT_EQ(4, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindStringPastEnd)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"two";
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(2U, [findDelegate matchesCount]);
- EXPECT_EQ(0, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(2U, [findDelegate matchesCount]);
- EXPECT_EQ(1, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_TRUE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-TEST(WKPDFView, FindStringBackwardPastStart)
-{
- auto webView = adoptNS([[WKWebView alloc] init]);
- auto findDelegate = adoptNS([[TestFindDelegate alloc] init]);
- loadWebView(webView.get(), findDelegate.get());
-
- NSString *expectedString = @"two";
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(2U, [findDelegate matchesCount]);
- EXPECT_EQ(1, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_EQ(2U, [findDelegate matchesCount]);
- EXPECT_EQ(0, [findDelegate matchIndex]);
- EXPECT_FALSE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-
- isDone = NO;
- [webView _findString:expectedString options:_WKFindOptionsCaseInsensitive | _WKFindOptionsBackwards maxCount:maxCount];
- TestWebKitAPI::Util::run(&isDone);
-
- EXPECT_TRUE([findDelegate didFail]);
- EXPECT_WK_STREQ(expectedString, [findDelegate findString]);
-}
-
-#endif