Bug 163839 - [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit)
Summary: [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P1 Critical
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-21 22:25 PDT by Darin Adler
Modified: 2016-10-22 09:29 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.53 KB, patch)
2016-10-21 22:33 PDT, Darin Adler
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.