Changeset 189816 in webkit


Ignore:
Timestamp:
Sep 15, 2015 11:36:04 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Watch Expressions uncaught exceptions on page reload
https://bugs.webkit.org/show_bug.cgi?id=149150

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-09-15
Reviewed by Brian Burg.

Instead of waiting 50ms to Resume, when the page navigates
Resume immediately. This ensures nobody is using a stale
activeCallFrame after the navigation.

Also clean up the manager a bit by removing some deletes.

  • UserInterface/Controllers/DebuggerManager.js:

(WebInspector.DebuggerManager.restoreBreakpointsSoon):
(WebInspector.DebuggerManager.prototype.reset):
(WebInspector.DebuggerManager.prototype.debuggerDidPause):
(WebInspector.DebuggerManager.prototype.debuggerDidResume):
(WebInspector.DebuggerManager.prototype._mainResourceDidChange):
(WebInspector.DebuggerManager.prototype._didResumeInternal):
(WebInspector.DebuggerManager.prototype._associateBreakpointsWithSourceCode):
(WebInspector.DebuggerManager.prototype.debuggerDidResume.delayedWork): Deleted.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r189815 r189816  
     12015-09-15  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Watch Expressions uncaught exceptions on page reload
     4        https://bugs.webkit.org/show_bug.cgi?id=149150
     5
     6        Reviewed by Brian Burg.
     7
     8        Instead of waiting 50ms to Resume, when the page navigates
     9        Resume immediately. This ensures nobody is using a stale
     10        activeCallFrame after the navigation.
     11
     12        Also clean up the manager a bit by removing some deletes.
     13
     14        * UserInterface/Controllers/DebuggerManager.js:
     15        (WebInspector.DebuggerManager.restoreBreakpointsSoon):
     16        (WebInspector.DebuggerManager.prototype.reset):
     17        (WebInspector.DebuggerManager.prototype.debuggerDidPause):
     18        (WebInspector.DebuggerManager.prototype.debuggerDidResume):
     19        (WebInspector.DebuggerManager.prototype._mainResourceDidChange):
     20        (WebInspector.DebuggerManager.prototype._didResumeInternal):
     21        (WebInspector.DebuggerManager.prototype._associateBreakpointsWithSourceCode):
     22        (WebInspector.DebuggerManager.prototype.debuggerDidResume.delayedWork): Deleted.
     23
    1242015-09-15  Joseph Pecoraro  <pecoraro@apple.com>
    225
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js

    r189002 r189816  
    3939        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, this._breakpointEditablePropertyDidChange, this);
    4040
     41        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     42
    4143        window.addEventListener("pagehide", this._inspectorClosing.bind(this));
    4244
     
    7779            for (var cookie of this._breakpointsSetting.value)
    7880                this.addBreakpoint(new WebInspector.Breakpoint(cookie));
    79             delete this._restoringBreakpoints;
     81            this._restoringBreakpoints = false;
    8082        }
    8183
     
    444446        }
    445447
    446         delete this._ignoreBreakpointDisplayLocationDidChangeEvent;
     448        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
    447449
    448450        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptsCleared);
     
    458460        if (this._delayedResumeTimeout) {
    459461            clearTimeout(this._delayedResumeTimeout);
    460             delete this._delayedResumeTimeout;
     462            this._delayedResumeTimeout = undefined;
    461463        }
    462464
     
    498500        // Called from WebInspector.DebuggerObserver.
    499501
    500         function delayedWork()
    501         {
    502             delete this._delayedResumeTimeout;
    503 
    504             this._paused = false;
    505             this._callFrames = null;
    506             this._activeCallFrame = null;
    507 
    508             this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
    509             this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange);
    510             this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
    511         }
    512 
    513502        // We delay clearing the state and firing events so the user interface does not flash
    514503        // between brief steps or successive breakpoints.
    515         this._delayedResumeTimeout = setTimeout(delayedWork.bind(this), 50);
     504        this._delayedResumeTimeout = setTimeout(this._didResumeInternal.bind(this), 50);
    516505    }
    517506
     
    811800    }
    812801
     802    _mainResourceDidChange(event)
     803    {
     804        if (!event.target.isMainFrame())
     805            return;
     806
     807        this._didResumeInternal();
     808    }
     809
     810    _didResumeInternal()
     811    {
     812        if (!this._activeCallFrame)
     813            return;
     814
     815        if (this._delayedResumeTimeout) {
     816            clearTimeout(this._delayedResumeTimeout);
     817            this._delayedResumeTimeout = undefined;
     818        }
     819
     820        this._paused = false;
     821        this._callFrames = null;
     822        this._activeCallFrame = null;
     823
     824        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
     825        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange);
     826        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
     827    }
     828
    813829    _updateBreakOnExceptionsState()
    814830    {
     
    872888        }
    873889
    874         delete this._ignoreBreakpointDisplayLocationDidChangeEvent;
     890        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
    875891    }
    876892};
Note: See TracChangeset for help on using the changeset viewer.