WebKit Bugzilla
Attachment 372595 Details for
Bug 199083
: [iOS] Evernote crashes when creating a note
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199083-20190620154535.patch (text/plain), 6.86 KB, created by
Daniel Bates
on 2019-06-20 15:45:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2019-06-20 15:45:36 PDT
Size:
6.86 KB
patch
obsolete
>Subversion Revision: 246655 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3ab049d81845fc7502cdd23dd2fb63a6a0cd6eb7..c4143f48b6e6b4109fbab718a36b78b7e9a69ee3 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-06-20 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Evernote crashes when creating a note >+ https://bugs.webkit.org/show_bug.cgi?id=199083 >+ <rdar://problem/51759247> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add runtime check whether WebKit is being used in Evernote. Evernote's bundle ID >+ references iPhone, but they use the same ID for their iPad app as well. >+ >+ * platform/RuntimeApplicationChecks.h: >+ * platform/cocoa/RuntimeApplicationChecksCocoa.mm: >+ (WebCore::IOSApplication::isEvernote): Added. >+ > 2019-06-20 Greg Doolittle <gr3g@apple.com> > > Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt> >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d258c3ccbe70b2759612e240d1ba89f5ae9b0987..445133a3984cb3062a75e192e7ddbe8dc9c698f2 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2019-06-20 Daniel Bates <dabates@apple.com> >+ >+ [iOS] Evernote crashes when creating a note >+ https://bugs.webkit.org/show_bug.cgi?id=199083 >+ <rdar://problem/51759247> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a hack just for Evernote linked before iOS 13 that dynamically adds a placeholder -[WKContentView keyCommands] >+ method (it just calls super). Evernote swizzles the IPI -[WKContentView keyCommands], but this >+ method may not always be present in the WebKit binary following r240514. So, Evernote may end >+ up swizzling -[UIResponder keyCommands], but their implementation doesn't account for this >+ scenario and they end up crashing because they call an unrecognized selector. >+ >+ * UIProcess/Cocoa/VersionChecks.h: Add version check. >+ * UIProcess/ios/WKContentView.mm: >+ (keyCommandsPlaceHolderHackForEvernote): Added. >+ (-[WKContentView _commonInitializationWithProcessPool:configuration:]): Install the hack. >+ > 2019-05-16 Daniel Bates <dabates@apple.com> > > [iOS] Select all with existing range selection replaces range instead of selecting all text >diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.h b/Source/WebCore/platform/RuntimeApplicationChecks.h >index f22b7c6da6fd1cb5012286345e2d6e8ce36c1ed3..351f10274ce32bd5f0a26de5c0f4c3fc3892e601 100644 >--- a/Source/WebCore/platform/RuntimeApplicationChecks.h >+++ b/Source/WebCore/platform/RuntimeApplicationChecks.h >@@ -92,6 +92,7 @@ WEBCORE_EXPORT bool isNike(); > bool isMoviStarPlus(); > WEBCORE_EXPORT bool isFirefox(); > WEBCORE_EXPORT bool isAppleApplication(); >+WEBCORE_EXPORT bool isEvernote(); > > } // IOSApplication > >diff --git a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >index 54238cda018ad1fc8c8d4e3dcc4a2ea7a2644f5d..bcec3d5f590f11640194ba9b2dfea722ea0ca111 100644 >--- a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >+++ b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm >@@ -294,6 +294,12 @@ bool IOSApplication::isAppleApplication() > return isAppleApplication; > } > >+bool IOSApplication::isEvernote() >+{ >+ static bool isEvernote = applicationBundleIsEqualTo("com.evernote.iPhone.Evernote"_s); >+ return isEvernote; >+} >+ > #endif > > } // namespace WebCore >diff --git a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >index ed2ac70d08b27ff857d2d8c5c968dec8196debaf..48adb87e537e24f33abbf7accebefd410edb4358 100644 >--- a/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >+++ b/Source/WebKit/UIProcess/Cocoa/VersionChecks.h >@@ -73,6 +73,7 @@ enum class SDKVersion : uint32_t { > FirstWithExceptionsForRelatedWebViewsUsingDifferentDataStores = DYLD_IOS_VERSION_FIRST_WITH_EXCEPTIONS_FOR_RELATED_WEBVIEWS_USING_DIFFERENT_DATA_STORES, > FirstWithModernCompabilityModeByDefault = DYLD_IOS_VERSION_FIRST_WITH_MODERN_COMPATIBILITY_MODE_BY_DEFAULT, > FirstThatHasUIContextMenuInteraction = DYLD_IOS_VERSION_13_0, >+ FirstWhereWKContentViewDoesNotOverrideKeyCommands = DYLD_IOS_VERSION_13_0, > #elif PLATFORM(MAC) > FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11, > FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13, >diff --git a/Source/WebKit/UIProcess/ios/WKContentView.mm b/Source/WebKit/UIProcess/ios/WKContentView.mm >index fe54df8766c6426605558c8d0b8fc435e75dd513..0bfffde80382d6b3a61e5c179be8dae9a5eb9648 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentView.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentView.mm >@@ -60,7 +60,9 @@ > #import <WebCore/NotImplemented.h> > #import <WebCore/PlatformScreen.h> > #import <WebCore/Quirks.h> >+#import <WebCore/RuntimeApplicationChecks.h> > #import <WebCore/VelocityData.h> >+#import <objc/message.h> > #import <pal/spi/cocoa/QuartzCoreSPI.h> > #import <wtf/RetainPtr.h> > #import <wtf/text/TextStream.h> >@@ -141,6 +143,22 @@ @implementation WKContentView { > RetainPtr<CGPDFDocumentRef> _printedDocument; > } > >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ >+// Evernote expects to swizzle -keyCommands on WKContentView or they crash. Remove this hack >+// as soon as reasonably possible. See <rdar://problem/51759247>. >+static NSArray *keyCommandsPlaceHolderHackForEvernote(id self, SEL _cmd) >+{ >+ struct objc_super super { 0 }; >+ super.receiver = self; >+ super.super_class = class_getSuperclass(object_getClass(self)); >+ >+ using SuperKeyCommandsFunction = NSArray *(*)(struct objc_super*, SEL); >+ return reinterpret_cast<SuperKeyCommandsFunction>(&objc_msgSendSuper)(&super, @selector(keyCommands)); >+} >+ >+#endif >+ > - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)processPool configuration:(Ref<API::PageConfiguration>&&)configuration > { > ASSERT(_pageClient); >@@ -187,6 +205,11 @@ - (instancetype)_commonInitializationWithProcessPool:(WebKit::WebProcessPool&)pr > [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:[UIApplication sharedApplication]]; > [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationDidBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:[UIApplication sharedApplication]]; > >+#if USE(UIKIT_KEYBOARD_ADDITIONS) >+ if (WebCore::IOSApplication::isEvernote() && !linkedOnOrAfter(WebKit::SDKVersion::FirstWhereWKContentViewDoesNotOverrideKeyCommands)) >+ class_addMethod(self.class, @selector(keyCommands), reinterpret_cast<IMP>(&keyCommandsPlaceHolderHackForEvernote), method_getTypeEncoding(class_getInstanceMethod(self.class, @selector(keyCommands)))); >+#endif >+ > return self; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199083
:
372595
|
372596