| Index: chrome_linux/resources/inspector/ResourcesPanel.js
|
| ===================================================================
|
| --- chrome_linux/resources/inspector/ResourcesPanel.js (revision 237140)
|
| +++ chrome_linux/resources/inspector/ResourcesPanel.js (working copy)
|
| @@ -186,7 +186,7 @@
|
| this._innerView.show(this.element);},_metadataReceived:function(errorCode,metadata)
|
| {if(errorCode||!metadata)
|
| return;if(this._content){if(!this._content.updateMetadata(metadata))
|
| -return;var sourceFrame=(this._innerView);this._content.requestContent(sourceFrame.setContent.bind(sourceFrame));}else{this._innerView.detach();this._content=new WebInspector.FileContentView.FileContentProvider(this._file,metadata);this._innerView=new WebInspector.SourceFrame(this._content);this._innerView.show(this.element);}},refresh:function()
|
| +return;var sourceFrame=(this._innerView);this._content.requestContent(sourceFrame.setContent.bind(sourceFrame));}else{this._innerView.detach();this._content=new WebInspector.FileContentView.FileContentProvider(this._file,metadata);var sourceFrame=new WebInspector.SourceFrame(this._content);sourceFrame.setHighlighterType(this._file.resourceType.canonicalMimeType());this._innerView=sourceFrame;this._innerView.show(this.element);}},refresh:function()
|
| {if(!this._innerView)
|
| return;if(this._file.isTextFile)
|
| this._file.requestMetadata(this._metadataReceived.bind(this));},__proto__:WebInspector.View.prototype}
|
| @@ -196,8 +196,8 @@
|
| {return this._file.url;},contentType:function()
|
| {return this._file.resourceType;},requestContent:function(callback)
|
| {var size=(this._metadata.size);this._file.requestFileContent(true,0,size,this._charset||"",this._fileContentReceived.bind(this,callback));},_fileContentReceived:function(callback,errorCode,content,base64Encoded,charset)
|
| -{if(errorCode||!content){callback(null,false,"");return;}
|
| -this._charset=charset;callback(content,false,this.contentType().canonicalMimeType());},searchInContent:function(query,caseSensitive,isRegex,callback)
|
| +{if(errorCode||!content){callback(null);return;}
|
| +this._charset=charset;callback(content);},searchInContent:function(query,caseSensitive,isRegex,callback)
|
| {setTimeout(callback.bind(null,[]),0);},updateMetadata:function(metadata)
|
| {if(this._metadata.modificationTime>=metadata.modificationTime)
|
| return false;this._metadata=metadata.modificationTime;return true;}};WebInspector.FileSystemView=function(fileSystem)
|
| @@ -238,12 +238,12 @@
|
| {if(this._entry!=this._entry.fileSystem.root)
|
| this.parent.refresh();},__proto__:TreeElement.prototype};WebInspector.ResourcesPanel=function(database)
|
| {WebInspector.Panel.call(this,"resources");this.registerRequiredCSS("resourcesPanel.css");WebInspector.settings.resourcesLastSelectedItem=WebInspector.settings.createSetting("resourcesLastSelectedItem",{});this.createSidebarViewWithTree();this.sidebarElement.addStyleClass("outline-disclosure");this.sidebarElement.addStyleClass("filter-all");this.sidebarElement.addStyleClass("children");this.sidebarElement.addStyleClass("small");this.sidebarTreeElement.removeStyleClass("sidebar-tree");this.resourcesListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Frames"),"Frames",["frame-storage-tree-item"]);this.sidebarTree.appendChild(this.resourcesListTreeElement);this.databasesListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Web SQL"),"Databases",["database-storage-tree-item"]);this.sidebarTree.appendChild(this.databasesListTreeElement);this.indexedDBListTreeElement=new WebInspector.IndexedDBTreeElement(this);this.sidebarTree.appendChild(this.indexedDBListTreeElement);this.localStorageListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Local Storage"),"LocalStorage",["domstorage-storage-tree-item","local-storage"]);this.sidebarTree.appendChild(this.localStorageListTreeElement);this.sessionStorageListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Session Storage"),"SessionStorage",["domstorage-storage-tree-item","session-storage"]);this.sidebarTree.appendChild(this.sessionStorageListTreeElement);this.cookieListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Cookies"),"Cookies",["cookie-storage-tree-item"]);this.sidebarTree.appendChild(this.cookieListTreeElement);this.applicationCacheListTreeElement=new WebInspector.StorageCategoryTreeElement(this,WebInspector.UIString("Application Cache"),"ApplicationCache",["application-cache-storage-tree-item"]);this.sidebarTree.appendChild(this.applicationCacheListTreeElement);if(WebInspector.experimentsSettings.fileSystemInspection.isEnabled()){this.fileSystemListTreeElement=new WebInspector.FileSystemListTreeElement(this);this.sidebarTree.appendChild(this.fileSystemListTreeElement);}
|
| -this.storageViews=this.splitView.mainElement;this.storageViews.addStyleClass("diff-container");this.storageViewStatusBarItemsContainer=document.createElement("div");this.storageViewStatusBarItemsContainer.className="status-bar-items";this._databaseTableViews=new Map();this._databaseQueryViews=new Map();this._databaseTreeElements=new Map();this._domStorageViews=new Map();this._domStorageTreeElements=new Map();this._cookieViews={};this._domains={};this.sidebarElement.addEventListener("mousemove",this._onmousemove.bind(this),false);this.sidebarElement.addEventListener("mouseout",this._onmouseout.bind(this),false);function viewGetter()
|
| +var mainElement=this.splitView.mainElement;this.storageViews=mainElement.createChild("div","resources-main");var statusBarContainer=mainElement.createChild("div","resources-status-bar");this.storageViewStatusBarItemsContainer=statusBarContainer.createChild("div","status-bar");this.storageViews.addStyleClass("diff-container");this._databaseTableViews=new Map();this._databaseQueryViews=new Map();this._databaseTreeElements=new Map();this._domStorageViews=new Map();this._domStorageTreeElements=new Map();this._cookieViews={};this._domains={};this.sidebarElement.addEventListener("mousemove",this._onmousemove.bind(this),false);this.sidebarElement.addEventListener("mouseout",this._onmouseout.bind(this),false);function viewGetter()
|
| {return this.visibleView;}
|
| WebInspector.GoToLineDialog.install(this,viewGetter.bind(this));if(WebInspector.resourceTreeModel.cachedResourcesLoaded())
|
| this._cachedResourcesLoaded();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._loadEventFired,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded,this._cachedResourcesLoaded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources,this._resetWithFrames,this);WebInspector.databaseModel.databases().forEach(this._addDatabase.bind(this));WebInspector.databaseModel.addEventListener(WebInspector.DatabaseModel.Events.DatabaseAdded,this._databaseAdded,this);}
|
| -WebInspector.ResourcesPanel.prototype={get statusBarItems()
|
| -{return[this.storageViewStatusBarItemsContainer];},wasShown:function()
|
| +WebInspector.ResourcesPanel.prototype={canSearch:function()
|
| +{return false;},wasShown:function()
|
| {WebInspector.Panel.prototype.wasShown.call(this);this._initialize();},_initialize:function()
|
| {if(!this._initialized&&this.isShowing()&&this._cachedResourcesWereLoaded){this._populateResourceTree();this._populateDOMStorageTree();this._populateApplicationCacheTree();this.indexedDBListTreeElement._initialize();if(WebInspector.experimentsSettings.fileSystemInspection.isEnabled())
|
| this.fileSystemListTreeElement._initialize();this._initDefaultSelection();this._initialized=true;}},_loadEventFired:function()
|
| @@ -289,16 +289,15 @@
|
| return;var wasSelected=treeElement.selected;var parentListTreeElement=treeElement.parent;parentListTreeElement.removeChild(treeElement);if(wasSelected)
|
| parentListTreeElement.select();this._domStorageTreeElements.remove(treeElement);this._domStorageViews.remove(domStorage);},selectDatabase:function(database)
|
| {if(database){this._showDatabase(database);this._databaseTreeElements.get(database).select();}},selectDOMStorage:function(domStorage)
|
| -{if(domStorage){this._showDOMStorage(domStorage);this._domStorageTreeElements.get(domStorage).select();}},canShowAnchorLocation:function(anchor)
|
| -{return!!WebInspector.resourceForURL(anchor.href);},showAnchorLocation:function(anchor)
|
| -{var resource=WebInspector.resourceForURL(anchor.href);this.showResource(resource,anchor.lineNumber);},showResource:function(resource,line,column)
|
| +{if(domStorage){this._showDOMStorage(domStorage);this._domStorageTreeElements.get(domStorage).select();}},showAnchorLocation:function(anchor)
|
| +{var resource=WebInspector.resourceForURL(anchor.href);if(!resource)
|
| +return false;this.showResource(resource,anchor.lineNumber);WebInspector.inspectorView.setCurrentPanel(this);return true;},showResource:function(resource,line,column)
|
| {var resourceTreeElement=this._findTreeElementForResource(resource);if(resourceTreeElement)
|
| resourceTreeElement.revealAndSelect(true);if(typeof line==="number"){var view=this._resourceViewForResource(resource);if(view.canHighlightPosition())
|
| view.highlightPosition(line,column);}
|
| return true;},_showResourceView:function(resource)
|
| {var view=this._resourceViewForResource(resource);if(!view){this.visibleView.detach();return;}
|
| -if(view.searchCanceled)
|
| -view.searchCanceled();this._innerShowView(view);},_resourceViewForResource:function(resource)
|
| +this._innerShowView(view);},_resourceViewForResource:function(resource)
|
| {if(WebInspector.ResourceView.hasTextContent(resource)){var treeElement=this._findTreeElementForResource(resource);if(!treeElement)
|
| return null;return treeElement.sourceView();}
|
| return WebInspector.ResourceView.nonSourceViewForResource(resource);},_showDatabase:function(database,tableName)
|
| @@ -345,47 +344,7 @@
|
| if(this._applicationCacheViews[frameId])
|
| this._applicationCacheViews[frameId].updateStatus(status);},_applicationCacheNetworkStateChanged:function(event)
|
| {var isNowOnline=event.data;for(var manifestURL in this._applicationCacheViews)
|
| -this._applicationCacheViews[manifestURL].updateNetworkState(isNowOnline);},sidebarResized:function(event)
|
| -{var width=event.data;this.storageViewStatusBarItemsContainer.style.left=width+"px";},performSearch:function(query,shouldJump)
|
| -{this._resetSearchResults();var regex=WebInspector.SourceFrame.createSearchRegex(query);var totalMatchesCount=0;function addMatchesToResource(resource,matchesCount)
|
| -{this._findTreeElementForResource(resource).searchMatchesFound(matchesCount);totalMatchesCount+=matchesCount;}
|
| -function searchInResourcesCallback(error,result)
|
| -{if(error)
|
| -return;for(var i=0;i<result.length;i++){var searchResult=result[i];var frameTreeElement=this._treeElementForFrameId[searchResult.frameId];if(!frameTreeElement)
|
| -continue;var resource=frameTreeElement.resourceByURL(searchResult.url);if(!resource)
|
| -continue;addMatchesToResource.call(this,resource,searchResult.matchesCount)}
|
| -if(!--callbacksLeft)
|
| -searchFinished.call(this);}
|
| -function searchInContentCallback(resource,result)
|
| -{addMatchesToResource.call(this,resource,result.length);if(!--callbacksLeft)
|
| -searchFinished.call(this);}
|
| -function searchFinished()
|
| -{WebInspector.searchController.updateSearchMatchesCount(totalMatchesCount,this);this._searchController=new WebInspector.ResourcesSearchController(this.resourcesListTreeElement,totalMatchesCount);if(shouldJump&&this.sidebarTree.selectedTreeElement&&this.sidebarTree.selectedTreeElement.searchMatchesCount)
|
| -this.jumpToNextSearchResult();}
|
| -var frames=WebInspector.resourceTreeModel.frames();var callbacksLeft=1+frames.length;for(var i=0;i<frames.length;++i){var mainResource=frames[i].mainResource;mainResource.searchInContent(regex.source,!regex.ignoreCase,true,searchInContentCallback.bind(this,mainResource));}
|
| -PageAgent.searchInResources(regex.source,!regex.ignoreCase,true,searchInResourcesCallback.bind(this));},_ensureViewSearchPerformed:function(callback)
|
| -{function viewSearchPerformedCallback(searchId)
|
| -{if(searchId!==this._lastViewSearchId)
|
| -return;this._viewSearchInProgress=false;callback();}
|
| -if(!this._viewSearchInProgress){if(!this.visibleView.hasSearchResults()){this._lastViewSearchId=this._lastViewSearchId?this._lastViewSearchId+1:0;this._viewSearchInProgress=true;this.visibleView.performSearch(this.currentQuery,false,viewSearchPerformedCallback.bind(this,this._lastViewSearchId));}else
|
| -callback();}},_showSearchResult:function(searchResult)
|
| -{this._lastSearchResultIndex=searchResult.index;this._lastSearchResultTreeElement=searchResult.treeElement;if(searchResult.treeElement!==this.sidebarTree.selectedTreeElement)
|
| -this.showResource(searchResult.treeElement.representedObject);function callback(searchId)
|
| -{if(this.sidebarTree.selectedTreeElement!==this._lastSearchResultTreeElement)
|
| -return;if(this._lastSearchResultIndex!=-1)
|
| -this.visibleView.jumpToSearchResult(this._lastSearchResultIndex);WebInspector.searchController.updateCurrentMatchIndex(searchResult.currentMatchIndex-1,this);}
|
| -this._ensureViewSearchPerformed(callback.bind(this));},_resetSearchResults:function()
|
| -{function callback(resourceTreeElement)
|
| -{resourceTreeElement._resetSearchResults();}
|
| -this._forAllResourceTreeElements(callback);if(this.visibleView&&this.visibleView.searchCanceled)
|
| -this.visibleView.searchCanceled();this._lastSearchResultTreeElement=null;this._lastSearchResultIndex=-1;this._viewSearchInProgress=false;},searchCanceled:function()
|
| -{function callback(resourceTreeElement)
|
| -{resourceTreeElement._updateErrorsAndWarningsBubbles();}
|
| -WebInspector.searchController.updateSearchMatchesCount(0,this);this._resetSearchResults();this._forAllResourceTreeElements(callback);},jumpToNextSearchResult:function()
|
| -{if(!this.currentSearchMatches)
|
| -return;var currentTreeElement=this.sidebarTree.selectedTreeElement;var nextSearchResult=this._searchController.nextSearchResult(currentTreeElement);this._showSearchResult(nextSearchResult);},jumpToPreviousSearchResult:function()
|
| -{if(!this.currentSearchMatches)
|
| -return;var currentTreeElement=this.sidebarTree.selectedTreeElement;var previousSearchResult=this._searchController.previousSearchResult(currentTreeElement);this._showSearchResult(previousSearchResult);},_forAllResourceTreeElements:function(callback)
|
| +this._applicationCacheViews[manifestURL].updateNetworkState(isNowOnline);},_forAllResourceTreeElements:function(callback)
|
| {var stop=false;for(var treeElement=this.resourcesListTreeElement;!stop&&treeElement;treeElement=treeElement.traverseNextTreeElement(false,this.resourcesListTreeElement,true)){if(treeElement instanceof WebInspector.FrameResourceTreeElement)
|
| stop=callback(treeElement);}},_findTreeElementForResource:function(resource)
|
| {function isAncestor(ancestor,object)
|
| @@ -424,8 +383,7 @@
|
| {return this._titleText;},set titleText(titleText)
|
| {this._titleText=titleText;this._updateTitle();},get subtitleText()
|
| {return this._subtitleText;},set subtitleText(subtitleText)
|
| -{this._subtitleText=subtitleText;this._updateSubtitle();},get searchMatchesCount()
|
| -{return 0;},__proto__:TreeElement.prototype}
|
| +{this._subtitleText=subtitleText;this._updateSubtitle();},__proto__:TreeElement.prototype}
|
| WebInspector.StorageCategoryTreeElement=function(storagePanel,categoryName,settingsKey,iconClasses,noIcon)
|
| {WebInspector.BaseStorageTreeElement.call(this,storagePanel,null,categoryName,iconClasses,false,noIcon);this._expandedSettingKey="resources"+settingsKey+"Expanded";WebInspector.settings[this._expandedSettingKey]=WebInspector.settings.createSetting(this._expandedSettingKey,settingsKey==="Frames");this._categoryName=categoryName;}
|
| WebInspector.StorageCategoryTreeElement.prototype={get itemURL()
|
| @@ -471,11 +429,7 @@
|
| {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems(this._resource);contextMenu.show();},_setBubbleText:function(x)
|
| {if(!this._bubbleElement){this._bubbleElement=document.createElement("div");this._bubbleElement.className="bubble";this._statusElement.appendChild(this._bubbleElement);}
|
| this._bubbleElement.textContent=x;},_resetBubble:function()
|
| -{if(this._bubbleElement){this._bubbleElement.textContent="";this._bubbleElement.removeStyleClass("search-matches");this._bubbleElement.removeStyleClass("warning");this._bubbleElement.removeStyleClass("error");}},_resetSearchResults:function()
|
| -{this._resetBubble();this._searchMatchesCount=0;},get searchMatchesCount()
|
| -{return this._searchMatchesCount;},searchMatchesFound:function(matchesCount)
|
| -{this._resetSearchResults();this._searchMatchesCount=matchesCount;this._setBubbleText(matchesCount);this._bubbleElement.addStyleClass("search-matches");var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
|
| -currentAncestor.expand();currentAncestor=currentAncestor.parent;}},_updateErrorsAndWarningsBubbles:function()
|
| +{if(this._bubbleElement){this._bubbleElement.textContent="";this._bubbleElement.removeStyleClass("warning");this._bubbleElement.removeStyleClass("error");}},_updateErrorsAndWarningsBubbles:function()
|
| {if(this._storagePanel.currentQuery)
|
| return;this._resetBubble();if(this._resource.warnings||this._resource.errors)
|
| this._setBubbleText(this._resource.warnings+this._resource.errors);if(this._resource.warnings)
|
| @@ -485,7 +439,7 @@
|
| this._sourceView.clearMessages();this._updateErrorsAndWarningsBubbles();},_consoleMessageAdded:function(event)
|
| {var msg=event.data;if(this._sourceView)
|
| this._sourceView.addMessage(msg);this._updateErrorsAndWarningsBubbles();},sourceView:function()
|
| -{if(!this._sourceView){this._sourceView=new WebInspector.ResourceSourceFrame(this._resource);if(this._resource.messages){for(var i=0;i<this._resource.messages.length;i++)
|
| +{if(!this._sourceView){var sourceFrame=new WebInspector.ResourceSourceFrame(this._resource);sourceFrame.setHighlighterType(this._resource.canonicalMimeType());this._sourceView=sourceFrame;if(this._resource.messages){for(var i=0;i<this._resource.messages.length;i++)
|
| this._sourceView.addMessage(this._resource.messages[i]);}}
|
| return this._sourceView;},__proto__:WebInspector.BaseStorageTreeElement.prototype}
|
| WebInspector.DatabaseTreeElement=function(storagePanel,database)
|
| @@ -633,34 +587,4 @@
|
| WebInspector.StorageCategoryView=function()
|
| {WebInspector.View.call(this);this.element.addStyleClass("storage-view");this._emptyView=new WebInspector.EmptyView("");this._emptyView.show(this.element);}
|
| WebInspector.StorageCategoryView.prototype={setText:function(text)
|
| -{this._emptyView.text=text;},__proto__:WebInspector.View.prototype}
|
| -WebInspector.ResourcesSearchController=function(rootElement,matchesCount)
|
| -{this._root=rootElement;this._matchesCount=matchesCount;this._traverser=new WebInspector.SearchResultsTreeElementsTraverser(rootElement);this._lastTreeElement=null;this._lastIndex=-1;}
|
| -WebInspector.ResourcesSearchController.prototype={nextSearchResult:function(currentTreeElement)
|
| -{if(!currentTreeElement)
|
| -return this._searchResult(this._traverser.first(),0,1);if(!currentTreeElement.searchMatchesCount)
|
| -return this._searchResult(this._traverser.next(currentTreeElement),0);if(this._lastTreeElement!==currentTreeElement||this._lastIndex===-1)
|
| -return this._searchResult(currentTreeElement,0);if(this._lastIndex===currentTreeElement.searchMatchesCount-1)
|
| -return this._searchResult(this._traverser.next(currentTreeElement),0,this._currentMatchIndex%this._matchesCount+1);return this._searchResult(currentTreeElement,this._lastIndex+1,this._currentMatchIndex+1);},previousSearchResult:function(currentTreeElement)
|
| -{if(!currentTreeElement){var treeElement=this._traverser.last();return this._searchResult(treeElement,treeElement.searchMatchesCount-1,this._matchesCount);}
|
| -if(currentTreeElement.searchMatchesCount&&this._lastTreeElement===currentTreeElement){if(this._lastIndex>0)
|
| -return this._searchResult(currentTreeElement,this._lastIndex-1,this._currentMatchIndex-1);else{var treeElement=this._traverser.previous(currentTreeElement);var currentMatchIndex=this._currentMatchIndex-1?this._currentMatchIndex-1:this._matchesCount;return this._searchResult(treeElement,treeElement.searchMatchesCount-1,currentMatchIndex);}}
|
| -var treeElement=this._traverser.previous(currentTreeElement)
|
| -return this._searchResult(treeElement,treeElement.searchMatchesCount-1);},_searchResult:function(treeElement,index,currentMatchIndex)
|
| -{this._lastTreeElement=treeElement;this._lastIndex=index;if(!currentMatchIndex)
|
| -currentMatchIndex=this._traverser.matchIndex(treeElement,index);this._currentMatchIndex=currentMatchIndex;return{treeElement:treeElement,index:index,currentMatchIndex:currentMatchIndex};}}
|
| -WebInspector.SearchResultsTreeElementsTraverser=function(rootElement)
|
| -{this._root=rootElement;}
|
| -WebInspector.SearchResultsTreeElementsTraverser.prototype={first:function()
|
| -{return this.next(this._root);},last:function()
|
| -{return this.previous(this._root);},next:function(startTreeElement)
|
| -{var treeElement=startTreeElement;do{treeElement=this._traverseNext(treeElement)||this._root;}while(treeElement!=startTreeElement&&!this._elementSearchMatchesCount(treeElement));return treeElement;},previous:function(startTreeElement)
|
| -{var treeElement=startTreeElement;do{treeElement=this._traversePrevious(treeElement)||this._lastTreeElement();}while(treeElement!=startTreeElement&&!this._elementSearchMatchesCount(treeElement));return treeElement;},matchIndex:function(startTreeElement,index)
|
| -{var matchIndex=1;var treeElement=this._root;while(treeElement!=startTreeElement){matchIndex+=this._elementSearchMatchesCount(treeElement);treeElement=this._traverseNext(treeElement)||this._root;if(treeElement===this._root)
|
| -return 0;}
|
| -return matchIndex+index;},_elementSearchMatchesCount:function(treeElement)
|
| -{return treeElement.searchMatchesCount;},_traverseNext:function(treeElement)
|
| -{return(treeElement.traverseNextTreeElement(false,this._root,true));},_traversePrevious:function(treeElement)
|
| -{return(treeElement.traversePreviousTreeElement(false,true));},_lastTreeElement:function()
|
| -{var treeElement=this._root;var nextTreeElement;while(nextTreeElement=this._traverseNext(treeElement))
|
| -treeElement=nextTreeElement;return treeElement;}}
|
| +{this._emptyView.text=text;},__proto__:WebInspector.View.prototype}
|
|
|