Bug 184865

Summary: Web Inspector: WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer
Product: WebKit Reporter: Matt Baker <mattbaker>
Component: Web InspectorAssignee: Matt Baker <mattbaker>
Status: RESOLVED FIXED    
Severity: Critical CC: bburg, commit-queue, ews-watchlist, inspector-bugzilla-changes, webkit-bug-importer
Priority: P1 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: OS X 10.11   
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews204 for win-future none

Description Matt Baker 2018-04-21 13:25:30 PDT
Summary:
WebInspectorProxy releases WKWebInspectorProxyObjCAdapter without removing corresponding observer.

As an optimization we keep the Inspector WebView alive for a minute after it's been closed, so that it can be reused if reopened quickly. If the Inspector is reopened within this time, WebInspectorProxy::platformCreateFrontendPage() will be called while the WKWebInspectorProxyObjCAdapter still exists. It then gets recreated, causing the original instance to be released while still registered as a a notification observer.

Prior to macOS 10.12, NSNotificationCenter didn't perform any sanity checks on observers before dispatching notifications, resulting in an access violation.
Comment 1 Matt Baker 2018-04-21 13:25:45 PDT
<rdar://problem/37764960>
Comment 2 Matt Baker 2018-04-21 13:29:10 PDT
Created attachment 338536 [details]
Patch
Comment 3 Matt Baker 2018-04-22 12:36:54 PDT
Created attachment 338558 [details]
Patch
Comment 4 EWS Watchlist 2018-04-22 14:14:18 PDT
Comment on attachment 338558 [details]
Patch

Attachment 338558 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/7406043

New failing tests:
http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html
Comment 5 EWS Watchlist 2018-04-22 14:14:29 PDT
Created attachment 338559 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 6 BJ Burg 2018-04-22 15:37:35 PDT
Comment on attachment 338558 [details]
Patch

r=me
Comment 7 WebKit Commit Bot 2018-04-22 16:03:50 PDT
Comment on attachment 338558 [details]
Patch

Clearing flags on attachment: 338558

Committed r230903: <https://trac.webkit.org/changeset/230903>
Comment 8 WebKit Commit Bot 2018-04-22 16:03:51 PDT
All reviewed patches have been landed.  Closing bug.