Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: chrome_linux/resources/inspector/ScriptsPanel.js

Issue 85333005: Update reference builds to Chrome 32.0.1700.19 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 WebInspector.JavaScriptBreakpointsSidebarPane=function(breakpointManager,showSou rceLineDelegate)
2 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Breakpoints"));this.r egisterRequiredCSS("breakpointsList.css");this._breakpointManager=breakpointMana ger;this._showSourceLineDelegate=showSourceLineDelegate;this.listElement=documen t.createElement("ol");this.listElement.className="breakpoint-list";this.emptyEle ment=document.createElement("div");this.emptyElement.className="info";this.empty Element.textContent=WebInspector.UIString("No Breakpoints");this.bodyElement.app endChild(this.emptyElement);this._items=new Map();var breakpointLocations=this._ breakpointManager.allBreakpointLocations();for(var i=0;i<breakpointLocations.len gth;++i)
3 this._addBreakpoint(breakpointLocations[i].breakpoint,breakpointLocations[i].uiL ocation);this._breakpointManager.addEventListener(WebInspector.BreakpointManager .Events.BreakpointAdded,this._breakpointAdded,this);this._breakpointManager.addE ventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved,this._break pointRemoved,this);this.emptyElement.addEventListener("contextmenu",this._emptyE lementContextMenu.bind(this),true);}
4 WebInspector.JavaScriptBreakpointsSidebarPane.prototype={_emptyElementContextMen u:function(event)
5 {var contextMenu=new WebInspector.ContextMenu(event);var breakpointActive=WebIns pector.debuggerModel.breakpointsActive();var breakpointActiveTitle=breakpointAct ive?WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Deactivate brea kpoints":"Deactivate Breakpoints"):WebInspector.UIString(WebInspector.useLowerCa seMenuTitles()?"Activate breakpoints":"Activate Breakpoints");contextMenu.append Item(breakpointActiveTitle,WebInspector.debuggerModel.setBreakpointsActive.bind( WebInspector.debuggerModel,!breakpointActive));contextMenu.show();},_breakpointA dded:function(event)
6 {this._breakpointRemoved(event);var breakpoint=(event.data.breakpoint);var uiLoc ation=(event.data.uiLocation);this._addBreakpoint(breakpoint,uiLocation);},_addB reakpoint:function(breakpoint,uiLocation)
7 {var element=document.createElement("li");element.addStyleClass("cursor-pointer" );element.addEventListener("contextmenu",this._breakpointContextMenu.bind(this,b reakpoint),true);element.addEventListener("click",this._breakpointClicked.bind(t his,uiLocation),false);var checkbox=document.createElement("input");checkbox.cla ssName="checkbox-elem";checkbox.type="checkbox";checkbox.checked=breakpoint.enab led();checkbox.addEventListener("click",this._breakpointCheckboxClicked.bind(thi s,breakpoint),false);element.appendChild(checkbox);var labelElement=document.cre ateTextNode(uiLocation.linkText());element.appendChild(labelElement);var snippet Element=document.createElement("div");snippetElement.className="source-text mono space";element.appendChild(snippetElement);function didRequestContent(content,co ntentEncoded,mimeType)
8 {var lineEndings=content.lineEndings();if(uiLocation.lineNumber<lineEndings.leng th)
9 snippetElement.textContent=content.substring(lineEndings[uiLocation.lineNumber-1 ],lineEndings[uiLocation.lineNumber]);}
10 uiLocation.uiSourceCode.requestContent(didRequestContent.bind(this));element._da ta=uiLocation;var currentElement=this.listElement.firstChild;while(currentElemen t){if(currentElement._data&&this._compareBreakpoints(currentElement._data,elemen t._data)>0)
11 break;currentElement=currentElement.nextSibling;}
12 this._addListElement(element,currentElement);var breakpointItem={};breakpointIte m.element=element;breakpointItem.checkbox=checkbox;this._items.put(breakpoint,br eakpointItem);this.expand();},_breakpointRemoved:function(event)
13 {var breakpoint=(event.data.breakpoint);var uiLocation=(event.data.uiLocation);v ar breakpointItem=this._items.get(breakpoint);if(!breakpointItem)
14 return;this._items.remove(breakpoint);this._removeListElement(breakpointItem.ele ment);},highlightBreakpoint:function(breakpoint)
15 {var breakpointItem=this._items.get(breakpoint);if(!breakpointItem)
16 return;breakpointItem.element.addStyleClass("breakpoint-hit");this._highlightedB reakpointItem=breakpointItem;},clearBreakpointHighlight:function()
17 {if(this._highlightedBreakpointItem){this._highlightedBreakpointItem.element.rem oveStyleClass("breakpoint-hit");delete this._highlightedBreakpointItem;}},_break pointClicked:function(uiLocation,event)
18 {this._showSourceLineDelegate(uiLocation.uiSourceCode,uiLocation.lineNumber);},_ breakpointCheckboxClicked:function(breakpoint,event)
19 {event.consume();breakpoint.setEnabled(event.target.checked);},_breakpointContex tMenu:function(breakpoint,event)
20 {var breakpoints=this._items.values();var contextMenu=new WebInspector.ContextMe nu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCase MenuTitles()?"Remove breakpoint":"Remove Breakpoint"),breakpoint.remove.bind(bre akpoint));if(breakpoints.length>1){var removeAllTitle=WebInspector.UIString(WebI nspector.useLowerCaseMenuTitles()?"Remove all breakpoints":"Remove All Breakpoin ts");contextMenu.appendItem(removeAllTitle,this._breakpointManager.removeAllBrea kpoints.bind(this._breakpointManager));}
21 contextMenu.appendSeparator();var breakpointActive=WebInspector.debuggerModel.br eakpointsActive();var breakpointActiveTitle=breakpointActive?WebInspector.UIStri ng(WebInspector.useLowerCaseMenuTitles()?"Deactivate breakpoints":"Deactivate Br eakpoints"):WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Activat e breakpoints":"Activate Breakpoints");contextMenu.appendItem(breakpointActiveTi tle,WebInspector.debuggerModel.setBreakpointsActive.bind(WebInspector.debuggerMo del,!breakpointActive));function enabledBreakpointCount(breakpoints)
22 {var count=0;for(var i=0;i<breakpoints.length;++i){if(breakpoints[i].checkbox.ch ecked)
23 count++;}
24 return count;}
25 if(breakpoints.length>1){var enableBreakpointCount=enabledBreakpointCount(breakp oints);var enableTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Enable all breakpoints":"Enable All Breakpoints");var disableTitle=WebInspec tor.UIString(WebInspector.useLowerCaseMenuTitles()?"Disable all breakpoints":"Di sable All Breakpoints");contextMenu.appendSeparator();contextMenu.appendItem(ena bleTitle,this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManag er,true),!(enableBreakpointCount!=breakpoints.length));contextMenu.appendItem(di sableTitle,this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointMan ager,false),!(enableBreakpointCount>1));}
26 contextMenu.show();},_addListElement:function(element,beforeElement)
27 {if(beforeElement)
28 this.listElement.insertBefore(element,beforeElement);else{if(!this.listElement.f irstChild){this.bodyElement.removeChild(this.emptyElement);this.bodyElement.appe ndChild(this.listElement);}
29 this.listElement.appendChild(element);}},_removeListElement:function(element)
30 {this.listElement.removeChild(element);if(!this.listElement.firstChild){this.bod yElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyEl ement);}},_compare:function(x,y)
31 {if(x!==y)
32 return x<y?-1:1;return 0;},_compareBreakpoints:function(b1,b2)
33 {return this._compare(b1.uiSourceCode.originURL(),b2.uiSourceCode.originURL())|| this._compare(b1.lineNumber,b2.lineNumber);},reset:function()
34 {this.listElement.removeChildren();if(this.listElement.parentElement){this.bodyE lement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElem ent);}
35 this._items.clear();},__proto__:WebInspector.SidebarPane.prototype}
36 WebInspector.XHRBreakpointsSidebarPane=function()
37 {WebInspector.NativeBreakpointsSidebarPane.call(this,WebInspector.UIString("XHR Breakpoints"));this._breakpointElements={};var addButton=document.createElement( "button");addButton.className="pane-title-button add";addButton.addEventListener ("click",this._addButtonClicked.bind(this),false);addButton.title=WebInspector.U IString("Add XHR breakpoint");this.titleElement.appendChild(addButton);this.empt yElement.addEventListener("contextmenu",this._emptyElementContextMenu.bind(this) ,true);this._restoreBreakpoints();}
38 WebInspector.XHRBreakpointsSidebarPane.prototype={_emptyElementContextMenu:funct ion(event)
39 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Br eakpoint"),this._addButtonClicked.bind(this));contextMenu.show();},_addButtonCli cked:function(event)
40 {if(event)
41 event.consume();this.expand();var inputElementContainer=document.createElement(" p");inputElementContainer.className="breakpoint-condition";var inputElement=docu ment.createElement("span");inputElementContainer.textContent=WebInspector.UIStri ng("Break when URL contains:");inputElement.className="editing";inputElement.id= "breakpoint-condition-input";inputElementContainer.appendChild(inputElement);thi s._addListElement(inputElementContainer,this.listElement.firstChild);function fi nishEditing(accept,e,text)
42 {this._removeListElement(inputElementContainer);if(accept){this._setBreakpoint(t ext,true);this._saveBreakpoints();}}
43 var config=new WebInspector.EditingConfig(finishEditing.bind(this,true),finishEd iting.bind(this,false));WebInspector.startEditing(inputElement,config);},_setBre akpoint:function(url,enabled)
44 {if(url in this._breakpointElements)
45 return;var element=document.createElement("li");element._url=url;element.addEven tListener("contextmenu",this._contextMenu.bind(this,url),true);var checkboxEleme nt=document.createElement("input");checkboxElement.className="checkbox-elem";che ckboxElement.type="checkbox";checkboxElement.checked=enabled;checkboxElement.add EventListener("click",this._checkboxClicked.bind(this,url),false);element._check boxElement=checkboxElement;element.appendChild(checkboxElement);var labelElement =document.createElement("span");if(!url)
46 labelElement.textContent=WebInspector.UIString("Any XHR");else
47 labelElement.textContent=WebInspector.UIString("URL contains \"%s\"",url);labelE lement.addStyleClass("cursor-auto");labelElement.addEventListener("dblclick",thi s._labelClicked.bind(this,url),false);element.appendChild(labelElement);var curr entElement=this.listElement.firstChild;while(currentElement){if(currentElement._ url&&currentElement._url<element._url)
48 break;currentElement=currentElement.nextSibling;}
49 this._addListElement(element,currentElement);this._breakpointElements[url]=eleme nt;if(enabled)
50 DOMDebuggerAgent.setXHRBreakpoint(url);},_removeBreakpoint:function(url)
51 {var element=this._breakpointElements[url];if(!element)
52 return;this._removeListElement(element);delete this._breakpointElements[url];if( element._checkboxElement.checked)
53 DOMDebuggerAgent.removeXHRBreakpoint(url);},_contextMenu:function(url,event)
54 {var contextMenu=new WebInspector.ContextMenu(event);function removeBreakpoint()
55 {this._removeBreakpoint(url);this._saveBreakpoints();}
56 function removeAllBreakpoints()
57 {for(var url in this._breakpointElements)
58 this._removeBreakpoint(url);this._saveBreakpoints();}
59 var removeAllTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?" Remove all breakpoints":"Remove All Breakpoints");contextMenu.appendItem(WebInsp ector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Break point"),this._addButtonClicked.bind(this));contextMenu.appendItem(WebInspector.U IString(WebInspector.useLowerCaseMenuTitles()?"Remove breakpoint":"Remove Breakp oint"),removeBreakpoint.bind(this));contextMenu.appendItem(removeAllTitle,remove AllBreakpoints.bind(this));contextMenu.show();},_checkboxClicked:function(url,ev ent)
60 {if(event.target.checked)
61 DOMDebuggerAgent.setXHRBreakpoint(url);else
62 DOMDebuggerAgent.removeXHRBreakpoint(url);this._saveBreakpoints();},_labelClicke d:function(url)
63 {var element=this._breakpointElements[url];var inputElement=document.createEleme nt("span");inputElement.className="breakpoint-condition editing";inputElement.te xtContent=url;this.listElement.insertBefore(inputElement,element);element.addSty leClass("hidden");function finishEditing(accept,e,text)
64 {this._removeListElement(inputElement);if(accept){this._removeBreakpoint(url);th is._setBreakpoint(text,element._checkboxElement.checked);this._saveBreakpoints() ;}else
65 element.removeStyleClass("hidden");}
66 WebInspector.startEditing(inputElement,new WebInspector.EditingConfig(finishEdit ing.bind(this,true),finishEditing.bind(this,false)));},highlightBreakpoint:funct ion(url)
67 {var element=this._breakpointElements[url];if(!element)
68 return;this.expand();element.addStyleClass("breakpoint-hit");this._highlightedEl ement=element;},clearBreakpointHighlight:function()
69 {if(this._highlightedElement){this._highlightedElement.removeStyleClass("breakpo int-hit");delete this._highlightedElement;}},_saveBreakpoints:function()
70 {var breakpoints=[];for(var url in this._breakpointElements)
71 breakpoints.push({url:url,enabled:this._breakpointElements[url]._checkboxElement .checked});WebInspector.settings.xhrBreakpoints.set(breakpoints);},_restoreBreak points:function()
72 {var breakpoints=WebInspector.settings.xhrBreakpoints.get();for(var i=0;i<breakp oints.length;++i){var breakpoint=breakpoints[i];if(breakpoint&&typeof breakpoint .url==="string")
73 this._setBreakpoint(breakpoint.url,breakpoint.enabled);}},__proto__:WebInspector .NativeBreakpointsSidebarPane.prototype}
74 WebInspector.EventListenerBreakpointsSidebarPane=function()
75 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Event Listener Breakp oints"));this.registerRequiredCSS("breakpointsList.css");this.categoriesElement= document.createElement("ol");this.categoriesElement.tabIndex=0;this.categoriesEl ement.addStyleClass("properties-tree");this.categoriesElement.addStyleClass("eve nt-listener-breakpoints");this.categoriesTreeOutline=new TreeOutline(this.catego riesElement);this.bodyElement.appendChild(this.categoriesElement);this._breakpoi ntItems={};this._createCategory(WebInspector.UIString("Animation"),false,["reque stAnimationFrame","cancelAnimationFrame","animationFrameFired"]);this._createCat egory(WebInspector.UIString("Control"),true,["resize","scroll","zoom","focus","b lur","select","change","submit","reset"]);this._createCategory(WebInspector.UISt ring("Clipboard"),true,["copy","cut","paste","beforecopy","beforecut","beforepas te"]);this._createCategory(WebInspector.UIString("DOM Mutation"),true,["DOMActiv ate","DOMFocusIn","DOMFocusOut","DOMAttrModified","DOMCharacterDataModified","DO MNodeInserted","DOMNodeInsertedIntoDocument","DOMNodeRemoved","DOMNodeRemovedFro mDocument","DOMSubtreeModified","DOMContentLoaded"]);this._createCategory(WebIns pector.UIString("Device"),true,["deviceorientation","devicemotion"]);this._creat eCategory(WebInspector.UIString("Keyboard"),true,["keydown","keyup","keypress"," input"]);this._createCategory(WebInspector.UIString("Load"),true,["load","unload ","abort","error"]);this._createCategory(WebInspector.UIString("Mouse"),true,["c lick","dblclick","mousedown","mouseup","mouseover","mousemove","mouseout","mouse wheel"]);this._createCategory(WebInspector.UIString("Timer"),false,["setTimer"," clearTimer","timerFired"]);this._createCategory(WebInspector.UIString("Touch"),t rue,["touchstart","touchmove","touchend","touchcancel"]);this._createCategory(We bInspector.UIString("WebGL"),false,["webglErrorFired","webglWarningFired"]);this ._restoreBreakpoints();}
76 WebInspector.EventListenerBreakpointsSidebarPane.categotyListener="listener:";We bInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation="instrume ntation:";WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI=functi on(eventName,auxData)
77 {if(!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI){WebInspe ctor.EventListenerBreakpointsSidebarPane._eventNamesForUI={"instrumentation:setT imer":WebInspector.UIString("Set Timer"),"instrumentation:clearTimer":WebInspect or.UIString("Clear Timer"),"instrumentation:timerFired":WebInspector.UIString("T imer Fired"),"instrumentation:requestAnimationFrame":WebInspector.UIString("Requ est Animation Frame"),"instrumentation:cancelAnimationFrame":WebInspector.UIStri ng("Cancel Animation Frame"),"instrumentation:animationFrameFired":WebInspector. UIString("Animation Frame Fired"),"instrumentation:webglErrorFired":WebInspector .UIString("WebGL Error Fired"),"instrumentation:webglWarningFired":WebInspector. UIString("WebGL Warning Fired")};}
78 if(auxData){if(eventName==="instrumentation:webglErrorFired"&&auxData["webglErro rName"]){var errorName=auxData["webglErrorName"];errorName=errorName.replace(/^. *(0x[0-9a-f]+).*$/i,"$1");return WebInspector.UIString("WebGL Error Fired (%s)", errorName);}}
79 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eventNa me]||eventName.substring(eventName.indexOf(":")+1);}
80 WebInspector.EventListenerBreakpointsSidebarPane.prototype={_createCategory:func tion(name,isDOMEvent,eventNames)
81 {var categoryItem={};categoryItem.element=new TreeElement(name);this.categoriesT reeOutline.appendChild(categoryItem.element);categoryItem.element.listItemElemen t.addStyleClass("event-category");categoryItem.element.selectable=true;categoryI tem.checkbox=this._createCheckbox(categoryItem.element);categoryItem.checkbox.ad dEventListener("click",this._categoryCheckboxClicked.bind(this,categoryItem),tru e);categoryItem.children={};for(var i=0;i<eventNames.length;++i){var eventName=( isDOMEvent?WebInspector.EventListenerBreakpointsSidebarPane.categotyListener:Web Inspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation)+eventName s[i];var breakpointItem={};var title=WebInspector.EventListenerBreakpointsSideba rPane.eventNameForUI(eventName);breakpointItem.element=new TreeElement(title);ca tegoryItem.element.appendChild(breakpointItem.element);var hitMarker=document.cr eateElement("div");hitMarker.className="breakpoint-hit-marker";breakpointItem.el ement.listItemElement.appendChild(hitMarker);breakpointItem.element.listItemElem ent.addStyleClass("source-code");breakpointItem.element.selectable=false;breakpo intItem.checkbox=this._createCheckbox(breakpointItem.element);breakpointItem.che ckbox.addEventListener("click",this._breakpointCheckboxClicked.bind(this,eventNa me),true);breakpointItem.parent=categoryItem;this._breakpointItems[eventName]=br eakpointItem;categoryItem.children[eventName]=breakpointItem;}},_createCheckbox: function(treeElement)
82 {var checkbox=document.createElement("input");checkbox.className="checkbox-elem" ;checkbox.type="checkbox";treeElement.listItemElement.insertBefore(checkbox,tree Element.listItemElement.firstChild);return checkbox;},_categoryCheckboxClicked:f unction(categoryItem)
83 {var checked=categoryItem.checkbox.checked;for(var eventName in categoryItem.chi ldren){var breakpointItem=categoryItem.children[eventName];if(breakpointItem.che ckbox.checked===checked)
84 continue;if(checked)
85 this._setBreakpoint(eventName);else
86 this._removeBreakpoint(eventName);}
87 this._saveBreakpoints();},_breakpointCheckboxClicked:function(eventName,event)
88 {if(event.target.checked)
89 this._setBreakpoint(eventName);else
90 this._removeBreakpoint(eventName);this._saveBreakpoints();},_setBreakpoint:funct ion(eventName)
91 {var breakpointItem=this._breakpointItems[eventName];if(!breakpointItem)
92 return;breakpointItem.checkbox.checked=true;if(eventName.startsWith(WebInspector .EventListenerBreakpointsSidebarPane.categotyListener))
93 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebInspector.Eve ntListenerBreakpointsSidebarPane.categotyListener.length));else if(eventName.sta rtsWith(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentation ))
94 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(WebInspector.E ventListenerBreakpointsSidebarPane.categotyInstrumentation.length));this._update CategoryCheckbox(breakpointItem.parent);},_removeBreakpoint:function(eventName)
95 {var breakpointItem=this._breakpointItems[eventName];if(!breakpointItem)
96 return;breakpointItem.checkbox.checked=false;if(eventName.startsWith(WebInspecto r.EventListenerBreakpointsSidebarPane.categotyListener))
97 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(WebInspector. EventListenerBreakpointsSidebarPane.categotyListener.length));else if(eventName. startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categotyInstrumentat ion))
98 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring(WebInspecto r.EventListenerBreakpointsSidebarPane.categotyInstrumentation.length));this._upd ateCategoryCheckbox(breakpointItem.parent);},_updateCategoryCheckbox:function(ca tegoryItem)
99 {var hasEnabled=false,hasDisabled=false;for(var eventName in categoryItem.childr en){var breakpointItem=categoryItem.children[eventName];if(breakpointItem.checkb ox.checked)
100 hasEnabled=true;else
101 hasDisabled=true;}
102 categoryItem.checkbox.checked=hasEnabled;categoryItem.checkbox.indeterminate=has Enabled&&hasDisabled;},highlightBreakpoint:function(eventName)
103 {var breakpointItem=this._breakpointItems[eventName];if(!breakpointItem)
104 return;this.expand();breakpointItem.parent.element.expand();breakpointItem.eleme nt.listItemElement.addStyleClass("breakpoint-hit");this._highlightedElement=brea kpointItem.element.listItemElement;},clearBreakpointHighlight:function()
105 {if(this._highlightedElement){this._highlightedElement.removeStyleClass("breakpo int-hit");delete this._highlightedElement;}},_saveBreakpoints:function()
106 {var breakpoints=[];for(var eventName in this._breakpointItems){if(this._breakpo intItems[eventName].checkbox.checked)
107 breakpoints.push({eventName:eventName});}
108 WebInspector.settings.eventListenerBreakpoints.set(breakpoints);},_restoreBreakp oints:function()
109 {var breakpoints=WebInspector.settings.eventListenerBreakpoints.get();for(var i= 0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(breakpoint&&typeof breakpoint.eventName==="string")
110 this._setBreakpoint(breakpoint.eventName);}},__proto__:WebInspector.SidebarPane. prototype};WebInspector.CallStackSidebarPane=function()
111 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Call Stack"));this._m odel=WebInspector.debuggerModel;this.bodyElement.addEventListener("keydown",this ._keyDown.bind(this),true);this.bodyElement.tabIndex=0;}
112 WebInspector.CallStackSidebarPane.prototype={update:function(callFrames)
113 {this.bodyElement.removeChildren();delete this._statusMessageElement;this.placar ds=[];if(!callFrames){var infoElement=document.createElement("div");infoElement. className="info";infoElement.textContent=WebInspector.UIString("Not Paused");thi s.bodyElement.appendChild(infoElement);return;}
114 for(var i=0;i<callFrames.length;++i){var callFrame=callFrames[i];var placard=new WebInspector.CallStackSidebarPane.Placard(callFrame,this);placard.element.addEv entListener("click",this._placardSelected.bind(this,placard),false);this.placard s.push(placard);this.bodyElement.appendChild(placard.element);}},setSelectedCall Frame:function(x)
115 {for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];placard.se lected=(placard._callFrame===x);}},_selectNextCallFrameOnStack:function(event)
116 {var index=this._selectedCallFrameIndex();if(index==-1)
117 return true;this._selectedPlacardByIndex(index+1);return true;},_selectPreviousC allFrameOnStack:function(event)
118 {var index=this._selectedCallFrameIndex();if(index==-1)
119 return true;this._selectedPlacardByIndex(index-1);return true;},_selectedPlacard ByIndex:function(index)
120 {if(index<0||index>=this.placards.length)
121 return;this._placardSelected(this.placards[index])},_selectedCallFrameIndex:func tion()
122 {if(!this._model.selectedCallFrame())
123 return-1;for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];if (placard._callFrame===this._model.selectedCallFrame())
124 return i;}
125 return-1;},_placardSelected:function(placard)
126 {this._model.setSelectedCallFrame(placard._callFrame);},_copyStackTrace:function ()
127 {var text="";for(var i=0;i<this.placards.length;++i)
128 text+=this.placards[i].title+" ("+this.placards[i].subtitle+")\n";InspectorFront endHost.copyText(text);},registerShortcuts:function(registerShortcutDelegate)
129 {registerShortcutDelegate(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextC allFrame,this._selectNextCallFrameOnStack.bind(this));registerShortcutDelegate(W ebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame,this._selectPrevio usCallFrameOnStack.bind(this));},setStatus:function(status)
130 {if(!this._statusMessageElement){this._statusMessageElement=document.createEleme nt("div");this._statusMessageElement.className="info";this.bodyElement.appendChi ld(this._statusMessageElement);}
131 if(typeof status==="string")
132 this._statusMessageElement.textContent=status;else{this._statusMessageElement.re moveChildren();this._statusMessageElement.appendChild(status);}},_keyDown:functi on(event)
133 {if(event.altKey||event.shiftKey||event.metaKey||event.ctrlKey)
134 return;if(event.keyIdentifier==="Up"){this._selectPreviousCallFrameOnStack();eve nt.consume();}else if(event.keyIdentifier==="Down"){this._selectNextCallFrameOnS tack();event.consume();}},__proto__:WebInspector.SidebarPane.prototype}
135 WebInspector.CallStackSidebarPane.Placard=function(callFrame,pane)
136 {WebInspector.Placard.call(this,callFrame.functionName||WebInspector.UIString("( anonymous function)"),"");callFrame.createLiveLocation(this._update.bind(this)); this.element.addEventListener("contextmenu",this._placardContextMenu.bind(this), true);this._callFrame=callFrame;this._pane=pane;}
137 WebInspector.CallStackSidebarPane.Placard.prototype={_update:function(uiLocation )
138 {this.subtitle=uiLocation.linkText().trimMiddle(100);},_placardContextMenu:funct ion(event)
139 {var contextMenu=new WebInspector.ContextMenu(event);if(WebInspector.debuggerMod el.canSetScriptSource()){contextMenu.appendItem(WebInspector.UIString(WebInspect or.useLowerCaseMenuTitles()?"Restart frame":"Restart Frame"),this._restartFrame. bind(this));contextMenu.appendSeparator();}
140 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Copy stack trace":"Copy Stack Trace"),this._pane._copyStackTrace.bind(this._ pane));contextMenu.show();},_restartFrame:function()
141 {this._callFrame.restart(undefined);},__proto__:WebInspector.Placard.prototype}; WebInspector.FilePathScoreFunction=function(query)
142 {this._query=query;this._queryUpperCase=query.toUpperCase();this._score=null;thi s._sequence=null;this._dataUpperCase="";this._fileNameIndex=0;}
143 WebInspector.FilePathScoreFunction.filterRegex=function(query)
144 {const toEscape=String.regexSpecialCharacters();var regexString="";for(var i=0;i <query.length;++i){var c=query.charAt(i);if(toEscape.indexOf(c)!==-1)
145 c="\\"+c;if(i)
146 regexString+="[^"+c+"]*";regexString+=c;}
147 return new RegExp(regexString,"i");}
148 WebInspector.FilePathScoreFunction.prototype={score:function(data,matchIndexes)
149 {if(!data||!this._query)
150 return 0;var n=this._query.length;var m=data.length;if(!this._score||this._score .length<n*m){this._score=new Int32Array(n*m*2);this._sequence=new Int32Array(n*m *2);}
151 var score=this._score;var sequence=this._sequence;this._dataUpperCase=data.toUpp erCase();this._fileNameIndex=data.lastIndexOf("/");for(var i=0;i<n;++i){for(var j=0;j<m;++j){var skipCharScore=j===0?0:score[i*m+j-1];var prevCharScore=i===0||j ===0?0:score[(i-1)*m+j-1];var consecutiveMatch=i===0||j===0?0:sequence[(i-1)*m+j -1];var pickCharScore=this._match(this._query,data,i,j,consecutiveMatch);if(pick CharScore&&prevCharScore+pickCharScore>skipCharScore){sequence[i*m+j]=consecutiv eMatch+1;score[i*m+j]=(prevCharScore+pickCharScore);}else{sequence[i*m+j]=0;scor e[i*m+j]=skipCharScore;}}}
152 if(matchIndexes)
153 this._restoreMatchIndexes(sequence,n,m,matchIndexes);return score[n*m-1];},_test WordStart:function(data,j)
154 {var prevChar=data.charAt(j-1);return j===0||prevChar==="_"||prevChar==="-"||pre vChar==="/"||(data[j-1]!==this._dataUpperCase[j-1]&&data[j]===this._dataUpperCas e[j]);},_restoreMatchIndexes:function(sequence,n,m,out)
155 {var i=n-1,j=m-1;while(i>=0&&j>=0){switch(sequence[i*m+j]){case 0:--j;break;defa ult:out.push(j);--i;--j;break;}}
156 out.reverse();},_singleCharScore:function(query,data,i,j)
157 {var isWordStart=this._testWordStart(data,j);var isFileName=j>this._fileNameInde x;var isPathTokenStart=j===0||data[j-1]==="/";var isCapsMatch=query[i]===data[j] &&query[i]==this._queryUpperCase[i];var score=10;if(isPathTokenStart)
158 score+=4;if(isWordStart)
159 score+=2;if(isCapsMatch)
160 score+=6;if(isFileName)
161 score+=4;if(j===this._fileNameIndex+1&&i===0)
162 score+=5;if(isFileName&&isWordStart)
163 score+=3;return score;},_sequenceCharScore:function(query,data,i,j,sequenceLengt h)
164 {var isFileName=j>this._fileNameIndex;var isPathTokenStart=j===0||data[j-1]==="/ ";var score=10;if(isFileName)
165 score+=4;if(isPathTokenStart)
166 score+=5;score+=sequenceLength*4;return score;},_match:function(query,data,i,j,c onsecutiveMatch)
167 {if(this._queryUpperCase[i]!==this._dataUpperCase[j])
168 return 0;if(!consecutiveMatch)
169 return this._singleCharScore(query,data,i,j);else
170 return this._sequenceCharScore(query,data,i,j-consecutiveMatch,consecutiveMatch) ;},};WebInspector.FilteredItemSelectionDialog=function(delegate)
171 {WebInspector.DialogDelegate.call(this);var xhr=new XMLHttpRequest();xhr.open("G ET","filteredItemSelectionDialog.css",false);xhr.send(null);this.element=documen t.createElement("div");this.element.className="filtered-item-list-dialog";this.e lement.addEventListener("keydown",this._onKeyDown.bind(this),false);var styleEle ment=this.element.createChild("style");styleElement.type="text/css";styleElement .textContent=xhr.responseText;this._promptElement=this.element.createChild("inpu t","monospace");this._promptElement.addEventListener("input",this._onInput.bind( this),false);this._promptElement.type="text";this._promptElement.setAttribute("s pellcheck","false");this._filteredItems=[];this._viewportControl=new WebInspecto r.ViewportControl(this);this._itemElementsContainer=this._viewportControl.elemen t;this._itemElementsContainer.addStyleClass("container");this._itemElementsConta iner.addStyleClass("monospace");this._itemElementsContainer.addEventListener("cl ick",this._onClick.bind(this),false);this.element.appendChild(this._itemElements Container);this._delegate=delegate;this._delegate.setRefreshCallback(this._items Loaded.bind(this));this._itemsLoaded();}
172 WebInspector.FilteredItemSelectionDialog.prototype={position:function(element,re lativeToElement)
173 {const minWidth=500;const minHeight=204;var width=Math.max(relativeToElement.off setWidth*2/3,minWidth);var height=Math.max(relativeToElement.offsetHeight*2/3,mi nHeight);this.element.style.width=width+"px";this.element.style.height=height+"p x";const shadowPadding=20;element.positionAt(relativeToElement.totalOffsetLeft() +Math.max((relativeToElement.offsetWidth-width-2*shadowPadding)/2,shadowPadding) ,relativeToElement.totalOffsetTop()+Math.max((relativeToElement.offsetHeight-hei ght-2*shadowPadding)/2,shadowPadding));},focus:function()
174 {WebInspector.setCurrentFocusElement(this._promptElement);if(this._filteredItems .length&&this._viewportControl.lastVisibleIndex()===-1)
175 this._viewportControl.refresh();},willHide:function()
176 {if(this._isHiding)
177 return;this._isHiding=true;this._delegate.dispose();if(this._filterTimer)
178 clearTimeout(this._filterTimer);},renderAsTwoRows:function()
179 {this._renderAsTwoRows=true;},onEnter:function()
180 {if(!this._delegate.itemCount())
181 return;this._delegate.selectItem(this._filteredItems[this._selectedIndexInFilter ed],this._promptElement.value.trim());},_itemsLoaded:function()
182 {if(this._loadTimeout)
183 return;this._loadTimeout=setTimeout(this._updateAfterItemsLoaded.bind(this),0);} ,_updateAfterItemsLoaded:function()
184 {delete this._loadTimeout;this._filterItems();},_createItemElement:function(inde x)
185 {var itemElement=document.createElement("div");itemElement.className="filtered-i tem-list-dialog-item "+(this._renderAsTwoRows?"two-rows":"one-row");itemElement. _titleElement=itemElement.createChild("span");itemElement._titleSuffixElement=it emElement.createChild("span");itemElement._subtitleElement=itemElement.createChi ld("div","filtered-item-list-dialog-subtitle");itemElement._subtitleElement.text Content="\u200B";itemElement._index=index;this._delegate.renderItem(index,this._ promptElement.value.trim(),itemElement._titleElement,itemElement._subtitleElemen t);return itemElement;},setQuery:function(query)
186 {this._promptElement.value=query;this._scheduleFilter();},_filterItems:function( )
187 {delete this._filterTimer;if(this._scoringTimer){clearTimeout(this._scoringTimer );delete this._scoringTimer;}
188 var query=this._delegate.rewriteQuery(this._promptElement.value.trim());this._qu ery=query;var queryLength=query.length;var filterRegex=query?WebInspector.FilePa thScoreFunction.filterRegex(query):null;var oldSelectedAbsoluteIndex=this._selec tedIndexInFiltered?this._filteredItems[this._selectedIndexInFiltered]:null;var f ilteredItems=[];this._selectedIndexInFiltered=0;var bestScores=[];var bestItems= [];var bestItemsToCollect=100;var minBestScore=0;var overflowItems=[];scoreItems .call(this,0);function compareIntegers(a,b)
189 {return b-a;}
190 function scoreItems(fromIndex)
191 {var maxWorkItems=1000;var workDone=0;for(var i=fromIndex;i<this._delegate.itemC ount()&&workDone<maxWorkItems;++i){if(filterRegex&&!filterRegex.test(this._deleg ate.itemKeyAt(i)))
192 continue;var score=this._delegate.itemScoreAt(i,query);if(query)
193 workDone++;if(score>minBestScore||bestScores.length<bestItemsToCollect){var inde x=insertionIndexForObjectInListSortedByFunction(score,bestScores,compareIntegers ,true);bestScores.splice(index,0,score);bestItems.splice(index,0,i);if(bestScore s.length>bestItemsToCollect){overflowItems.push(bestItems.peekLast());bestScores .length=bestItemsToCollect;bestItems.length=bestItemsToCollect;}
194 minBestScore=bestScores.peekLast();}else
195 filteredItems.push(i);}
196 if(i<this._delegate.itemCount()){this._scoringTimer=setTimeout(scoreItems.bind(t his,i),0);return;}
197 delete this._scoringTimer;this._filteredItems=bestItems.concat(overflowItems).co ncat(filteredItems);for(var i=0;i<this._filteredItems.length;++i){if(this._filte redItems[i]===oldSelectedAbsoluteIndex){this._selectedIndexInFiltered=i;break;}}
198 this._viewportControl.refresh();if(!query)
199 this._selectedIndexInFiltered=0;this._updateSelection(this._selectedIndexInFilte red,false);}},_onInput:function(event)
200 {this._scheduleFilter();},_onKeyDown:function(event)
201 {var newSelectedIndex=this._selectedIndexInFiltered;switch(event.keyCode){case W ebInspector.KeyboardShortcut.Keys.Down.code:if(++newSelectedIndex>=this._filtere dItems.length)
202 newSelectedIndex=this._filteredItems.length-1;this._updateSelection(newSelectedI ndex,true);event.consume(true);break;case WebInspector.KeyboardShortcut.Keys.Up. code:if(--newSelectedIndex<0)
203 newSelectedIndex=0;this._updateSelection(newSelectedIndex,false);event.consume(t rue);break;case WebInspector.KeyboardShortcut.Keys.PageDown.code:newSelectedInde x=Math.min(newSelectedIndex+this._viewportControl.rowsPerViewport(),this._filter edItems.length-1);this._updateSelection(newSelectedIndex,true);event.consume(tru e);break;case WebInspector.KeyboardShortcut.Keys.PageUp.code:newSelectedIndex=Ma th.max(newSelectedIndex-this._viewportControl.rowsPerViewport(),0);this._updateS election(newSelectedIndex,false);event.consume(true);break;default:}},_scheduleF ilter:function()
204 {if(this._filterTimer)
205 return;this._filterTimer=setTimeout(this._filterItems.bind(this),0);},_updateSel ection:function(index,makeLast)
206 {var element=this._viewportControl.renderedElementAt(this._selectedIndexInFilter ed);if(element)
207 element.removeStyleClass("selected");this._viewportControl.scrollItemIntoView(in dex,makeLast);this._selectedIndexInFiltered=index;element=this._viewportControl. renderedElementAt(index);if(element)
208 element.addStyleClass("selected");},_onClick:function(event)
209 {var itemElement=event.target.enclosingNodeOrSelfWithClass("filtered-item-list-d ialog-item");if(!itemElement)
210 return;this._delegate.selectItem(itemElement._index,this._promptElement.value.tr im());WebInspector.Dialog.hide();},itemCount:function()
211 {return this._filteredItems.length;},itemElement:function(index)
212 {var delegateIndex=this._filteredItems[index];var element=this._createItemElemen t(delegateIndex);if(index===this._selectedIndexInFiltered)
213 element.addStyleClass("selected");return element;},__proto__:WebInspector.Dialog Delegate.prototype}
214 WebInspector.SelectionDialogContentProvider=function()
215 {}
216 WebInspector.SelectionDialogContentProvider.prototype={setRefreshCallback:functi on(refreshCallback)
217 {this._refreshCallback=refreshCallback;},itemCount:function()
218 {return 0;},itemKeyAt:function(itemIndex)
219 {return"";},itemScoreAt:function(itemIndex,query)
220 {return 1;},renderItem:function(itemIndex,query,titleElement,subtitleElement)
221 {},highlightRanges:function(element,query)
222 {if(!query)
223 return false;function rangesForMatch(text,query)
224 {var sm=new difflib.SequenceMatcher(query,text);var opcodes=sm.get_opcodes();var ranges=[];for(var i=0;i<opcodes.length;++i){var opcode=opcodes[i];if(opcode[0]= =="equal")
225 ranges.push({offset:opcode[3],length:opcode[4]-opcode[3]});else if(opcode[0]!==" insert")
226 return null;}
227 return ranges;}
228 var text=element.textContent;var ranges=rangesForMatch(text,query);if(!ranges)
229 ranges=rangesForMatch(text.toUpperCase(),query.toUpperCase());if(ranges){WebInsp ector.highlightRangesWithStyleClass(element,ranges,"highlight");return true;}
230 return false;},selectItem:function(itemIndex,promptValue)
231 {},refresh:function()
232 {this._refreshCallback();},rewriteQuery:function(query)
233 {return query;},dispose:function()
234 {}}
235 WebInspector.JavaScriptOutlineDialog=function(view,contentProvider)
236 {WebInspector.SelectionDialogContentProvider.call(this);this._functionItems=[];t his._view=view;contentProvider.requestContent(this._contentAvailable.bind(this)) ;}
237 WebInspector.JavaScriptOutlineDialog.show=function(view,contentProvider)
238 {if(WebInspector.Dialog.currentInstance())
239 return null;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelecti onDialog(new WebInspector.JavaScriptOutlineDialog(view,contentProvider));WebInsp ector.Dialog.show(view.element,filteredItemSelectionDialog);}
240 WebInspector.JavaScriptOutlineDialog.prototype={_contentAvailable:function(conte nt,contentEncoded,mimeType)
241 {this._outlineWorker=new Worker("ScriptFormatterWorker.js");this._outlineWorker. onmessage=this._didBuildOutlineChunk.bind(this);const method="outline";this._out lineWorker.postMessage({method:method,params:{content:content}});},_didBuildOutl ineChunk:function(event)
242 {var data=event.data;var chunk=data["chunk"];for(var i=0;i<chunk.length;++i)
243 this._functionItems.push(chunk[i]);if(data.total===data.index)
244 this.dispose();this.refresh();},itemCount:function()
245 {return this._functionItems.length;},itemKeyAt:function(itemIndex)
246 {return this._functionItems[itemIndex].name;},itemScoreAt:function(itemIndex,que ry)
247 {var item=this._functionItems[itemIndex];return-item.line;},renderItem:function( itemIndex,query,titleElement,subtitleElement)
248 {var item=this._functionItems[itemIndex];titleElement.textContent=item.name+(ite m.arguments?item.arguments:"");this.highlightRanges(titleElement,query);subtitle Element.textContent=":"+(item.line+1);},selectItem:function(itemIndex,promptValu e)
249 {var lineNumber=this._functionItems[itemIndex].line;if(!isNaN(lineNumber)&&lineN umber>=0)
250 this._view.highlightPosition(lineNumber,this._functionItems[itemIndex].column);t his._view.focus();},dispose:function()
251 {if(this._outlineWorker){this._outlineWorker.terminate();delete this._outlineWor ker;}},__proto__:WebInspector.SelectionDialogContentProvider.prototype}
252 WebInspector.SelectUISourceCodeDialog=function(defaultScores)
253 {WebInspector.SelectionDialogContentProvider.call(this);this._uiSourceCodes=[];v ar projects=WebInspector.workspace.projects().filter(this.filterProject.bind(thi s));for(var i=0;i<projects.length;++i)
254 this._uiSourceCodes=this._uiSourceCodes.concat(projects[i].uiSourceCodes());this ._defaultScores=defaultScores;this._scorer=new WebInspector.FilePathScoreFunctio n("");WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISo urceCodeAdded,this._uiSourceCodeAdded,this);}
255 WebInspector.SelectUISourceCodeDialog.prototype={uiSourceCodeSelected:function(u iSourceCode,lineNumber)
256 {},filterProject:function(project)
257 {return true;},itemCount:function()
258 {return this._uiSourceCodes.length;},itemKeyAt:function(itemIndex)
259 {return this._uiSourceCodes[itemIndex].fullDisplayName();},itemScoreAt:function( itemIndex,query)
260 {var uiSourceCode=this._uiSourceCodes[itemIndex];var score=this._defaultScores?( this._defaultScores.get(uiSourceCode)||0):0;if(!query||query.length<2)
261 return score;if(this._query!==query){this._query=query;this._scorer=new WebInspe ctor.FilePathScoreFunction(query);}
262 var path=uiSourceCode.fullDisplayName();return score+10*this._scorer.score(path, null);},renderItem:function(itemIndex,query,titleElement,subtitleElement)
263 {query=this.rewriteQuery(query);var uiSourceCode=this._uiSourceCodes[itemIndex]; titleElement.textContent=uiSourceCode.displayName()+(this._queryLineNumber?this. _queryLineNumber:"");subtitleElement.textContent=uiSourceCode.fullDisplayName(). trimEnd(100);var indexes=[];var score=new WebInspector.FilePathScoreFunction(que ry).score(subtitleElement.textContent,indexes);var fileNameIndex=subtitleElement .textContent.lastIndexOf("/");var ranges=[];for(var i=0;i<indexes.length;++i)
264 ranges.push({offset:indexes[i],length:1});if(indexes[0]>fileNameIndex){for(var i =0;i<ranges.length;++i)
265 ranges[i].offset-=fileNameIndex+1;return WebInspector.highlightRangesWithStyleCl ass(titleElement,ranges,"highlight");}else{return WebInspector.highlightRangesWi thStyleClass(subtitleElement,ranges,"highlight");}},selectItem:function(itemInde x,promptValue)
266 {var lineNumberMatch=promptValue.match(/[^:]+\:([\d]*)$/);var lineNumber=lineNum berMatch?Math.max(parseInt(lineNumberMatch[1],10)-1,0):undefined;this.uiSourceCo deSelected(this._uiSourceCodes[itemIndex],lineNumber);},rewriteQuery:function(qu ery)
267 {if(!query)
268 return query;query=query.trim();var lineNumberMatch=query.match(/([^:]+)(\:[\d]* )$/);this._queryLineNumber=lineNumberMatch?lineNumberMatch[2]:"";return lineNumb erMatch?lineNumberMatch[1]:query;},_uiSourceCodeAdded:function(event)
269 {var uiSourceCode=(event.data);if(!this.filterProject(uiSourceCode.project()))
270 return;this._uiSourceCodes.push(uiSourceCode)
271 this.refresh();},dispose:function()
272 {WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISour ceCodeAdded,this._uiSourceCodeAdded,this);},__proto__:WebInspector.SelectionDial ogContentProvider.prototype}
273 WebInspector.OpenResourceDialog=function(panel,defaultScores)
274 {WebInspector.SelectUISourceCodeDialog.call(this,defaultScores);this._panel=pane l;}
275 WebInspector.OpenResourceDialog.prototype={uiSourceCodeSelected:function(uiSourc eCode,lineNumber)
276 {this._panel.showUISourceCode(uiSourceCode,lineNumber);},filterProject:function( project)
277 {return!project.isServiceProject();},__proto__:WebInspector.SelectUISourceCodeDi alog.prototype}
278 WebInspector.OpenResourceDialog.show=function(panel,relativeToElement,name,defau ltScores)
279 {if(WebInspector.Dialog.currentInstance())
280 return;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDia log(new WebInspector.OpenResourceDialog(panel,defaultScores));filteredItemSelect ionDialog.renderAsTwoRows();if(name)
281 filteredItemSelectionDialog.setQuery(name);WebInspector.Dialog.show(relativeToEl ement,filteredItemSelectionDialog);}
282 WebInspector.SelectUISourceCodeForProjectTypeDialog=function(type,callback)
283 {this._type=type;WebInspector.SelectUISourceCodeDialog.call(this);this._callback =callback;}
284 WebInspector.SelectUISourceCodeForProjectTypeDialog.prototype={uiSourceCodeSelec ted:function(uiSourceCode,lineNumber)
285 {this._callback(uiSourceCode);},filterProject:function(project)
286 {return project.type()===this._type;},__proto__:WebInspector.SelectUISourceCodeD ialog.prototype}
287 WebInspector.SelectUISourceCodeForProjectTypeDialog.show=function(name,type,call back,relativeToElement)
288 {if(WebInspector.Dialog.currentInstance())
289 return;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDia log(new WebInspector.SelectUISourceCodeForProjectTypeDialog(type,callback));filt eredItemSelectionDialog.setQuery(name);filteredItemSelectionDialog.renderAsTwoRo ws();WebInspector.Dialog.show(relativeToElement,filteredItemSelectionDialog);};W ebInspector.UISourceCodeFrame=function(uiSourceCode)
290 {this._uiSourceCode=uiSourceCode;WebInspector.SourceFrame.call(this,this._uiSour ceCode);this.textEditor.setCompletionDictionary(new WebInspector.SampleCompletio nDictionary());this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Eve nts.FormattedChanged,this._onFormattedChanged,this);this._uiSourceCode.addEventL istener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._onWorkingCopyC hanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Event s.WorkingCopyCommitted,this._onWorkingCopyCommitted,this);}
291 WebInspector.UISourceCodeFrame.prototype={wasShown:function()
292 {WebInspector.SourceFrame.prototype.wasShown.call(this);this._boundWindowFocused =this._windowFocused.bind(this);window.addEventListener("focus",this._boundWindo wFocused,false);this._checkContentUpdated();},willHide:function()
293 {WebInspector.SourceFrame.prototype.willHide.call(this);window.removeEventListen er("focus",this._boundWindowFocused,false);delete this._boundWindowFocused;this. _uiSourceCode.removeWorkingCopyGetter();},canEditSource:function()
294 {return this._uiSourceCode.isEditable();},_windowFocused:function(event)
295 {this._checkContentUpdated();},_checkContentUpdated:function()
296 {if(!this.loaded||!this.isShowing())
297 return;this._uiSourceCode.checkContentUpdated();},commitEditing:function(text)
298 {if(!this._uiSourceCode.isDirty())
299 return;this._muteSourceCodeEvents=true;this._uiSourceCode.commitWorkingCopy(this ._didEditContent.bind(this));delete this._muteSourceCodeEvents;},onTextChanged:f unction(oldRange,newRange)
300 {WebInspector.SourceFrame.prototype.onTextChanged.call(this,oldRange,newRange);i f(this._isSettingContent)
301 return;this._muteSourceCodeEvents=true;if(this._textEditor.isClean())
302 this._uiSourceCode.resetWorkingCopy();else
303 this._uiSourceCode.setWorkingCopyGetter(this._textEditor.text.bind(this._textEdi tor));delete this._muteSourceCodeEvents;},_didEditContent:function(error)
304 {if(error){WebInspector.log(error,WebInspector.ConsoleMessage.MessageLevel.Error ,true);return;}},_onFormattedChanged:function(event)
305 {var content=(event.data.content);this._textEditor.setReadOnly(this._uiSourceCod e.formatted());this._innerSetContent(content);},_onWorkingCopyChanged:function(e vent)
306 {if(this._muteSourceCodeEvents)
307 return;this._innerSetContent(this._uiSourceCode.workingCopy());this.onUISourceCo deContentChanged();},_onWorkingCopyCommitted:function(event)
308 {if(!this._muteSourceCodeEvents){this._innerSetContent(this._uiSourceCode.workin gCopy());this.onUISourceCodeContentChanged();}
309 this._textEditor.markClean();},onUISourceCodeContentChanged:function()
310 {},_innerSetContent:function(content)
311 {this._isSettingContent=true;this.setContent(content,false,this._uiSourceCode.mi meType());delete this._isSettingContent;},populateTextAreaContextMenu:function(c ontextMenu,lineNumber)
312 {WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this,contex tMenu,lineNumber);contextMenu.appendApplicableItems(this._uiSourceCode);contextM enu.appendSeparator();},dispose:function()
313 {this.detach();},__proto__:WebInspector.SourceFrame.prototype};WebInspector.Java ScriptSourceFrame=function(scriptsPanel,uiSourceCode)
314 {this._scriptsPanel=scriptsPanel;this._breakpointManager=WebInspector.breakpoint Manager;this._uiSourceCode=uiSourceCode;WebInspector.UISourceCodeFrame.call(this ,uiSourceCode);if(uiSourceCode.project().type()===WebInspector.projectTypes.Debu gger)
315 this.element.addStyleClass("source-frame-debugger-script");this._popoverHelper=n ew WebInspector.ObjectPopoverHelper(this.textEditor.element,this._getPopoverAnch or.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind( this),true);this.textEditor.element.addEventListener("keydown",this._onKeyDown.b ind(this),true);this.textEditor.addEventListener(WebInspector.TextEditor.Events. GutterClick,this._handleGutterClick.bind(this),this);this._breakpointManager.add EventListener(WebInspector.BreakpointManager.Events.BreakpointAdded,this._breakp ointAdded,this);this._breakpointManager.addEventListener(WebInspector.Breakpoint Manager.Events.BreakpointRemoved,this._breakpointRemoved,this);this._uiSourceCod e.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded,this._co nsoleMessageAdded,this);this._uiSourceCode.addEventListener(WebInspector.UISourc eCode.Events.ConsoleMessageRemoved,this._consoleMessageRemoved,this);this._uiSou rceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared ,this._consoleMessagesCleared,this);this._uiSourceCode.addEventListener(WebInspe ctor.UISourceCode.Events.SourceMappingChanged,this._onSourceMappingChanged,this) ;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCop yChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebI nspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,thi s);this._registerShortcuts();this._updateScriptFile();}
316 WebInspector.JavaScriptSourceFrame.prototype={_registerShortcuts:function()
317 {var modifiers=WebInspector.KeyboardShortcut.Modifiers;this.addShortcut(WebInspe ctor.KeyboardShortcut.makeKey("e",modifiers.Shift|modifiers.Ctrl),this._evaluate SelectionInConsole.bind(this));},_evaluateSelectionInConsole:function(event)
318 {var selection=this.textEditor.selection();if(!selection||selection.isEmpty())
319 return false;WebInspector.evaluateInConsole(this.textEditor.copyRange(selection) );return true;},wasShown:function()
320 {WebInspector.UISourceCodeFrame.prototype.wasShown.call(this);},willHide:functio n()
321 {WebInspector.UISourceCodeFrame.prototype.willHide.call(this);this._popoverHelpe r.hidePopover();},onUISourceCodeContentChanged:function()
322 {this._removeAllBreakpoints();WebInspector.UISourceCodeFrame.prototype.onUISourc eCodeContentChanged.call(this);},populateLineGutterContextMenu:function(contextM enu,lineNumber)
323 {contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitle s()?"Continue to here":"Continue to Here"),this._continueToLine.bind(this,lineNu mber));var breakpoint=this._breakpointManager.findBreakpoint(this._uiSourceCode, lineNumber);if(!breakpoint){contextMenu.appendItem(WebInspector.UIString(WebInsp ector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Breakpoint"),this._setBreak point.bind(this,lineNumber,"",true));contextMenu.appendItem(WebInspector.UIStrin g(WebInspector.useLowerCaseMenuTitles()?"Add conditional breakpoint…":"Add Condi tional Breakpoint…"),this._editBreakpointCondition.bind(this,lineNumber));}else{ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Remove breakpoint":"Remove Breakpoint"),breakpoint.remove.bind(breakpoint)); contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Edit breakpoint…":"Edit Breakpoint…"),this._editBreakpointCondition.bind(thi s,lineNumber,breakpoint));if(breakpoint.enabled())
324 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Disable breakpoint":"Disable Breakpoint"),breakpoint.setEnabled.bind(breakpo int,false));else
325 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Enable breakpoint":"Enable Breakpoint"),breakpoint.setEnabled.bind(breakpoin t,true));}},populateTextAreaContextMenu:function(contextMenu,lineNumber)
326 {var textSelection=this.textEditor.selection();if(textSelection&&!textSelection. isEmpty()){var selection=this.textEditor.copyRange(textSelection);var addToWatch Label=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add to watch" :"Add to Watch");contextMenu.appendItem(addToWatchLabel,this._scriptsPanel.addTo Watch.bind(this._scriptsPanel,selection));var evaluateLabel=WebInspector.UIStrin g(WebInspector.useLowerCaseMenuTitles()?"Evaluate in console":"Evaluate in Conso le");contextMenu.appendItem(evaluateLabel,WebInspector.evaluateInConsole.bind(We bInspector,selection));contextMenu.appendSeparator();}else if(!this._uiSourceCod e.isEditable()&&this._uiSourceCode.contentType()===WebInspector.resourceTypes.Sc ript){function liveEdit(event)
327 {var liveEditUISourceCode=WebInspector.liveEditSupport.uiSourceCodeForLiveEdit(t his._uiSourceCode);this._scriptsPanel.showUISourceCode(liveEditUISourceCode,line Number)}
328 var liveEditLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"L ive edit":"Live Edit");contextMenu.appendItem(liveEditLabel,liveEdit.bind(this)) ;contextMenu.appendSeparator();}
329 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this,c ontextMenu,lineNumber);},_workingCopyChanged:function(event)
330 {if(this._supportsEnabledBreakpointsWhileEditing()||this._scriptFile)
331 return;if(this._uiSourceCode.isDirty())
332 this._muteBreakpointsWhileEditing();else
333 this._restoreBreakpointsAfterEditing();},_workingCopyCommitted:function(event)
334 {if(this._supportsEnabledBreakpointsWhileEditing()||this._scriptFile)
335 return;this._restoreBreakpointsAfterEditing();},_didMergeToVM:function()
336 {if(this._supportsEnabledBreakpointsWhileEditing())
337 return;this._restoreBreakpointsAfterEditing();},_didDivergeFromVM:function()
338 {if(this._supportsEnabledBreakpointsWhileEditing())
339 return;this._muteBreakpointsWhileEditing();},_muteBreakpointsWhileEditing:functi on()
340 {if(this._muted)
341 return;for(var lineNumber=0;lineNumber<this._textEditor.linesCount;++lineNumber) {var breakpointDecoration=this._textEditor.getAttribute(lineNumber,"breakpoint") ;if(!breakpointDecoration)
342 continue;this._removeBreakpointDecoration(lineNumber);this._addBreakpointDecorat ion(lineNumber,breakpointDecoration.condition,breakpointDecoration.enabled,true) ;}
343 this._muted=true;},_supportsEnabledBreakpointsWhileEditing:function()
344 {return this._uiSourceCode.project().type()===WebInspector.projectTypes.Snippets ;},_restoreBreakpointsAfterEditing:function()
345 {delete this._muted;var breakpoints={};for(var lineNumber=0;lineNumber<this._tex tEditor.linesCount;++lineNumber){var breakpointDecoration=this._textEditor.getAt tribute(lineNumber,"breakpoint");if(breakpointDecoration){breakpoints[lineNumber ]=breakpointDecoration;this._removeBreakpointDecoration(lineNumber);}}
346 this._removeAllBreakpoints();for(var lineNumberString in breakpoints){var lineNu mber=parseInt(lineNumberString,10);if(isNaN(lineNumber))
347 continue;var breakpointDecoration=breakpoints[lineNumberString];this._setBreakpo int(lineNumber,breakpointDecoration.condition,breakpointDecoration.enabled);}},_ removeAllBreakpoints:function()
348 {var breakpoints=this._breakpointManager.breakpointsForUISourceCode(this._uiSour ceCode);for(var i=0;i<breakpoints.length;++i)
349 breakpoints[i].remove();},_getPopoverAnchor:function(element,event)
350 {if(!WebInspector.debuggerModel.isPaused())
351 return null;var textPosition=this.textEditor.coordinatesToCursorPosition(event.x ,event.y);if(!textPosition)
352 return null;var mouseLine=textPosition.startLine;var mouseColumn=textPosition.st artColumn;var textSelection=this.textEditor.selection();if(textSelection&&!textS election.isEmpty()){if(textSelection.startLine!==textSelection.endLine||textSele ction.startLine!==mouseLine||mouseColumn<textSelection.startColumn||mouseColumn> textSelection.endColumn)
353 return null;var leftCorner=this.textEditor.cursorPositionToCoordinates(textSelec tion.startLine,textSelection.startColumn);var rightCorner=this.textEditor.cursor PositionToCoordinates(textSelection.endLine,textSelection.endColumn);var anchorB ox=new AnchorBox(leftCorner.x,leftCorner.y,rightCorner.x-leftCorner.x,leftCorner .height);anchorBox.highlight={lineNumber:textSelection.startLine,startColumn:tex tSelection.startColumn,endColumn:textSelection.endColumn-1};anchorBox.forSelecti on=true;return anchorBox;}
354 var token=this.textEditor.tokenAtTextPosition(textPosition.startLine,textPositio n.startColumn);if(!token)
355 return null;var lineNumber=textPosition.startLine;var line=this.textEditor.line( lineNumber);var tokenContent=line.substring(token.startColumn,token.endColumn+1) ;if(token.type!=="javascript-ident"&&(token.type!=="javascript-keyword"||tokenCo ntent!=="this"))
356 return null;var leftCorner=this.textEditor.cursorPositionToCoordinates(lineNumbe r,token.startColumn);var rightCorner=this.textEditor.cursorPositionToCoordinates (lineNumber,token.endColumn+1);var anchorBox=new AnchorBox(leftCorner.x,leftCorn er.y,rightCorner.x-leftCorner.x,leftCorner.height);anchorBox.highlight={lineNumb er:lineNumber,startColumn:token.startColumn,endColumn:token.endColumn};return an chorBox;},_resolveObjectForPopover:function(anchorBox,showCallback,objectGroupNa me)
357 {function showObjectPopover(result,wasThrown)
358 {if(!WebInspector.debuggerModel.isPaused()){this._popoverHelper.hidePopover();re turn;}
359 this._popoverAnchorBox=anchorBox;showCallback(WebInspector.RemoteObject.fromPayl oad(result),wasThrown,this._popoverAnchorBox);if(this._popoverAnchorBox){var hig hlightRange=new WebInspector.TextRange(lineNumber,startHighlight,lineNumber,endH ighlight);this._popoverAnchorBox._highlightDescriptor=this.textEditor.highlightR ange(highlightRange,"source-frame-eval-expression");}}
360 if(!WebInspector.debuggerModel.isPaused()){this._popoverHelper.hidePopover();ret urn;}
361 var lineNumber=anchorBox.highlight.lineNumber;var startHighlight=anchorBox.highl ight.startColumn;var endHighlight=anchorBox.highlight.endColumn;var line=this.te xtEditor.line(lineNumber);if(!anchorBox.forSelection){while(startHighlight>1&&li ne.charAt(startHighlight-1)==='.')
362 startHighlight=this.textEditor.tokenAtTextPosition(lineNumber,startHighlight-2). startColumn;}
363 var evaluationText=line.substring(startHighlight,endHighlight+1);var selectedCal lFrame=WebInspector.debuggerModel.selectedCallFrame();selectedCallFrame.evaluate (evaluationText,objectGroupName,false,true,false,false,showObjectPopover.bind(th is));},_onHidePopover:function()
364 {if(!this._popoverAnchorBox)
365 return;if(this._popoverAnchorBox._highlightDescriptor)
366 this.textEditor.removeHighlight(this._popoverAnchorBox._highlightDescriptor);del ete this._popoverAnchorBox;},_addBreakpointDecoration:function(lineNumber,condit ion,enabled,mutedWhileEditing)
367 {var breakpoint={condition:condition,enabled:enabled};this.textEditor.setAttribu te(lineNumber,"breakpoint",breakpoint);var disabled=!enabled||mutedWhileEditing; this.textEditor.addBreakpoint(lineNumber,disabled,!!condition);},_removeBreakpoi ntDecoration:function(lineNumber)
368 {this.textEditor.removeAttribute(lineNumber,"breakpoint");this.textEditor.remove Breakpoint(lineNumber);},_onKeyDown:function(event)
369 {if(event.keyIdentifier==="U+001B"){if(this._popoverHelper.isPopoverVisible()){t his._popoverHelper.hidePopover();event.consume();}}},_editBreakpointCondition:fu nction(lineNumber,breakpoint)
370 {this._conditionElement=this._createConditionElement(lineNumber);this.textEditor .addDecoration(lineNumber,this._conditionElement);function finishEditing(committ ed,element,newText)
371 {this.textEditor.removeDecoration(lineNumber,this._conditionElement);delete this ._conditionEditorElement;delete this._conditionElement;if(!committed)
372 return;if(breakpoint)
373 breakpoint.setCondition(newText);else
374 this._setBreakpoint(lineNumber,newText,true);}
375 var config=new WebInspector.EditingConfig(finishEditing.bind(this,true),finishEd iting.bind(this,false));WebInspector.startEditing(this._conditionEditorElement,c onfig);this._conditionEditorElement.value=breakpoint?breakpoint.condition():"";t his._conditionEditorElement.select();},_createConditionElement:function(lineNumb er)
376 {var conditionElement=document.createElement("div");conditionElement.className=" source-frame-breakpoint-condition";var labelElement=document.createElement("labe l");labelElement.className="source-frame-breakpoint-message";labelElement.htmlFo r="source-frame-breakpoint-condition";labelElement.appendChild(document.createTe xtNode(WebInspector.UIString("The breakpoint on line %d will stop only if this e xpression is true:",lineNumber)));conditionElement.appendChild(labelElement);var editorElement=document.createElement("input");editorElement.id="source-frame-br eakpoint-condition";editorElement.className="monospace";editorElement.type="text ";conditionElement.appendChild(editorElement);this._conditionEditorElement=edito rElement;return conditionElement;},setExecutionLine:function(lineNumber)
377 {this._executionLineNumber=lineNumber;if(this.loaded){this.textEditor.setExecuti onLine(lineNumber);this.revealLine(this._executionLineNumber);if(this.canEditSou rce())
378 this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber,0));}},cl earExecutionLine:function()
379 {if(this.loaded&&typeof this._executionLineNumber==="number")
380 this.textEditor.clearExecutionLine();delete this._executionLineNumber;},_lineNum berAfterEditing:function(lineNumber,oldRange,newRange)
381 {var shiftOffset=lineNumber<=oldRange.startLine?0:newRange.linesCount-oldRange.l inesCount;if(lineNumber===oldRange.startLine){var whiteSpacesRegex=/^[\s\xA0]*$/ ;for(var i=0;lineNumber+i<=newRange.endLine;++i){if(!whiteSpacesRegex.test(this. textEditor.line(lineNumber+i))){shiftOffset=i;break;}}}
382 var newLineNumber=Math.max(0,lineNumber+shiftOffset);if(oldRange.startLine<lineN umber&&lineNumber<oldRange.endLine)
383 newLineNumber=oldRange.startLine;return newLineNumber;},_shouldIgnoreExternalBre akpointEvents:function()
384 {if(this._supportsEnabledBreakpointsWhileEditing())
385 return false;if(this._muted)
386 return true;return this._scriptFile&&(this._scriptFile.isDivergingFromVM()||this ._scriptFile.isMergingToVM());},_breakpointAdded:function(event)
387 {var uiLocation=(event.data.uiLocation);if(uiLocation.uiSourceCode!==this._uiSou rceCode)
388 return;if(this._shouldIgnoreExternalBreakpointEvents())
389 return;var breakpoint=(event.data.breakpoint);if(this.loaded)
390 this._addBreakpointDecoration(uiLocation.lineNumber,breakpoint.condition(),break point.enabled(),false);},_breakpointRemoved:function(event)
391 {var uiLocation=(event.data.uiLocation);if(uiLocation.uiSourceCode!==this._uiSou rceCode)
392 return;if(this._shouldIgnoreExternalBreakpointEvents())
393 return;var breakpoint=(event.data.breakpoint);var remainingBreakpoint=this._brea kpointManager.findBreakpoint(this._uiSourceCode,uiLocation.lineNumber);if(!remai ningBreakpoint&&this.loaded)
394 this._removeBreakpointDecoration(uiLocation.lineNumber);},_consoleMessageAdded:f unction(event)
395 {var message=(event.data);if(this.loaded)
396 this.addMessageToSource(message.lineNumber,message.originalMessage);},_consoleMe ssageRemoved:function(event)
397 {var message=(event.data);if(this.loaded)
398 this.removeMessageFromSource(message.lineNumber,message.originalMessage);},_cons oleMessagesCleared:function(event)
399 {this.clearMessages();},_onSourceMappingChanged:function(event)
400 {this._updateScriptFile();},_updateScriptFile:function()
401 {if(this._scriptFile){this._scriptFile.removeEventListener(WebInspector.ScriptFi le.Events.DidMergeToVM,this._didMergeToVM,this);this._scriptFile.removeEventList ener(WebInspector.ScriptFile.Events.DidDivergeFromVM,this._didDivergeFromVM,this );if(this._muted&&!this._uiSourceCode.isDirty())
402 this._restoreBreakpointsAfterEditing();}
403 this._scriptFile=this._uiSourceCode.scriptFile();if(this._scriptFile){this._scri ptFile.addEventListener(WebInspector.ScriptFile.Events.DidMergeToVM,this._didMer geToVM,this);this._scriptFile.addEventListener(WebInspector.ScriptFile.Events.Di dDivergeFromVM,this._didDivergeFromVM,this);if(this.loaded)
404 this._scriptFile.checkMapping();}},onTextEditorContentLoaded:function()
405 {if(typeof this._executionLineNumber==="number")
406 this.setExecutionLine(this._executionLineNumber);var breakpointLocations=this._b reakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);for(var i=0;i<breakpointLocations.length;++i)
407 this._breakpointAdded({data:breakpointLocations[i]});var messages=this._uiSource Code.consoleMessages();for(var i=0;i<messages.length;++i){var message=messages[i ];this.addMessageToSource(message.lineNumber,message.originalMessage);}
408 if(this._scriptFile)
409 this._scriptFile.checkMapping();},_handleGutterClick:function(event)
410 {if(this._muted)
411 return;var eventData=(event.data);var lineNumber=eventData.lineNumber;var eventO bject=(eventData.event);if(eventObject.button!=0||eventObject.altKey||eventObjec t.ctrlKey||eventObject.metaKey)
412 return;this._toggleBreakpoint(lineNumber,eventObject.shiftKey);eventObject.consu me(true);},_toggleBreakpoint:function(lineNumber,onlyDisable)
413 {var breakpoint=this._breakpointManager.findBreakpoint(this._uiSourceCode,lineNu mber);if(breakpoint){if(onlyDisable)
414 breakpoint.setEnabled(!breakpoint.enabled());else
415 breakpoint.remove();}else
416 this._setBreakpoint(lineNumber,"",true);},toggleBreakpointOnCurrentLine:function ()
417 {if(this._muted)
418 return;var selection=this.textEditor.selection();if(!selection)
419 return;this._toggleBreakpoint(selection.startLine,false);},_setBreakpoint:functi on(lineNumber,condition,enabled)
420 {this._breakpointManager.setBreakpoint(this._uiSourceCode,lineNumber,condition,e nabled);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.SetBreakpoint,u rl:this._uiSourceCode.originURL(),line:lineNumber,enabled:enabled});},_continueT oLine:function(lineNumber)
421 {var rawLocation=(this._uiSourceCode.uiLocationToRawLocation(lineNumber,0));WebI nspector.debuggerModel.continueToLocation(rawLocation);},dispose:function()
422 {this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Even ts.BreakpointAdded,this._breakpointAdded,this);this._breakpointManager.removeEve ntListener(WebInspector.BreakpointManager.Events.BreakpointRemoved,this._breakpo intRemoved,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCod e.Events.ConsoleMessageAdded,this._consoleMessageAdded,this);this._uiSourceCode. removeEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved,this. _consoleMessageRemoved,this);this._uiSourceCode.removeEventListener(WebInspector .UISourceCode.Events.ConsoleMessagesCleared,this._consoleMessagesCleared,this);t his._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMap pingChanged,this._onSourceMappingChanged,this);this._uiSourceCode.removeEventLis tener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChang ed,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events .WorkingCopyCommitted,this._workingCopyCommitted,this);WebInspector.UISourceCode Frame.prototype.dispose.call(this);},__proto__:WebInspector.UISourceCodeFrame.pr ototype};WebInspector.NavigatorOverlayController=function(parentSidebarView,navi gatorView,editorView)
423 {this._parentSidebarView=parentSidebarView;this._navigatorView=navigatorView;thi s._editorView=editorView;this._navigatorSidebarResizeWidgetElement=this._navigat orView.element.createChild("div","resizer-widget");this._parentSidebarView.insta llResizer(this._navigatorSidebarResizeWidgetElement);this._navigatorShowHideButt on=new WebInspector.StatusBarButton(WebInspector.UIString("Hide navigator"),"lef t-sidebar-show-hide-button scripts-navigator-show-hide-button",3);this._navigato rShowHideButton.state="left";this._navigatorShowHideButton.addEventListener("cli ck",this._toggleNavigator,this);this._editorView.element.appendChild(this._navig atorShowHideButton.element);WebInspector.settings.navigatorHidden=WebInspector.s ettings.createSetting("navigatorHidden",true);if(WebInspector.settings.navigator Hidden.get())
424 this._toggleNavigator();}
425 WebInspector.NavigatorOverlayController.prototype={wasShown:function()
426 {window.setTimeout(this._maybeShowNavigatorOverlay.bind(this),0);},_maybeShowNav igatorOverlay:function()
427 {if(WebInspector.settings.navigatorHidden.get()&&!WebInspector.settings.navigato rWasOnceHidden.get())
428 this.showNavigatorOverlay();},_toggleNavigator:function()
429 {if(this._navigatorShowHideButton.state==="overlay")
430 this._pinNavigator();else if(this._navigatorShowHideButton.state==="right")
431 this.showNavigatorOverlay();else
432 this._hidePinnedNavigator();},_hidePinnedNavigator:function()
433 {this._navigatorShowHideButton.state="right";this._navigatorShowHideButton.title =WebInspector.UIString("Show navigator");this._parentSidebarView.element.appendC hild(this._navigatorShowHideButton.element);this._editorView.element.addStyleCla ss("navigator-hidden");this._navigatorSidebarResizeWidgetElement.addStyleClass(" hidden");this._parentSidebarView.hideSidebarElement();this._navigatorView.detach ();this._editorView.focus();WebInspector.settings.navigatorWasOnceHidden.set(tru e);WebInspector.settings.navigatorHidden.set(true);},_pinNavigator:function()
434 {this._navigatorShowHideButton.state="left";this._navigatorShowHideButton.title= WebInspector.UIString("Hide navigator");this._editorView.element.removeStyleClas s("navigator-hidden");this._navigatorSidebarResizeWidgetElement.removeStyleClass ("hidden");this._editorView.element.appendChild(this._navigatorShowHideButton.el ement);this._innerHideNavigatorOverlay();this._parentSidebarView.showSidebarElem ent();this._navigatorView.show(this._parentSidebarView.sidebarElement);this._nav igatorView.focus();WebInspector.settings.navigatorHidden.set(false);},showNaviga torOverlay:function()
435 {if(this._navigatorShowHideButton.state==="overlay")
436 return;this._navigatorShowHideButton.state="overlay";this._navigatorShowHideButt on.title=WebInspector.UIString("Pin navigator");this._sidebarOverlay=new WebInsp ector.SidebarOverlay(this._navigatorView,"scriptsPanelNavigatorOverlayWidth",Pre ferences.minScriptsSidebarWidth);this._boundKeyDown=this._keyDown.bind(this);thi s._sidebarOverlay.element.addEventListener("keydown",this._boundKeyDown,false);v ar navigatorOverlayResizeWidgetElement=document.createElement("div");navigatorOv erlayResizeWidgetElement.addStyleClass("resizer-widget");this._sidebarOverlay.re sizerWidgetElement=navigatorOverlayResizeWidgetElement;this._navigatorView.eleme nt.appendChild(this._navigatorShowHideButton.element);this._boundContainingEleme ntFocused=this._containingElementFocused.bind(this);this._parentSidebarView.elem ent.addEventListener("mousedown",this._boundContainingElementFocused,false);this ._sidebarOverlay.show(this._parentSidebarView.element);this._navigatorView.focus ();},_keyDown:function(event)
437 {if(event.handled)
438 return;if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code){this.hide NavigatorOverlay();event.consume(true);}},hideNavigatorOverlay:function()
439 {if(this._navigatorShowHideButton.state!=="overlay")
440 return;this._navigatorShowHideButton.state="right";this._navigatorShowHideButton .title=WebInspector.UIString("Show navigator");this._parentSidebarView.element.a ppendChild(this._navigatorShowHideButton.element);this._innerHideNavigatorOverla y();this._editorView.focus();},_innerHideNavigatorOverlay:function()
441 {this._parentSidebarView.element.removeEventListener("mousedown",this._boundCont ainingElementFocused,false);this._sidebarOverlay.element.removeEventListener("ke ydown",this._boundKeyDown,false);this._sidebarOverlay.hide();},_containingElemen tFocused:function(event)
442 {if(!event.target.isSelfOrDescendant(this._sidebarOverlay.element))
443 this.hideNavigatorOverlay();},isNavigatorPinned:function()
444 {return this._navigatorShowHideButton.state==="left";},isNavigatorHidden:functio n()
445 {return this._navigatorShowHideButton.state==="right";}};WebInspector.NavigatorV iew=function()
446 {WebInspector.View.call(this);this.registerRequiredCSS("navigatorView.css");var scriptsTreeElement=document.createElement("ol");this._scriptsTree=new WebInspect or.NavigatorTreeOutline(scriptsTreeElement);this._scriptsTree.childrenListElemen t.addEventListener("keypress",this._treeKeyPress.bind(this),true);var scriptsOut lineElement=document.createElement("div");scriptsOutlineElement.addStyleClass("o utline-disclosure");scriptsOutlineElement.addStyleClass("navigator");scriptsOutl ineElement.appendChild(scriptsTreeElement);this.element.addStyleClass("fill");th is.element.addStyleClass("navigator-container");this.element.appendChild(scripts OutlineElement);this.setDefaultFocusedElement(this._scriptsTree.element);this._u iSourceCodeNodes=new Map();this._subfolderNodes=new Map();this._rootNode=new Web Inspector.NavigatorRootTreeNode(this);this._rootNode.populate();WebInspector.res ourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Inspec tedURLChanged,this._inspectedURLChanged,this);this.element.addEventListener("con textmenu",this.handleContextMenu.bind(this),false);}
447 WebInspector.NavigatorView.Events={ItemSelected:"ItemSelected",ItemSearchStarted :"ItemSearchStarted",ItemRenamingRequested:"ItemRenamingRequested",ItemCreationR equested:"ItemCreationRequested"}
448 WebInspector.NavigatorView.iconClassForType=function(type)
449 {if(type===WebInspector.NavigatorTreeOutline.Types.Domain)
450 return"navigator-domain-tree-item";if(type===WebInspector.NavigatorTreeOutline.T ypes.FileSystem)
451 return"navigator-folder-tree-item";return"navigator-folder-tree-item";}
452 WebInspector.NavigatorView.prototype={addUISourceCode:function(uiSourceCode)
453 {var projectNode=this._projectNode(uiSourceCode.project());var folderNode=this._ folderNode(projectNode,uiSourceCode.parentPath());var uiSourceCodeNode=new WebIn spector.NavigatorUISourceCodeTreeNode(this,uiSourceCode);this._uiSourceCodeNodes .put(uiSourceCode,uiSourceCodeNode);folderNode.appendChild(uiSourceCodeNode);if( uiSourceCode.url===WebInspector.inspectedPageURL)
454 this.revealUISourceCode(uiSourceCode);},_inspectedURLChanged:function(event)
455 {var nodes=this._uiSourceCodeNodes.values();for(var i=0;i<nodes.length;++i){var uiSourceCode=nodes[i].uiSourceCode();if(uiSourceCode.url===WebInspector.inspecte dPageURL)
456 this.revealUISourceCode(uiSourceCode);}},_projectNode:function(project)
457 {if(!project.displayName())
458 return this._rootNode;var projectNode=this._rootNode.child(project.id());if(!pro jectNode){var type=project.type()===WebInspector.projectTypes.FileSystem?WebInsp ector.NavigatorTreeOutline.Types.FileSystem:WebInspector.NavigatorTreeOutline.Ty pes.Domain;projectNode=new WebInspector.NavigatorFolderTreeNode(this,project,pro ject.id(),type,"",project.displayName());this._rootNode.appendChild(projectNode) ;}
459 return projectNode;},_folderNode:function(projectNode,folderPath)
460 {if(!folderPath)
461 return projectNode;var subfolderNodes=this._subfolderNodes.get(projectNode);if(! subfolderNodes){subfolderNodes=(new StringMap());this._subfolderNodes.put(projec tNode,subfolderNodes);}
462 var folderNode=subfolderNodes.get(folderPath);if(folderNode)
463 return folderNode;var parentNode=projectNode;var index=folderPath.lastIndexOf("/ ");if(index!==-1)
464 parentNode=this._folderNode(projectNode,folderPath.substring(0,index));var name= folderPath.substring(index+1);folderNode=new WebInspector.NavigatorFolderTreeNod e(this,null,name,WebInspector.NavigatorTreeOutline.Types.Folder,folderPath,name) ;subfolderNodes.put(folderPath,folderNode);parentNode.appendChild(folderNode);re turn folderNode;},revealUISourceCode:function(uiSourceCode,select)
465 {var node=this._uiSourceCodeNodes.get(uiSourceCode);if(!node)
466 return null;if(this._scriptsTree.selectedTreeElement)
467 this._scriptsTree.selectedTreeElement.deselect();this._lastSelectedUISourceCode= uiSourceCode;node.reveal(select);},_scriptSelected:function(uiSourceCode,focusSo urce)
468 {this._lastSelectedUISourceCode=uiSourceCode;var data={uiSourceCode:uiSourceCode ,focusSource:focusSource};this.dispatchEventToListeners(WebInspector.NavigatorVi ew.Events.ItemSelected,data);},removeUISourceCode:function(uiSourceCode)
469 {var node=this._uiSourceCodeNodes.get(uiSourceCode);if(!node)
470 return;var projectNode=this._projectNode(uiSourceCode.project());var subfolderNo des=this._subfolderNodes.get(projectNode);var parentNode=node.parent;this._uiSou rceCodeNodes.remove(uiSourceCode);parentNode.removeChild(node);node=parentNode;w hile(node){parentNode=node.parent;if(!parentNode||!node.isEmpty())
471 break;if(subfolderNodes)
472 subfolderNodes.remove(node._folderPath);parentNode.removeChild(node);node=parent Node;}},requestRename:function(uiSourceCode)
473 {this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemRenaming Requested,uiSourceCode);},rename:function(uiSourceCode,callback)
474 {var node=this._uiSourceCodeNodes.get(uiSourceCode);if(!node)
475 return null;node.rename(callback);},reset:function()
476 {var nodes=this._uiSourceCodeNodes.values();for(var i=0;i<nodes.length;++i)
477 nodes[i].dispose();this._scriptsTree.removeChildren();this._uiSourceCodeNodes.cl ear();this._subfolderNodes.clear();this._rootNode.reset();},handleContextMenu:fu nction(event)
478 {var contextMenu=new WebInspector.ContextMenu(event);this._appendAddFolderItem(c ontextMenu);contextMenu.show();},_appendAddFolderItem:function(contextMenu)
479 {function addFolder()
480 {WebInspector.isolatedFileSystemManager.addFileSystem();}
481 var addFolderLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?" Add folder to workspace":"Add Folder to Workspace");contextMenu.appendItem(addFo lderLabel,addFolder);},handleFileContextMenu:function(event,uiSourceCode)
482 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicabl eItems(uiSourceCode);contextMenu.appendSeparator();this._appendAddFolderItem(con textMenu);contextMenu.show();},handleFolderContextMenu:function(event,node)
483 {var contextMenu=new WebInspector.ContextMenu(event);var path="/";var projectNod e=node;while(projectNode.parent!==this._rootNode){path="/"+projectNode.id+path;p rojectNode=projectNode.parent;}
484 var project=projectNode._project;if(project.type()===WebInspector.projectTypes.F ileSystem){function refresh()
485 {project.refresh(path);}
486 function create()
487 {var data={};data.project=project;data.path=path;this.dispatchEventToListeners(W ebInspector.NavigatorView.Events.ItemCreationRequested,data);}
488 contextMenu.appendItem(WebInspector.UIString("Refresh"),refresh.bind(this));cont extMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?" New file":"New File"),create.bind(this));}
489 contextMenu.appendSeparator();this._appendAddFolderItem(contextMenu);if(project. type()===WebInspector.projectTypes.FileSystem&&node===projectNode){function remo veFolder()
490 {var shouldRemove=window.confirm(WebInspector.UIString("Are you sure you want to remove this folder?"));if(shouldRemove)
491 project.remove();}
492 var removeFolderLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles( )?"Remove folder from workspace":"Remove Folder from Workspace");contextMenu.app endItem(removeFolderLabel,removeFolder);}
493 contextMenu.show();},_treeKeyPress:function(event)
494 {if(WebInspector.isBeingEdited(this._scriptsTree.childrenListElement))
495 return;var searchText=String.fromCharCode(event.charCode);if(searchText.trim()!= =searchText)
496 return;this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemSearc hStarted,searchText);event.consume(true);},__proto__:WebInspector.View.prototype }
497 WebInspector.NavigatorTreeOutline=function(element)
498 {TreeOutline.call(this,element);this.element=element;this.comparator=WebInspecto r.NavigatorTreeOutline._treeElementsCompare;}
499 WebInspector.NavigatorTreeOutline.Types={Root:"Root",Domain:"Domain",Folder:"Fol der",UISourceCode:"UISourceCode",FileSystem:"FileSystem"}
500 WebInspector.NavigatorTreeOutline._treeElementsCompare=function compare(treeElem ent1,treeElement2)
501 {function typeWeight(treeElement)
502 {var type=treeElement.type();if(type===WebInspector.NavigatorTreeOutline.Types.D omain){if(treeElement.titleText===WebInspector.inspectedPageDomain)
503 return 1;return 2;}
504 if(type===WebInspector.NavigatorTreeOutline.Types.FileSystem)
505 return 3;if(type===WebInspector.NavigatorTreeOutline.Types.Folder)
506 return 4;return 5;}
507 var typeWeight1=typeWeight(treeElement1);var typeWeight2=typeWeight(treeElement2 );var result;if(typeWeight1>typeWeight2)
508 result=1;else if(typeWeight1<typeWeight2)
509 result=-1;else{var title1=treeElement1.titleText;var title2=treeElement2.titleTe xt;result=title1.compareTo(title2);}
510 return result;}
511 WebInspector.NavigatorTreeOutline.prototype={scriptTreeElements:function()
512 {var result=[];if(this.children.length){for(var treeElement=this.children[0];tre eElement;treeElement=treeElement.traverseNextTreeElement(false,this,true)){if(tr eeElement instanceof WebInspector.NavigatorSourceTreeElement)
513 result.push(treeElement.uiSourceCode);}}
514 return result;},__proto__:TreeOutline.prototype}
515 WebInspector.BaseNavigatorTreeElement=function(type,title,iconClasses,hasChildre n,noIcon)
516 {this._type=type;TreeElement.call(this,"",null,hasChildren);this._titleText=titl e;this._iconClasses=iconClasses;this._noIcon=noIcon;}
517 WebInspector.BaseNavigatorTreeElement.prototype={onattach:function()
518 {this.listItemElement.removeChildren();if(this._iconClasses){for(var i=0;i<this. _iconClasses.length;++i)
519 this.listItemElement.addStyleClass(this._iconClasses[i]);}
520 var selectionElement=document.createElement("div");selectionElement.className="s election";this.listItemElement.appendChild(selectionElement);if(!this._noIcon){t his.imageElement=document.createElement("img");this.imageElement.className="icon ";this.listItemElement.appendChild(this.imageElement);}
521 this.titleElement=document.createElement("div");this.titleElement.className="bas e-navigator-tree-element-title";this._titleTextNode=document.createTextNode(""); this._titleTextNode.textContent=this._titleText;this.titleElement.appendChild(th is._titleTextNode);this.listItemElement.appendChild(this.titleElement);},onrevea l:function()
522 {if(this.listItemElement)
523 this.listItemElement.scrollIntoViewIfNeeded(true);},get titleText()
524 {return this._titleText;},set titleText(titleText)
525 {if(this._titleText===titleText)
526 return;this._titleText=titleText||"";if(this.titleElement)
527 this.titleElement.textContent=this._titleText;},type:function()
528 {return this._type;},__proto__:TreeElement.prototype}
529 WebInspector.NavigatorFolderTreeElement=function(navigatorView,type,title)
530 {var iconClass=WebInspector.NavigatorView.iconClassForType(type);WebInspector.Ba seNavigatorTreeElement.call(this,type,title,[iconClass],true);this._navigatorVie w=navigatorView;}
531 WebInspector.NavigatorFolderTreeElement.prototype={onpopulate:function()
532 {this._node.populate();},onattach:function()
533 {WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this);this.collap se();this.listItemElement.addEventListener("contextmenu",this._handleContextMenu Event.bind(this),false);},setNode:function(node)
534 {this._node=node;var paths=[];while(node&&!node.isRoot()){paths.push(node._title );node=node.parent;}
535 paths.reverse();this.tooltip=paths.join("/");},_handleContextMenuEvent:function( event)
536 {if(!this._node)
537 return;this.select();this._navigatorView.handleFolderContextMenu(event,this._nod e);},__proto__:WebInspector.BaseNavigatorTreeElement.prototype}
538 WebInspector.NavigatorSourceTreeElement=function(navigatorView,uiSourceCode,titl e)
539 {WebInspector.BaseNavigatorTreeElement.call(this,WebInspector.NavigatorTreeOutli ne.Types.UISourceCode,title,["navigator-"+uiSourceCode.contentType().name()+"-tr ee-item"],false);this._navigatorView=navigatorView;this._uiSourceCode=uiSourceCo de;this.tooltip=uiSourceCode.originURL();}
540 WebInspector.NavigatorSourceTreeElement.prototype={get uiSourceCode()
541 {return this._uiSourceCode;},onattach:function()
542 {WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this);this.listIt emElement.draggable=true;this.listItemElement.addEventListener("click",this._onc lick.bind(this),false);this.listItemElement.addEventListener("contextmenu",this. _handleContextMenuEvent.bind(this),false);this.listItemElement.addEventListener( "mousedown",this._onmousedown.bind(this),false);this.listItemElement.addEventLis tener("dragstart",this._ondragstart.bind(this),false);},_onmousedown:function(ev ent)
543 {if(event.which===1)
544 this._uiSourceCode.requestContent(callback.bind(this));function callback(content ,contentEncoded,mimeType)
545 {this._warmedUpContent=content;}},_shouldRenameOnMouseDown:function()
546 {if(!this._uiSourceCode.canRename())
547 return false;var isSelected=this===this.treeOutline.selectedTreeElement;var isFo cused=this.treeOutline.childrenListElement.isSelfOrAncestor(document.activeEleme nt);return isSelected&&isFocused&&!WebInspector.isBeingEdited(this.treeOutline.e lement);},selectOnMouseDown:function(event)
548 {if(event.which!==1||!this._shouldRenameOnMouseDown()){TreeElement.prototype.sel ectOnMouseDown.call(this,event);return;}
549 setTimeout(rename.bind(this),300);function rename()
550 {if(this._shouldRenameOnMouseDown())
551 this._navigatorView.requestRename(this._uiSourceCode);}},_ondragstart:function(e vent)
552 {event.dataTransfer.setData("text/plain",this._warmedUpContent);event.dataTransf er.effectAllowed="copy";return true;},onspace:function()
553 {this._navigatorView._scriptSelected(this.uiSourceCode,true);return true;},_oncl ick:function(event)
554 {this._navigatorView._scriptSelected(this.uiSourceCode,false);},ondblclick:funct ion(event)
555 {var middleClick=event.button===1;this._navigatorView._scriptSelected(this.uiSou rceCode,!middleClick);},onenter:function()
556 {this._navigatorView._scriptSelected(this.uiSourceCode,true);return true;},_hand leContextMenuEvent:function(event)
557 {this.select();this._navigatorView.handleFileContextMenu(event,this._uiSourceCod e);},__proto__:WebInspector.BaseNavigatorTreeElement.prototype}
558 WebInspector.NavigatorTreeNode=function(id)
559 {this.id=id;this._children=new StringMap();}
560 WebInspector.NavigatorTreeNode.prototype={treeElement:function(){},dispose:funct ion(){},isRoot:function()
561 {return false;},hasChildren:function()
562 {return true;},populate:function()
563 {if(this.isPopulated())
564 return;if(this.parent)
565 this.parent.populate();this._populated=true;this.wasPopulated();},wasPopulated:f unction()
566 {var children=this.children();for(var i=0;i<children.length;++i)
567 this.treeElement().appendChild(children[i].treeElement());},didAddChild:function (node)
568 {if(this.isPopulated())
569 this.treeElement().appendChild(node.treeElement());},willRemoveChild:function(no de)
570 {if(this.isPopulated())
571 this.treeElement().removeChild(node.treeElement());},isPopulated:function()
572 {return this._populated;},isEmpty:function()
573 {return!this._children.size();},child:function(id)
574 {return this._children.get(id);},children:function()
575 {return this._children.values();},appendChild:function(node)
576 {this._children.put(node.id,node);node.parent=this;this.didAddChild(node);},remo veChild:function(node)
577 {this.willRemoveChild(node);this._children.remove(node.id);delete node.parent;no de.dispose();},reset:function()
578 {this._children.clear();}}
579 WebInspector.NavigatorRootTreeNode=function(navigatorView)
580 {WebInspector.NavigatorTreeNode.call(this,"");this._navigatorView=navigatorView; }
581 WebInspector.NavigatorRootTreeNode.prototype={isRoot:function()
582 {return true;},treeElement:function()
583 {return this._navigatorView._scriptsTree;},__proto__:WebInspector.NavigatorTreeN ode.prototype}
584 WebInspector.NavigatorUISourceCodeTreeNode=function(navigatorView,uiSourceCode)
585 {WebInspector.NavigatorTreeNode.call(this,uiSourceCode.name());this._navigatorVi ew=navigatorView;this._uiSourceCode=uiSourceCode;this._treeElement=null;}
586 WebInspector.NavigatorUISourceCodeTreeNode.prototype={uiSourceCode:function()
587 {return this._uiSourceCode;},treeElement:function()
588 {if(this._treeElement)
589 return this._treeElement;this._treeElement=new WebInspector.NavigatorSourceTreeE lement(this._navigatorView,this._uiSourceCode,"");this.updateTitle();this._uiSou rceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged,this._tit leChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Ev ents.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEve ntListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCo pyCommitted,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode. Events.FormattedChanged,this._formattedChanged,this);return this._treeElement;}, updateTitle:function(ignoreIsDirty)
590 {if(!this._treeElement)
591 return;var titleText=this._uiSourceCode.displayName();if(!ignoreIsDirty&&this._u iSourceCode.isDirty())
592 titleText="*"+titleText;this._treeElement.titleText=titleText;},hasChildren:func tion()
593 {return false;},dispose:function()
594 {if(!this._treeElement)
595 return;this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.T itleChanged,this._titleChanged,this);this._uiSourceCode.removeEventListener(WebI nspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);t his._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCo pyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListe ner(WebInspector.UISourceCode.Events.FormattedChanged,this._formattedChanged,thi s);},_titleChanged:function(event)
596 {this.updateTitle();},_workingCopyChanged:function(event)
597 {this.updateTitle();},_workingCopyCommitted:function(event)
598 {this.updateTitle();},_formattedChanged:function(event)
599 {this.updateTitle();},reveal:function(select)
600 {this.parent.populate();this.parent.treeElement().expand();this._treeElement.rev eal();if(select)
601 this._treeElement.select();},rename:function(callback)
602 {if(!this._treeElement)
603 return;var treeOutlineElement=this._treeElement.treeOutline.element;WebInspector .markBeingEdited(treeOutlineElement,true);function commitHandler(element,newTitl e,oldTitle)
604 {if(newTitle!==oldTitle){this._treeElement.titleText=newTitle;this._uiSourceCode .rename(newTitle,renameCallback.bind(this));return;}
605 afterEditing.call(this,true);}
606 function renameCallback(success)
607 {if(!success){WebInspector.markBeingEdited(treeOutlineElement,false);this.update Title();this.rename(callback);return;}
608 afterEditing.call(this,true);}
609 function cancelHandler()
610 {afterEditing.call(this,false);}
611 function afterEditing(committed)
612 {WebInspector.markBeingEdited(treeOutlineElement,false);this.updateTitle();this. _treeElement.treeOutline.childrenListElement.focus();if(callback)
613 callback(committed);}
614 var editingConfig=new WebInspector.EditingConfig(commitHandler.bind(this),cancel Handler.bind(this));this.updateTitle(true);WebInspector.startEditing(this._treeE lement.titleElement,editingConfig);window.getSelection().setBaseAndExtent(this._ treeElement.titleElement,0,this._treeElement.titleElement,1);},__proto__:WebInsp ector.NavigatorTreeNode.prototype}
615 WebInspector.NavigatorFolderTreeNode=function(navigatorView,project,id,type,fold erPath,title)
616 {WebInspector.NavigatorTreeNode.call(this,id);this._navigatorView=navigatorView; this._project=project;this._type=type;this._folderPath=folderPath;this._title=ti tle;}
617 WebInspector.NavigatorFolderTreeNode.prototype={treeElement:function()
618 {if(this._treeElement)
619 return this._treeElement;this._treeElement=this._createTreeElement(this._title,t his);return this._treeElement;},_createTreeElement:function(title,node)
620 {var treeElement=new WebInspector.NavigatorFolderTreeElement(this._navigatorView ,this._type,title);treeElement.setNode(node);return treeElement;},wasPopulated:f unction()
621 {if(!this._treeElement||this._treeElement._node!==this)
622 return;this._addChildrenRecursive();},_addChildrenRecursive:function()
623 {var children=this.children();for(var i=0;i<children.length;++i){var child=child ren[i];this.didAddChild(child);if(child instanceof WebInspector.NavigatorFolderT reeNode)
624 child._addChildrenRecursive();}},_shouldMerge:function(node)
625 {return this._type!==WebInspector.NavigatorTreeOutline.Types.Domain&&node instan ceof WebInspector.NavigatorFolderTreeNode;},didAddChild:function(node)
626 {function titleForNode(node)
627 {return node._title;}
628 if(!this._treeElement)
629 return;var children=this.children();if(children.length===1&&this._shouldMerge(no de)){node._isMerged=true;this._treeElement.titleText=this._treeElement.titleText +"/"+node._title;node._treeElement=this._treeElement;this._treeElement.setNode(n ode);return;}
630 var oldNode;if(children.length===2)
631 oldNode=children[0]!==node?children[0]:children[1];if(oldNode&&oldNode._isMerged ){delete oldNode._isMerged;var mergedToNodes=[];mergedToNodes.push(this);var tre eNode=this;while(treeNode._isMerged){treeNode=treeNode.parent;mergedToNodes.push (treeNode);}
632 mergedToNodes.reverse();var titleText=mergedToNodes.map(titleForNode).join("/"); var nodes=[];treeNode=oldNode;do{nodes.push(treeNode);children=treeNode.children ();treeNode=children.length===1?children[0]:null;}while(treeNode&&treeNode._isMe rged);if(!this.isPopulated()){this._treeElement.titleText=titleText;this._treeEl ement.setNode(this);for(var i=0;i<nodes.length;++i){delete nodes[i]._treeElement ;delete nodes[i]._isMerged;}
633 return;}
634 var oldTreeElement=this._treeElement;var treeElement=this._createTreeElement(tit leText,this);for(var i=0;i<mergedToNodes.length;++i)
635 mergedToNodes[i]._treeElement=treeElement;oldTreeElement.parent.appendChild(tree Element);oldTreeElement.setNode(nodes[nodes.length-1]);oldTreeElement.titleText= nodes.map(titleForNode).join("/");oldTreeElement.parent.removeChild(oldTreeEleme nt);this._treeElement.appendChild(oldTreeElement);if(oldTreeElement.expanded)
636 treeElement.expand();}
637 if(this.isPopulated())
638 this._treeElement.appendChild(node.treeElement());},willRemoveChild:function(nod e)
639 {if(node._isMerged||!this.isPopulated())
640 return;this._treeElement.removeChild(node._treeElement);},__proto__:WebInspector .NavigatorTreeNode.prototype};WebInspector.RevisionHistoryView=function()
641 {WebInspector.View.call(this);this.registerRequiredCSS("revisionHistory.css");th is.element.addStyleClass("revision-history-drawer");this.element.addStyleClass(" fill");this.element.addStyleClass("outline-disclosure");this._uiSourceCodeItems= new Map();var olElement=this.element.createChild("ol");this._treeOutline=new Tre eOutline(olElement);function populateRevisions(uiSourceCode)
642 {if(uiSourceCode.history.length)
643 this._createUISourceCodeItem(uiSourceCode);}
644 WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this));Web Inspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeC ontentCommitted,this._revisionAdded,this);WebInspector.workspace.addEventListene r(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,th is);WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Projec tWillReset,this._projectWillReset,this);this._statusElement=document.createEleme nt("span");this._statusElement.textContent=WebInspector.UIString("Local modifica tions");}
645 WebInspector.RevisionHistoryView.showHistory=function(uiSourceCode)
646 {if(!WebInspector.RevisionHistoryView._view)
647 WebInspector.RevisionHistoryView._view=new WebInspector.RevisionHistoryView();va r view=WebInspector.RevisionHistoryView._view;WebInspector.showViewInDrawer(view ._statusElement,view);view._revealUISourceCode(uiSourceCode);}
648 WebInspector.RevisionHistoryView.prototype={_createUISourceCodeItem:function(uiS ourceCode)
649 {var uiSourceCodeItem=new TreeElement(uiSourceCode.displayName(),null,true);uiSo urceCodeItem.selectable=false;for(var i=0;i<this._treeOutline.children.length;++ i){if(this._treeOutline.children[i].title.localeCompare(uiSourceCode.displayName ())>0){this._treeOutline.insertChild(uiSourceCodeItem,i);break;}}
650 if(i===this._treeOutline.children.length)
651 this._treeOutline.appendChild(uiSourceCodeItem);this._uiSourceCodeItems.put(uiSo urceCode,uiSourceCodeItem);var revisionCount=uiSourceCode.history.length;for(var i=revisionCount-1;i>=0;--i){var revision=uiSourceCode.history[i];var historyIte m=new WebInspector.RevisionHistoryTreeElement(revision,uiSourceCode.history[i-1] ,i!==revisionCount-1);uiSourceCodeItem.appendChild(historyItem);}
652 var linkItem=new TreeElement("",null,false);linkItem.selectable=false;uiSourceCo deItem.appendChild(linkItem);var revertToOriginal=linkItem.listItemElement.creat eChild("span","revision-history-link revision-history-link-row");revertToOrigina l.textContent=WebInspector.UIString("apply original content");revertToOriginal.a ddEventListener("click",uiSourceCode.revertToOriginal.bind(uiSourceCode));var cl earHistoryElement=uiSourceCodeItem.listItemElement.createChild("span","revision- history-link");clearHistoryElement.textContent=WebInspector.UIString("revert");c learHistoryElement.addEventListener("click",this._clearHistory.bind(this,uiSourc eCode));return uiSourceCodeItem;},_clearHistory:function(uiSourceCode)
653 {uiSourceCode.revertAndClearHistory(this._removeUISourceCode.bind(this));},_revi sionAdded:function(event)
654 {var uiSourceCode=(event.data.uiSourceCode);var uiSourceCodeItem=this._uiSourceC odeItems.get(uiSourceCode);if(!uiSourceCodeItem){uiSourceCodeItem=this._createUI SourceCodeItem(uiSourceCode);return;}
655 var historyLength=uiSourceCode.history.length;var historyItem=new WebInspector.R evisionHistoryTreeElement(uiSourceCode.history[historyLength-1],uiSourceCode.his tory[historyLength-2],false);if(uiSourceCodeItem.children.length)
656 uiSourceCodeItem.children[0].allowRevert();uiSourceCodeItem.insertChild(historyI tem,0);},_revealUISourceCode:function(uiSourceCode)
657 {var uiSourceCodeItem=this._uiSourceCodeItems.get(uiSourceCode);if(uiSourceCodeI tem){uiSourceCodeItem.reveal();uiSourceCodeItem.expand();}},_uiSourceCodeRemoved :function(event)
658 {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_removeU ISourceCode:function(uiSourceCode)
659 {var uiSourceCodeItem=this._uiSourceCodeItems.get(uiSourceCode);if(!uiSourceCode Item)
660 return;this._treeOutline.removeChild(uiSourceCodeItem);this._uiSourceCodeItems.r emove(uiSourceCode);},_projectWillReset:function(event)
661 {var project=event.data;project.uiSourceCodes().forEach(this._removeUISourceCode .bind(this));},__proto__:WebInspector.View.prototype}
662 WebInspector.RevisionHistoryTreeElement=function(revision,baseRevision,allowReve rt)
663 {TreeElement.call(this,revision.timestamp.toLocaleTimeString(),null,true);this.s electable=false;this._revision=revision;this._baseRevision=baseRevision;this._re vertElement=document.createElement("span");this._revertElement.className="revisi on-history-link";this._revertElement.textContent=WebInspector.UIString("apply re vision content");this._revertElement.addEventListener("click",this._revision.rev ertToThis.bind(this._revision),false);if(!allowRevert)
664 this._revertElement.addStyleClass("hidden");}
665 WebInspector.RevisionHistoryTreeElement.prototype={onattach:function()
666 {this.listItemElement.addStyleClass("revision-history-revision");},onexpand:func tion()
667 {this.listItemElement.appendChild(this._revertElement);if(this._wasExpandedOnce)
668 return;this._wasExpandedOnce=true;this.childrenListElement.addStyleClass("source -code");if(this._baseRevision)
669 this._baseRevision.requestContent(step1.bind(this));else
670 this._revision.uiSourceCode.requestOriginalContent(step1.bind(this));function st ep1(baseContent)
671 {this._revision.requestContent(step2.bind(this,baseContent));}
672 function step2(baseContent,newContent)
673 {var baseLines=difflib.stringAsLines(baseContent);var newLines=difflib.stringAsL ines(newContent);var sm=new difflib.SequenceMatcher(baseLines,newLines);var opco des=sm.get_opcodes();var lastWasSeparator=false;for(var idx=0;idx<opcodes.length ;idx++){var code=opcodes[idx];var change=code[0];var b=code[1];var be=code[2];va r n=code[3];var ne=code[4];var rowCount=Math.max(be-b,ne-n);var topRows=[];var b ottomRows=[];for(var i=0;i<rowCount;i++){if(change==="delete"||(change==="replac e"&&b<be)){var lineNumber=b++;this._createLine(lineNumber,null,baseLines[lineNum ber],"removed");lastWasSeparator=false;}
674 if(change==="insert"||(change==="replace"&&n<ne)){var lineNumber=n++;this._creat eLine(null,lineNumber,newLines[lineNumber],"added");lastWasSeparator=false;}
675 if(change==="equal"){b++;n++;if(!lastWasSeparator)
676 this._createLine(null,null," \u2026","separator");lastWasSeparator=true;}}}}} ,oncollapse:function()
677 {this._revertElement.remove();},_createLine:function(baseLineNumber,newLineNumbe r,lineContent,changeType)
678 {var child=new TreeElement("",null,false);child.selectable=false;this.appendChil d(child);var lineElement=document.createElement("span");function appendLineNumbe r(lineNumber)
679 {var numberString=lineNumber!==null?numberToStringWithSpacesPadding(lineNumber+1 ,4):" ";var lineNumberSpan=document.createElement("span");lineNumberSpan.addS tyleClass("webkit-line-number");lineNumberSpan.textContent=numberString;child.li stItemElement.appendChild(lineNumberSpan);}
680 appendLineNumber(baseLineNumber);appendLineNumber(newLineNumber);var contentSpan =document.createElement("span");contentSpan.textContent=lineContent;child.listIt emElement.appendChild(contentSpan);child.listItemElement.addStyleClass("revision -history-line");child.listItemElement.addStyleClass("revision-history-line-"+cha ngeType);},allowRevert:function()
681 {this._revertElement.removeStyleClass("hidden");},__proto__:TreeElement.prototyp e};WebInspector.ScopeChainSidebarPane=function()
682 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Scope Variables"));th is._sections=[];this._expandedSections={};this._expandedProperties=[];}
683 WebInspector.ScopeChainSidebarPane.prototype={update:function(callFrame)
684 {this.bodyElement.removeChildren();if(!callFrame){var infoElement=document.creat eElement("div");infoElement.className="info";infoElement.textContent=WebInspecto r.UIString("Not Paused");this.bodyElement.appendChild(infoElement);return;}
685 for(var i=0;i<this._sections.length;++i){var section=this._sections[i];if(!secti on.title)
686 continue;if(section.expanded)
687 this._expandedSections[section.title]=true;else
688 delete this._expandedSections[section.title];}
689 this._sections=[];var foundLocalScope=false;var scopeChain=callFrame.scopeChain; for(var i=0;i<scopeChain.length;++i){var scope=scopeChain[i];var title=null;var subtitle=scope.object.description;var emptyPlaceholder=null;var extraProperties= null;var declarativeScope;switch(scope.type){case"local":foundLocalScope=true;ti tle=WebInspector.UIString("Local");emptyPlaceholder=WebInspector.UIString("No Va riables");subtitle=null;if(callFrame.this)
690 extraProperties=[new WebInspector.RemoteObjectProperty("this",WebInspector.Remot eObject.fromPayload(callFrame.this))];if(i==0){var details=WebInspector.debugger Model.debuggerPausedDetails();var exception=details.reason===WebInspector.Debugg erModel.BreakReason.Exception?details.auxData:0;if(exception){extraProperties=ex traProperties||[];var exceptionObject=(exception);extraProperties.push(new WebIn spector.RemoteObjectProperty("<exception>",WebInspector.RemoteObject.fromPayload (exceptionObject)));}}
691 declarativeScope=true;break;case"closure":title=WebInspector.UIString("Closure") ;emptyPlaceholder=WebInspector.UIString("No Variables");subtitle=null;declarativ eScope=true;break;case"catch":title=WebInspector.UIString("Catch");subtitle=null ;declarativeScope=true;break;case"with":title=WebInspector.UIString("With Block" );declarativeScope=false;break;case"global":title=WebInspector.UIString("Global" );declarativeScope=false;break;}
692 if(!title||title===subtitle)
693 subtitle=null;var scopeRef;if(declarativeScope)
694 scopeRef=new WebInspector.ScopeRef(i,callFrame.id,undefined);else
695 scopeRef=undefined;var section=new WebInspector.ObjectPropertiesSection(WebInspe ctor.ScopeRemoteObject.fromPayload(scope.object,scopeRef),title,subtitle,emptyPl aceholder,true,extraProperties,WebInspector.ScopeVariableTreeElement);section.ed itInSelectedCallFrameWhenPaused=true;section.pane=this;if(scope.type==="global")
696 section.expanded=false;else if(!foundLocalScope||scope.type==="local"||title in this._expandedSections)
697 section.expanded=true;this._sections.push(section);this.bodyElement.appendChild( section.element);}},__proto__:WebInspector.SidebarPane.prototype}
698 WebInspector.ScopeVariableTreeElement=function(property)
699 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
700 WebInspector.ScopeVariableTreeElement.prototype={onattach:function()
701 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.ha sChildren&&this.propertyIdentifier in this.treeOutline.section.pane._expandedPro perties)
702 this.expand();},onexpand:function()
703 {this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier]=true ;},oncollapse:function()
704 {delete this.treeOutline.section.pane._expandedProperties[this.propertyIdentifie r];},get propertyIdentifier()
705 {if("_propertyIdentifier"in this)
706 return this._propertyIdentifier;var section=this.treeOutline.section;this._prope rtyIdentifier=section.title+":"+(section.subtitle?section.subtitle+":":"")+this. propertyPath();return this._propertyIdentifier;},__proto__:WebInspector.ObjectPr opertyTreeElement.prototype};WebInspector.ScriptsNavigator=function()
707 {WebInspector.Object.call(this);this._tabbedPane=new WebInspector.TabbedPane();t his._tabbedPane.shrinkableTabs=true;this._tabbedPane.element.addStyleClass("navi gator-tabbed-pane");this._scriptsView=new WebInspector.NavigatorView();this._scr iptsView.addEventListener(WebInspector.NavigatorView.Events.ItemSelected,this._s criptSelected,this);this._scriptsView.addEventListener(WebInspector.NavigatorVie w.Events.ItemSearchStarted,this._itemSearchStarted,this);this._scriptsView.addEv entListener(WebInspector.NavigatorView.Events.ItemRenamingRequested,this._itemRe namingRequested,this);this._scriptsView.addEventListener(WebInspector.NavigatorV iew.Events.ItemCreationRequested,this._itemCreationRequested,this);this._content ScriptsView=new WebInspector.NavigatorView();this._contentScriptsView.addEventLi stener(WebInspector.NavigatorView.Events.ItemSelected,this._scriptSelected,this) ;this._contentScriptsView.addEventListener(WebInspector.NavigatorView.Events.Ite mSearchStarted,this._itemSearchStarted,this);this._contentScriptsView.addEventLi stener(WebInspector.NavigatorView.Events.ItemRenamingRequested,this._itemRenamin gRequested,this);this._contentScriptsView.addEventListener(WebInspector.Navigato rView.Events.ItemCreationRequested,this._itemCreationRequested,this);this._snipp etsView=new WebInspector.SnippetsNavigatorView();this._snippetsView.addEventList ener(WebInspector.NavigatorView.Events.ItemSelected,this._scriptSelected,this);t his._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemSearchS tarted,this._itemSearchStarted,this);this._snippetsView.addEventListener(WebInsp ector.NavigatorView.Events.ItemRenamingRequested,this._itemRenamingRequested,thi s);this._snippetsView.addEventListener(WebInspector.NavigatorView.Events.ItemCre ationRequested,this._itemCreationRequested,this);this._tabbedPane.appendTab(WebI nspector.ScriptsNavigator.ScriptsTab,WebInspector.UIString("Sources"),this._scri ptsView);this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ScriptsTab);th is._tabbedPane.appendTab(WebInspector.ScriptsNavigator.ContentScriptsTab,WebInsp ector.UIString("Content scripts"),this._contentScriptsView);this._tabbedPane.app endTab(WebInspector.ScriptsNavigator.SnippetsTab,WebInspector.UIString("Snippets "),this._snippetsView);}
708 WebInspector.ScriptsNavigator.Events={ScriptSelected:"ScriptSelected",ItemCreati onRequested:"ItemCreationRequested",ItemRenamingRequested:"ItemRenamingRequested ",ItemSearchStarted:"ItemSearchStarted",}
709 WebInspector.ScriptsNavigator.ScriptsTab="scripts";WebInspector.ScriptsNavigator .ContentScriptsTab="contentScripts";WebInspector.ScriptsNavigator.SnippetsTab="s nippets";WebInspector.ScriptsNavigator.prototype={get view()
710 {return this._tabbedPane;},_navigatorViewForUISourceCode:function(uiSourceCode)
711 {if(uiSourceCode.isContentScript)
712 return this._contentScriptsView;else if(uiSourceCode.project().type()===WebInspe ctor.projectTypes.Snippets)
713 return this._snippetsView;else
714 return this._scriptsView;},addUISourceCode:function(uiSourceCode)
715 {this._navigatorViewForUISourceCode(uiSourceCode).addUISourceCode(uiSourceCode); },removeUISourceCode:function(uiSourceCode)
716 {this._navigatorViewForUISourceCode(uiSourceCode).removeUISourceCode(uiSourceCod e);},revealUISourceCode:function(uiSourceCode,select)
717 {this._navigatorViewForUISourceCode(uiSourceCode).revealUISourceCode(uiSourceCod e,select);if(uiSourceCode.isContentScript)
718 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ContentScriptsTab);else if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets)
719 this._tabbedPane.selectTab(WebInspector.ScriptsNavigator.ScriptsTab);},rename:fu nction(uiSourceCode,callback)
720 {this._navigatorViewForUISourceCode(uiSourceCode).rename(uiSourceCode,callback); },_scriptSelected:function(event)
721 {this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ScriptSelect ed,event.data);},_itemSearchStarted:function(event)
722 {this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemSearchSt arted,event.data);},_itemRenamingRequested:function(event)
723 {this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemRenaming Requested,event.data);},_itemCreationRequested:function(event)
724 {this.dispatchEventToListeners(WebInspector.ScriptsNavigator.Events.ItemCreation Requested,event.data);},__proto__:WebInspector.Object.prototype}
725 WebInspector.SnippetsNavigatorView=function()
726 {WebInspector.NavigatorView.call(this);}
727 WebInspector.SnippetsNavigatorView.prototype={handleContextMenu:function(event)
728 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString("New"),this._handleCreateSnippet.bind(this));contextMenu.show( );},handleFileContextMenu:function(event,uiSourceCode)
729 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString("Run"),this._handleEvaluateSnippet.bind(this,uiSourceCode));co ntextMenu.appendItem(WebInspector.UIString("Rename"),this.requestRename.bind(thi s,uiSourceCode));contextMenu.appendItem(WebInspector.UIString("Remove"),this._ha ndleRemoveSnippet.bind(this,uiSourceCode));contextMenu.appendSeparator();context Menu.appendItem(WebInspector.UIString("New"),this._handleCreateSnippet.bind(this ));contextMenu.show();},_handleEvaluateSnippet:function(uiSourceCode)
730 {if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets)
731 return;WebInspector.scriptSnippetModel.evaluateScriptSnippet(uiSourceCode);},_ha ndleRemoveSnippet:function(uiSourceCode)
732 {if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets)
733 return;uiSourceCode.project().deleteFile(uiSourceCode);},_handleCreateSnippet:fu nction()
734 {var data={};data.project=WebInspector.scriptSnippetModel.project();data.path="" ;this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemCreationReq uested,data);},__proto__:WebInspector.NavigatorView.prototype};WebInspector.Scri ptsSearchScope=function(workspace)
735 {WebInspector.SearchScope.call(this)
736 this._searchId=0;this._workspace=workspace;}
737 WebInspector.ScriptsSearchScope.prototype={performIndexing:function(progress,ind exingFinishedCallback)
738 {this.stopSearch();function filterOutServiceProjects(project)
739 {return!project.isServiceProject();}
740 var projects=this._workspace.projects().filter(filterOutServiceProjects);var bar rier=new CallbackBarrier();var compositeProgress=new WebInspector.CompositeProgr ess(progress);progress.addEventListener(WebInspector.Progress.Events.Canceled,in dexingCanceled.bind(this));for(var i=0;i<projects.length;++i){var project=projec ts[i];var projectProgress=compositeProgress.createSubProgress(project.uiSourceCo des().length);project.indexContent(projectProgress,barrier.createCallback());}
741 barrier.callWhenDone(indexingFinishedCallback.bind(this,true));function indexing Canceled()
742 {indexingFinishedCallback(false);progress.done();}},performSearch:function(searc hConfig,progress,searchResultCallback,searchFinishedCallback)
743 {this.stopSearch();function filterOutServiceProjects(project)
744 {return!project.isServiceProject();}
745 var projects=this._workspace.projects().filter(filterOutServiceProjects);var bar rier=new CallbackBarrier();var compositeProgress=new WebInspector.CompositeProgr ess(progress);for(var i=0;i<projects.length;++i){var project=projects[i];var pro jectProgress=compositeProgress.createSubProgress(project.uiSourceCodes().length) ;var callback=barrier.createCallback(searchCallbackWrapper.bind(this,this._searc hId,project));project.searchInContent(searchConfig.query,!searchConfig.ignoreCas e,searchConfig.isRegex,projectProgress,callback);}
746 barrier.callWhenDone(searchFinishedCallback.bind(this,true));function searchCall backWrapper(searchId,project,searchMatches)
747 {if(searchId!==this._searchId){searchFinishedCallback(false);return;}
748 var paths=searchMatches.keys();for(var i=0;i<paths.length;++i){var uiSourceCode= project.uiSourceCode(paths[i]);var searchResult=new WebInspector.FileBasedSearch ResultsPane.SearchResult(uiSourceCode,searchMatches.get(paths[i]));searchResultC allback(searchResult);}}},stopSearch:function()
749 {++this._searchId;},createSearchResultsPane:function(searchConfig)
750 {return new WebInspector.FileBasedSearchResultsPane(searchConfig);},__proto__:We bInspector.SearchScope.prototype};WebInspector.StyleSheetOutlineDialog=function( view,uiSourceCode)
751 {WebInspector.SelectionDialogContentProvider.call(this);this._rules=[];this._vie w=view;this._uiSourceCode=uiSourceCode;this._requestItems();}
752 WebInspector.StyleSheetOutlineDialog.show=function(view,uiSourceCode)
753 {if(WebInspector.Dialog.currentInstance())
754 return null;var delegate=new WebInspector.StyleSheetOutlineDialog(view,uiSourceC ode);var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDialo g(delegate);WebInspector.Dialog.show(view.element,filteredItemSelectionDialog);}
755 WebInspector.StyleSheetOutlineDialog.prototype={itemCount:function()
756 {return this._rules.length;},itemKeyAt:function(itemIndex)
757 {return this._rules[itemIndex].selectorText;},itemScoreAt:function(itemIndex,que ry)
758 {var rule=this._rules[itemIndex];return-rule.rawLocation.lineNumber;},renderItem :function(itemIndex,query,titleElement,subtitleElement)
759 {var rule=this._rules[itemIndex];titleElement.textContent=rule.selectorText;this .highlightRanges(titleElement,query);subtitleElement.textContent=":"+(rule.rawLo cation.lineNumber+1);},_requestItems:function()
760 {function didGetAllStyleSheets(error,infos)
761 {if(error)
762 return;for(var i=0;i<infos.length;++i){var info=infos[i];if(info.sourceURL===thi s._uiSourceCode.url){WebInspector.CSSStyleSheet.createForId(info.styleSheetId,di dGetStyleSheet.bind(this));return;}}}
763 CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));function didGetStyle Sheet(styleSheet)
764 {if(!styleSheet)
765 return;this._rules=styleSheet.rules;this.refresh();}},selectItem:function(itemIn dex,promptValue)
766 {var rule=this._rules[itemIndex];var lineNumber=rule.rawLocation.lineNumber;if(! isNaN(lineNumber)&&lineNumber>=0)
767 this._view.highlightPosition(lineNumber,rule.rawLocation.columnNumber);this._vie w.focus();},__proto__:WebInspector.SelectionDialogContentProvider.prototype};Web Inspector.TabbedEditorContainerDelegate=function(){}
768 WebInspector.TabbedEditorContainerDelegate.prototype={viewForFile:function(uiSou rceCode){}}
769 WebInspector.TabbedEditorContainer=function(delegate,settingName,placeholderText )
770 {WebInspector.Object.call(this);this._delegate=delegate;this._tabbedPane=new Web Inspector.TabbedPane();this._tabbedPane.setPlaceholderText(placeholderText);this ._tabbedPane.setTabDelegate(new WebInspector.EditorContainerTabDelegate(this));t his._tabbedPane.closeableTabs=true;this._tabbedPane.element.id="scripts-editor-c ontainer-tabbed-pane";this._tabbedPane.addEventListener(WebInspector.TabbedPane. EventTypes.TabClosed,this._tabClosed,this);this._tabbedPane.addEventListener(Web Inspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._tabIds =new Map();this._files={};this._previouslyViewedFilesSetting=WebInspector.settin gs.createSetting(settingName,[]);this._history=WebInspector.TabbedEditorContaine r.History.fromObject(this._previouslyViewedFilesSetting.get());}
771 WebInspector.TabbedEditorContainer.Events={EditorSelected:"EditorSelected",Edito rClosed:"EditorClosed"}
772 WebInspector.TabbedEditorContainer._tabId=0;WebInspector.TabbedEditorContainer.m aximalPreviouslyViewedFilesCount=30;WebInspector.TabbedEditorContainer.prototype ={get view()
773 {return this._tabbedPane;},get visibleView()
774 {return this._tabbedPane.visibleView;},show:function(parentElement)
775 {this._tabbedPane.show(parentElement);},showFile:function(uiSourceCode)
776 {this._innerShowFile(uiSourceCode,true);},historyUISourceCodes:function()
777 {var uriToUISourceCode={};for(var id in this._files){var uiSourceCode=this._file s[id];uriToUISourceCode[uiSourceCode.uri()]=uiSourceCode;}
778 var result=[];var uris=this._history._urls();for(var i=0;i<uris.length;++i){var uiSourceCode=uriToUISourceCode[uris[i]];if(uiSourceCode)
779 result.push(uiSourceCode);}
780 return result;},_addScrollAndSelectionListeners:function()
781 {if(!this._currentView)
782 return;this._currentView.addEventListener(WebInspector.SourceFrame.Events.Scroll Changed,this._scrollChanged,this);this._currentView.addEventListener(WebInspecto r.SourceFrame.Events.SelectionChanged,this._selectionChanged,this);},_removeScro llAndSelectionListeners:function()
783 {if(!this._currentView)
784 return;this._currentView.removeEventListener(WebInspector.SourceFrame.Events.Scr ollChanged,this._scrollChanged,this);this._currentView.removeEventListener(WebIn spector.SourceFrame.Events.SelectionChanged,this._selectionChanged,this);},_scro llChanged:function(event)
785 {var lineNumber=(event.data);this._history.updateScrollLineNumber(this._currentF ile.uri(),lineNumber);this._history.save(this._previouslyViewedFilesSetting);},_ selectionChanged:function(event)
786 {var range=(event.data);this._history.updateSelectionRange(this._currentFile.uri (),range);this._history.save(this._previouslyViewedFilesSetting);},_innerShowFil e:function(uiSourceCode,userGesture)
787 {if(this._currentFile===uiSourceCode)
788 return;this._removeScrollAndSelectionListeners();this._currentFile=uiSourceCode; var tabId=this._tabIds.get(uiSourceCode)||this._appendFileTab(uiSourceCode,userG esture);this._tabbedPane.selectTab(tabId,userGesture);if(userGesture)
789 this._editorSelectedByUserAction();this._currentView=this.visibleView;this._addS crollAndSelectionListeners();this.dispatchEventToListeners(WebInspector.TabbedEd itorContainer.Events.EditorSelected,this._currentFile);},_titleForFile:function( uiSourceCode)
790 {var maxDisplayNameLength=30;var title=uiSourceCode.displayName(true).trimMiddle (maxDisplayNameLength);if(uiSourceCode.isDirty())
791 title+="*";return title;},_maybeCloseTab:function(id,nextTabId)
792 {var uiSourceCode=this._files[id];var shouldPrompt=uiSourceCode.isDirty()&&uiSou rceCode.project().canSetFileContent();if(!shouldPrompt||confirm(WebInspector.UIS tring("Are you sure you want to close unsaved file: %s?",uiSourceCode.name()))){ uiSourceCode.resetWorkingCopy();if(nextTabId)
793 this._tabbedPane.selectTab(nextTabId,true);this._tabbedPane.closeTab(id,true);re turn true;}
794 return false;},_closeTabs:function(ids)
795 {var dirtyTabs=[];var cleanTabs=[];for(var i=0;i<ids.length;++i){var id=ids[i];v ar uiSourceCode=this._files[id];if(uiSourceCode.isDirty())
796 dirtyTabs.push(id);else
797 cleanTabs.push(id);}
798 if(dirtyTabs.length)
799 this._tabbedPane.selectTab(dirtyTabs[0],true);this._tabbedPane.closeTabs(cleanTa bs,true);for(var i=0;i<dirtyTabs.length;++i){var nextTabId=i+1<dirtyTabs.length? dirtyTabs[i+1]:null;if(!this._maybeCloseTab(dirtyTabs[i],nextTabId))
800 break;}},addUISourceCode:function(uiSourceCode)
801 {var uri=uiSourceCode.uri();if(this._userSelectedFiles)
802 return;var index=this._history.index(uri)
803 if(index===-1)
804 return;var tabId=this._tabIds.get(uiSourceCode)||this._appendFileTab(uiSourceCod e,false);if(!this._currentFile)
805 return;if(!index){this._innerShowFile(uiSourceCode,false);return;}
806 var currentProjectType=this._currentFile.project().type();var addedProjectType=u iSourceCode.project().type();var snippetsProjectType=WebInspector.projectTypes.S nippets;if(this._history.index(this._currentFile.uri())&&currentProjectType===sn ippetsProjectType&&addedProjectType!==snippetsProjectType)
807 this._innerShowFile(uiSourceCode,false);},removeUISourceCode:function(uiSourceCo de)
808 {this.removeUISourceCodes([uiSourceCode]);},removeUISourceCodes:function(uiSourc eCodes)
809 {var tabIds=[];for(var i=0;i<uiSourceCodes.length;++i){var uiSourceCode=uiSource Codes[i];var tabId=this._tabIds.get(uiSourceCode);if(tabId)
810 tabIds.push(tabId);}
811 this._tabbedPane.closeTabs(tabIds);},_editorClosedByUserAction:function(uiSource Code)
812 {this._userSelectedFiles=true;this._history.remove(uiSourceCode.uri());this._upd ateHistory();},_editorSelectedByUserAction:function()
813 {this._userSelectedFiles=true;this._updateHistory();},_updateHistory:function()
814 {var tabIds=this._tabbedPane.lastOpenedTabIds(WebInspector.TabbedEditorContainer .maximalPreviouslyViewedFilesCount);function tabIdToURI(tabId)
815 {return this._files[tabId].uri();}
816 this._history.update(tabIds.map(tabIdToURI.bind(this)));this._history.save(this. _previouslyViewedFilesSetting);},_tooltipForFile:function(uiSourceCode)
817 {return uiSourceCode.originURL();},_appendFileTab:function(uiSourceCode,userGest ure)
818 {var view=this._delegate.viewForFile(uiSourceCode);var title=this._titleForFile( uiSourceCode);var tooltip=this._tooltipForFile(uiSourceCode);var tabId=this._gen erateTabId();this._tabIds.put(uiSourceCode,tabId);this._files[tabId]=uiSourceCod e;var savedSelectionRange=this._history.selectionRange(uiSourceCode.uri());if(sa vedSelectionRange)
819 view.setSelection(savedSelectionRange);var savedScrollLineNumber=this._history.s crollLineNumber(uiSourceCode.uri());if(savedScrollLineNumber)
820 view.scrollToLine(savedScrollLineNumber);this._tabbedPane.appendTab(tabId,title, view,tooltip,userGesture);this._addUISourceCodeListeners(uiSourceCode);return ta bId;},_tabClosed:function(event)
821 {var tabId=(event.data.tabId);var userGesture=(event.data.isUserGesture);var uiS ourceCode=this._files[tabId];if(this._currentFile===uiSourceCode){this._removeSc rollAndSelectionListeners();delete this._currentView;delete this._currentFile;}
822 this._tabIds.remove(uiSourceCode);delete this._files[tabId];this._removeUISource CodeListeners(uiSourceCode);this.dispatchEventToListeners(WebInspector.TabbedEdi torContainer.Events.EditorClosed,uiSourceCode);if(userGesture)
823 this._editorClosedByUserAction(uiSourceCode);},_tabSelected:function(event)
824 {var tabId=(event.data.tabId);var userGesture=(event.data.isUserGesture);var uiS ourceCode=this._files[tabId];this._innerShowFile(uiSourceCode,userGesture);},_ad dUISourceCodeListeners:function(uiSourceCode)
825 {uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged,thi s._uiSourceCodeTitleChanged,this);uiSourceCode.addEventListener(WebInspector.UIS ourceCode.Events.WorkingCopyChanged,this._uiSourceCodeWorkingCopyChanged,this);u iSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitt ed,this._uiSourceCodeWorkingCopyCommitted,this);uiSourceCode.addEventListener(We bInspector.UISourceCode.Events.SavedStateUpdated,this._uiSourceCodeSavedStateUpd ated,this);uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Format tedChanged,this._uiSourceCodeFormattedChanged,this);},_removeUISourceCodeListene rs:function(uiSourceCode)
826 {uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged, this._uiSourceCodeTitleChanged,this);uiSourceCode.removeEventListener(WebInspect or.UISourceCode.Events.WorkingCopyChanged,this._uiSourceCodeWorkingCopyChanged,t his);uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCo pyCommitted,this._uiSourceCodeWorkingCopyCommitted,this);uiSourceCode.removeEven tListener(WebInspector.UISourceCode.Events.SavedStateUpdated,this._uiSourceCodeS avedStateUpdated,this);uiSourceCode.removeEventListener(WebInspector.UISourceCod e.Events.FormattedChanged,this._uiSourceCodeFormattedChanged,this);},_updateFile Title:function(uiSourceCode)
827 {var tabId=this._tabIds.get(uiSourceCode);if(tabId){var title=this._titleForFile (uiSourceCode);this._tabbedPane.changeTabTitle(tabId,title);if(uiSourceCode.hasU nsavedCommittedChanges())
828 this._tabbedPane.setTabIcon(tabId,"editor-container-unsaved-committed-changes-ic on",WebInspector.UIString("Changes to this file were not saved to file system.") );else
829 this._tabbedPane.setTabIcon(tabId,"");}},_uiSourceCodeTitleChanged:function(even t)
830 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);this._updat eHistory();},_uiSourceCodeWorkingCopyChanged:function(event)
831 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},_uiSource CodeWorkingCopyCommitted:function(event)
832 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},_uiSource CodeSavedStateUpdated:function(event)
833 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},_uiSource CodeFormattedChanged:function(event)
834 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},reset:fun ction()
835 {delete this._userSelectedFiles;},_generateTabId:function()
836 {return"tab_"+(WebInspector.TabbedEditorContainer._tabId++);},currentFile:functi on()
837 {return this._currentFile;},__proto__:WebInspector.Object.prototype}
838 WebInspector.TabbedEditorContainer.HistoryItem=function(url,selectionRange,scrol lLineNumber)
839 {this.url=url;this._isSerializable=url.length<WebInspector.TabbedEditorContainer .HistoryItem.serializableUrlLengthLimit;this.selectionRange=selectionRange;this. scrollLineNumber=scrollLineNumber;}
840 WebInspector.TabbedEditorContainer.HistoryItem.serializableUrlLengthLimit=4096;W ebInspector.TabbedEditorContainer.HistoryItem.fromObject=function(serializedHist oryItem)
841 {var selectionRange=serializedHistoryItem.selectionRange?WebInspector.TextRange. fromObject(serializedHistoryItem.selectionRange):null;return new WebInspector.Ta bbedEditorContainer.HistoryItem(serializedHistoryItem.url,selectionRange,seriali zedHistoryItem.scrollLineNumber);}
842 WebInspector.TabbedEditorContainer.HistoryItem.prototype={serializeToObject:func tion()
843 {if(!this._isSerializable)
844 return null;var serializedHistoryItem={};serializedHistoryItem.url=this.url;seri alizedHistoryItem.selectionRange=this.selectionRange;serializedHistoryItem.scrol lLineNumber=this.scrollLineNumber;return serializedHistoryItem;},__proto__:WebIn spector.Object.prototype}
845 WebInspector.TabbedEditorContainer.History=function(items)
846 {this._items=items;this._rebuildItemIndex();}
847 WebInspector.TabbedEditorContainer.History.fromObject=function(serializedHistory )
848 {var items=[];for(var i=0;i<serializedHistory.length;++i)
849 items.push(WebInspector.TabbedEditorContainer.HistoryItem.fromObject(serializedH istory[i]));return new WebInspector.TabbedEditorContainer.History(items);}
850 WebInspector.TabbedEditorContainer.History.prototype={index:function(url)
851 {var index=this._itemsIndex[url];if(typeof index==="number")
852 return index;return-1;},_rebuildItemIndex:function()
853 {this._itemsIndex={};for(var i=0;i<this._items.length;++i){console.assert(!this. _itemsIndex.hasOwnProperty(this._items[i].url));this._itemsIndex[this._items[i]. url]=i;}},selectionRange:function(url)
854 {var index=this.index(url);return index!==-1?this._items[index].selectionRange:u ndefined;},updateSelectionRange:function(url,selectionRange)
855 {if(!selectionRange)
856 return;var index=this.index(url);if(index===-1)
857 return;this._items[index].selectionRange=selectionRange;},scrollLineNumber:funct ion(url)
858 {var index=this.index(url);return index!==-1?this._items[index].scrollLineNumber :undefined;},updateScrollLineNumber:function(url,scrollLineNumber)
859 {var index=this.index(url);if(index===-1)
860 return;this._items[index].scrollLineNumber=scrollLineNumber;},update:function(ur ls)
861 {for(var i=urls.length-1;i>=0;--i){var index=this.index(urls[i]);var item;if(ind ex!==-1){item=this._items[index];this._items.splice(index,1);}else
862 item=new WebInspector.TabbedEditorContainer.HistoryItem(urls[i]);this._items.uns hift(item);this._rebuildItemIndex();}},remove:function(url)
863 {var index=this.index(url);if(index!==-1){this._items.splice(index,1);this._rebu ildItemIndex();}},save:function(setting)
864 {setting.set(this._serializeToObject());},_serializeToObject:function()
865 {var serializedHistory=[];for(var i=0;i<this._items.length;++i){var serializedIt em=this._items[i].serializeToObject();if(serializedItem)
866 serializedHistory.push(serializedItem);if(serializedHistory.length===WebInspecto r.TabbedEditorContainer.maximalPreviouslyViewedFilesCount)
867 break;}
868 return serializedHistory;},_urls:function()
869 {var result=[];for(var i=0;i<this._items.length;++i)
870 result.push(this._items[i].url);return result;},__proto__:WebInspector.Object.pr ototype}
871 WebInspector.EditorContainerTabDelegate=function(editorContainer)
872 {this._editorContainer=editorContainer;}
873 WebInspector.EditorContainerTabDelegate.prototype={closeTabs:function(tabbedPane ,ids)
874 {this._editorContainer._closeTabs(ids);}};WebInspector.WatchExpressionsSidebarPa ne=function()
875 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Watch Expressions")); this.section=new WebInspector.WatchExpressionsSection();this.bodyElement.appendC hild(this.section.element);var refreshButton=document.createElement("button");re freshButton.className="pane-title-button refresh";refreshButton.addEventListener ("click",this._refreshButtonClicked.bind(this),false);refreshButton.title=WebIns pector.UIString("Refresh");this.titleElement.appendChild(refreshButton);var addB utton=document.createElement("button");addButton.className="pane-title-button ad d";addButton.addEventListener("click",this._addButtonClicked.bind(this),false);t his.titleElement.appendChild(addButton);addButton.title=WebInspector.UIString("A dd watch expression");this._requiresUpdate=true;}
876 WebInspector.WatchExpressionsSidebarPane.prototype={wasShown:function()
877 {this._refreshExpressionsIfNeeded();},reset:function()
878 {this.refreshExpressions();},refreshExpressions:function()
879 {this._requiresUpdate=true;this._refreshExpressionsIfNeeded();},addExpression:fu nction(expression)
880 {this.section.addExpression(expression);this.expand();},_refreshExpressionsIfNee ded:function()
881 {if(this._requiresUpdate&&this.isShowing()){this.section.update();delete this._r equiresUpdate;}else
882 this._requiresUpdate=true;},_addButtonClicked:function(event)
883 {event.consume();this.expand();this.section.addNewExpressionAndEdit();},_refresh ButtonClicked:function(event)
884 {event.consume();this.refreshExpressions();},__proto__:WebInspector.SidebarPane. prototype}
885 WebInspector.WatchExpressionsSection=function()
886 {this._watchObjectGroupId="watch-group";WebInspector.ObjectPropertiesSection.cal l(this,WebInspector.RemoteObject.fromPrimitiveValue(""));this.treeElementConstru ctor=WebInspector.WatchedPropertyTreeElement;this._expandedExpressions={};this._ expandedProperties={};this.emptyElement=document.createElement("div");this.empty Element.className="info";this.emptyElement.textContent=WebInspector.UIString("No Watch Expressions");this.watchExpressions=WebInspector.settings.watchExpression s.get();this.headerElement.className="hidden";this.editable=true;this.expanded=t rue;this.propertiesElement.addStyleClass("watch-expressions");this.element.addEv entListener("mousemove",this._mouseMove.bind(this),true);this.element.addEventLi stener("mouseout",this._mouseOut.bind(this),true);this.element.addEventListener( "dblclick",this._sectionDoubleClick.bind(this),false);this.emptyElement.addEvent Listener("contextmenu",this._emptyElementContextMenu.bind(this),false);}
887 WebInspector.WatchExpressionsSection.NewWatchExpression="\xA0";WebInspector.Watc hExpressionsSection.prototype={update:function(e)
888 {if(e)
889 e.consume();function appendResult(expression,watchIndex,result,wasThrown)
890 {if(!result)
891 return;var property=new WebInspector.RemoteObjectProperty(expression,result);pro perty.watchIndex=watchIndex;property.wasThrown=wasThrown;properties.push(propert y);if(properties.length==propertyCount){this.updateProperties(properties,[],WebI nspector.WatchExpressionTreeElement,WebInspector.WatchExpressionsSection.Compare Properties);if(this._newExpressionAdded){delete this._newExpressionAdded;var tre eElement=this.findAddedTreeElement();if(treeElement)
892 treeElement.startEditing();}
893 if(this._lastMouseMovePageY)
894 this._updateHoveredElement(this._lastMouseMovePageY);}}
895 RuntimeAgent.releaseObjectGroup(this._watchObjectGroupId)
896 var properties=[];var propertyCount=0;for(var i=0;i<this.watchExpressions.length ;++i){if(!this.watchExpressions[i])
897 continue;++propertyCount;}
898 for(var i=0;i<this.watchExpressions.length;++i){var expression=this.watchExpress ions[i];if(!expression)
899 continue;WebInspector.runtimeModel.evaluate(expression,this._watchObjectGroupId, false,true,false,false,appendResult.bind(this,expression,i));}
900 if(!propertyCount){if(!this.emptyElement.parentNode)
901 this.element.appendChild(this.emptyElement);}else{if(this.emptyElement.parentNod e)
902 this.element.removeChild(this.emptyElement);}
903 this.expanded=(propertyCount!=0);},addExpression:function(expression)
904 {this.watchExpressions.push(expression);this.saveExpressions();this.update();},a ddNewExpressionAndEdit:function()
905 {this._newExpressionAdded=true;this.watchExpressions.push(WebInspector.WatchExpr essionsSection.NewWatchExpression);this.update();},_sectionDoubleClick:function( event)
906 {if(event.target!==this.element&&event.target!==this.propertiesElement&&event.ta rget!==this.emptyElement)
907 return;event.consume();this.addNewExpressionAndEdit();},updateExpression:functio n(element,value)
908 {if(value===null){var index=element.property.watchIndex;this.watchExpressions.sp lice(index,1);}
909 else
910 this.watchExpressions[element.property.watchIndex]=value;this.saveExpressions(); this.update();},_deleteAllExpressions:function()
911 {this.watchExpressions=[];this.saveExpressions();this.update();},findAddedTreeEl ement:function()
912 {var children=this.propertiesTreeOutline.children;for(var i=0;i<children.length; ++i){if(children[i].property.name===WebInspector.WatchExpressionsSection.NewWatc hExpression)
913 return children[i];}},saveExpressions:function()
914 {var toSave=[];for(var i=0;i<this.watchExpressions.length;i++)
915 if(this.watchExpressions[i])
916 toSave.push(this.watchExpressions[i]);WebInspector.settings.watchExpressions.set (toSave);return toSave.length;},_mouseMove:function(e)
917 {if(this.propertiesElement.firstChild)
918 this._updateHoveredElement(e.pageY);},_mouseOut:function()
919 {if(this._hoveredElement){this._hoveredElement.removeStyleClass("hovered");delet e this._hoveredElement;}
920 delete this._lastMouseMovePageY;},_updateHoveredElement:function(pageY)
921 {var candidateElement=this.propertiesElement.firstChild;while(true){var next=can didateElement.nextSibling;while(next&&!next.clientHeight)
922 next=next.nextSibling;if(!next||next.totalOffsetTop()>pageY)
923 break;candidateElement=next;}
924 if(this._hoveredElement!==candidateElement){if(this._hoveredElement)
925 this._hoveredElement.removeStyleClass("hovered");if(candidateElement)
926 candidateElement.addStyleClass("hovered");this._hoveredElement=candidateElement; }
927 this._lastMouseMovePageY=pageY;},_emptyElementContextMenu:function(event)
928 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebI nspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add watch expression":" Add Watch Expression"),this.addNewExpressionAndEdit.bind(this));contextMenu.show ();},__proto__:WebInspector.ObjectPropertiesSection.prototype}
929 WebInspector.WatchExpressionsSection.CompareProperties=function(propertyA,proper tyB)
930 {if(propertyA.watchIndex==propertyB.watchIndex)
931 return 0;else if(propertyA.watchIndex<propertyB.watchIndex)
932 return-1;else
933 return 1;}
934 WebInspector.WatchExpressionTreeElement=function(property)
935 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
936 WebInspector.WatchExpressionTreeElement.prototype={onexpand:function()
937 {WebInspector.ObjectPropertyTreeElement.prototype.onexpand.call(this);this.treeO utline.section._expandedExpressions[this._expression()]=true;},oncollapse:functi on()
938 {WebInspector.ObjectPropertyTreeElement.prototype.oncollapse.call(this);delete t his.treeOutline.section._expandedExpressions[this._expression()];},onattach:func tion()
939 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.tr eeOutline.section._expandedExpressions[this._expression()])
940 this.expanded=true;},_expression:function()
941 {return this.property.name;},update:function()
942 {WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);if(this.prop erty.wasThrown){this.valueElement.textContent=WebInspector.UIString("<not availa ble>");this.listItemElement.addStyleClass("dimmed");}else
943 this.listItemElement.removeStyleClass("dimmed");var deleteButton=document.create Element("input");deleteButton.type="button";deleteButton.title=WebInspector.UISt ring("Delete watch expression.");deleteButton.addStyleClass("enabled-button");de leteButton.addStyleClass("delete-button");deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this),false);this.listItemElement.addEventListene r("contextmenu",this._contextMenu.bind(this),false);this.listItemElement.insertB efore(deleteButton,this.listItemElement.firstChild);},populateContextMenu:functi on(contextMenu)
944 {if(!this.isEditing()){contextMenu.appendItem(WebInspector.UIString(WebInspector .useLowerCaseMenuTitles()?"Add watch expression":"Add Watch Expression"),this.tr eeOutline.section.addNewExpressionAndEdit.bind(this.treeOutline.section));contex tMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"De lete watch expression":"Delete Watch Expression"),this._deleteButtonClicked.bind (this));}
945 if(this.treeOutline.section.watchExpressions.length>1)
946 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Delete all watch expressions":"Delete All Watch Expressions"),this._deleteAl lButtonClicked.bind(this));},_contextMenu:function(event)
947 {var contextMenu=new WebInspector.ContextMenu(event);this.populateContextMenu(co ntextMenu);contextMenu.show();},_deleteAllButtonClicked:function()
948 {this.treeOutline.section._deleteAllExpressions();},_deleteButtonClicked:functio n()
949 {this.treeOutline.section.updateExpression(this,null);},renderPromptAsBlock:func tion()
950 {return true;},elementAndValueToEdit:function(event)
951 {return[this.nameElement,this.property.name.trim()];},editingCancelled:function( element,context)
952 {if(!context.elementToEdit.textContent)
953 this.treeOutline.section.updateExpression(this,null);WebInspector.ObjectProperty TreeElement.prototype.editingCancelled.call(this,element,context);},applyExpress ion:function(expression,updateInterface)
954 {expression=expression.trim();if(!expression)
955 expression=null;this.property.name=expression;this.treeOutline.section.updateExp ression(this,expression);},__proto__:WebInspector.ObjectPropertyTreeElement.prot otype}
956 WebInspector.WatchedPropertyTreeElement=function(property)
957 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
958 WebInspector.WatchedPropertyTreeElement.prototype={onattach:function()
959 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.ha sChildren&&this.propertyPath()in this.treeOutline.section._expandedProperties)
960 this.expand();},onexpand:function()
961 {WebInspector.ObjectPropertyTreeElement.prototype.onexpand.call(this);this.treeO utline.section._expandedProperties[this.propertyPath()]=true;},oncollapse:functi on()
962 {WebInspector.ObjectPropertyTreeElement.prototype.oncollapse.call(this);delete t his.treeOutline.section._expandedProperties[this.propertyPath()];},__proto__:Web Inspector.ObjectPropertyTreeElement.prototype};WebInspector.Worker=function(id,u rl,shared)
963 {this.id=id;this.url=url;this.shared=shared;}
964 WebInspector.WorkersSidebarPane=function(workerManager)
965 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Workers"));this._enab leWorkersCheckbox=new WebInspector.Checkbox(WebInspector.UIString("Pause on star t"),"sidebar-label",WebInspector.UIString("Automatically attach to new workers a nd pause them. Enabling this option will force opening inspector for all new wor kers."));this._enableWorkersCheckbox.element.id="pause-workers-checkbox";this.bo dyElement.appendChild(this._enableWorkersCheckbox.element);this._enableWorkersCh eckbox.addEventListener(this._autoattachToWorkersClicked.bind(this));this._enabl eWorkersCheckbox.checked=false;var note=this.bodyElement.createChild("div");note .id="shared-workers-list";note.addStyleClass("sidebar-label")
966 note.textContent=WebInspector.UIString("Shared workers can be inspected in the T ask Manager");var separator=this.bodyElement.createChild("div","sidebar-separato r");separator.textContent=WebInspector.UIString("Dedicated worker inspectors");t his._workerListElement=document.createElement("ol");this._workerListElement.tabI ndex=0;this._workerListElement.addStyleClass("properties-tree");this._workerList Element.addStyleClass("sidebar-label");this.bodyElement.appendChild(this._worker ListElement);this._idToWorkerItem={};this._workerManager=workerManager;workerMan ager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded,this._worker Added,this);workerManager.addEventListener(WebInspector.WorkerManager.Events.Wor kerRemoved,this._workerRemoved,this);workerManager.addEventListener(WebInspector .WorkerManager.Events.WorkersCleared,this._workersCleared,this);}
967 WebInspector.WorkersSidebarPane.prototype={_workerAdded:function(event)
968 {this._addWorker(event.data.workerId,event.data.url,event.data.inspectorConnecte d);},_workerRemoved:function(event)
969 {this._idToWorkerItem[event.data].remove();delete this._idToWorkerItem[event.dat a];},_workersCleared:function(event)
970 {this._idToWorkerItem={};this._workerListElement.removeChildren();},_addWorker:f unction(workerId,url,inspectorConnected)
971 {var item=this._workerListElement.createChild("div","dedicated-worker-item");var link=item.createChild("a");link.textContent=url;link.href="#";link.target="_bla nk";link.addEventListener("click",this._workerItemClicked.bind(this,workerId),tr ue);this._idToWorkerItem[workerId]=item;},_workerItemClicked:function(workerId,e vent)
972 {event.preventDefault();this._workerManager.openWorkerInspector(workerId);},_aut oattachToWorkersClicked:function(event)
973 {WorkerAgent.setAutoconnectToWorkers(this._enableWorkersCheckbox.checked);},__pr oto__:WebInspector.SidebarPane.prototype};WebInspector.ScriptsPanel=function(wor kspaceForTest)
974 {WebInspector.Panel.call(this,"scripts");this.registerRequiredCSS("scriptsPanel. css");this.registerRequiredCSS("textPrompt.css");WebInspector.settings.navigator WasOnceHidden=WebInspector.settings.createSetting("navigatorWasOnceHidden",false );WebInspector.settings.debuggerSidebarHidden=WebInspector.settings.createSettin g("debuggerSidebarHidden",false);this._workspace=workspaceForTest||WebInspector. workspace;function viewGetter()
975 {return this.visibleView;}
976 WebInspector.GoToLineDialog.install(this,viewGetter.bind(this));var helpSection= WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));thi s.debugToolbar=this._createDebugToolbar();const initialDebugSidebarWidth=225;con st minimumDebugSidebarWidthPercent=0.5;this.createSidebarView(this.element,WebIn spector.SidebarView.SidebarPosition.End,initialDebugSidebarWidth);this.splitView .element.id="scripts-split-view";this.splitView.setSidebarElementConstraints(Pre ferences.minScriptsSidebarWidth);this.splitView.setMainElementConstraints(minimu mDebugSidebarWidthPercent);const initialNavigatorWidth=225;const minimumViewsCon tainerWidthPercent=0.5;this.editorView=new WebInspector.SidebarView(WebInspector .SidebarView.SidebarPosition.Start,"scriptsPanelNavigatorSidebarWidth",initialNa vigatorWidth);this.editorView.element.tabIndex=0;this.editorView.setSidebarEleme ntConstraints(Preferences.minScriptsSidebarWidth);this.editorView.setMainElement Constraints(minimumViewsContainerWidthPercent);this.editorView.show(this.splitVi ew.mainElement);this._navigator=new WebInspector.ScriptsNavigator();this._naviga tor.view.show(this.editorView.sidebarElement);var tabbedEditorPlaceholderText=We bInspector.isMac()?WebInspector.UIString("Hit Cmd+O to open a file"):WebInspecto r.UIString("Hit Ctrl+O to open a file");this._editorContentsElement=this.editorV iew.mainElement.createChild("div","fill");this._editorFooterElement=this.editorV iew.mainElement.createChild("div","inspector-footer status-bar hidden");this._ed itorContainer=new WebInspector.TabbedEditorContainer(this,"previouslyViewedFiles ",tabbedEditorPlaceholderText);this._editorContainer.show(this._editorContentsEl ement);this._navigatorController=new WebInspector.NavigatorOverlayController(thi s.editorView,this._navigator.view,this._editorContainer.view);this._navigator.ad dEventListener(WebInspector.ScriptsNavigator.Events.ScriptSelected,this._scriptS elected,this);this._navigator.addEventListener(WebInspector.ScriptsNavigator.Eve nts.ItemSearchStarted,this._itemSearchStarted,this);this._navigator.addEventList ener(WebInspector.ScriptsNavigator.Events.ItemCreationRequested,this._itemCreati onRequested,this);this._navigator.addEventListener(WebInspector.ScriptsNavigator .Events.ItemRenamingRequested,this._itemRenamingRequested,this);this._editorCont ainer.addEventListener(WebInspector.TabbedEditorContainer.Events.EditorSelected, this._editorSelected,this);this._editorContainer.addEventListener(WebInspector.T abbedEditorContainer.Events.EditorClosed,this._editorClosed,this);this._debugSid ebarResizeWidgetElement=this.splitView.mainElement.createChild("div","resizer-wi dget");this._debugSidebarResizeWidgetElement.id="scripts-debug-sidebar-resizer-w idget";this.splitView.installResizer(this._debugSidebarResizeWidgetElement);this .sidebarPanes={};this.sidebarPanes.watchExpressions=new WebInspector.WatchExpres sionsSidebarPane();this.sidebarPanes.callstack=new WebInspector.CallStackSidebar Pane();this.sidebarPanes.scopechain=new WebInspector.ScopeChainSidebarPane();thi s.sidebarPanes.jsBreakpoints=new WebInspector.JavaScriptBreakpointsSidebarPane(W ebInspector.breakpointManager,this._showSourceLocation.bind(this));this.sidebarP anes.domBreakpoints=WebInspector.domBreakpointsSidebarPane.createProxy(this);thi s.sidebarPanes.xhrBreakpoints=new WebInspector.XHRBreakpointsSidebarPane();this. sidebarPanes.eventListenerBreakpoints=new WebInspector.EventListenerBreakpointsS idebarPane();if(Capabilities.canInspectWorkers&&!WebInspector.WorkerManager.isWo rkerFrontend()){WorkerAgent.enable();this.sidebarPanes.workerList=new WebInspect or.WorkersSidebarPane(WebInspector.workerManager);}
977 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this)) ;this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.GoToMem ber,this._showOutlineDialog.bind(this));this.registerShortcuts(WebInspector.Scri ptsPanelDescriptor.ShortcutKeys.ToggleBreakpoint,this._toggleBreakpoint.bind(thi s));this._pauseOnExceptionButton=new WebInspector.StatusBarButton("","scripts-pa use-on-exceptions-status-bar-item",3);this._pauseOnExceptionButton.addEventListe ner("click",this._togglePauseOnExceptions,this);this._toggleFormatSourceButton=n ew WebInspector.StatusBarButton(WebInspector.UIString("Pretty print"),"scripts-t oggle-pretty-print-status-bar-item");this._toggleFormatSourceButton.toggled=fals e;this._toggleFormatSourceButton.addEventListener("click",this._toggleFormatSour ce,this);this._scriptViewStatusBarItemsContainer=document.createElement("div");t his._scriptViewStatusBarItemsContainer.className="inline-block";this._scriptView StatusBarTextContainer=document.createElement("div");this._scriptViewStatusBarTe xtContainer.className="inline-block";this._installDebuggerSidebarController();We bInspector.dockController.addEventListener(WebInspector.DockController.Events.Do ckSideChanged,this._dockSideChanged.bind(this));WebInspector.settings.splitVerti callyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));this. _dockSideChanged();this._sourceFramesByUISourceCode=new Map();this._updateDebugg erButtons();this._pauseOnExceptionStateChanged();if(WebInspector.debuggerModel.i sPaused())
978 this._debuggerPaused();WebInspector.settings.pauseOnExceptionStateString.addChan geListener(this._pauseOnExceptionStateChanged,this);WebInspector.debuggerModel.a ddEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled,this._debug gerWasEnabled,this);WebInspector.debuggerModel.addEventListener(WebInspector.Deb uggerModel.Events.DebuggerWasDisabled,this._debuggerWasDisabled,this);WebInspect or.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaus ed,this._debuggerPaused,this);WebInspector.debuggerModel.addEventListener(WebIns pector.DebuggerModel.Events.DebuggerResumed,this._debuggerResumed,this);WebInspe ctor.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.CallFrameS elected,this._callFrameSelected,this);WebInspector.debuggerModel.addEventListene r(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame,t his._consoleCommandEvaluatedInSelectedCallFrame,this);WebInspector.debuggerModel .addEventListener(WebInspector.DebuggerModel.Events.ExecutionLineChanged,this._e xecutionLineChanged,this);WebInspector.debuggerModel.addEventListener(WebInspect or.DebuggerModel.Events.BreakpointsActiveStateChanged,this._breakpointsActiveSta teChanged,this);WebInspector.startBatchUpdate();this._workspace.uiSourceCodes(). forEach(this._addUISourceCode.bind(this));WebInspector.endBatchUpdate();this._wo rkspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._u iSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.E vents.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);this._workspace.addEve ntListener(WebInspector.Workspace.Events.ProjectWillReset,this._projectWillReset .bind(this),this);WebInspector.debuggerModel.addEventListener(WebInspector.Debug gerModel.Events.GlobalObjectCleared,this._debuggerReset,this);WebInspector.advan cedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this ._workspace));}
979 WebInspector.ScriptsPanel.prototype={get statusBarItems()
980 {return[this._pauseOnExceptionButton.element,this._toggleFormatSourceButton.elem ent,this._scriptViewStatusBarItemsContainer];},statusBarText:function()
981 {return this._scriptViewStatusBarTextContainer;},defaultFocusedElement:function( )
982 {return this._editorContainer.view.defaultFocusedElement()||this._navigator.view .defaultFocusedElement();},get paused()
983 {return this._paused;},wasShown:function()
984 {WebInspector.Panel.prototype.wasShown.call(this);this._navigatorController.wasS hown();},willHide:function()
985 {WebInspector.Panel.prototype.willHide.call(this);WebInspector.closeViewInDrawer ();},_uiSourceCodeAdded:function(event)
986 {var uiSourceCode=(event.data);this._addUISourceCode(uiSourceCode);},_addUISourc eCode:function(uiSourceCode)
987 {if(this._toggleFormatSourceButton.toggled)
988 uiSourceCode.setFormatted(true);if(uiSourceCode.project().isServiceProject())
989 return;this._navigator.addUISourceCode(uiSourceCode);this._editorContainer.addUI SourceCode(uiSourceCode);var currentUISourceCode=this._currentUISourceCode;if(cu rrentUISourceCode&&currentUISourceCode.project().isServiceProject()&&currentUISo urceCode!==uiSourceCode&&currentUISourceCode.url===uiSourceCode.url){this._showF ile(uiSourceCode);this._editorContainer.removeUISourceCode(currentUISourceCode); }},_uiSourceCodeRemoved:function(event)
990 {var uiSourceCode=(event.data);this._removeUISourceCodes([uiSourceCode]);},_remo veUISourceCodes:function(uiSourceCodes)
991 {for(var i=0;i<uiSourceCodes.length;++i){this._navigator.removeUISourceCode(uiSo urceCodes[i]);this._removeSourceFrame(uiSourceCodes[i]);}
992 this._editorContainer.removeUISourceCodes(uiSourceCodes);},_consoleCommandEvalua tedInSelectedCallFrame:function(event)
993 {this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedCallFram e());},_debuggerPaused:function()
994 {var details=WebInspector.debuggerModel.debuggerPausedDetails();this._paused=tru e;this._waitingToPause=false;this._stepping=false;this._updateDebuggerButtons(); WebInspector.inspectorView.setCurrentPanel(this);this.sidebarPanes.callstack.upd ate(details.callFrames);if(details.reason===WebInspector.DebuggerModel.BreakReas on.DOM){WebInspector.domBreakpointsSidebarPane.highlightBreakpoint(details.auxDa ta);function didCreateBreakpointHitStatusMessage(element)
995 {this.sidebarPanes.callstack.setStatus(element);}
996 WebInspector.domBreakpointsSidebarPane.createBreakpointHitStatusMessage(details. auxData,didCreateBreakpointHitStatusMessage.bind(this));}else if(details.reason= ==WebInspector.DebuggerModel.BreakReason.EventListener){var eventName=details.au xData.eventName;this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(d etails.auxData.eventName);var eventNameForUI=WebInspector.EventListenerBreakpoin tsSidebarPane.eventNameForUI(eventName,details.auxData);this.sidebarPanes.callst ack.setStatus(WebInspector.UIString("Paused on a \"%s\" Event Listener.",eventNa meForUI));}else if(details.reason===WebInspector.DebuggerModel.BreakReason.XHR){ this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.auxData["breakpoint URL"]);this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a XMLHttpRequest."));}else if(details.reason===WebInspector.DebuggerModel.BreakRea son.Exception)
997 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception : '%s'.",details.auxData.description));else if(details.reason===WebInspector.Deb uggerModel.BreakReason.Assert)
998 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on assertion ."));else if(details.reason===WebInspector.DebuggerModel.BreakReason.CSPViolatio n)
999 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a script blocked due to Content Security Policy directive: \"%s\".",details.auxData["dire ctiveText"]));else if(details.reason===WebInspector.DebuggerModel.BreakReason.De bugCommand)
1000 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a debugge d function"));else{function didGetUILocation(uiLocation)
1001 {var breakpoint=WebInspector.breakpointManager.findBreakpoint(uiLocation.uiSourc eCode,uiLocation.lineNumber);if(!breakpoint)
1002 return;this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint);this.side barPanes.callstack.setStatus(WebInspector.UIString("Paused on a JavaScript break point."));}
1003 if(details.callFrames.length)
1004 details.callFrames[0].createLiveLocation(didGetUILocation.bind(this));else
1005 console.warn("ScriptsPanel paused, but callFrames.length is zero.");}
1006 this._enableDebuggerSidebar(true);this._toggleDebuggerSidebarButton.setEnabled(f alse);window.focus();InspectorFrontendHost.bringToFront();},_debuggerResumed:fun ction()
1007 {this._paused=false;this._waitingToPause=false;this._stepping=false;this._clearI nterface();this._toggleDebuggerSidebarButton.setEnabled(true);},_debuggerWasEnab led:function()
1008 {this._updateDebuggerButtons();},_debuggerWasDisabled:function()
1009 {this._debuggerReset();},_debuggerReset:function()
1010 {this._debuggerResumed();this.sidebarPanes.watchExpressions.reset();},_projectWi llReset:function(event)
1011 {var project=event.data;var uiSourceCodes=project.uiSourceCodes();this._removeUI SourceCodes(uiSourceCodes);if(project.type()===WebInspector.projectTypes.Network )
1012 this._editorContainer.reset();},get visibleView()
1013 {return this._editorContainer.visibleView;},_updateScriptViewStatusBarItems:func tion()
1014 {this._scriptViewStatusBarItemsContainer.removeChildren();this._scriptViewStatus BarTextContainer.removeChildren();var sourceFrame=this.visibleView;if(sourceFram e){var statusBarItems=sourceFrame.statusBarItems()||[];for(var i=0;i<statusBarIt ems.length;++i)
1015 this._scriptViewStatusBarItemsContainer.appendChild(statusBarItems[i]);var statu sBarText=sourceFrame.statusBarText();if(statusBarText)
1016 this._scriptViewStatusBarTextContainer.appendChild(statusBarText);}},canShowAnch orLocation:function(anchor)
1017 {if(WebInspector.debuggerModel.debuggerEnabled()&&anchor.uiSourceCode)
1018 return true;var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(anchor.hr ef);if(uiSourceCode){anchor.uiSourceCode=uiSourceCode;return true;}
1019 return false;},showAnchorLocation:function(anchor)
1020 {this._showSourceLocation(anchor.uiSourceCode,anchor.lineNumber,anchor.columnNum ber);},showUISourceCode:function(uiSourceCode,lineNumber,columnNumber)
1021 {this._showSourceLocation(uiSourceCode,lineNumber,columnNumber);},_showSourceLoc ation:function(uiSourceCode,lineNumber,columnNumber)
1022 {var sourceFrame=this._showFile(uiSourceCode);if(typeof lineNumber==="number")
1023 sourceFrame.highlightPosition(lineNumber,columnNumber);sourceFrame.focus();WebIn spector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserActi on,{action:WebInspector.UserMetrics.UserActionNames.OpenSourceLink,url:uiSourceC ode.originURL(),lineNumber:lineNumber});},_showFile:function(uiSourceCode)
1024 {var sourceFrame=this._getOrCreateSourceFrame(uiSourceCode);if(this._currentUISo urceCode===uiSourceCode)
1025 return sourceFrame;this._currentUISourceCode=uiSourceCode;if(!uiSourceCode.proje ct().isServiceProject())
1026 this._navigator.revealUISourceCode(uiSourceCode,true);this._editorContainer.show File(uiSourceCode);this._updateScriptViewStatusBarItems();if(this._currentUISour ceCode.project().type()===WebInspector.projectTypes.Snippets)
1027 this._runSnippetButton.element.removeStyleClass("hidden");else
1028 this._runSnippetButton.element.addStyleClass("hidden");return sourceFrame;},_cre ateSourceFrame:function(uiSourceCode)
1029 {var sourceFrame;switch(uiSourceCode.contentType()){case WebInspector.resourceTy pes.Script:sourceFrame=new WebInspector.JavaScriptSourceFrame(this,uiSourceCode) ;break;case WebInspector.resourceTypes.Document:sourceFrame=new WebInspector.Jav aScriptSourceFrame(this,uiSourceCode);break;case WebInspector.resourceTypes.Styl esheet:default:sourceFrame=new WebInspector.UISourceCodeFrame(uiSourceCode);brea k;}
1030 this._sourceFramesByUISourceCode.put(uiSourceCode,sourceFrame);return sourceFram e;},_getOrCreateSourceFrame:function(uiSourceCode)
1031 {return this._sourceFramesByUISourceCode.get(uiSourceCode)||this._createSourceFr ame(uiSourceCode);},viewForFile:function(uiSourceCode)
1032 {return this._getOrCreateSourceFrame(uiSourceCode);},_removeSourceFrame:function (uiSourceCode)
1033 {var sourceFrame=this._sourceFramesByUISourceCode.get(uiSourceCode);if(!sourceFr ame)
1034 return;this._sourceFramesByUISourceCode.remove(uiSourceCode);sourceFrame.dispose ();},_clearCurrentExecutionLine:function()
1035 {if(this._executionSourceFrame)
1036 this._executionSourceFrame.clearExecutionLine();delete this._executionSourceFram e;},_executionLineChanged:function(event)
1037 {var uiLocation=event.data;this._clearCurrentExecutionLine();if(!uiLocation)
1038 return;var sourceFrame=this._getOrCreateSourceFrame(uiLocation.uiSourceCode);sou rceFrame.setExecutionLine(uiLocation.lineNumber);this._executionSourceFrame=sour ceFrame;},_revealExecutionLine:function(uiLocation)
1039 {var uiSourceCode=uiLocation.uiSourceCode;if(this._currentUISourceCode&&this._cu rrentUISourceCode.scriptFile()&&this._currentUISourceCode.scriptFile().isDivergi ngFromVM())
1040 return;if(this._toggleFormatSourceButton.toggled&&!uiSourceCode.formatted())
1041 uiSourceCode.setFormatted(true);var sourceFrame=this._showFile(uiSourceCode);sou rceFrame.revealLine(uiLocation.lineNumber);sourceFrame.focus();},_callFrameSelec ted:function(event)
1042 {var callFrame=event.data;if(!callFrame)
1043 return;this.sidebarPanes.scopechain.update(callFrame);this.sidebarPanes.watchExp ressions.refreshExpressions();this.sidebarPanes.callstack.setSelectedCallFrame(c allFrame);callFrame.createLiveLocation(this._revealExecutionLine.bind(this));},_ editorClosed:function(event)
1044 {this._navigatorController.hideNavigatorOverlay();var uiSourceCode=(event.data); if(this._currentUISourceCode===uiSourceCode)
1045 delete this._currentUISourceCode;this._updateScriptViewStatusBarItems();WebInspe ctor.searchController.resetSearch();},_editorSelected:function(event)
1046 {var uiSourceCode=(event.data);var sourceFrame=this._showFile(uiSourceCode);this ._navigatorController.hideNavigatorOverlay();if(!this._navigatorController.isNav igatorPinned())
1047 sourceFrame.focus();WebInspector.searchController.resetSearch();},_scriptSelecte d:function(event)
1048 {var uiSourceCode=(event.data.uiSourceCode);var sourceFrame=this._showFile(uiSou rceCode);this._navigatorController.hideNavigatorOverlay();if(sourceFrame&&(!this ._navigatorController.isNavigatorPinned()||event.data.focusSource))
1049 sourceFrame.focus();},_itemSearchStarted:function(event)
1050 {var searchText=(event.data);WebInspector.OpenResourceDialog.show(this,this.edit orView.mainElement,searchText);},_pauseOnExceptionStateChanged:function()
1051 {var pauseOnExceptionsState=WebInspector.settings.pauseOnExceptionStateString.ge t();switch(pauseOnExceptionsState){case WebInspector.DebuggerModel.PauseOnExcept ionsState.DontPauseOnExceptions:this._pauseOnExceptionButton.title=WebInspector. UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");break; case WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions:this ._pauseOnExceptionButton.title=WebInspector.UIString("Pause on all exceptions.\n Click to Pause on uncaught exceptions.");break;case WebInspector.DebuggerModel.P auseOnExceptionsState.PauseOnUncaughtExceptions:this._pauseOnExceptionButton.tit le=WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on e xceptions.");break;}
1052 this._pauseOnExceptionButton.state=pauseOnExceptionsState;},_updateDebuggerButto ns:function()
1053 {if(WebInspector.debuggerModel.debuggerEnabled()){this._pauseOnExceptionButton.v isible=true;}else{this._pauseOnExceptionButton.visible=false;}
1054 if(this._paused){this._updateButtonTitle(this._pauseButton,WebInspector.UIString ("Resume script execution (%s)."))
1055 this._pauseButton.state=true;this._pauseButton.setEnabled(true);this._stepOverBu tton.setEnabled(true);this._stepIntoButton.setEnabled(true);this._stepOutButton. setEnabled(true);this.debuggerStatusElement.textContent=WebInspector.UIString("P aused");}else{this._updateButtonTitle(this._pauseButton,WebInspector.UIString("P ause script execution (%s)."))
1056 this._pauseButton.state=false;this._pauseButton.setEnabled(!this._waitingToPause );this._stepOverButton.setEnabled(false);this._stepIntoButton.setEnabled(false); this._stepOutButton.setEnabled(false);if(this._waitingToPause)
1057 this.debuggerStatusElement.textContent=WebInspector.UIString("Pausing");else if( this._stepping)
1058 this.debuggerStatusElement.textContent=WebInspector.UIString("Stepping");else
1059 this.debuggerStatusElement.textContent="";}},_clearInterface:function()
1060 {this.sidebarPanes.callstack.update(null);this.sidebarPanes.scopechain.update(nu ll);this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();WebInspector.domB reakpointsSidebarPane.clearBreakpointHighlight();this.sidebarPanes.eventListener Breakpoints.clearBreakpointHighlight();this.sidebarPanes.xhrBreakpoints.clearBre akpointHighlight();this._clearCurrentExecutionLine();this._updateDebuggerButtons ();},_togglePauseOnExceptions:function()
1061 {var nextStateMap={};var stateEnum=WebInspector.DebuggerModel.PauseOnExceptionsS tate;nextStateMap[stateEnum.DontPauseOnExceptions]=stateEnum.PauseOnAllException s;nextStateMap[stateEnum.PauseOnAllExceptions]=stateEnum.PauseOnUncaughtExceptio ns;nextStateMap[stateEnum.PauseOnUncaughtExceptions]=stateEnum.DontPauseOnExcept ions;WebInspector.settings.pauseOnExceptionStateString.set(nextStateMap[this._pa useOnExceptionButton.state]);},_runSnippet:function(event)
1062 {if(this._currentUISourceCode.project().type()!==WebInspector.projectTypes.Snipp ets)
1063 return false;WebInspector.scriptSnippetModel.evaluateScriptSnippet(this._current UISourceCode);return true;},_togglePause:function(event)
1064 {if(this._paused){this._paused=false;this._waitingToPause=false;DebuggerAgent.re sume();}else{this._stepping=false;this._waitingToPause=true;DebuggerAgent.pause( );}
1065 this._clearInterface();return true;},_stepOverClicked:function(event)
1066 {if(!this._paused)
1067 return true;this._paused=false;this._stepping=true;this._clearInterface();Debugg erAgent.stepOver();return true;},_stepIntoClicked:function(event)
1068 {if(!this._paused)
1069 return true;this._paused=false;this._stepping=true;this._clearInterface();Debugg erAgent.stepInto();return true;},_stepOutClicked:function(event)
1070 {if(!this._paused)
1071 return true;this._paused=false;this._stepping=true;this._clearInterface();Debugg erAgent.stepOut();return true;},_toggleBreakpointsClicked:function(event)
1072 {WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerModel.bre akpointsActive());},_breakpointsActiveStateChanged:function(event)
1073 {var active=event.data;this._toggleBreakpointsButton.toggled=!active;if(active){ this._toggleBreakpointsButton.title=WebInspector.UIString("Deactivate breakpoint s.");WebInspector.inspectorView.element.removeStyleClass("breakpoints-deactivate d");this.sidebarPanes.jsBreakpoints.listElement.removeStyleClass("breakpoints-li st-deactivated");}else{this._toggleBreakpointsButton.title=WebInspector.UIString ("Activate breakpoints.");WebInspector.inspectorView.element.addStyleClass("brea kpoints-deactivated");this.sidebarPanes.jsBreakpoints.listElement.addStyleClass( "breakpoints-list-deactivated");}},_createDebugToolbar:function()
1074 {var debugToolbar=document.createElement("div");debugToolbar.className="status-b ar";debugToolbar.id="scripts-debug-toolbar";var title,handler;var platformSpecif icModifier=WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;title=WebInspector .UIString("Run snippet (%s).");handler=this._runSnippet.bind(this);this._runSnip petButton=this._createButtonAndRegisterShortcuts("scripts-run-snippet",title,han dler,WebInspector.ScriptsPanelDescriptor.ShortcutKeys.RunSnippet);debugToolbar.a ppendChild(this._runSnippetButton.element);this._runSnippetButton.element.addSty leClass("hidden");handler=this._togglePause.bind(this);this._pauseButton=this._c reateButtonAndRegisterShortcuts("scripts-pause","",handler,WebInspector.ScriptsP anelDescriptor.ShortcutKeys.PauseContinue);debugToolbar.appendChild(this._pauseB utton.element);title=WebInspector.UIString("Step over next function call (%s).") ;handler=this._stepOverClicked.bind(this);this._stepOverButton=this._createButto nAndRegisterShortcuts("scripts-step-over",title,handler,WebInspector.ScriptsPane lDescriptor.ShortcutKeys.StepOver);debugToolbar.appendChild(this._stepOverButton .element);title=WebInspector.UIString("Step into next function call (%s).");hand ler=this._stepIntoClicked.bind(this);this._stepIntoButton=this._createButtonAndR egisterShortcuts("scripts-step-into",title,handler,WebInspector.ScriptsPanelDesc riptor.ShortcutKeys.StepInto);debugToolbar.appendChild(this._stepIntoButton.elem ent);title=WebInspector.UIString("Step out of current function (%s).");handler=t his._stepOutClicked.bind(this);this._stepOutButton=this._createButtonAndRegister Shortcuts("scripts-step-out",title,handler,WebInspector.ScriptsPanelDescriptor.S hortcutKeys.StepOut);debugToolbar.appendChild(this._stepOutButton.element);this. _toggleBreakpointsButton=new WebInspector.StatusBarButton(WebInspector.UIString( "Deactivate breakpoints."),"scripts-toggle-breakpoints");this._toggleBreakpoints Button.toggled=false;this._toggleBreakpointsButton.addEventListener("click",this ._toggleBreakpointsClicked,this);debugToolbar.appendChild(this._toggleBreakpoint sButton.element);this.debuggerStatusElement=document.createElement("div");this.d ebuggerStatusElement.id="scripts-debugger-status";debugToolbar.appendChild(this. debuggerStatusElement);return debugToolbar;},_updateButtonTitle:function(button, buttonTitle)
1075 {var hasShortcuts=button.shortcuts&&button.shortcuts.length;if(hasShortcuts)
1076 button.title=String.vsprintf(buttonTitle,[button.shortcuts[0].name]);else
1077 button.title=buttonTitle;},_createButtonAndRegisterShortcuts:function(buttonId,b uttonTitle,handler,shortcuts)
1078 {var button=new WebInspector.StatusBarButton(buttonTitle,buttonId);button.elemen t.addEventListener("click",handler,false);button.shortcuts=shortcuts;this._updat eButtonTitle(button,buttonTitle);this.registerShortcuts(shortcuts,handler);retur n button;},searchCanceled:function()
1079 {if(this._searchView)
1080 this._searchView.searchCanceled();delete this._searchView;delete this._searchQue ry;},performSearch:function(query,shouldJump)
1081 {WebInspector.searchController.updateSearchMatchesCount(0,this);if(!this.visible View)
1082 return;this._searchView=this.visibleView;this._searchQuery=query;function finish edCallback(view,searchMatches)
1083 {if(!searchMatches)
1084 return;WebInspector.searchController.updateSearchMatchesCount(searchMatches,this );}
1085 function currentMatchChanged(currentMatchIndex)
1086 {WebInspector.searchController.updateCurrentMatchIndex(currentMatchIndex,this);}
1087 this._searchView.performSearch(query,shouldJump,finishedCallback.bind(this),curr entMatchChanged.bind(this));},minimalSearchQuerySize:function()
1088 {return 0;},jumpToNextSearchResult:function()
1089 {if(!this._searchView)
1090 return;if(this._searchView!==this.visibleView){this.performSearch(this._searchQu ery,true);return;}
1091 this._searchView.jumpToNextSearchResult();return true;},jumpToPreviousSearchResu lt:function()
1092 {if(!this._searchView)
1093 return;if(this._searchView!==this.visibleView){this.performSearch(this._searchQu ery,true);if(this._searchView)
1094 this._searchView.jumpToLastSearchResult();return;}
1095 this._searchView.jumpToPreviousSearchResult();},canSearchAndReplace:function()
1096 {var view=(this.visibleView);return!!view&&view.canEditSource();},replaceSelecti onWith:function(text)
1097 {var view=(this.visibleView);view.replaceSearchMatchWith(text);},replaceAllWith: function(query,text)
1098 {var view=(this.visibleView);view.replaceAllWith(query,text);},_toggleFormatSour ce:function()
1099 {this._toggleFormatSourceButton.toggled=!this._toggleFormatSourceButton.toggled; var uiSourceCodes=this._workspace.uiSourceCodes();for(var i=0;i<uiSourceCodes.le ngth;++i)
1100 uiSourceCodes[i].setFormatted(this._toggleFormatSourceButton.toggled);var curren tFile=this._editorContainer.currentFile();WebInspector.notifications.dispatchEve ntToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetri cs.UserActionNames.TogglePrettyPrint,enabled:this._toggleFormatSourceButton.togg led,url:currentFile?currentFile.originURL():null});},addToWatch:function(express ion)
1101 {this.sidebarPanes.watchExpressions.addExpression(expression);},_toggleBreakpoin t:function()
1102 {var sourceFrame=this.visibleView;if(!sourceFrame)
1103 return false;if(sourceFrame instanceof WebInspector.JavaScriptSourceFrame){var j avaScriptSourceFrame=(sourceFrame);javaScriptSourceFrame.toggleBreakpointOnCurre ntLine();return true;}
1104 return false;},_showOutlineDialog:function(event)
1105 {var uiSourceCode=this._editorContainer.currentFile();if(!uiSourceCode)
1106 return false;switch(uiSourceCode.contentType()){case WebInspector.resourceTypes. Document:case WebInspector.resourceTypes.Script:WebInspector.JavaScriptOutlineDi alog.show(this.visibleView,uiSourceCode);return true;case WebInspector.resourceT ypes.Stylesheet:WebInspector.StyleSheetOutlineDialog.show(this.visibleView,uiSou rceCode);return true;}
1107 return false;},_installDebuggerSidebarController:function()
1108 {this._toggleDebuggerSidebarButton=new WebInspector.StatusBarButton("","right-si debar-show-hide-button scripts-debugger-show-hide-button",3);this._toggleDebugge rSidebarButton.addEventListener("click",clickHandler,this);this.editorView.eleme nt.appendChild(this._toggleDebuggerSidebarButton.element);this._enableDebuggerSi debar(!WebInspector.settings.debuggerSidebarHidden.get());function clickHandler( )
1109 {this._enableDebuggerSidebar(this._toggleDebuggerSidebarButton.state==="left");} },_enableDebuggerSidebar:function(show)
1110 {this._toggleDebuggerSidebarButton.state=show?"right":"left";this._toggleDebugge rSidebarButton.title=show?WebInspector.UIString("Hide debugger"):WebInspector.UI String("Show debugger");if(show)
1111 this.splitView.showSidebarElement();else
1112 this.splitView.hideSidebarElement();this._debugSidebarResizeWidgetElement.enable StyleClass("hidden",!show);WebInspector.settings.debuggerSidebarHidden.set(!show );},_itemCreationRequested:function(event)
1113 {var project=event.data.project;var path=event.data.path;var filePath;var should HideNavigator;var uiSourceCode;project.createFile(path,null,fileCreated.bind(thi s));function fileCreated(path)
1114 {if(!path)
1115 return;filePath=path;uiSourceCode=project.uiSourceCode(filePath);this._showSourc eLocation(uiSourceCode);shouldHideNavigator=!this._navigatorController.isNavigat orPinned();if(this._navigatorController.isNavigatorHidden())
1116 this._navigatorController.showNavigatorOverlay();this._navigator.rename(uiSource Code,callback.bind(this));}
1117 function callback(committed)
1118 {if(shouldHideNavigator)
1119 this._navigatorController.hideNavigatorOverlay();if(!committed){project.deleteFi le(uiSourceCode);return;}
1120 this._showSourceLocation(uiSourceCode);}},_itemRenamingRequested:function(event)
1121 {var uiSourceCode=(event.data);var shouldHideNavigator=!this._navigatorControlle r.isNavigatorPinned();if(this._navigatorController.isNavigatorHidden())
1122 this._navigatorController.showNavigatorOverlay();this._navigator.rename(uiSource Code,callback.bind(this));function callback(committed)
1123 {if(shouldHideNavigator&&committed){this._navigatorController.hideNavigatorOverl ay();this._showSourceLocation(uiSourceCode);}}},_showLocalHistory:function(uiSou rceCode)
1124 {WebInspector.RevisionHistoryView.showHistory(uiSourceCode);},appendApplicableIt ems:function(event,contextMenu,target)
1125 {this._appendUISourceCodeItems(contextMenu,target);this._appendFunctionItems(con textMenu,target);},_mapFileSystemToNetwork:function(uiSourceCode)
1126 {WebInspector.SelectUISourceCodeForProjectTypeDialog.show(uiSourceCode.name(),We bInspector.projectTypes.Network,mapFileSystemToNetwork.bind(this),this.editorVie w.mainElement)
1127 function mapFileSystemToNetwork(networkUISourceCode)
1128 {this._workspace.addMapping(networkUISourceCode,uiSourceCode,WebInspector.fileSy stemWorkspaceProvider);}},_removeNetworkMapping:function(uiSourceCode)
1129 {if(confirm(WebInspector.UIString("Are you sure you want to remove network mappi ng?")))
1130 this._workspace.removeMapping(uiSourceCode);},_mapNetworkToFileSystem:function(n etworkUISourceCode)
1131 {WebInspector.SelectUISourceCodeForProjectTypeDialog.show(networkUISourceCode.na me(),WebInspector.projectTypes.FileSystem,mapNetworkToFileSystem.bind(this),this .editorView.mainElement)
1132 function mapNetworkToFileSystem(uiSourceCode)
1133 {this._workspace.addMapping(networkUISourceCode,uiSourceCode,WebInspector.fileSy stemWorkspaceProvider);}},_appendUISourceCodeMappingItems:function(contextMenu,u iSourceCode)
1134 {if(uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem){var ha sMappings=!!uiSourceCode.url;if(!hasMappings)
1135 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Map to network resource\u2026":"Map to Network Resource\u2026"),this._mapFil eSystemToNetwork.bind(this,uiSourceCode));else
1136 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Remove network mapping":"Remove Network Mapping"),this._removeNetworkMapping .bind(this,uiSourceCode));}
1137 if(uiSourceCode.project().type()===WebInspector.projectTypes.Network){function f ilterProject(project)
1138 {return project.type()===WebInspector.projectTypes.FileSystem;}
1139 if(!this._workspace.projects().filter(filterProject).length)
1140 return;if(this._workspace.uiSourceCodeForURL(uiSourceCode.url)===uiSourceCode)
1141 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Map to file system resource\u2026":"Map to File System Resource\u2026"),this ._mapNetworkToFileSystem.bind(this,uiSourceCode));}},_appendUISourceCodeItems:fu nction(contextMenu,target)
1142 {if(!(target instanceof WebInspector.UISourceCode))
1143 return;var uiSourceCode=(target);contextMenu.appendItem(WebInspector.UIString(We bInspector.useLowerCaseMenuTitles()?"Local modifications\u2026":"Local Modificat ions\u2026"),this._showLocalHistory.bind(this,uiSourceCode));if(WebInspector.iso latedFileSystemManager.supportsFileSystems())
1144 this._appendUISourceCodeMappingItems(contextMenu,uiSourceCode);var resource=WebI nspector.resourceForURL(uiSourceCode.url);if(resource&&resource.request)
1145 contextMenu.appendApplicableItems(resource.request);},_appendFunctionItems:funct ion(contextMenu,target)
1146 {if(!(target instanceof WebInspector.RemoteObject))
1147 return;var remoteObject=(target);if(remoteObject.type!=="function")
1148 return;function didGetDetails(error,response)
1149 {if(error){console.error(error);return;}
1150 WebInspector.inspectorView.setCurrentPanel(this);var uiLocation=WebInspector.deb uggerModel.rawLocationToUILocation(response.location);this._showSourceLocation(u iLocation.uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber);}
1151 function revealFunction()
1152 {DebuggerAgent.getFunctionDetails(remoteObject.objectId,didGetDetails.bind(this) );}
1153 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles ()?"Show function definition":"Show Function Definition"),revealFunction.bind(th is));},showGoToSourceDialog:function()
1154 {var uiSourceCodes=this._editorContainer.historyUISourceCodes();var defaultScore s=new Map();for(var i=1;i<uiSourceCodes.length;++i)
1155 defaultScores.put(uiSourceCodes[i],uiSourceCodes.length-i);WebInspector.OpenReso urceDialog.show(this,this.editorView.mainElement,undefined,defaultScores);},_doc kSideChanged:function()
1156 {var dockSide=WebInspector.dockController.dockSide();var vertically=dockSide===W ebInspector.DockController.State.DockedToRight&&WebInspector.settings.splitVerti callyWhenDockedToRight.get();this._splitVertically(vertically);},_splitVerticall y:function(vertically)
1157 {if(this.sidebarPaneView&&vertically===!this.splitView.isVertical())
1158 return;if(this.sidebarPaneView)
1159 this.sidebarPaneView.detach();this.splitView.setVertical(!vertically);if(!vertic ally){this.sidebarPaneView=new WebInspector.SidebarPaneStack();for(var pane in t his.sidebarPanes)
1160 this.sidebarPaneView.addPane(this.sidebarPanes[pane]);this.sidebarElement.append Child(this.debugToolbar);}else{this._enableDebuggerSidebar(true);this.sidebarPan eView=new WebInspector.SplitView(true,this.name+"PanelSplitSidebarRatio",0.5);va r group1=new WebInspector.SidebarPaneStack();group1.show(this.sidebarPaneView.fi rstElement());group1.element.id="scripts-sidebar-stack-pane";group1.addPane(this .sidebarPanes.callstack);group1.addPane(this.sidebarPanes.jsBreakpoints);group1. addPane(this.sidebarPanes.domBreakpoints);group1.addPane(this.sidebarPanes.xhrBr eakpoints);group1.addPane(this.sidebarPanes.eventListenerBreakpoints);if(this.si debarPanes.workerList)
1161 group1.addPane(this.sidebarPanes.workerList);var group2=new WebInspector.Sidebar TabbedPane();group2.show(this.sidebarPaneView.secondElement());group2.addPane(th is.sidebarPanes.scopechain);group2.addPane(this.sidebarPanes.watchExpressions);t his.sidebarPaneView.firstElement().appendChild(this.debugToolbar);}
1162 this.sidebarPaneView.element.id="scripts-debug-sidebar-contents";this.sidebarPan eView.show(this.splitView.sidebarElement);this.sidebarPanes.scopechain.expand(); this.sidebarPanes.jsBreakpoints.expand();this.sidebarPanes.callstack.expand();if (WebInspector.settings.watchExpressions.get().length>0)
1163 this.sidebarPanes.watchExpressions.expand();},canSetFooterElement:function()
1164 {return true;},setFooterElement:function(element)
1165 {if(element){this._editorFooterElement.removeStyleClass("hidden");this._editorFo oterElement.appendChild(element);this._editorContentsElement.style.bottom=this._ editorFooterElement.offsetHeight+"px";}else{this._editorFooterElement.addStyleCl ass("hidden");this._editorFooterElement.removeChildren();this._editorContentsEle ment.style.bottom=0;}
1166 this.doResize();},__proto__:WebInspector.Panel.prototype}
OLDNEW
« no previous file with comments | « chrome_linux/resources/inspector/ScriptFormatterWorker.js ('k') | chrome_linux/resources/inspector/SourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698