Skip to content

Instantly share code, notes, and snippets.

@jarek-foksa
Created February 25, 2015 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarek-foksa/93cc9e494ec595620d9e to your computer and use it in GitHub Desktop.
Save jarek-foksa/93cc9e494ec595620d9e to your computer and use it in GitHub Desktop.

In order to improve the (re)load time of Safari Web Inspector you have to modify /System/Library/PrivateFrameworks/WebInspectorUI.framework/Versions/A/Resources/Main.js file.

Comment or remove the following three lines (TimelineManager.js in the unminified source):

WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._startAutoRecording, this);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);

Reimplement WebInspector.dispatchMessageFromBackend method (Main.js in the unminified source) as follows:

WebInspector.dispatchMessageFromBackend = function(message) {
  // Enforce asynchronous interaction between the backend and the frontend by queueing messages.
  // The messages are dequeued on a zero delay timeout.
 
  this.messagesToDispatch.push(message);
 
  if (message.method == 'Page.frameStartedLoading') {
    this._isLoading = true;
    this.consoleContentView._clearLog();
    this.quickConsole.prompt.text = '';
  }
  else if (message.method == 'Page.frameStoppedLoading') {
    this._isLoading = false;
  }
 
  if (this._dispatchTimeout || this._isLoading) {
    return;
  }
 
  this._dispatchTimeout = setTimeout(this.dispatchNextQueuedMessageFromBackend.bind(this), 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment