[webkit-changes] [WebKit/WebKit] d60bec: Web Inspector: Crash when opening the web inspecto...

Chris Dumez noreply at github.com
Tue Dec 3 08:41:13 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d60bec76831e181ddffbf50cbc80a709d821ec37
      https://github.com/WebKit/WebKit/commit/d60bec76831e181ddffbf50cbc80a709d821ec37
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2024-12-03 (Tue, 03 Dec 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
    M Source/WebKit/WebProcess/Inspector/WebInspectorUI.h

  Log Message:
  -----------
  Web Inspector: Crash when opening the web inspector for the first time
https://bugs.webkit.org/show_bug.cgi?id=283874
rdar://140796551

Reviewed by Devin Rousso.

In 284749 at main, I made WebInspectorUI::m_inspectedPageIdentifier a std::optional,
as part of making ObjectIdentifier non-nullable. Whenever m_inspectedPageIdentifier
was using to send IPC, I started dereferencing m_inspectedPageIdentifier, expecting
the identifier to always be valid when sending IPC. However, this assumption turned
out to be incorrect and it would cause us to dereference std::nullopt when opening
WebInspector on an empty tab (no page loaded).

To restore the pre-284749 at main behavior, I now null-check m_inspectedPageIdentifier
and use 0 as identifier for sending the IPC if m_inspectedPageIdentifier is std::nullopt.
This behaves exactly like prior to 284749 at main. I have verified locally that it makes
the crash go away and Web Inspector correctly opens up on the empty page.

* Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::updateConnection):
(WebKit::WebInspectorUI::frontendLoaded):
(WebKit::WebInspectorUI::startWindowDrag):
(WebKit::WebInspectorUI::bringToFront):
(WebKit::WebInspectorUI::closeWindow):
(WebKit::WebInspectorUI::reopen):
(WebKit::WebInspectorUI::resetState):
(WebKit::WebInspectorUI::setForcedAppearance):
(WebKit::WebInspectorUI::effectiveAppearanceDidChange):
(WebKit::WebInspectorUI::requestSetDockSide):
(WebKit::WebInspectorUI::changeAttachedWindowHeight):
(WebKit::WebInspectorUI::changeAttachedWindowWidth):
(WebKit::WebInspectorUI::changeSheetRect):
(WebKit::WebInspectorUI::openURLExternally):
(WebKit::WebInspectorUI::revealFileExternally):
(WebKit::WebInspectorUI::save):
(WebKit::WebInspectorUI::load):
(WebKit::WebInspectorUI::pickColorFromScreen):
(WebKit::WebInspectorUI::inspectedURLChanged):
(WebKit::WebInspectorUI::showCertificate):
(WebKit::WebInspectorUI::setInspectorPageDeveloperExtrasEnabled):
(WebKit::WebInspectorUI::sendMessageToBackend):
* Source/WebKit/WebProcess/Inspector/WebInspectorUI.h:

Canonical link: https://commits.webkit.org/287282@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list