Bug 163839

Summary: [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit)
Product: WebKit Reporter: Darin Adler <darin>
Component: HTML EditingAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Critical CC: andersca, commit-queue, mitz
Priority: P1 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Darin Adler 2016-10-21 22:25:44 PDT
Seeing crashes in init_WebCreateFragment(WebCore::Document&, NSAttributedString*, WebCore::FragmentAndResources&).

Dan pointed out the likely cause:

The use of SOFT_LINK_FRAMEWORK(WebKitLegacy) seems incorrect. The macro is intended for use with frameworks installed directly in /System/Library/Frameworks. But WebKitLegacy is not installed in that location. In macOS it’s installed inside the WebKit umbrella framework, and in iOS it’s installed in /System/Library/PrivateFrameworks.
Comment 1 Darin Adler 2016-10-21 22:26:40 PDT
<rdar://problem/28187870>
Comment 2 Darin Adler 2016-10-21 22:27:18 PDT
I’m going to try this:

#if PLATFORM(IOS)
SOFT_LINK_PRIVATE_FRAMEWORK(WebKitLegacy)
#endif

#if PLATFORM(MAC)
SOFT_LINK_FRAMEWORK_IN_UMBRELLA(WebKit, WebKitLegacy)
#endif

But the real problem is that last time I didn’t test!
Comment 3 Darin Adler 2016-10-21 22:33:45 PDT
Created attachment 292464 [details]
Patch
Comment 4 Darin Adler 2016-10-21 22:34:32 PDT
I’ve uploaded a patch, but also seems critical this time that someone does some testing, ideally me. Maybe I can make a unit test? I am not set up for iOS development at the moment.
Comment 5 mitz 2016-10-22 00:03:31 PDT
Comment on attachment 292464 [details]
Patch

We should have a unit test that exercises this code path. However, such a test would not have caught this mistake, because when we run tests, we always have DYLD_FRAMEWORK_PATH pointing at a location that contains a WebKitLegacy.framework, so dyld never gets as far as to look for it in /System/Library/Frameworks and fail to find it there.

r=me because there’s no practical way to add a regression test for this.
Comment 6 WebKit Commit Bot 2016-10-22 09:29:22 PDT
Comment on attachment 292464 [details]
Patch

Clearing flags on attachment: 292464

Committed r207712: <http://trac.webkit.org/changeset/207712>
Comment 7 WebKit Commit Bot 2016-10-22 09:29:25 PDT
All reviewed patches have been landed.  Closing bug.