Changeset 292888 in webkit
- Timestamp:
- Apr 14, 2022, 1:58:47 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Source/WebCore/PAL/ChangeLog (modified) (1 diff)
-
Source/WebCore/PAL/pal/spi/ios/ManagedConfigurationSPI.h (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/ios/UIKitSPI.h (modified) (3 diffs)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/PAL/ChangeLog
r292859 r292888 1 2022-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] [WK2] Managed pasteboard should function for all managed domains 4 https://bugs.webkit.org/show_bug.cgi?id=239319 5 rdar://80059355 6 7 Reviewed by Kate Cheney. 8 9 Add an SPI method on `MCProfileConnection`. 10 11 * pal/spi/ios/ManagedConfigurationSPI.h: 12 1 13 2022-04-13 Myles C. Maxfield <mmaxfield@apple.com> 2 14 -
trunk/Source/WebCore/PAL/pal/spi/ios/ManagedConfigurationSPI.h
r259373 r292888 57 57 @end 58 58 59 @class NSURL; 60 59 61 @interface MCProfileConnection () 60 62 + (MCProfileConnection *)sharedConnection; 61 63 - (MCRestrictedBoolType)effectiveBoolValueForSetting:(NSString *)feature; 64 - (BOOL)isURLManaged:(NSURL *)url; 62 65 @end 63 66 -
trunk/Source/WebKit/ChangeLog
r292882 r292888 1 2022-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] [WK2] Managed pasteboard should function for all managed domains 4 https://bugs.webkit.org/show_bug.cgi?id=239319 5 rdar://80059355 6 7 Reviewed by Kate Cheney. 8 9 Unless a WebKit client has specified a data owner for the web view that is not _UIDataOwnerUndefined, fall back 10 to _UIDataOwnerEnterprise when the current domain of the WKWebView is managed (that is, `-[MCProfileConnection 11 isURLManaged:]` returns YES for the web view's current URL). This allows managed pasteboard to work for all 12 WebKit clients, if the current URL is managed. 13 14 Test: UIPasteboardTests.PerformAsDataOwnerWithManagedURL 15 16 * Platform/spi/ios/UIKitSPI.h: 17 18 Drive-by fix: move the staged declarations of `-_dataOwnerForCopy` and `-_dataOwnerForPaste` out of the IPI 19 section, and into the non-internal SDK section. 20 21 * UIProcess/ios/WKContentViewInteraction.mm: 22 (-[WKContentView _dataOwnerForPasteboard:]): 23 1 24 2022-04-14 J Pascoe <j_pascoe@apple.com> 2 25 -
trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h
r292715 r292888 169 169 }; 170 170 171 typedef NS_ENUM(NSInteger, _UIDataOwner) { 172 _UIDataOwnerUndefined, 173 _UIDataOwnerUser, 174 _UIDataOwnerEnterprise, 175 _UIDataOwnerShared, 176 }; 177 171 178 @class UIPreviewItemController; 172 179 … … 491 498 - (void)_beginPinningInputViews; 492 499 - (void)_endPinningInputViews; 493 500 #if HAVE(PASTEBOARD_DATA_OWNER) 501 @property (nonatomic, setter=_setDataOwnerForCopy:) _UIDataOwner _dataOwnerForCopy; 502 @property (nonatomic, setter=_setDataOwnerForPaste:) _UIDataOwner _dataOwnerForPaste; 503 #endif 494 504 @end 495 505 … … 1373 1383 #endif // USE(APPLE_INTERNAL_SDK) 1374 1384 1375 #if HAVE(PASTEBOARD_DATA_OWNER)1376 1377 @interface UIResponder (Staging_73852335)1378 @property (nonatomic, setter=_setDataOwnerForCopy:) _UIDataOwner _dataOwnerForCopy;1379 @property (nonatomic, setter=_setDataOwnerForPaste:) _UIDataOwner _dataOwnerForPaste;1380 @end1381 1382 #endif1383 1384 1385 @interface UITextInteractionAssistant (IPI) 1385 1386 @property (nonatomic, readonly) BOOL inGesture; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r292880 r292888 8203 8203 - (WebCore::DataOwnerType)_dataOwnerForPasteboard:(WebKit::PasteboardAccessIntent)intent 8204 8204 { 8205 if (![self respondsToSelector:@selector(_dataOwnerForPaste)]) { 8206 // FIXME: Remove this once the relevant bots have fix for <rdar://problem/73852335>. 8205 auto specifiedType = [&] { 8206 if (intent == WebKit::PasteboardAccessIntent::Read) 8207 return coreDataOwnerType(self._dataOwnerForPaste); 8208 8209 if (intent == WebKit::PasteboardAccessIntent::Write) 8210 return coreDataOwnerType(self._dataOwnerForCopy); 8211 8212 ASSERT_NOT_REACHED(); 8207 8213 return WebCore::DataOwnerType::Undefined; 8208 } 8209 8210 if (intent == WebKit::PasteboardAccessIntent::Read) 8211 return coreDataOwnerType(self._dataOwnerForPaste); 8212 8213 if (intent == WebKit::PasteboardAccessIntent::Write) 8214 return coreDataOwnerType(self._dataOwnerForCopy); 8215 8216 ASSERT_NOT_REACHED(); 8214 }(); 8215 8216 if (specifiedType != WebCore::DataOwnerType::Undefined) 8217 return specifiedType; 8218 8219 if ([[PAL::getMCProfileConnectionClass() sharedConnection] isURLManaged:[_webView URL]]) 8220 return WebCore::DataOwnerType::Enterprise; 8221 8217 8222 return WebCore::DataOwnerType::Undefined; 8218 8223 } -
trunk/Tools/ChangeLog
r292882 r292888 1 2022-04-14 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] [WK2] Managed pasteboard should function for all managed domains 4 https://bugs.webkit.org/show_bug.cgi?id=239319 5 rdar://80059355 6 7 Reviewed by Kate Cheney. 8 9 Add a new API test to verify that we fall back to consulting `-[MCProfileConnection isURLManaged:]` when 10 determining the data owner for copy and paste, unless a data owner is already explicitly set on a view in the 11 responder chain (specifically, the WKWebView). 12 13 * TestWebKitAPI/Tests/ios/UIPasteboardTests.mm: 14 (+[TestUIPasteboard _performAsDataOwner:block:]): 15 (-[TestMCProfileConnection isURLManaged:]): 16 (TestWebKitAPI::TEST): 17 1 18 2022-04-14 J Pascoe <j_pascoe@apple.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/ios/UIPasteboardTests.mm
r273184 r292888 29 29 30 30 #import "ClassMethodSwizzler.h" 31 #import "InstanceMethodSwizzler.h" 31 32 #import "PlatformUtilities.h" 32 33 #import "TestWKWebView.h" … … 36 37 #import <WebKit/WKPreferencesPrivate.h> 37 38 #import <WebKit/WKWebViewPrivate.h> 38 #import < wtf/SoftLinking.h>39 #import <pal/ios/ManagedConfigurationSoftLink.h> 39 40 40 41 typedef void (^DataLoadCompletionBlock)(NSData *, NSError *); … … 64 65 block(); 65 66 gLastKnownDataOwner = owner; 67 } 68 69 @end 70 71 @interface TestMCProfileConnection : NSObject 72 @end 73 74 @implementation TestMCProfileConnection 75 76 - (BOOL)isURLManaged:(NSURL *)url 77 { 78 return [url.lastPathComponent isEqualToString:@"simple.html"]; 66 79 } 67 80 … … 412 425 } 413 426 427 TEST(UIPasteboardTests, PerformAsDataOwnerWithManagedURL) 428 { 429 auto pasteboardSwizzler = ClassMethodSwizzler { 430 UIPasteboard.class, 431 @selector(_performAsDataOwner:block:), 432 [TestUIPasteboard methodForSelector:@selector(_performAsDataOwner:block:)] 433 }; 434 435 auto managedConfigurationSwizzler = InstanceMethodSwizzler { 436 PAL::getMCProfileConnectionClass(), 437 @selector(isURLManaged:), 438 [TestMCProfileConnection instanceMethodForSelector:@selector(isURLManaged:)] 439 }; 440 441 { 442 auto source = setUpWebViewForPasteboardTests(@"simple"); 443 [source selectAll:nil]; 444 [source copy:nil]; 445 [source waitForNextPresentationUpdate]; 446 EXPECT_EQ(gLastKnownDataOwner, _UIDataOwnerEnterprise); 447 } 448 { 449 auto destination = setUpWebViewForPasteboardTests(@"autofocus-contenteditable"); 450 [destination _setDataOwnerForPaste:_UIDataOwnerUser]; 451 [destination paste:nil]; 452 [destination waitForNextPresentationUpdate]; 453 EXPECT_EQ(gLastKnownDataOwner, _UIDataOwnerUser); 454 } 455 } 456 414 457 #endif // HAVE(PASTEBOARD_DATA_OWNER) 415 458
Note:
See TracChangeset
for help on using the changeset viewer.