Bug 234965

Summary: Web Inspector: Inspector::RemoteInspector::receivedSetupMessage() falls through ASSERT_NOT_REACHED()
Product: WebKit Reporter: David Kilzer (:ddkilzer) <ddkilzer>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=234971
Bug Depends on: 234932    
Bug Blocks:    

Description David Kilzer (:ddkilzer) 2022-01-07 10:33:40 PST
Inspector::RemoteInspector::receivedSetupMessage() falls through ASSERT_NOT_REACHED().

Since there are many other early returns in this method, it seems like there should be an early return after ASSERT_NOT_REACHED() as well.

void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
{
    [...]
    if (is<RemoteInspectionTarget>(target)) {
        bool isAutomaticInspection = m_automaticInspectionCandidateTargetIdentifier == target->targetIdentifier();

        if (!connectionToTarget->setup(isAutomaticInspection, automaticallyPause)) {
            connectionToTarget->close();
            return;
        }
        m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
    } else if (is<RemoteAutomationTarget>(target)) {
        if (!connectionToTarget->setup()) {
            connectionToTarget->close();
            return;
        }
        m_targetConnectionMap.set(targetIdentifier, WTFMove(connectionToTarget));
    } else
        ASSERT_NOT_REACHED();

    updateHasActiveDebugSession();
}

See Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm.
Comment 1 Radar WebKit Bug Importer 2022-01-07 10:33:54 PST
<rdar://problem/87260301>