⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 292075 in webkit


Ignore:
Timestamp:
Mar 29, 2022, 3:10:45 PM (5 years ago)
Author:
Patrick Angle
Message:

Web Inspector: Add check for null entryScope in JSC::Debugger::detach
​https://bugs.webkit.org/show_bug.cgi?id=238518

Reviewed by Devin Rousso.

A virtual machine may not always have an entryScope, which can occur if a JSGlobalObject is being destructed
(which will call into JSC::Debugger::Detach) before a VMEntryScope is created or after a VMEntryScope has
fallen out of scope, causing the VM's entryScope to be null again. In the original internal issue that led to
finding this, this most commonly occurred in conjunction with page refresh while the debugger was paused.

Because it is possible that we were previously paused in the VM that now has no entryScope, we should go ahead
and unpause.

  • debugger/Debugger.cpp:

(JSC::Debugger::detach):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r292037 r292075  
     12022-03-29  Patrick Angle  <pangle@apple.com>
     2
     3        Web Inspector: Add check for null `entryScope` in JSC::Debugger::detach
     4        https://bugs.webkit.org/show_bug.cgi?id=238518
     5
     6        Reviewed by Devin Rousso.
     7
     8        A virtual machine may not always have an `entryScope`, which can occur if a `JSGlobalObject` is being destructed
     9        (which will call into `JSC::Debugger::Detach`) before a `VMEntryScope` is created or after a `VMEntryScope` has
     10        fallen out of scope, causing the VM's `entryScope` to be null again. In the original internal issue that led to
     11        finding this, this most commonly occurred in conjunction with page refresh while the debugger was paused.
     12
     13        Because it is possible that we were previously paused in the VM that now has no `entryScope`, we should go ahead
     14        and unpause.
     15
     16        * debugger/Debugger.cpp:
     17        (JSC::Debugger::detach):
     18
    1192022-03-29  Patrick Angle  <pangle@apple.com>
    220
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r291517 r292075  
    172172    JSLockHolder locker(vm);
    173173
    174     if (m_isPaused && m_currentCallFrame && vm.entryScope->globalObject() == globalObject) {
     174    if (m_isPaused && m_currentCallFrame && (!vm.isEntered() || vm.entryScope->globalObject() == globalObject)) {
    175175        m_currentCallFrame = nullptr;
    176176        m_pauseOnCallFrame = nullptr;
Note: See TracChangeset for help on using the changeset viewer.