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

Changeset 181437 in webkit


Ignore:
Timestamp:
Mar 12, 2015, 9:10:00 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Console Errors during provisional document loads get lost with "Clear Log on Reload"
https://bugs.webkit.org/show_bug.cgi?id=142603

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-03-12
Reviewed by Timothy Hatcher.

  • UserInterface/Views/LogContentView.js:

(WebInspector.LogContentView.prototype._messageAdded):
(WebInspector.LogContentView.prototype._provisionalLoadStarted):
Detect a provisional load has started to start save messages that come in at this time.

(WebInspector.LogContentView.prototype._sessionStarted):
Reappend provisional load messages if we auto-cleared.

(WebInspector.LogContentView.prototype._reappendProvisionalMessages):
(WebInspector.LogContentView.prototype._clearProvisionalState):
Helpers for dealing with the provisional loading state.

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r181426 r181437  
     12015-03-12  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Console Errors during provisional document loads get lost with "Clear Log on Reload"
     4        https://bugs.webkit.org/show_bug.cgi?id=142603
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        * UserInterface/Views/LogContentView.js:
     9        (WebInspector.LogContentView.prototype._messageAdded):
     10        (WebInspector.LogContentView.prototype._provisionalLoadStarted):
     11        Detect a provisional load has started to start save messages that come in at this time.
     12
     13        (WebInspector.LogContentView.prototype._sessionStarted):
     14        Reappend provisional load messages if we auto-cleared.
     15
     16        (WebInspector.LogContentView.prototype._reappendProvisionalMessages):
     17        (WebInspector.LogContentView.prototype._clearProvisionalState):
     18        Helpers for dealing with the provisional loading state.
     19
    1202015-03-11  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js

    r181185 r181437  
    3131    this._selectedMessages = [];
    3232
     33    // FIXME: Try to use a marker, instead of a list of messages that get re-added.
     34    this._provisionalMessages = [];
     35
    3336    this.element.classList.add(WebInspector.LogContentView.StyleClassName);
    3437
     
    8992    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, this._previousMessageRepeatCountUpdated, this);
    9093    WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.ActiveLogCleared, this._activeLogCleared, this);
     94
     95    WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
    9196};
    9297
     
    311316        if (this._clearLogOnReloadSetting.value)  {
    312317            this._clearLog();
     318            this._reappendProvisionalMessages();
    313319            return;
    314320        }
    315321
    316322        this._logViewController.startNewSession();
     323
     324        this._clearProvisionalState();
    317325    },
    318326
    319327    _messageAdded: function(event)
    320328    {
     329        if (this._startedProvisionalLoad)
     330            this._provisionalMessages.push(event.data.message);
     331
    321332        var message = this._logViewController.appendConsoleMessage(event.data.message);
    322333        if (message.type !== WebInspector.ConsoleMessage.MessageType.EndGroup)
     
    970981
    971982        this._ensureMessageIsVisible(this._selectedSearchMatch.message);
     983    },
     984
     985    _provisionalLoadStarted: function()
     986    {
     987        this._startedProvisionalLoad = true;
     988    },
     989
     990    _reappendProvisionalMessages: function()
     991    {
     992        if (!this._startedProvisionalLoad)
     993            return;
     994
     995        this._startedProvisionalLoad = false;
     996
     997        for (var provisionalMessage of this._provisionalMessages) {
     998            var message = this._logViewController.appendConsoleMessage(provisionalMessage);
     999            if (message.type !== WebInspector.ConsoleMessage.MessageType.EndGroup)
     1000                this._filterMessages([message.toMessageElement()]);
     1001        }
     1002
     1003        this._provisionalMessages = [];
     1004    },
     1005
     1006    _clearProvisionalState: function()
     1007    {
     1008        this._startedProvisionalLoad = false;
     1009        this._provisionalMessages = [];       
    9721010    }
    9731011};
Note: See TracChangeset for help on using the changeset viewer.