Changeset 84483 in webkit
- Timestamp:
- Apr 21, 2011 4:43:42 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84481 r84483 1 2011-04-21 Pavel Feldman <pfeldman@google.com> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: persist local resource history between inspector / browser launches. 6 https://bugs.webkit.org/show_bug.cgi?id=58993 7 8 * inspector/front-end/Resource.js: 9 (WebInspector.Resource.prototype._restoreRevisions): 10 1 11 2011-04-20 Alexander Pavlov <apavlov@chromium.org> 2 12 -
trunk/Source/WebCore/inspector/front-end/NetworkManager.js
r84260 r84483 318 318 _createResource: function(identifier, frameId, loaderId, url, documentURL, stackTrace) 319 319 { 320 var resource = new WebInspector.Resource(identifier, url );320 var resource = new WebInspector.Resource(identifier, url, loaderId); 321 321 resource.documentURL = documentURL; 322 322 resource.frameId = frameId; 323 resource.loaderId = loaderId;324 323 resource.stackTrace = stackTrace; 325 324 return resource; -
trunk/Source/WebCore/inspector/front-end/Resource.js
r83987 r84483 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 WebInspector.Resource = function(identifier, url )28 WebInspector.Resource = function(identifier, url, loaderId) 29 29 { 30 30 this.identifier = identifier; 31 31 this.url = url; 32 this.loaderId = loaderId; 32 33 this._startTime = -1; 33 34 this._endTime = -1; … … 35 36 this._pendingContentCallbacks = []; 36 37 this.history = []; 38 39 this._restoreRevisions(); 37 40 } 38 41 … … 107 110 { 108 111 WebInspector.Resource._domainModelBindings[type] = binding; 112 } 113 114 WebInspector.Resource.clearRevisionHistory = function() 115 { 116 if (!window.localStorage) 117 return; 118 119 for (var key in window.localStorage) { 120 if (key.indexOf("resource-history|") === 0) 121 delete window.localStorage[key]; 122 } 109 123 } 110 124 … … 722 736 }, 723 737 724 addRevision: function(newContent )738 addRevision: function(newContent, timestamp, restoringHistory) 725 739 { 726 740 var revision = new WebInspector.ResourceRevision(this, this._content, this._contentTimestamp); … … 728 742 729 743 this._content = newContent; 730 this._contentTimestamp = new Date();744 this._contentTimestamp = timestamp || new Date(); 731 745 732 746 this.dispatchEventToListeners(WebInspector.Resource.Events.RevisionAdded, revision); 747 748 if (!restoringHistory) 749 this._persistRevision(); 750 }, 751 752 _persistRevision: function() 753 { 754 if (!window.localStorage) 755 return; 756 757 var url = this.url; 758 var loaderId = this.loaderId; 759 var timestamp = this._contentTimestamp.getTime(); 760 var content = this._content; 761 function persist() 762 { 763 var key = "resource-history|" + url + "|" + loaderId + "|" + timestamp; 764 window.localStorage[key] = content; 765 } 766 767 // Schedule async storage. 768 setTimeout(persist, 0); 769 }, 770 771 _restoreRevisions: function() 772 { 773 if (!window.localStorage) 774 return; 775 776 try { 777 var urlKey = "resource-history|" + this.url + "|" + this.loaderId + "|"; 778 779 var content = {}; 780 var timestamps = []; 781 for (var key in window.localStorage) { 782 if (key.indexOf(urlKey) !== 0) 783 continue; 784 var timestamp = parseInt(key.substring(urlKey.length)); 785 content[timestamp] = window.localStorage[key]; 786 timestamps.push(timestamp); 787 } 788 789 if (!timestamps.length) 790 return; 791 792 timestamps.sort(); 793 for (var i = 0; i < timestamps.length; ++i) { 794 var timestamp = timestamps[i]; 795 this.addRevision(content[timestamp], new Date(timestamp), true); 796 } 797 } catch(e) { 798 console.error(e.toString()); 799 } 733 800 }, 734 801 -
trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js
r83845 r84483 124 124 if (isMainFrame && this.resourceForURL(frame.url)) 125 125 WebInspector.mainResource = this.resourceForURL(frame.url); 126 127 if (isMainFrame) 128 WebInspector.Resource.clearRevisionHistory(); 126 129 }, 127 130 … … 300 303 _createResource: function(frame, url) 301 304 { 302 var resource = new WebInspector.Resource(null, url );305 var resource = new WebInspector.Resource(null, url, frame.loaderId); 303 306 resource.frameId = frame.id; 304 resource.loaderId = frame.loaderId;305 307 resource.documentURL = frame.url; 306 308 return resource; -
trunk/Source/WebCore/inspector/front-end/SourceCSSTokenizer.js
r74352 r84483 46 46 WebInspector.SourceTokenizer.call(this); 47 47 48 this._propertyKeywords = WebInspector.cssNameCompletions .keySet();48 this._propertyKeywords = WebInspector.cssNameCompletions ? WebInspector.cssNameCompletions.keySet() : {}; 49 49 50 50 this._valueKeywords = [
Note: See TracChangeset
for help on using the changeset viewer.