Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / tools / test / reference_build / chrome_linux / resources / inspector / sources / SourcesPanel.js
1 WebInspector.Placard=function(title,subtitle)
2 {this.element=document.createElementWithClass("div","placard");this.element.placard=this;this.subtitleElement=this.element.createChild("div","subtitle");this.titleElement=this.element.createChild("div","title");this._hidden=false;this.title=title;this.subtitle=subtitle;this.selected=false;}
3 WebInspector.Placard.prototype={get title()
4 {return this._title;},set title(x)
5 {if(this._title===x)
6 return;this._title=x;this.titleElement.textContent=x;},get subtitle()
7 {return this._subtitle;},set subtitle(x)
8 {if(this._subtitle===x)
9 return;this._subtitle=x;this.subtitleElement.textContent=x;},get selected()
10 {return this._selected;},set selected(x)
11 {if(x)
12 this.select();else
13 this.deselect();},select:function()
14 {if(this._selected)
15 return;this._selected=true;this.element.classList.add("selected");},deselect:function()
16 {if(!this._selected)
17 return;this._selected=false;this.element.classList.remove("selected");},toggleSelected:function()
18 {this.selected=!this.selected;},isHidden:function()
19 {return this._hidden;},setHidden:function(x)
20 {if(this._hidden===x)
21 return;this._hidden=x;this.element.classList.toggle("hidden",x);},discard:function()
22 {}};WebInspector.JavaScriptBreakpointsSidebarPane=function(debuggerModel,breakpointManager,showSourceLineDelegate)
23 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Breakpoints"));this._debuggerModel=debuggerModel;this.registerRequiredCSS("breakpointsList.css");this._breakpointManager=breakpointManager;this._showSourceLineDelegate=showSourceLineDelegate;this.listElement=document.createElement("ol");this.listElement.className="breakpoint-list";this.emptyElement=document.createElement("div");this.emptyElement.className="info";this.emptyElement.textContent=WebInspector.UIString("No Breakpoints");this.bodyElement.appendChild(this.emptyElement);this._items=new Map();var breakpointLocations=this._breakpointManager.allBreakpointLocations();for(var i=0;i<breakpointLocations.length;++i)
24 this._addBreakpoint(breakpointLocations[i].breakpoint,breakpointLocations[i].uiLocation);this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded,this._breakpointAdded,this);this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved,this._breakpointRemoved,this);this.emptyElement.addEventListener("contextmenu",this._emptyElementContextMenu.bind(this),true);}
25 WebInspector.JavaScriptBreakpointsSidebarPane.prototype={_emptyElementContextMenu:function(event)
26 {var contextMenu=new WebInspector.ContextMenu(event);var breakpointActive=this._debuggerModel.breakpointsActive();var breakpointActiveTitle=breakpointActive?WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Deactivate breakpoints":"Deactivate Breakpoints"):WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Activate breakpoints":"Activate Breakpoints");contextMenu.appendItem(breakpointActiveTitle,this._debuggerModel.setBreakpointsActive.bind(this._debuggerModel,!breakpointActive));contextMenu.show();},_breakpointAdded:function(event)
27 {this._breakpointRemoved(event);var breakpoint=(event.data.breakpoint);var uiLocation=(event.data.uiLocation);this._addBreakpoint(breakpoint,uiLocation);},_addBreakpoint:function(breakpoint,uiLocation)
28 {var element=document.createElement("li");element.classList.add("cursor-pointer");element.addEventListener("contextmenu",this._breakpointContextMenu.bind(this,breakpoint),true);element.addEventListener("click",this._breakpointClicked.bind(this,uiLocation),false);var checkbox=document.createElement("input");checkbox.className="checkbox-elem";checkbox.type="checkbox";checkbox.checked=breakpoint.enabled();checkbox.addEventListener("click",this._breakpointCheckboxClicked.bind(this,breakpoint),false);element.appendChild(checkbox);var labelElement=document.createTextNode(uiLocation.linkText());element.appendChild(labelElement);var snippetElement=document.createElement("div");snippetElement.className="source-text monospace";element.appendChild(snippetElement);function didRequestContent(content)
29 {var lineNumber=uiLocation.lineNumber
30 var columnNumber=uiLocation.columnNumber;var contentString=new String(content);if(lineNumber<contentString.lineCount()){var lineText=contentString.lineAt(lineNumber);var maxSnippetLength=200;snippetElement.textContent=lineText.substr(columnNumber).trimEnd(maxSnippetLength);}}
31 uiLocation.uiSourceCode.requestContent(didRequestContent);element._data=uiLocation;var currentElement=this.listElement.firstChild;while(currentElement){if(currentElement._data&&this._compareBreakpoints(currentElement._data,element._data)>0)
32 break;currentElement=currentElement.nextSibling;}
33 this._addListElement(element,currentElement);var breakpointItem={};breakpointItem.element=element;breakpointItem.checkbox=checkbox;this._items.put(breakpoint,breakpointItem);this.expand();},_breakpointRemoved:function(event)
34 {var breakpoint=(event.data.breakpoint);var uiLocation=(event.data.uiLocation);var breakpointItem=this._items.get(breakpoint);if(!breakpointItem)
35 return;this._items.remove(breakpoint);this._removeListElement(breakpointItem.element);},highlightBreakpoint:function(breakpoint)
36 {var breakpointItem=this._items.get(breakpoint);if(!breakpointItem)
37 return;breakpointItem.element.classList.add("breakpoint-hit");this._highlightedBreakpointItem=breakpointItem;},clearBreakpointHighlight:function()
38 {if(this._highlightedBreakpointItem){this._highlightedBreakpointItem.element.classList.remove("breakpoint-hit");delete this._highlightedBreakpointItem;}},_breakpointClicked:function(uiLocation,event)
39 {this._showSourceLineDelegate(uiLocation.uiSourceCode,uiLocation.lineNumber);},_breakpointCheckboxClicked:function(breakpoint,event)
40 {event.consume();breakpoint.setEnabled(event.target.checked);},_breakpointContextMenu:function(breakpoint,event)
41 {var breakpoints=this._items.values();var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove breakpoint":"Remove Breakpoint"),breakpoint.remove.bind(breakpoint));if(breakpoints.length>1){var removeAllTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove all breakpoints":"Remove All Breakpoints");contextMenu.appendItem(removeAllTitle,this._breakpointManager.removeAllBreakpoints.bind(this._breakpointManager));}
42 contextMenu.appendSeparator();var breakpointActive=this._debuggerModel.breakpointsActive();var breakpointActiveTitle=breakpointActive?WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Deactivate breakpoints":"Deactivate Breakpoints"):WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Activate breakpoints":"Activate Breakpoints");contextMenu.appendItem(breakpointActiveTitle,this._debuggerModel.setBreakpointsActive.bind(this._debuggerModel,!breakpointActive));function enabledBreakpointCount(breakpoints)
43 {var count=0;for(var i=0;i<breakpoints.length;++i){if(breakpoints[i].checkbox.checked)
44 count++;}
45 return count;}
46 if(breakpoints.length>1){var enableBreakpointCount=enabledBreakpointCount(breakpoints);var enableTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Enable all breakpoints":"Enable All Breakpoints");var disableTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Disable all breakpoints":"Disable All Breakpoints");contextMenu.appendSeparator();contextMenu.appendItem(enableTitle,this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager,true),!(enableBreakpointCount!=breakpoints.length));contextMenu.appendItem(disableTitle,this._breakpointManager.toggleAllBreakpoints.bind(this._breakpointManager,false),!(enableBreakpointCount>1));}
47 contextMenu.show();},_addListElement:function(element,beforeElement)
48 {if(beforeElement)
49 this.listElement.insertBefore(element,beforeElement);else{if(!this.listElement.firstChild){this.bodyElement.removeChild(this.emptyElement);this.bodyElement.appendChild(this.listElement);}
50 this.listElement.appendChild(element);}},_removeListElement:function(element)
51 {this.listElement.removeChild(element);if(!this.listElement.firstChild){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}},_compare:function(x,y)
52 {if(x!==y)
53 return x<y?-1:1;return 0;},_compareBreakpoints:function(b1,b2)
54 {return this._compare(b1.uiSourceCode.originURL(),b2.uiSourceCode.originURL())||this._compare(b1.lineNumber,b2.lineNumber);},reset:function()
55 {this.listElement.removeChildren();if(this.listElement.parentElement){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}
56 this._items.clear();},__proto__:WebInspector.SidebarPane.prototype}
57 WebInspector.XHRBreakpointsSidebarPane=function()
58 {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.UIString("Add XHR breakpoint");this.titleElement.appendChild(addButton);this.emptyElement.addEventListener("contextmenu",this._emptyElementContextMenu.bind(this),true);this._restoreBreakpoints();}
59 WebInspector.XHRBreakpointsSidebarPane.prototype={_emptyElementContextMenu:function(event)
60 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Breakpoint"),this._addButtonClicked.bind(this));contextMenu.show();},_addButtonClicked:function(event)
61 {if(event)
62 event.consume();this.expand();var inputElementContainer=document.createElement("p");inputElementContainer.className="breakpoint-condition";var inputElement=document.createElement("span");inputElementContainer.textContent=WebInspector.UIString("Break when URL contains:");inputElement.className="editing";inputElement.id="breakpoint-condition-input";inputElementContainer.appendChild(inputElement);this._addListElement(inputElementContainer,this.listElement.firstChild);function finishEditing(accept,e,text)
63 {this._removeListElement(inputElementContainer);if(accept){this._setBreakpoint(text,true);this._saveBreakpoints();}}
64 var config=new WebInspector.InplaceEditor.Config(finishEditing.bind(this,true),finishEditing.bind(this,false));WebInspector.InplaceEditor.startEditing(inputElement,config);},_setBreakpoint:function(url,enabled)
65 {if(url in this._breakpointElements)
66 return;var element=document.createElement("li");element._url=url;element.addEventListener("contextmenu",this._contextMenu.bind(this,url),true);var checkboxElement=document.createElement("input");checkboxElement.className="checkbox-elem";checkboxElement.type="checkbox";checkboxElement.checked=enabled;checkboxElement.addEventListener("click",this._checkboxClicked.bind(this,url),false);element._checkboxElement=checkboxElement;element.appendChild(checkboxElement);var labelElement=document.createElement("span");if(!url)
67 labelElement.textContent=WebInspector.UIString("Any XHR");else
68 labelElement.textContent=WebInspector.UIString("URL contains \"%s\"",url);labelElement.classList.add("cursor-auto");labelElement.addEventListener("dblclick",this._labelClicked.bind(this,url),false);element.appendChild(labelElement);var currentElement=this.listElement.firstChild;while(currentElement){if(currentElement._url&&currentElement._url<element._url)
69 break;currentElement=currentElement.nextSibling;}
70 this._addListElement(element,currentElement);this._breakpointElements[url]=element;if(enabled)
71 DOMDebuggerAgent.setXHRBreakpoint(url);},_removeBreakpoint:function(url)
72 {var element=this._breakpointElements[url];if(!element)
73 return;this._removeListElement(element);delete this._breakpointElements[url];if(element._checkboxElement.checked)
74 DOMDebuggerAgent.removeXHRBreakpoint(url);},_contextMenu:function(url,event)
75 {var contextMenu=new WebInspector.ContextMenu(event);function removeBreakpoint()
76 {this._removeBreakpoint(url);this._saveBreakpoints();}
77 function removeAllBreakpoints()
78 {for(var url in this._breakpointElements)
79 this._removeBreakpoint(url);this._saveBreakpoints();}
80 var removeAllTitle=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove all breakpoints":"Remove All Breakpoints");contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Breakpoint"),this._addButtonClicked.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove breakpoint":"Remove Breakpoint"),removeBreakpoint.bind(this));contextMenu.appendItem(removeAllTitle,removeAllBreakpoints.bind(this));contextMenu.show();},_checkboxClicked:function(url,event)
81 {if(event.target.checked)
82 DOMDebuggerAgent.setXHRBreakpoint(url);else
83 DOMDebuggerAgent.removeXHRBreakpoint(url);this._saveBreakpoints();},_labelClicked:function(url)
84 {var element=this._breakpointElements[url];var inputElement=document.createElement("span");inputElement.className="breakpoint-condition editing";inputElement.textContent=url;this.listElement.insertBefore(inputElement,element);element.classList.add("hidden");function finishEditing(accept,e,text)
85 {this._removeListElement(inputElement);if(accept){this._removeBreakpoint(url);this._setBreakpoint(text,element._checkboxElement.checked);this._saveBreakpoints();}else
86 element.classList.remove("hidden");}
87 WebInspector.InplaceEditor.startEditing(inputElement,new WebInspector.InplaceEditor.Config(finishEditing.bind(this,true),finishEditing.bind(this,false)));},highlightBreakpoint:function(url)
88 {var element=this._breakpointElements[url];if(!element)
89 return;this.expand();element.classList.add("breakpoint-hit");this._highlightedElement=element;},clearBreakpointHighlight:function()
90 {if(this._highlightedElement){this._highlightedElement.classList.remove("breakpoint-hit");delete this._highlightedElement;}},_saveBreakpoints:function()
91 {var breakpoints=[];for(var url in this._breakpointElements)
92 breakpoints.push({url:url,enabled:this._breakpointElements[url]._checkboxElement.checked});WebInspector.settings.xhrBreakpoints.set(breakpoints);},_restoreBreakpoints:function()
93 {var breakpoints=WebInspector.settings.xhrBreakpoints.get();for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(breakpoint&&typeof breakpoint.url==="string")
94 this._setBreakpoint(breakpoint.url,breakpoint.enabled);}},__proto__:WebInspector.NativeBreakpointsSidebarPane.prototype}
95 WebInspector.EventListenerBreakpointsSidebarPane=function()
96 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Event Listener Breakpoints"));this.registerRequiredCSS("breakpointsList.css");this.categoriesElement=document.createElement("ol");this.categoriesElement.tabIndex=0;this.categoriesElement.classList.add("properties-tree");this.categoriesElement.classList.add("event-listener-breakpoints");this.categoriesTreeOutline=new TreeOutline(this.categoriesElement);this.bodyElement.appendChild(this.categoriesElement);this._categoryItems=[];this._createCategory(WebInspector.UIString("Animation"),["requestAnimationFrame","cancelAnimationFrame","animationFrameFired"],true);this._createCategory(WebInspector.UIString("Control"),["resize","scroll","zoom","focus","blur","select","change","submit","reset"]);this._createCategory(WebInspector.UIString("Clipboard"),["copy","cut","paste","beforecopy","beforecut","beforepaste"]);this._createCategory(WebInspector.UIString("DOM Mutation"),["DOMActivate","DOMFocusIn","DOMFocusOut","DOMAttrModified","DOMCharacterDataModified","DOMNodeInserted","DOMNodeInsertedIntoDocument","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMSubtreeModified","DOMContentLoaded"]);this._createCategory(WebInspector.UIString("Device"),["deviceorientation","devicemotion"]);this._createCategory(WebInspector.UIString("Drag / drop"),["dragenter","dragover","dragleave","drop"]);this._createCategory(WebInspector.UIString("Keyboard"),["keydown","keyup","keypress","input"]);this._createCategory(WebInspector.UIString("Load"),["load","beforeunload","unload","abort","error","hashchange","popstate"]);this._createCategory(WebInspector.UIString("Mouse"),["click","dblclick","mousedown","mouseup","mouseover","mousemove","mouseout","mousewheel","wheel"]);this._createCategory(WebInspector.UIString("Timer"),["setTimer","clearTimer","timerFired"],true);this._createCategory(WebInspector.UIString("Touch"),["touchstart","touchmove","touchend","touchcancel"]);this._createCategory(WebInspector.UIString("XHR"),["readystatechange","load","loadstart","loadend","abort","error","progress","timeout"],false,["XMLHttpRequest","XMLHttpRequestUpload"]);this._createCategory(WebInspector.UIString("WebGL"),["webglErrorFired","webglWarningFired"],true);this._restoreBreakpoints();}
97 WebInspector.EventListenerBreakpointsSidebarPane.categoryListener="listener:";WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation="instrumentation:";WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny="*";WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI=function(eventName,auxData)
98 {if(!WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI){WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI={"instrumentation:setTimer":WebInspector.UIString("Set Timer"),"instrumentation:clearTimer":WebInspector.UIString("Clear Timer"),"instrumentation:timerFired":WebInspector.UIString("Timer Fired"),"instrumentation:requestAnimationFrame":WebInspector.UIString("Request Animation Frame"),"instrumentation:cancelAnimationFrame":WebInspector.UIString("Cancel Animation Frame"),"instrumentation:animationFrameFired":WebInspector.UIString("Animation Frame Fired"),"instrumentation:webglErrorFired":WebInspector.UIString("WebGL Error Fired"),"instrumentation:webglWarningFired":WebInspector.UIString("WebGL Warning Fired")};}
99 if(auxData){if(eventName==="instrumentation:webglErrorFired"&&auxData["webglErrorName"]){var errorName=auxData["webglErrorName"];errorName=errorName.replace(/^.*(0x[0-9a-f]+).*$/i,"$1");return WebInspector.UIString("WebGL Error Fired (%s)",errorName);}}
100 return WebInspector.EventListenerBreakpointsSidebarPane._eventNamesForUI[eventName]||eventName.substring(eventName.indexOf(":")+1);}
101 WebInspector.EventListenerBreakpointsSidebarPane.prototype={_createCategory:function(name,eventNames,isInstrumentationEvent,targetNames)
102 {var labelNode=document.createElement("label");labelNode.textContent=name;var categoryItem={};categoryItem.element=new TreeElement(labelNode);this.categoriesTreeOutline.appendChild(categoryItem.element);categoryItem.element.listItemElement.classList.add("event-category");categoryItem.element.selectable=true;categoryItem.checkbox=this._createCheckbox(labelNode);categoryItem.checkbox.addEventListener("click",this._categoryCheckboxClicked.bind(this,categoryItem),true);categoryItem.targetNames=this._stringArrayToLowerCase(targetNames||[WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny]);categoryItem.children={};var category=(isInstrumentationEvent?WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation:WebInspector.EventListenerBreakpointsSidebarPane.categoryListener);for(var i=0;i<eventNames.length;++i){var eventName=category+eventNames[i];var breakpointItem={};var title=WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName);labelNode=document.createElement("label");labelNode.textContent=title;breakpointItem.element=new TreeElement(labelNode);categoryItem.element.appendChild(breakpointItem.element);breakpointItem.element.listItemElement.createChild("div","breakpoint-hit-marker");breakpointItem.element.listItemElement.classList.add("source-code");breakpointItem.element.selectable=false;breakpointItem.checkbox=this._createCheckbox(labelNode);breakpointItem.checkbox.addEventListener("click",this._breakpointCheckboxClicked.bind(this,eventName,categoryItem.targetNames),true);breakpointItem.parent=categoryItem;categoryItem.children[eventName]=breakpointItem;}
103 this._categoryItems.push(categoryItem);},_stringArrayToLowerCase:function(array)
104 {return array.map(function(value){return value.toLowerCase();});},_createCheckbox:function(labelNode)
105 {var checkbox=document.createElement("input");checkbox.className="checkbox-elem";checkbox.type="checkbox";labelNode.insertBefore(checkbox,labelNode.firstChild);return checkbox;},_categoryCheckboxClicked:function(categoryItem)
106 {var checked=categoryItem.checkbox.checked;for(var eventName in categoryItem.children){var breakpointItem=categoryItem.children[eventName];if(breakpointItem.checkbox.checked===checked)
107 continue;if(checked)
108 this._setBreakpoint(eventName,categoryItem.targetNames);else
109 this._removeBreakpoint(eventName,categoryItem.targetNames);}
110 this._saveBreakpoints();},_breakpointCheckboxClicked:function(eventName,targetNames,event)
111 {if(event.target.checked)
112 this._setBreakpoint(eventName,targetNames);else
113 this._removeBreakpoint(eventName,targetNames);this._saveBreakpoints();},_setBreakpoint:function(eventName,targetNames)
114 {targetNames=targetNames||[WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny];for(var i=0;i<targetNames.length;++i){var targetName=targetNames[i];var breakpointItem=this._findBreakpointItem(eventName,targetName);if(!breakpointItem)
115 continue;breakpointItem.checkbox.checked=true;breakpointItem.parent.dirtyCheckbox=true;if(eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener))
116 DOMDebuggerAgent.setEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length),targetName);else if(eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation))
117 DOMDebuggerAgent.setInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.length));}
118 this._updateCategoryCheckboxes();},_removeBreakpoint:function(eventName,targetNames)
119 {targetNames=targetNames||[WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny];for(var i=0;i<targetNames.length;++i){var targetName=targetNames[i];var breakpointItem=this._findBreakpointItem(eventName,targetName);if(!breakpointItem)
120 continue;breakpointItem.checkbox.checked=false;breakpointItem.parent.dirtyCheckbox=true;if(eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener))
121 DOMDebuggerAgent.removeEventListenerBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryListener.length),targetName);else if(eventName.startsWith(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation))
122 DOMDebuggerAgent.removeInstrumentationBreakpoint(eventName.substring(WebInspector.EventListenerBreakpointsSidebarPane.categoryInstrumentation.length));}
123 this._updateCategoryCheckboxes();},_updateCategoryCheckboxes:function()
124 {for(var i=0;i<this._categoryItems.length;++i){var categoryItem=this._categoryItems[i];if(!categoryItem.dirtyCheckbox)
125 continue;categoryItem.dirtyCheckbox=false;var hasEnabled=false;var hasDisabled=false;for(var eventName in categoryItem.children){var breakpointItem=categoryItem.children[eventName];if(breakpointItem.checkbox.checked)
126 hasEnabled=true;else
127 hasDisabled=true;}
128 categoryItem.checkbox.checked=hasEnabled;categoryItem.checkbox.indeterminate=hasEnabled&&hasDisabled;}},_findBreakpointItem:function(eventName,targetName)
129 {targetName=(targetName||WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny).toLowerCase();for(var i=0;i<this._categoryItems.length;++i){var categoryItem=this._categoryItems[i];if(categoryItem.targetNames.indexOf(targetName)===-1)
130 continue;var breakpointItem=categoryItem.children[eventName];if(breakpointItem)
131 return breakpointItem;}
132 return null;},highlightBreakpoint:function(eventName,targetName)
133 {var breakpointItem=this._findBreakpointItem(eventName,targetName);if(!breakpointItem||!breakpointItem.checkbox.checked)
134 breakpointItem=this._findBreakpointItem(eventName,WebInspector.EventListenerBreakpointsSidebarPane.eventTargetAny);if(!breakpointItem)
135 return;this.expand();breakpointItem.parent.element.expand();breakpointItem.element.listItemElement.classList.add("breakpoint-hit");this._highlightedElement=breakpointItem.element.listItemElement;},clearBreakpointHighlight:function()
136 {if(this._highlightedElement){this._highlightedElement.classList.remove("breakpoint-hit");delete this._highlightedElement;}},_saveBreakpoints:function()
137 {var breakpoints=[];for(var i=0;i<this._categoryItems.length;++i){var categoryItem=this._categoryItems[i];for(var eventName in categoryItem.children){var breakpointItem=categoryItem.children[eventName];if(breakpointItem.checkbox.checked)
138 breakpoints.push({eventName:eventName,targetNames:categoryItem.targetNames});}}
139 WebInspector.settings.eventListenerBreakpoints.set(breakpoints);},_restoreBreakpoints:function()
140 {var breakpoints=WebInspector.settings.eventListenerBreakpoints.get();for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(breakpoint&&typeof breakpoint.eventName==="string")
141 this._setBreakpoint(breakpoint.eventName,breakpoint.targetNames);}},__proto__:WebInspector.SidebarPane.prototype};WebInspector.CallStackSidebarPane=function()
142 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Call Stack"));this.bodyElement.addEventListener("keydown",this._keyDown.bind(this),true);this.bodyElement.tabIndex=0;var asyncCheckbox=this.titleElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Async"),WebInspector.settings.enableAsyncStackTraces,true,undefined,WebInspector.UIString("Capture async stack traces")));asyncCheckbox.classList.add("scripts-callstack-async");asyncCheckbox.addEventListener("click",consumeEvent,false);WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncStackTracesStateChanged,this);}
143 WebInspector.CallStackSidebarPane.Events={CallFrameRestarted:"CallFrameRestarted",CallFrameSelected:"CallFrameSelected"}
144 WebInspector.CallStackSidebarPane.prototype={update:function(details)
145 {this.bodyElement.removeChildren();if(!details){var infoElement=this.bodyElement.createChild("div","info");infoElement.textContent=WebInspector.UIString("Not Paused");return;}
146 this._target=details.target();var callFrames=details.callFrames;var asyncStackTrace=details.asyncStackTrace;delete this._statusMessageElement;delete this._hiddenPlacardsMessageElement;this.placards=[];this._hiddenPlacards=0;this._appendSidebarPlacards(callFrames);var topStackHidden=(this._hiddenPlacards===this.placards.length);while(asyncStackTrace){var title=asyncStackTrace.description;if(title)
147 title+=" "+WebInspector.UIString("(async)");else
148 title=WebInspector.UIString("Async Call");var asyncPlacard=new WebInspector.Placard(title,"");asyncPlacard.element.addEventListener("click",this._selectNextVisiblePlacard.bind(this,this.placards.length,false),false);asyncPlacard.element.addEventListener("contextmenu",this._asyncPlacardContextMenu.bind(this,this.placards.length),true);asyncPlacard.element.classList.add("placard-label");this.bodyElement.appendChild(asyncPlacard.element);this._appendSidebarPlacards(asyncStackTrace.callFrames,asyncPlacard);asyncStackTrace=asyncStackTrace.asyncStackTrace;}
149 if(topStackHidden)
150 this._revealHiddenPlacards();if(this._hiddenPlacards){var element=document.createElementWithClass("div","hidden-placards-message");if(this._hiddenPlacards===1)
151 element.textContent=WebInspector.UIString("1 stack frame is hidden (black-boxed).");else
152 element.textContent=WebInspector.UIString("%d stack frames are hidden (black-boxed).",this._hiddenPlacards);element.createTextChild(" ");var showAllLink=element.createChild("span","node-link");showAllLink.textContent=WebInspector.UIString("Show");showAllLink.addEventListener("click",this._revealHiddenPlacards.bind(this),false);this.bodyElement.insertBefore(element,this.bodyElement.firstChild);this._hiddenPlacardsMessageElement=element;}},_appendSidebarPlacards:function(callFrames,asyncPlacard)
153 {var allPlacardsHidden=true;for(var i=0,n=callFrames.length;i<n;++i){var callFrame=callFrames[i];var placard=new WebInspector.CallStackSidebarPane.Placard(callFrame,asyncPlacard);placard.element.addEventListener("click",this._placardSelected.bind(this,placard),false);placard.element.addEventListener("contextmenu",this._placardContextMenu.bind(this,placard),true);this.placards.push(placard);this.bodyElement.appendChild(placard.element);if(callFrame.script.isFramework()){placard.setHidden(true);placard.element.classList.add("dimmed");++this._hiddenPlacards;}else{allPlacardsHidden=false;}}
154 if(allPlacardsHidden&&asyncPlacard)
155 asyncPlacard.setHidden(true);},_revealHiddenPlacards:function()
156 {if(!this._hiddenPlacards)
157 return;this._hiddenPlacards=0;for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];placard.setHidden(false);if(placard._asyncPlacard)
158 placard._asyncPlacard.setHidden(false);}
159 if(this._hiddenPlacardsMessageElement){this._hiddenPlacardsMessageElement.remove();delete this._hiddenPlacardsMessageElement;}},_placardContextMenu:function(placard,event)
160 {var contextMenu=new WebInspector.ContextMenu(event);if(!placard._callFrame.isAsync())
161 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Restart frame":"Restart Frame"),this._restartFrame.bind(this,placard));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy stack trace":"Copy Stack Trace"),this._copyStackTrace.bind(this));contextMenu.show();},_asyncPlacardContextMenu:function(index,event)
162 {for(;index<this.placards.length;++index){var placard=this.placards[index];if(!placard.isHidden()){this._placardContextMenu(placard,event);break;}}},_restartFrame:function(placard)
163 {placard._callFrame.restart();this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.CallFrameRestarted,placard._callFrame);},_asyncStackTracesStateChanged:function()
164 {var enabled=WebInspector.settings.enableAsyncStackTraces.get();if(!enabled&&this.placards)
165 this._removeAsyncPlacards();},_removeAsyncPlacards:function()
166 {var shouldSelectTopFrame=false;var lastSyncPlacardIndex=-1;for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];if(placard._asyncPlacard){if(placard.selected)
167 shouldSelectTopFrame=true;placard._asyncPlacard.element.remove();placard.element.remove();}else{lastSyncPlacardIndex=i;}}
168 this.placards.length=lastSyncPlacardIndex+1;if(shouldSelectTopFrame)
169 this._selectNextVisiblePlacard(0);},setSelectedCallFrame:function(x)
170 {for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];placard.selected=(placard._callFrame===x);if(placard.selected&&placard.isHidden())
171 this._revealHiddenPlacards();}},_selectNextCallFrameOnStack:function()
172 {var index=this._selectedCallFrameIndex();if(index===-1)
173 return false;return this._selectNextVisiblePlacard(index+1);},_selectPreviousCallFrameOnStack:function()
174 {var index=this._selectedCallFrameIndex();if(index===-1)
175 return false;return this._selectNextVisiblePlacard(index-1,true);},_selectNextVisiblePlacard:function(index,backward)
176 {while(0<=index&&index<this.placards.length){var placard=this.placards[index];if(!placard.isHidden()){this._placardSelected(placard);return true;}
177 index+=backward?-1:1;}
178 return false;},_selectedCallFrameIndex:function()
179 {var selectedCallFrame=this._target.debuggerModel.selectedCallFrame();if(!selectedCallFrame)
180 return-1;for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];if(placard._callFrame===selectedCallFrame)
181 return i;}
182 return-1;},_placardSelected:function(placard)
183 {placard.element.scrollIntoViewIfNeeded();this.dispatchEventToListeners(WebInspector.CallStackSidebarPane.Events.CallFrameSelected,placard._callFrame);},_copyStackTrace:function()
184 {var text="";var lastPlacard=null;for(var i=0;i<this.placards.length;++i){var placard=this.placards[i];if(placard.isHidden())
185 continue;if(lastPlacard&&placard._asyncPlacard!==lastPlacard._asyncPlacard)
186 text+=placard._asyncPlacard.title+"\n";text+=placard.title+" ("+placard.subtitle+")\n";lastPlacard=placard;}
187 InspectorFrontendHost.copyText(text);},registerShortcuts:function(registerShortcutDelegate)
188 {registerShortcutDelegate(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame,this._selectNextCallFrameOnStack.bind(this));registerShortcutDelegate(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame,this._selectPreviousCallFrameOnStack.bind(this));},setStatus:function(status)
189 {if(!this._statusMessageElement)
190 this._statusMessageElement=this.bodyElement.createChild("div","info");if(typeof status==="string"){this._statusMessageElement.textContent=status;}else{this._statusMessageElement.removeChildren();this._statusMessageElement.appendChild(status);}},_keyDown:function(event)
191 {if(event.altKey||event.shiftKey||event.metaKey||event.ctrlKey)
192 return;if(event.keyIdentifier==="Up"&&this._selectPreviousCallFrameOnStack()||event.keyIdentifier==="Down"&&this._selectNextCallFrameOnStack())
193 event.consume(true);},__proto__:WebInspector.SidebarPane.prototype}
194 WebInspector.CallStackSidebarPane.Placard=function(callFrame,asyncPlacard)
195 {WebInspector.Placard.call(this,callFrame.functionName||WebInspector.UIString("(anonymous function)"),"");callFrame.createLiveLocation(this._update.bind(this));this._callFrame=callFrame;this._asyncPlacard=asyncPlacard;}
196 WebInspector.CallStackSidebarPane.Placard.prototype={_update:function(uiLocation)
197 {this.subtitle=uiLocation.linkText().trimMiddle(100);},__proto__:WebInspector.Placard.prototype};WebInspector.HistoryEntry=function(){}
198 WebInspector.HistoryEntry.prototype={valid:function(){},reveal:function(){}};WebInspector.SimpleHistoryManager=function(historyDepth)
199 {this._entries=[];this._activeEntryIndex=-1;this._coalescingReadonly=0;this._historyDepth=historyDepth;}
200 WebInspector.SimpleHistoryManager.prototype={readOnlyLock:function()
201 {++this._coalescingReadonly;},releaseReadOnlyLock:function()
202 {--this._coalescingReadonly;},readOnly:function()
203 {return!!this._coalescingReadonly;},filterOut:function(filterOutCallback)
204 {if(this.readOnly())
205 return;var filteredEntries=[];var removedBeforeActiveEntry=0;for(var i=0;i<this._entries.length;++i){if(!filterOutCallback(this._entries[i])){filteredEntries.push(this._entries[i]);}else if(i<=this._activeEntryIndex)
206 ++removedBeforeActiveEntry;}
207 this._entries=filteredEntries;this._activeEntryIndex=Math.max(0,this._activeEntryIndex-removedBeforeActiveEntry);},empty:function()
208 {return!this._entries.length;},active:function()
209 {return this.empty()?null:this._entries[this._activeEntryIndex];},push:function(entry)
210 {if(this.readOnly())
211 return;if(!this.empty())
212 this._entries.splice(this._activeEntryIndex+1);this._entries.push(entry);if(this._entries.length>this._historyDepth)
213 this._entries.shift();this._activeEntryIndex=this._entries.length-1;},rollback:function()
214 {if(this.empty())
215 return false;var revealIndex=this._activeEntryIndex-1;while(revealIndex>=0&&!this._entries[revealIndex].valid())
216 --revealIndex;if(revealIndex<0)
217 return false;this.readOnlyLock();this._entries[revealIndex].reveal();this.releaseReadOnlyLock();this._activeEntryIndex=revealIndex;return true;},rollover:function()
218 {var revealIndex=this._activeEntryIndex+1;while(revealIndex<this._entries.length&&!this._entries[revealIndex].valid())
219 ++revealIndex;if(revealIndex>=this._entries.length)
220 return false;this.readOnlyLock();this._entries[revealIndex].reveal();this.releaseReadOnlyLock();this._activeEntryIndex=revealIndex;return true;},};;WebInspector.EditingLocationHistoryManager=function(sourcesView,currentSourceFrameCallback)
221 {this._sourcesView=sourcesView;this._historyManager=new WebInspector.SimpleHistoryManager(WebInspector.EditingLocationHistoryManager.HistoryDepth);this._currentSourceFrameCallback=currentSourceFrameCallback;}
222 WebInspector.EditingLocationHistoryManager.HistoryDepth=20;WebInspector.EditingLocationHistoryManager.prototype={trackSourceFrameCursorJumps:function(sourceFrame)
223 {sourceFrame.addEventListener(WebInspector.SourceFrame.Events.JumpHappened,this._onJumpHappened.bind(this));},_onJumpHappened:function(event)
224 {if(event.data.from)
225 this._updateActiveState(event.data.from);if(event.data.to)
226 this._pushActiveState(event.data.to);},rollback:function()
227 {this._historyManager.rollback();},rollover:function()
228 {this._historyManager.rollover();},updateCurrentState:function()
229 {var sourceFrame=this._currentSourceFrameCallback();if(!sourceFrame)
230 return;this._updateActiveState(sourceFrame.textEditor.selection());},pushNewState:function()
231 {var sourceFrame=this._currentSourceFrameCallback();if(!sourceFrame)
232 return;this._pushActiveState(sourceFrame.textEditor.selection());},_updateActiveState:function(selection)
233 {var active=this._historyManager.active();if(!active)
234 return;var sourceFrame=this._currentSourceFrameCallback();if(!sourceFrame)
235 return;var entry=new WebInspector.EditingLocationHistoryEntry(this._sourcesView,this,sourceFrame,selection);active.merge(entry);},_pushActiveState:function(selection)
236 {var sourceFrame=this._currentSourceFrameCallback();if(!sourceFrame)
237 return;var entry=new WebInspector.EditingLocationHistoryEntry(this._sourcesView,this,sourceFrame,selection);this._historyManager.push(entry);},removeHistoryForSourceCode:function(uiSourceCode)
238 {function filterOut(entry)
239 {return entry._projectId===uiSourceCode.project().id()&&entry._path===uiSourceCode.path();}
240 this._historyManager.filterOut(filterOut);},}
241 WebInspector.EditingLocationHistoryEntry=function(sourcesView,editingLocationManager,sourceFrame,selection)
242 {this._sourcesView=sourcesView;this._editingLocationManager=editingLocationManager;var uiSourceCode=sourceFrame.uiSourceCode();this._projectId=uiSourceCode.project().id();this._path=uiSourceCode.path();var position=this._positionFromSelection(selection);this._positionHandle=sourceFrame.textEditor.textEditorPositionHandle(position.lineNumber,position.columnNumber);}
243 WebInspector.EditingLocationHistoryEntry.prototype={merge:function(entry)
244 {if(this._projectId!==entry._projectId||this._path!==entry._path)
245 return;this._positionHandle=entry._positionHandle;},_positionFromSelection:function(selection)
246 {return{lineNumber:selection.endLine,columnNumber:selection.endColumn};},valid:function()
247 {var position=this._positionHandle.resolve();var uiSourceCode=WebInspector.workspace.project(this._projectId).uiSourceCode(this._path);return!!(position&&uiSourceCode);},reveal:function()
248 {var position=this._positionHandle.resolve();var uiSourceCode=WebInspector.workspace.project(this._projectId).uiSourceCode(this._path);if(!position||!uiSourceCode)
249 return;this._editingLocationManager.updateCurrentState();this._sourcesView.showSourceLocation(uiSourceCode,position.lineNumber,position.columnNumber);}};;WebInspector.FilePathScoreFunction=function(query)
250 {this._query=query;this._queryUpperCase=query.toUpperCase();this._score=null;this._sequence=null;this._dataUpperCase="";this._fileNameIndex=0;}
251 WebInspector.FilePathScoreFunction.filterRegex=function(query)
252 {const toEscape=String.regexSpecialCharacters();var regexString="";for(var i=0;i<query.length;++i){var c=query.charAt(i);if(toEscape.indexOf(c)!==-1)
253 c="\\"+c;if(i)
254 regexString+="[^"+c+"]*";regexString+=c;}
255 return new RegExp(regexString,"i");}
256 WebInspector.FilePathScoreFunction.prototype={score:function(data,matchIndexes)
257 {if(!data||!this._query)
258 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);}
259 var score=this._score;var sequence=(this._sequence);this._dataUpperCase=data.toUpperCase();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(pickCharScore&&prevCharScore+pickCharScore>skipCharScore){sequence[i*m+j]=consecutiveMatch+1;score[i*m+j]=(prevCharScore+pickCharScore);}else{sequence[i*m+j]=0;score[i*m+j]=skipCharScore;}}}
260 if(matchIndexes)
261 this._restoreMatchIndexes(sequence,n,m,matchIndexes);return score[n*m-1];},_testWordStart:function(data,j)
262 {var prevChar=data.charAt(j-1);return j===0||prevChar==="_"||prevChar==="-"||prevChar==="/"||(data[j-1]!==this._dataUpperCase[j-1]&&data[j]===this._dataUpperCase[j]);},_restoreMatchIndexes:function(sequence,n,m,out)
263 {var i=n-1,j=m-1;while(i>=0&&j>=0){switch(sequence[i*m+j]){case 0:--j;break;default:out.push(j);--i;--j;break;}}
264 out.reverse();},_singleCharScore:function(query,data,i,j)
265 {var isWordStart=this._testWordStart(data,j);var isFileName=j>this._fileNameIndex;var isPathTokenStart=j===0||data[j-1]==="/";var isCapsMatch=query[i]===data[j]&&query[i]==this._queryUpperCase[i];var score=10;if(isPathTokenStart)
266 score+=4;if(isWordStart)
267 score+=2;if(isCapsMatch)
268 score+=6;if(isFileName)
269 score+=4;if(j===this._fileNameIndex+1&&i===0)
270 score+=5;if(isFileName&&isWordStart)
271 score+=3;return score;},_sequenceCharScore:function(query,data,i,j,sequenceLength)
272 {var isFileName=j>this._fileNameIndex;var isPathTokenStart=j===0||data[j-1]==="/";var score=10;if(isFileName)
273 score+=4;if(isPathTokenStart)
274 score+=5;score+=sequenceLength*4;return score;},_match:function(query,data,i,j,consecutiveMatch)
275 {if(this._queryUpperCase[i]!==this._dataUpperCase[j])
276 return 0;if(!consecutiveMatch)
277 return this._singleCharScore(query,data,i,j);else
278 return this._sequenceCharScore(query,data,i,j-consecutiveMatch,consecutiveMatch);},};WebInspector.FilteredItemSelectionDialog=function(delegate)
279 {WebInspector.DialogDelegate.call(this);if(!WebInspector.FilteredItemSelectionDialog._stylesLoaded){WebInspector.View.createStyleElement("filteredItemSelectionDialog.css");WebInspector.FilteredItemSelectionDialog._stylesLoaded=true;}
280 this.element=document.createElement("div");this.element.className="filtered-item-list-dialog";this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._promptElement=this.element.createChild("input","monospace");this._promptElement.addEventListener("input",this._onInput.bind(this),false);this._promptElement.type="text";this._promptElement.setAttribute("spellcheck","false");this._filteredItems=[];this._viewportControl=new WebInspector.ViewportControl(this);this._viewportControl.element.classList.add("fill");this._itemElementsContainer=this._viewportControl.element;this._itemElementsContainer.classList.add("container");this._itemElementsContainer.classList.add("monospace");this._itemElementsContainer.addEventListener("click",this._onClick.bind(this),false);this.element.appendChild(this._itemElementsContainer);this._delegate=delegate;this._delegate.setRefreshCallback(this._itemsLoaded.bind(this));this._itemsLoaded();}
281 WebInspector.FilteredItemSelectionDialog.prototype={position:function(element,relativeToElement)
282 {const shadow=10;const shadowPadding=20;var container=WebInspector.Dialog.modalHostView().element;var preferredWidth=Math.max(relativeToElement.offsetWidth*2/3,500);var width=Math.min(preferredWidth,container.offsetWidth-2*shadowPadding);var preferredHeight=Math.max(relativeToElement.offsetHeight*2/3,204);var height=Math.min(preferredHeight,container.offsetHeight-2*shadowPadding);this.element.style.width=width+"px";var box=relativeToElement.boxInWindow(window).relativeToElement(container);var positionX=box.x+Math.max((box.width-width-2*shadowPadding)/2,shadow);positionX=Math.max(shadow,Math.min(container.offsetWidth-width-2*shadowPadding,positionX));var positionY=box.y+Math.max((box.height-height-2*shadowPadding)/2,shadow);positionY=Math.max(shadow,Math.min(container.offsetHeight-height-2*shadowPadding,positionY));element.positionAt(positionX,positionY,container);this._dialogHeight=height;this._updateShowMatchingItems();},focus:function()
283 {WebInspector.setCurrentFocusElement(this._promptElement);if(this._filteredItems.length&&this._viewportControl.lastVisibleIndex()===-1)
284 this._viewportControl.refresh();},willHide:function()
285 {if(this._isHiding)
286 return;this._isHiding=true;this._delegate.dispose();if(this._filterTimer)
287 clearTimeout(this._filterTimer);},renderAsTwoRows:function()
288 {this._renderAsTwoRows=true;},onEnter:function()
289 {if(!this._delegate.itemCount())
290 return;var selectedIndex=this._shouldShowMatchingItems()&&this._selectedIndexInFiltered<this._filteredItems.length?this._filteredItems[this._selectedIndexInFiltered]:null;this._delegate.selectItem(selectedIndex,this._promptElement.value.trim());},_itemsLoaded:function()
291 {if(this._loadTimeout)
292 return;this._loadTimeout=setTimeout(this._updateAfterItemsLoaded.bind(this),0);},_updateAfterItemsLoaded:function()
293 {delete this._loadTimeout;this._filterItems();},_createItemElement:function(index)
294 {var itemElement=document.createElement("div");itemElement.className="filtered-item-list-dialog-item "+(this._renderAsTwoRows?"two-rows":"one-row");itemElement._titleElement=itemElement.createChild("div","filtered-item-list-dialog-title");itemElement._subtitleElement=itemElement.createChild("div","filtered-item-list-dialog-subtitle");itemElement._subtitleElement.textContent="\u200B";itemElement._index=index;this._delegate.renderItem(index,this._promptElement.value.trim(),itemElement._titleElement,itemElement._subtitleElement);return itemElement;},setQuery:function(query)
295 {this._promptElement.value=query;this._scheduleFilter();},_filterItems:function()
296 {delete this._filterTimer;if(this._scoringTimer){clearTimeout(this._scoringTimer);delete this._scoringTimer;}
297 var query=this._delegate.rewriteQuery(this._promptElement.value.trim());this._query=query;var queryLength=query.length;var filterRegex=query?WebInspector.FilePathScoreFunction.filterRegex(query):null;var oldSelectedAbsoluteIndex=this._selectedIndexInFiltered?this._filteredItems[this._selectedIndexInFiltered]:null;var filteredItems=[];this._selectedIndexInFiltered=0;var bestScores=[];var bestItems=[];var bestItemsToCollect=100;var minBestScore=0;var overflowItems=[];scoreItems.call(this,0);function compareIntegers(a,b)
298 {return b-a;}
299 function scoreItems(fromIndex)
300 {var maxWorkItems=1000;var workDone=0;for(var i=fromIndex;i<this._delegate.itemCount()&&workDone<maxWorkItems;++i){if(filterRegex&&!filterRegex.test(this._delegate.itemKeyAt(i)))
301 continue;var score=this._delegate.itemScoreAt(i,query);if(query)
302 workDone++;if(score>minBestScore||bestScores.length<bestItemsToCollect){var index=insertionIndexForObjectInListSortedByFunction(score,bestScores,compareIntegers,true);bestScores.splice(index,0,score);bestItems.splice(index,0,i);if(bestScores.length>bestItemsToCollect){overflowItems.push(bestItems.peekLast());bestScores.length=bestItemsToCollect;bestItems.length=bestItemsToCollect;}
303 minBestScore=bestScores.peekLast();}else
304 filteredItems.push(i);}
305 if(i<this._delegate.itemCount()){this._scoringTimer=setTimeout(scoreItems.bind(this,i),0);return;}
306 delete this._scoringTimer;this._filteredItems=bestItems.concat(overflowItems).concat(filteredItems);for(var i=0;i<this._filteredItems.length;++i){if(this._filteredItems[i]===oldSelectedAbsoluteIndex){this._selectedIndexInFiltered=i;break;}}
307 this._viewportControl.invalidate();if(!query)
308 this._selectedIndexInFiltered=0;this._updateSelection(this._selectedIndexInFiltered,false);}},_shouldShowMatchingItems:function()
309 {return this._delegate.shouldShowMatchingItems(this._promptElement.value);},_onInput:function(event)
310 {this._updateShowMatchingItems();this._scheduleFilter();},_updateShowMatchingItems:function()
311 {var shouldShowMatchingItems=this._shouldShowMatchingItems();this._itemElementsContainer.classList.toggle("hidden",!shouldShowMatchingItems);this.element.style.height=shouldShowMatchingItems?this._dialogHeight+"px":"auto";},_rowsPerViewport:function()
312 {return Math.floor(this._viewportControl.element.clientHeight/this._rowHeight);},_onKeyDown:function(event)
313 {var newSelectedIndex=this._selectedIndexInFiltered;switch(event.keyCode){case WebInspector.KeyboardShortcut.Keys.Down.code:if(++newSelectedIndex>=this._filteredItems.length)
314 newSelectedIndex=this._filteredItems.length-1;this._updateSelection(newSelectedIndex,true);event.consume(true);break;case WebInspector.KeyboardShortcut.Keys.Up.code:if(--newSelectedIndex<0)
315 newSelectedIndex=0;this._updateSelection(newSelectedIndex,false);event.consume(true);break;case WebInspector.KeyboardShortcut.Keys.PageDown.code:newSelectedIndex=Math.min(newSelectedIndex+this._rowsPerViewport(),this._filteredItems.length-1);this._updateSelection(newSelectedIndex,true);event.consume(true);break;case WebInspector.KeyboardShortcut.Keys.PageUp.code:newSelectedIndex=Math.max(newSelectedIndex-this._rowsPerViewport(),0);this._updateSelection(newSelectedIndex,false);event.consume(true);break;default:}},_scheduleFilter:function()
316 {if(this._filterTimer)
317 return;this._filterTimer=setTimeout(this._filterItems.bind(this),0);},_updateSelection:function(index,makeLast)
318 {var element=this._viewportControl.renderedElementAt(this._selectedIndexInFiltered);if(element)
319 element.classList.remove("selected");this._viewportControl.scrollItemIntoView(index,makeLast);this._selectedIndexInFiltered=index;element=this._viewportControl.renderedElementAt(index);if(element)
320 element.classList.add("selected");},_onClick:function(event)
321 {var itemElement=event.target.enclosingNodeOrSelfWithClass("filtered-item-list-dialog-item");if(!itemElement)
322 return;this._delegate.selectItem(itemElement._index,this._promptElement.value.trim());WebInspector.Dialog.hide();},itemCount:function()
323 {return this._filteredItems.length;},fastHeight:function(index)
324 {if(!this._rowHeight){var delegateIndex=this._filteredItems[index];var element=this._createItemElement(delegateIndex);this._rowHeight=element.measurePreferredSize(this._viewportControl.contentElement()).height;}
325 return this._rowHeight;},itemElement:function(index)
326 {var delegateIndex=this._filteredItems[index];var element=this._createItemElement(delegateIndex);if(index===this._selectedIndexInFiltered)
327 element.classList.add("selected");return new WebInspector.StaticViewportElement(element);},minimumRowHeight:function()
328 {return this.fastHeight(0);},__proto__:WebInspector.DialogDelegate.prototype}
329 WebInspector.SelectionDialogContentProvider=function()
330 {}
331 WebInspector.SelectionDialogContentProvider.prototype={setRefreshCallback:function(refreshCallback)
332 {this._refreshCallback=refreshCallback;},shouldShowMatchingItems:function(query)
333 {return true;},itemCount:function()
334 {return 0;},itemKeyAt:function(itemIndex)
335 {return"";},itemScoreAt:function(itemIndex,query)
336 {return 1;},renderItem:function(itemIndex,query,titleElement,subtitleElement)
337 {},highlightRanges:function(element,query)
338 {if(!query)
339 return false;function rangesForMatch(text,query)
340 {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")
341 ranges.push(new WebInspector.SourceRange(opcode[3],opcode[4]-opcode[3]));else if(opcode[0]!=="insert")
342 return null;}
343 return ranges;}
344 var text=element.textContent;var ranges=rangesForMatch(text,query);if(!ranges)
345 ranges=rangesForMatch(text.toUpperCase(),query.toUpperCase());if(ranges){WebInspector.highlightRangesWithStyleClass(element,ranges,"highlight");return true;}
346 return false;},selectItem:function(itemIndex,promptValue)
347 {},refresh:function()
348 {this._refreshCallback();},rewriteQuery:function(query)
349 {return query;},dispose:function()
350 {}}
351 WebInspector.JavaScriptOutlineDialog=function(uiSourceCode,selectItemCallback)
352 {WebInspector.SelectionDialogContentProvider.call(this);this._functionItems=[];this._selectItemCallback=selectItemCallback;this._outlineWorker=new Worker("script_formatter_worker/ScriptFormatterWorker.js");this._outlineWorker.onmessage=this._didBuildOutlineChunk.bind(this);this._outlineWorker.postMessage({method:"javaScriptOutline",params:{content:uiSourceCode.workingCopy()}});}
353 WebInspector.JavaScriptOutlineDialog.show=function(view,uiSourceCode,selectItemCallback)
354 {if(WebInspector.Dialog.currentInstance())
355 return;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDialog(new WebInspector.JavaScriptOutlineDialog(uiSourceCode,selectItemCallback));WebInspector.Dialog.show(view.element,filteredItemSelectionDialog);}
356 WebInspector.JavaScriptOutlineDialog.prototype={_didBuildOutlineChunk:function(event)
357 {var data=(event.data);var chunk=data.chunk;for(var i=0;i<chunk.length;++i)
358 this._functionItems.push(chunk[i]);if(data.total===data.index+1)
359 this.dispose();this.refresh();},itemCount:function()
360 {return this._functionItems.length;},itemKeyAt:function(itemIndex)
361 {return this._functionItems[itemIndex].name;},itemScoreAt:function(itemIndex,query)
362 {var item=this._functionItems[itemIndex];return-item.line;},renderItem:function(itemIndex,query,titleElement,subtitleElement)
363 {var item=this._functionItems[itemIndex];titleElement.textContent=item.name+(item.arguments?item.arguments:"");this.highlightRanges(titleElement,query);subtitleElement.textContent=":"+(item.line+1);},selectItem:function(itemIndex,promptValue)
364 {if(itemIndex===null)
365 return;var lineNumber=this._functionItems[itemIndex].line;if(!isNaN(lineNumber)&&lineNumber>=0)
366 this._selectItemCallback(lineNumber,this._functionItems[itemIndex].column);},dispose:function()
367 {if(this._outlineWorker){this._outlineWorker.terminate();delete this._outlineWorker;}},__proto__:WebInspector.SelectionDialogContentProvider.prototype}
368 WebInspector.SelectUISourceCodeDialog=function(defaultScores)
369 {WebInspector.SelectionDialogContentProvider.call(this);this._populate();this._defaultScores=defaultScores;this._scorer=new WebInspector.FilePathScoreFunction("");WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);}
370 WebInspector.SelectUISourceCodeDialog.prototype={_projectRemoved:function(event)
371 {var project=(event.data);this._populate(project);this.refresh();},_populate:function(skipProject)
372 {this._uiSourceCodes=[];var projects=WebInspector.workspace.projects().filter(this.filterProject.bind(this));for(var i=0;i<projects.length;++i){if(skipProject&&projects[i]===skipProject)
373 continue;this._uiSourceCodes=this._uiSourceCodes.concat(projects[i].uiSourceCodes());}},uiSourceCodeSelected:function(uiSourceCode,lineNumber,columnNumber)
374 {},filterProject:function(project)
375 {return true;},itemCount:function()
376 {return this._uiSourceCodes.length;},itemKeyAt:function(itemIndex)
377 {return this._uiSourceCodes[itemIndex].fullDisplayName();},itemScoreAt:function(itemIndex,query)
378 {var uiSourceCode=this._uiSourceCodes[itemIndex];var score=this._defaultScores?(this._defaultScores.get(uiSourceCode)||0):0;if(!query||query.length<2)
379 return score;if(this._query!==query){this._query=query;this._scorer=new WebInspector.FilePathScoreFunction(query);}
380 var path=uiSourceCode.fullDisplayName();return score+10*this._scorer.score(path,null);},renderItem:function(itemIndex,query,titleElement,subtitleElement)
381 {query=this.rewriteQuery(query);var uiSourceCode=this._uiSourceCodes[itemIndex];titleElement.textContent=uiSourceCode.displayName()+(this._queryLineNumberAndColumnNumber||"");subtitleElement.textContent=uiSourceCode.fullDisplayName().trimEnd(100);var indexes=[];var score=new WebInspector.FilePathScoreFunction(query).score(subtitleElement.textContent,indexes);var fileNameIndex=subtitleElement.textContent.lastIndexOf("/");var ranges=[];for(var i=0;i<indexes.length;++i)
382 ranges.push({offset:indexes[i],length:1});if(indexes[0]>fileNameIndex){for(var i=0;i<ranges.length;++i)
383 ranges[i].offset-=fileNameIndex+1;return WebInspector.highlightRangesWithStyleClass(titleElement,ranges,"highlight");}else{return WebInspector.highlightRangesWithStyleClass(subtitleElement,ranges,"highlight");}},selectItem:function(itemIndex,promptValue)
384 {var parsedExpression=promptValue.trim().match(/^([^:]*)(:\d+)?(:\d+)?$/);if(!parsedExpression)
385 return;var lineNumber;var columnNumber;if(parsedExpression[2])
386 lineNumber=parseInt(parsedExpression[2].substr(1),10)-1;if(parsedExpression[3])
387 columnNumber=parseInt(parsedExpression[3].substr(1),10)-1;var uiSourceCode=itemIndex!==null?this._uiSourceCodes[itemIndex]:null;this.uiSourceCodeSelected(uiSourceCode,lineNumber,columnNumber);},rewriteQuery:function(query)
388 {if(!query)
389 return query;query=query.trim();var lineNumberMatch=query.match(/^([^:]+)((?::[^:]*){0,2})$/);this._queryLineNumberAndColumnNumber=lineNumberMatch?lineNumberMatch[2]:"";return lineNumberMatch?lineNumberMatch[1]:query;},_uiSourceCodeAdded:function(event)
390 {var uiSourceCode=(event.data);if(!this.filterProject(uiSourceCode.project()))
391 return;this._uiSourceCodes.push(uiSourceCode)
392 this.refresh();},dispose:function()
393 {WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);},__proto__:WebInspector.SelectionDialogContentProvider.prototype}
394 WebInspector.OpenResourceDialog=function(sourcesView,defaultScores)
395 {WebInspector.SelectUISourceCodeDialog.call(this,defaultScores);this._sourcesView=sourcesView;}
396 WebInspector.OpenResourceDialog.prototype={uiSourceCodeSelected:function(uiSourceCode,lineNumber,columnNumber)
397 {if(!uiSourceCode)
398 uiSourceCode=this._sourcesView.currentUISourceCode();if(!uiSourceCode)
399 return;this._sourcesView.showSourceLocation(uiSourceCode,lineNumber,columnNumber);},shouldShowMatchingItems:function(query)
400 {return!query.startsWith(":");},filterProject:function(project)
401 {return!project.isServiceProject();},__proto__:WebInspector.SelectUISourceCodeDialog.prototype}
402 WebInspector.OpenResourceDialog.show=function(sourcesView,relativeToElement,query,defaultScores)
403 {if(WebInspector.Dialog.currentInstance())
404 return;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDialog(new WebInspector.OpenResourceDialog(sourcesView,defaultScores));filteredItemSelectionDialog.renderAsTwoRows();if(query)
405 filteredItemSelectionDialog.setQuery(query);WebInspector.Dialog.show(relativeToElement,filteredItemSelectionDialog);}
406 WebInspector.SelectUISourceCodeForProjectTypesDialog=function(types,callback)
407 {this._types=types;WebInspector.SelectUISourceCodeDialog.call(this);this._callback=callback;}
408 WebInspector.SelectUISourceCodeForProjectTypesDialog.prototype={uiSourceCodeSelected:function(uiSourceCode,lineNumber,columnNumber)
409 {this._callback(uiSourceCode);},filterProject:function(project)
410 {return this._types.indexOf(project.type())!==-1;},__proto__:WebInspector.SelectUISourceCodeDialog.prototype}
411 WebInspector.SelectUISourceCodeForProjectTypesDialog.show=function(name,types,callback,relativeToElement)
412 {if(WebInspector.Dialog.currentInstance())
413 return;var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDialog(new WebInspector.SelectUISourceCodeForProjectTypesDialog(types,callback));filteredItemSelectionDialog.setQuery(name);filteredItemSelectionDialog.renderAsTwoRows();WebInspector.Dialog.show(relativeToElement,filteredItemSelectionDialog);}
414 WebInspector.JavaScriptOutlineDialog.MessageEventData;;WebInspector.UISourceCodeFrame=function(uiSourceCode)
415 {this._uiSourceCode=uiSourceCode;WebInspector.SourceFrame.call(this,this._uiSourceCode);WebInspector.settings.textEditorAutocompletion.addChangeListener(this._enableAutocompletionIfNeeded,this);this._enableAutocompletionIfNeeded();this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._onWorkingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._onWorkingCopyCommitted,this);this._updateStyle();}
416 WebInspector.UISourceCodeFrame.prototype={uiSourceCode:function()
417 {return this._uiSourceCode;},_enableAutocompletionIfNeeded:function()
418 {this.textEditor.setCompletionDictionary(WebInspector.settings.textEditorAutocompletion.get()?new WebInspector.SampleCompletionDictionary():null);},wasShown:function()
419 {WebInspector.SourceFrame.prototype.wasShown.call(this);this._boundWindowFocused=this._windowFocused.bind(this);window.addEventListener("focus",this._boundWindowFocused,false);this._checkContentUpdated();},willHide:function()
420 {WebInspector.SourceFrame.prototype.willHide.call(this);window.removeEventListener("focus",this._boundWindowFocused,false);delete this._boundWindowFocused;this._uiSourceCode.removeWorkingCopyGetter();},canEditSource:function()
421 {var projectType=this._uiSourceCode.project().type();if(projectType===WebInspector.projectTypes.Debugger||projectType===WebInspector.projectTypes.Formatter)
422 return false;if(projectType===WebInspector.projectTypes.Network&&this._uiSourceCode.contentType()===WebInspector.resourceTypes.Document)
423 return false;return true;},_windowFocused:function(event)
424 {this._checkContentUpdated();},_checkContentUpdated:function()
425 {if(!this.loaded||!this.isShowing())
426 return;this._uiSourceCode.checkContentUpdated();},commitEditing:function()
427 {if(!this._uiSourceCode.isDirty())
428 return;this._muteSourceCodeEvents=true;this._uiSourceCode.commitWorkingCopy(this._didEditContent.bind(this));delete this._muteSourceCodeEvents;},onTextChanged:function(oldRange,newRange)
429 {WebInspector.SourceFrame.prototype.onTextChanged.call(this,oldRange,newRange);if(this._isSettingContent)
430 return;this._muteSourceCodeEvents=true;if(this._textEditor.isClean())
431 this._uiSourceCode.resetWorkingCopy();else
432 this._uiSourceCode.setWorkingCopyGetter(this._textEditor.text.bind(this._textEditor));delete this._muteSourceCodeEvents;},_didEditContent:function(error)
433 {if(error){WebInspector.messageSink.addErrorMessage(error,true);return;}},_onWorkingCopyChanged:function(event)
434 {if(this._muteSourceCodeEvents)
435 return;this._innerSetContent(this._uiSourceCode.workingCopy());this.onUISourceCodeContentChanged();},_onWorkingCopyCommitted:function(event)
436 {if(!this._muteSourceCodeEvents){this._innerSetContent(this._uiSourceCode.workingCopy());this.onUISourceCodeContentChanged();}
437 this._textEditor.markClean();this._updateStyle();},_updateStyle:function()
438 {this.element.classList.toggle("source-frame-unsaved-committed-changes",this._uiSourceCode.hasUnsavedCommittedChanges());},onUISourceCodeContentChanged:function()
439 {},_innerSetContent:function(content)
440 {this._isSettingContent=true;this.setContent(content);delete this._isSettingContent;},populateTextAreaContextMenu:function(contextMenu,lineNumber)
441 {WebInspector.SourceFrame.prototype.populateTextAreaContextMenu.call(this,contextMenu,lineNumber);contextMenu.appendApplicableItems(this._uiSourceCode);contextMenu.appendSeparator();},dispose:function()
442 {WebInspector.settings.textEditorAutocompletion.removeChangeListener(this._enableAutocompletionIfNeeded,this);this._textEditor.dispose();this.detach();},__proto__:WebInspector.SourceFrame.prototype};WebInspector.JavaScriptSourceFrame=function(scriptsPanel,uiSourceCode)
443 {this._scriptsPanel=scriptsPanel;this._breakpointManager=WebInspector.breakpointManager;this._uiSourceCode=uiSourceCode;WebInspector.UISourceCodeFrame.call(this,uiSourceCode);if(uiSourceCode.project().type()===WebInspector.projectTypes.Debugger)
444 this.element.classList.add("source-frame-debugger-script");this._popoverHelper=new WebInspector.ObjectPopoverHelper(this.textEditor.element,this._getPopoverAnchor.bind(this),this._resolveObjectForPopover.bind(this),this._onHidePopover.bind(this),true);this.textEditor.element.addEventListener("keydown",this._onKeyDown.bind(this),true);this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick,this._handleGutterClick.bind(this),this);this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded,this._breakpointAdded,this);this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved,this._breakpointRemoved,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageAdded,this._consoleMessageAdded,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessageRemoved,this._consoleMessageRemoved,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ConsoleMessagesCleared,this._consoleMessagesCleared,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._onSourceMappingChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._scriptFileForTarget=new Map();this._registerShortcuts();var targets=WebInspector.targetManager.targets();for(var i=0;i<targets.length;++i){var scriptFile=uiSourceCode.scriptFileForTarget(targets[i]);if(scriptFile)
445 this._updateScriptFile(targets[i]);}}
446 WebInspector.JavaScriptSourceFrame.prototype={_showInfobar:function(infobarElement)
447 {if(this._infobarElement)
448 this._infobarElement.remove();this._infobarElement=infobarElement;this._infobarElement.classList.add("java-script-source-frame-infobar");this.element.insertBefore(this._infobarElement,this.element.children[0]);this.doResize();},_hideInfobar:function(infobarElement)
449 {infobarElement.remove();this.doResize();},_showDivergedInfobar:function()
450 {if(this._uiSourceCode.contentType()!==WebInspector.resourceTypes.Script)
451 return;this._divergedInfobarElement=document.createElement("div");var infobarMainRow=this._divergedInfobarElement.createChild("div","java-script-source-frame-infobar-main-row");var infobarDetailsContainer=this._divergedInfobarElement.createChild("span","java-script-source-frame-infobar-details-container");infobarMainRow.createChild("span","java-script-source-frame-infobar-warning-icon");var infobarMessage=infobarMainRow.createChild("span","java-script-source-frame-infobar-row-message");infobarMessage.textContent=WebInspector.UIString("Workspace mapping mismatch");function updateDetailsVisibility()
452 {detailsToggleElement.textContent=detailsToggleElement._toggled?WebInspector.UIString("less"):WebInspector.UIString("more");infobarDetailsContainer.classList.toggle("hidden",!detailsToggleElement._toggled);this.doResize();}
453 function toggleDetails()
454 {detailsToggleElement._toggled=!detailsToggleElement._toggled;updateDetailsVisibility.call(this);}
455 infobarMainRow.appendChild(document.createTextNode("\u00a0"));var detailsToggleElement=infobarMainRow.createChild("div","java-script-source-frame-infobar-toggle");detailsToggleElement.addEventListener("click",toggleDetails.bind(this),false);updateDetailsVisibility.call(this);function createDetailsRowMessage()
456 {var infobarDetailsRow=infobarDetailsContainer.createChild("div","java-script-source-frame-infobar-details-row");return infobarDetailsRow.createChild("span","java-script-source-frame-infobar-row-message");}
457 var infobarDetailsRowMessage;infobarDetailsRowMessage=createDetailsRowMessage();infobarDetailsRowMessage.appendChild(document.createTextNode(WebInspector.UIString("The content of this file on the file system:\u00a0")));var fileURL=this._uiSourceCode.originURL();infobarDetailsRowMessage.appendChild(WebInspector.linkifyURLAsNode(fileURL,fileURL,"java-script-source-frame-infobar-details-url",true,fileURL));infobarDetailsRowMessage=createDetailsRowMessage();infobarDetailsRowMessage.appendChild(document.createTextNode(WebInspector.UIString("does not match the loaded script:\u00a0")));var scriptURL=this._uiSourceCode.url;infobarDetailsRowMessage.appendChild(WebInspector.linkifyURLAsNode(scriptURL,scriptURL,"java-script-source-frame-infobar-details-url",true,scriptURL));createDetailsRowMessage();createDetailsRowMessage().textContent=WebInspector.UIString("Possible solutions are:");;function createDetailsRowMessageAction(title)
458 {infobarDetailsRowMessage=createDetailsRowMessage();infobarDetailsRowMessage.appendChild(document.createTextNode(" - "));infobarDetailsRowMessage.appendChild(document.createTextNode(title));}
459 if(WebInspector.settings.cacheDisabled.get())
460 createDetailsRowMessageAction(WebInspector.UIString("Reload inspected page"));else
461 createDetailsRowMessageAction(WebInspector.UIString("Check \"Disable cache\" in settings and reload inspected page (recommended setup for authoring and debugging)"));createDetailsRowMessageAction(WebInspector.UIString("Check that your file and script are both loaded from the correct source and their contents match."));this._showInfobar(this._divergedInfobarElement);},_hideDivergedInfobar:function()
462 {if(!this._divergedInfobarElement)
463 return;this._hideInfobar(this._divergedInfobarElement);delete this._divergedInfobarElement;},_registerShortcuts:function()
464 {var shortcutKeys=WebInspector.ShortcutsScreen.SourcesPanelShortcuts;for(var i=0;i<shortcutKeys.EvaluateSelectionInConsole.length;++i){var keyDescriptor=shortcutKeys.EvaluateSelectionInConsole[i];this.addShortcut(keyDescriptor.key,this._evaluateSelectionInConsole.bind(this));}
465 for(var i=0;i<shortcutKeys.AddSelectionToWatch.length;++i){var keyDescriptor=shortcutKeys.AddSelectionToWatch[i];this.addShortcut(keyDescriptor.key,this._addCurrentSelectionToWatch.bind(this));}},_addCurrentSelectionToWatch:function()
466 {var textSelection=this.textEditor.selection();if(textSelection&&!textSelection.isEmpty())
467 this._innerAddToWatch(this.textEditor.copyRange(textSelection));},_innerAddToWatch:function(expression)
468 {this._scriptsPanel.addToWatch(expression);},_evaluateSelectionInConsole:function()
469 {var selection=this.textEditor.selection();if(!selection||selection.isEmpty())
470 return false;this._evaluateInConsole(this.textEditor.copyRange(selection));return true;},_evaluateInConsole:function(expression)
471 {var currentExecutionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(currentExecutionContext)
472 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionContext,expression);},wasShown:function()
473 {WebInspector.UISourceCodeFrame.prototype.wasShown.call(this);},willHide:function()
474 {WebInspector.UISourceCodeFrame.prototype.willHide.call(this);this._popoverHelper.hidePopover();},onUISourceCodeContentChanged:function()
475 {this._removeAllBreakpoints();WebInspector.UISourceCodeFrame.prototype.onUISourceCodeContentChanged.call(this);},populateLineGutterContextMenu:function(contextMenu,lineNumber)
476 {contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Continue to here":"Continue to Here"),this._continueToLine.bind(this,lineNumber));var breakpoint=this._breakpointManager.findBreakpointOnLine(this._uiSourceCode,lineNumber);if(!breakpoint){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add breakpoint":"Add Breakpoint"),this._setBreakpoint.bind(this,lineNumber,0,"",true));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add conditional breakpoint…":"Add Conditional 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(this,lineNumber,breakpoint));if(breakpoint.enabled())
477 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Disable breakpoint":"Disable Breakpoint"),breakpoint.setEnabled.bind(breakpoint,false));else
478 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Enable breakpoint":"Enable Breakpoint"),breakpoint.setEnabled.bind(breakpoint,true));}},populateTextAreaContextMenu:function(contextMenu,lineNumber)
479 {var textSelection=this.textEditor.selection();if(textSelection&&!textSelection.isEmpty()){var selection=this.textEditor.copyRange(textSelection);var addToWatchLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add to watch":"Add to Watch");contextMenu.appendItem(addToWatchLabel,this._innerAddToWatch.bind(this,selection));var evaluateLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Evaluate in console":"Evaluate in Console");contextMenu.appendItem(evaluateLabel,this._evaluateInConsole.bind(this,selection));contextMenu.appendSeparator();}else if(this._uiSourceCode.project().type()===WebInspector.projectTypes.Debugger){var liveEditLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Live edit":"Live Edit");contextMenu.appendItem(liveEditLabel,liveEdit.bind(this));contextMenu.appendSeparator();}
480 function liveEdit()
481 {var liveEditUISourceCode=WebInspector.liveEditSupport.uiSourceCodeForLiveEdit(this._uiSourceCode);WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNumber));}
482 WebInspector.UISourceCodeFrame.prototype.populateTextAreaContextMenu.call(this,contextMenu,lineNumber);},_workingCopyChanged:function(event)
483 {if(this._supportsEnabledBreakpointsWhileEditing()||this._scriptFileForTarget.size())
484 return;if(this._uiSourceCode.isDirty())
485 this._muteBreakpointsWhileEditing();else
486 this._restoreBreakpointsAfterEditing();},_workingCopyCommitted:function(event)
487 {if(this._supportsEnabledBreakpointsWhileEditing())
488 return;if(this._scriptFileForTarget.size()){this._hasCommittedLiveEdit=true;var scriptFiles=this._scriptFileForTarget.values();for(var i=0;i<scriptFiles.length;++i)
489 scriptFiles[i].commitLiveEdit();return;}
490 this._restoreBreakpointsAfterEditing();},_didMergeToVM:function()
491 {if(this._supportsEnabledBreakpointsWhileEditing())
492 return;this._updateDivergedInfobar();this._restoreBreakpointsIfConsistentScripts();},_didDivergeFromVM:function()
493 {if(this._supportsEnabledBreakpointsWhileEditing())
494 return;this._updateDivergedInfobar();this._muteBreakpointsWhileEditing();},_muteBreakpointsWhileEditing:function()
495 {if(this._muted)
496 return;for(var lineNumber=0;lineNumber<this._textEditor.linesCount;++lineNumber){var breakpointDecoration=this._textEditor.getAttribute(lineNumber,"breakpoint");if(!breakpointDecoration)
497 continue;this._removeBreakpointDecoration(lineNumber);this._addBreakpointDecoration(lineNumber,breakpointDecoration.columnNumber,breakpointDecoration.condition,breakpointDecoration.enabled,true);}
498 this._muted=true;},_updateDivergedInfobar:function()
499 {if(this._uiSourceCode.project().type()!==WebInspector.projectTypes.FileSystem){this._hideDivergedInfobar();return;}
500 var scriptFiles=this._scriptFileForTarget.values();var hasDivergedScript=false;for(var i=0;i<scriptFiles.length;++i)
501 hasDivergedScript=hasDivergedScript||scriptFiles[i].hasDivergedFromVM();if(this._divergedInfobarElement){if(!hasDivergedScript||this._hasCommittedLiveEdit)
502 this._hideDivergedInfobar();}else{if(hasDivergedScript&&!this._uiSourceCode.isDirty()&&!this._hasCommittedLiveEdit)
503 this._showDivergedInfobar();}},_supportsEnabledBreakpointsWhileEditing:function()
504 {return this._uiSourceCode.project().type()===WebInspector.projectTypes.Snippets;},_restoreBreakpointsIfConsistentScripts:function()
505 {var scriptFiles=this._scriptFileForTarget.values();for(var i=0;i<scriptFiles.length;++i)
506 if(scriptFiles[i].hasDivergedFromVM()||scriptFiles[i].isMergingToVM())
507 return;this._restoreBreakpointsAfterEditing();},_restoreBreakpointsAfterEditing:function()
508 {delete this._muted;var breakpoints={};for(var lineNumber=0;lineNumber<this._textEditor.linesCount;++lineNumber){var breakpointDecoration=this._textEditor.getAttribute(lineNumber,"breakpoint");if(breakpointDecoration){breakpoints[lineNumber]=breakpointDecoration;this._removeBreakpointDecoration(lineNumber);}}
509 this._removeAllBreakpoints();for(var lineNumberString in breakpoints){var lineNumber=parseInt(lineNumberString,10);if(isNaN(lineNumber))
510 continue;var breakpointDecoration=breakpoints[lineNumberString];this._setBreakpoint(lineNumber,breakpointDecoration.columnNumber,breakpointDecoration.condition,breakpointDecoration.enabled);}},_removeAllBreakpoints:function()
511 {var breakpoints=this._breakpointManager.breakpointsForUISourceCode(this._uiSourceCode);for(var i=0;i<breakpoints.length;++i)
512 breakpoints[i].remove();},_getPopoverAnchor:function(element,event)
513 {if(!WebInspector.debuggerModel.isPaused())
514 return null;var textPosition=this.textEditor.coordinatesToCursorPosition(event.x,event.y);if(!textPosition)
515 return null;var mouseLine=textPosition.startLine;var mouseColumn=textPosition.startColumn;var textSelection=this.textEditor.selection().normalize();if(textSelection&&!textSelection.isEmpty()){if(textSelection.startLine!==textSelection.endLine||textSelection.startLine!==mouseLine||mouseColumn<textSelection.startColumn||mouseColumn>textSelection.endColumn)
516 return null;var leftCorner=this.textEditor.cursorPositionToCoordinates(textSelection.startLine,textSelection.startColumn);var rightCorner=this.textEditor.cursorPositionToCoordinates(textSelection.endLine,textSelection.endColumn);var anchorBox=new AnchorBox(leftCorner.x,leftCorner.y,rightCorner.x-leftCorner.x,leftCorner.height);anchorBox.highlight={lineNumber:textSelection.startLine,startColumn:textSelection.startColumn,endColumn:textSelection.endColumn-1};anchorBox.forSelection=true;return anchorBox;}
517 var token=this.textEditor.tokenAtTextPosition(textPosition.startLine,textPosition.startColumn);if(!token)
518 return null;var lineNumber=textPosition.startLine;var line=this.textEditor.line(lineNumber);var tokenContent=line.substring(token.startColumn,token.endColumn+1);var isIdentifier=token.type.startsWith("js-variable")||token.type.startsWith("js-property")||token.type=="js-def";if(!isIdentifier&&(token.type!=="js-keyword"||tokenContent!=="this"))
519 return null;var leftCorner=this.textEditor.cursorPositionToCoordinates(lineNumber,token.startColumn);var rightCorner=this.textEditor.cursorPositionToCoordinates(lineNumber,token.endColumn+1);var anchorBox=new AnchorBox(leftCorner.x,leftCorner.y,rightCorner.x-leftCorner.x,leftCorner.height);anchorBox.highlight={lineNumber:lineNumber,startColumn:token.startColumn,endColumn:token.endColumn};return anchorBox;},_resolveObjectForPopover:function(anchorBox,showCallback,objectGroupName)
520 {if(!WebInspector.debuggerModel.isPaused()){this._popoverHelper.hidePopover();return;}
521 var lineNumber=anchorBox.highlight.lineNumber;var startHighlight=anchorBox.highlight.startColumn;var endHighlight=anchorBox.highlight.endColumn;var line=this.textEditor.line(lineNumber);if(!anchorBox.forSelection){while(startHighlight>1&&line.charAt(startHighlight-1)==='.'){var token=this.textEditor.tokenAtTextPosition(lineNumber,startHighlight-2);if(!token){this._popoverHelper.hidePopover();return;}
522 startHighlight=token.startColumn;}}
523 var evaluationText=line.substring(startHighlight,endHighlight+1);var selectedCallFrame=WebInspector.debuggerModel.selectedCallFrame();selectedCallFrame.evaluate(evaluationText,objectGroupName,false,true,false,false,showObjectPopover.bind(this));function showObjectPopover(result,wasThrown)
524 {if(!WebInspector.debuggerModel.isPaused()||!result){this._popoverHelper.hidePopover();return;}
525 this._popoverAnchorBox=anchorBox;showCallback(selectedCallFrame.target().runtimeModel.createRemoteObject(result),wasThrown,this._popoverAnchorBox);if(this._popoverAnchorBox){var highlightRange=new WebInspector.TextRange(lineNumber,startHighlight,lineNumber,endHighlight);this._popoverAnchorBox._highlightDescriptor=this.textEditor.highlightRange(highlightRange,"source-frame-eval-expression");}}},_onHidePopover:function()
526 {if(!this._popoverAnchorBox)
527 return;if(this._popoverAnchorBox._highlightDescriptor)
528 this.textEditor.removeHighlight(this._popoverAnchorBox._highlightDescriptor);delete this._popoverAnchorBox;},_addBreakpointDecoration:function(lineNumber,columnNumber,condition,enabled,mutedWhileEditing)
529 {var breakpoint={condition:condition,enabled:enabled,columnNumber:columnNumber};this.textEditor.setAttribute(lineNumber,"breakpoint",breakpoint);var disabled=!enabled||mutedWhileEditing;this.textEditor.addBreakpoint(lineNumber,disabled,!!condition);},_removeBreakpointDecoration:function(lineNumber)
530 {this.textEditor.removeAttribute(lineNumber,"breakpoint");this.textEditor.removeBreakpoint(lineNumber);},_onKeyDown:function(event)
531 {if(event.keyIdentifier==="U+001B"){if(this._popoverHelper.isPopoverVisible()){this._popoverHelper.hidePopover();event.consume();}}},_editBreakpointCondition:function(lineNumber,breakpoint)
532 {this._conditionElement=this._createConditionElement(lineNumber);this.textEditor.addDecoration(lineNumber,this._conditionElement);function finishEditing(committed,element,newText)
533 {this.textEditor.removeDecoration(lineNumber,this._conditionElement);delete this._conditionEditorElement;delete this._conditionElement;if(!committed)
534 return;if(breakpoint)
535 breakpoint.setCondition(newText);else
536 this._setBreakpoint(lineNumber,0,newText,true);}
537 var config=new WebInspector.InplaceEditor.Config(finishEditing.bind(this,true),finishEditing.bind(this,false));WebInspector.InplaceEditor.startEditing(this._conditionEditorElement,config);this._conditionEditorElement.value=breakpoint?breakpoint.condition():"";this._conditionEditorElement.select();},_createConditionElement:function(lineNumber)
538 {var conditionElement=document.createElement("div");conditionElement.className="source-frame-breakpoint-condition";var labelElement=document.createElement("label");labelElement.className="source-frame-breakpoint-message";labelElement.htmlFor="source-frame-breakpoint-condition";labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:",lineNumber+1)));conditionElement.appendChild(labelElement);var editorElement=document.createElement("input");editorElement.id="source-frame-breakpoint-condition";editorElement.className="monospace";editorElement.type="text";conditionElement.appendChild(editorElement);this._conditionEditorElement=editorElement;return conditionElement;},setExecutionLine:function(lineNumber)
539 {this._executionLineNumber=lineNumber;if(this.loaded)
540 this.textEditor.setExecutionLine(lineNumber);},clearExecutionLine:function()
541 {if(this.loaded&&typeof this._executionLineNumber==="number")
542 this.textEditor.clearExecutionLine();delete this._executionLineNumber;},_shouldIgnoreExternalBreakpointEvents:function()
543 {if(this._supportsEnabledBreakpointsWhileEditing())
544 return false;if(this._muted)
545 return true;var scriptFiles=this._scriptFileForTarget.values();var hasDivergingOrMergingFile=false;for(var i=0;i<scriptFiles.length;++i)
546 if(scriptFiles[i].isDivergingFromVM()||scriptFiles[i].isMergingToVM())
547 return true;return false;},_breakpointAdded:function(event)
548 {var uiLocation=(event.data.uiLocation);if(uiLocation.uiSourceCode!==this._uiSourceCode)
549 return;if(this._shouldIgnoreExternalBreakpointEvents())
550 return;var breakpoint=(event.data.breakpoint);if(this.loaded)
551 this._addBreakpointDecoration(uiLocation.lineNumber,uiLocation.columnNumber,breakpoint.condition(),breakpoint.enabled(),false);},_breakpointRemoved:function(event)
552 {var uiLocation=(event.data.uiLocation);if(uiLocation.uiSourceCode!==this._uiSourceCode)
553 return;if(this._shouldIgnoreExternalBreakpointEvents())
554 return;var breakpoint=(event.data.breakpoint);var remainingBreakpoint=this._breakpointManager.findBreakpointOnLine(this._uiSourceCode,uiLocation.lineNumber);if(!remainingBreakpoint&&this.loaded)
555 this._removeBreakpointDecoration(uiLocation.lineNumber);},_consoleMessageAdded:function(event)
556 {var message=(event.data);if(this.loaded)
557 this.addMessageToSource(message.lineNumber,message.originalMessage);},_consoleMessageRemoved:function(event)
558 {var message=(event.data);if(this.loaded)
559 this.removeMessageFromSource(message.lineNumber,message.originalMessage);},_consoleMessagesCleared:function(event)
560 {this.clearMessages();},_onSourceMappingChanged:function(event)
561 {var data=(event.data);this._updateScriptFile(data.target);},_updateScriptFile:function(target)
562 {var oldScriptFile=this._scriptFileForTarget.get(target);var newScriptFile=this._uiSourceCode.scriptFileForTarget(target);this._scriptFileForTarget.remove(target);if(oldScriptFile){oldScriptFile.removeEventListener(WebInspector.ScriptFile.Events.DidMergeToVM,this._didMergeToVM,this);oldScriptFile.removeEventListener(WebInspector.ScriptFile.Events.DidDivergeFromVM,this._didDivergeFromVM,this);if(this._muted&&!this._uiSourceCode.isDirty())
563 this._restoreBreakpointsIfConsistentScripts();}
564 if(newScriptFile)
565 this._scriptFileForTarget.put(target,newScriptFile);delete this._hasCommittedLiveEdit;this._updateDivergedInfobar();if(newScriptFile){newScriptFile.addEventListener(WebInspector.ScriptFile.Events.DidMergeToVM,this._didMergeToVM,this);newScriptFile.addEventListener(WebInspector.ScriptFile.Events.DidDivergeFromVM,this._didDivergeFromVM,this);if(this.loaded)
566 newScriptFile.checkMapping();}},onTextEditorContentLoaded:function()
567 {if(typeof this._executionLineNumber==="number")
568 this.setExecutionLine(this._executionLineNumber);var breakpointLocations=this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode);for(var i=0;i<breakpointLocations.length;++i)
569 this._breakpointAdded({data:breakpointLocations[i]});var messages=this._uiSourceCode.consoleMessages();for(var i=0;i<messages.length;++i){var message=messages[i];this.addMessageToSource(message.lineNumber,message.originalMessage);}
570 var scriptFiles=this._scriptFileForTarget.values();for(var i=0;i<scriptFiles.length;++i)
571 scriptFiles[i].checkMapping();},_handleGutterClick:function(event)
572 {if(this._muted)
573 return;var eventData=(event.data);var lineNumber=eventData.lineNumber;var eventObject=(eventData.event);if(eventObject.button!=0||eventObject.altKey||eventObject.ctrlKey||eventObject.metaKey)
574 return;this._toggleBreakpoint(lineNumber,eventObject.shiftKey);eventObject.consume(true);},_toggleBreakpoint:function(lineNumber,onlyDisable)
575 {var breakpoint=this._breakpointManager.findBreakpointOnLine(this._uiSourceCode,lineNumber);if(breakpoint){if(onlyDisable)
576 breakpoint.setEnabled(!breakpoint.enabled());else
577 breakpoint.remove();}else
578 this._setBreakpoint(lineNumber,0,"",true);},toggleBreakpointOnCurrentLine:function()
579 {if(this._muted)
580 return;var selection=this.textEditor.selection();if(!selection)
581 return;this._toggleBreakpoint(selection.startLine,false);},_setBreakpoint:function(lineNumber,columnNumber,condition,enabled)
582 {this._breakpointManager.setBreakpoint(this._uiSourceCode,lineNumber,columnNumber,condition,enabled);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.SetBreakpoint,url:this._uiSourceCode.originURL(),line:lineNumber,enabled:enabled});},_continueToLine:function(lineNumber)
583 {var executionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(!executionContext)
584 return;var rawLocation=(this._uiSourceCode.uiLocationToRawLocation(executionContext.target(),lineNumber,0));this._scriptsPanel.continueToLocation(rawLocation);},dispose:function()
585 {this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded,this._breakpointAdded,this);this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved,this._breakpointRemoved,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.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);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._onSourceMappingChanged,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);WebInspector.UISourceCodeFrame.prototype.dispose.call(this);},__proto__:WebInspector.UISourceCodeFrame.prototype};WebInspector.CSSSourceFrame=function(uiSourceCode)
586 {WebInspector.UISourceCodeFrame.call(this,uiSourceCode);this._registerShortcuts();}
587 WebInspector.CSSSourceFrame.prototype={_registerShortcuts:function()
588 {var shortcutKeys=WebInspector.ShortcutsScreen.SourcesPanelShortcuts;for(var i=0;i<shortcutKeys.IncreaseCSSUnitByOne.length;++i)
589 this.addShortcut(shortcutKeys.IncreaseCSSUnitByOne[i].key,this._handleUnitModification.bind(this,1));for(var i=0;i<shortcutKeys.DecreaseCSSUnitByOne.length;++i)
590 this.addShortcut(shortcutKeys.DecreaseCSSUnitByOne[i].key,this._handleUnitModification.bind(this,-1));for(var i=0;i<shortcutKeys.IncreaseCSSUnitByTen.length;++i)
591 this.addShortcut(shortcutKeys.IncreaseCSSUnitByTen[i].key,this._handleUnitModification.bind(this,10));for(var i=0;i<shortcutKeys.DecreaseCSSUnitByTen.length;++i)
592 this.addShortcut(shortcutKeys.DecreaseCSSUnitByTen[i].key,this._handleUnitModification.bind(this,-10));},_modifyUnit:function(unit,change)
593 {var unitValue=parseInt(unit,10);if(isNaN(unitValue))
594 return null;var tail=unit.substring((unitValue).toString().length);return String.sprintf("%d%s",unitValue+change,tail);},_handleUnitModification:function(change)
595 {var selection=this.textEditor.selection().normalize();var token=this.textEditor.tokenAtTextPosition(selection.startLine,selection.startColumn);if(!token){if(selection.startColumn>0)
596 token=this.textEditor.tokenAtTextPosition(selection.startLine,selection.startColumn-1);if(!token)
597 return false;}
598 if(token.type!=="css-number")
599 return false;var cssUnitRange=new WebInspector.TextRange(selection.startLine,token.startColumn,selection.startLine,token.endColumn+1);var cssUnitText=this.textEditor.copyRange(cssUnitRange);var newUnitText=this._modifyUnit(cssUnitText,change);if(!newUnitText)
600 return false;this.textEditor.editRange(cssUnitRange,newUnitText);selection.startColumn=token.startColumn;selection.endColumn=selection.startColumn+newUnitText.length;this.textEditor.setSelection(selection);return true;},__proto__:WebInspector.UISourceCodeFrame.prototype};WebInspector.NavigatorView=function()
601 {WebInspector.VBox.call(this);this.registerRequiredCSS("navigatorView.css");var scriptsTreeElement=document.createElement("ol");this._scriptsTree=new WebInspector.NavigatorTreeOutline(scriptsTreeElement);var scriptsOutlineElement=document.createElement("div");scriptsOutlineElement.classList.add("outline-disclosure");scriptsOutlineElement.classList.add("navigator");scriptsOutlineElement.appendChild(scriptsTreeElement);this.element.classList.add("navigator-container");this.element.appendChild(scriptsOutlineElement);this.setDefaultFocusedElement(this._scriptsTree.element);this._uiSourceCodeNodes=new Map();this._subfolderNodes=new Map();this._rootNode=new WebInspector.NavigatorRootTreeNode(this);this._rootNode.populate();this.element.addEventListener("contextmenu",this.handleContextMenu.bind(this),false);}
602 WebInspector.NavigatorView.Events={ItemSelected:"ItemSelected",ItemRenamed:"ItemRenamed",}
603 WebInspector.NavigatorView.iconClassForType=function(type)
604 {if(type===WebInspector.NavigatorTreeOutline.Types.Domain)
605 return"navigator-domain-tree-item";if(type===WebInspector.NavigatorTreeOutline.Types.FileSystem)
606 return"navigator-folder-tree-item";return"navigator-folder-tree-item";}
607 WebInspector.NavigatorView.prototype={setWorkspace:function(workspace)
608 {this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved.bind(this),this);},wasShown:function()
609 {if(this._loaded)
610 return;this._loaded=true;this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));},accept:function(uiSourceCode)
611 {return!uiSourceCode.project().isServiceProject();},_addUISourceCode:function(uiSourceCode)
612 {if(!this.accept(uiSourceCode))
613 return;var projectNode=this._projectNode(uiSourceCode.project());var folderNode=this._folderNode(projectNode,uiSourceCode.parentPath());var uiSourceCodeNode=new WebInspector.NavigatorUISourceCodeTreeNode(this,uiSourceCode);this._uiSourceCodeNodes.put(uiSourceCode,uiSourceCodeNode);folderNode.appendChild(uiSourceCodeNode);},_uiSourceCodeAdded:function(event)
614 {var uiSourceCode=(event.data);this._addUISourceCode(uiSourceCode);},_uiSourceCodeRemoved:function(event)
615 {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_projectRemoved:function(event)
616 {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
617 this._removeUISourceCode(uiSourceCodes[i]);},_projectNode:function(project)
618 {if(!project.displayName())
619 return this._rootNode;var projectNode=this._rootNode.child(project.id());if(!projectNode){var type=project.type()===WebInspector.projectTypes.FileSystem?WebInspector.NavigatorTreeOutline.Types.FileSystem:WebInspector.NavigatorTreeOutline.Types.Domain;projectNode=new WebInspector.NavigatorFolderTreeNode(this,project,project.id(),type,"",project.displayName());this._rootNode.appendChild(projectNode);}
620 return projectNode;},_folderNode:function(projectNode,folderPath)
621 {if(!folderPath)
622 return projectNode;var subfolderNodes=this._subfolderNodes.get(projectNode);if(!subfolderNodes){subfolderNodes=(new StringMap());this._subfolderNodes.put(projectNode,subfolderNodes);}
623 var folderNode=subfolderNodes.get(folderPath);if(folderNode)
624 return folderNode;var parentNode=projectNode;var index=folderPath.lastIndexOf("/");if(index!==-1)
625 parentNode=this._folderNode(projectNode,folderPath.substring(0,index));var name=folderPath.substring(index+1);folderNode=new WebInspector.NavigatorFolderTreeNode(this,null,name,WebInspector.NavigatorTreeOutline.Types.Folder,folderPath,name);subfolderNodes.put(folderPath,folderNode);parentNode.appendChild(folderNode);return folderNode;},revealUISourceCode:function(uiSourceCode,select)
626 {var node=this._uiSourceCodeNodes.get(uiSourceCode);if(!node)
627 return;if(this._scriptsTree.selectedTreeElement)
628 this._scriptsTree.selectedTreeElement.deselect();this._lastSelectedUISourceCode=uiSourceCode;node.reveal(select);},_sourceSelected:function(uiSourceCode,focusSource)
629 {this._lastSelectedUISourceCode=uiSourceCode;var data={uiSourceCode:uiSourceCode,focusSource:focusSource};this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemSelected,data);},sourceDeleted:function(uiSourceCode)
630 {},_removeUISourceCode:function(uiSourceCode)
631 {var node=this._uiSourceCodeNodes.get(uiSourceCode);if(!node)
632 return;var projectNode=this._projectNode(uiSourceCode.project());var subfolderNodes=this._subfolderNodes.get(projectNode);var parentNode=node.parent;this._uiSourceCodeNodes.remove(uiSourceCode);parentNode.removeChild(node);node=parentNode;while(node){parentNode=node.parent;if(!parentNode||!node.isEmpty())
633 break;if(subfolderNodes)
634 subfolderNodes.remove(node._folderPath);parentNode.removeChild(node);node=parentNode;}},_updateIcon:function(uiSourceCode)
635 {var node=this._uiSourceCodeNodes.get(uiSourceCode);node.updateIcon();},reset:function()
636 {var nodes=this._uiSourceCodeNodes.values();for(var i=0;i<nodes.length;++i)
637 nodes[i].dispose();this._scriptsTree.removeChildren();this._uiSourceCodeNodes.clear();this._subfolderNodes.clear();this._rootNode.reset();},handleContextMenu:function(event)
638 {var contextMenu=new WebInspector.ContextMenu(event);this._appendAddFolderItem(contextMenu);contextMenu.show();},_appendAddFolderItem:function(contextMenu)
639 {function addFolder()
640 {WebInspector.isolatedFileSystemManager.addFileSystem();}
641 var addFolderLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add folder to workspace":"Add Folder to Workspace");contextMenu.appendItem(addFolderLabel,addFolder);},_handleContextMenuRefresh:function(project,path)
642 {project.refresh(path);},_handleContextMenuCreate:function(project,path,uiSourceCode)
643 {this.create(project,path,uiSourceCode);},_handleContextMenuRename:function(uiSourceCode)
644 {this.rename(uiSourceCode,false);},_handleContextMenuExclude:function(project,path)
645 {var shouldExclude=window.confirm(WebInspector.UIString("Are you sure you want to exclude this folder?"));if(shouldExclude){WebInspector.startBatchUpdate();project.excludeFolder(path);WebInspector.endBatchUpdate();}},_handleContextMenuDelete:function(uiSourceCode)
646 {var shouldDelete=window.confirm(WebInspector.UIString("Are you sure you want to delete this file?"));if(shouldDelete)
647 uiSourceCode.project().deleteFile(uiSourceCode.path());},handleFileContextMenu:function(event,uiSourceCode)
648 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems(uiSourceCode);contextMenu.appendSeparator();var project=uiSourceCode.project();if(project.type()===WebInspector.projectTypes.FileSystem){var path=uiSourceCode.parentPath();contextMenu.appendItem(WebInspector.UIString("Rename\u2026"),this._handleContextMenuRename.bind(this,uiSourceCode));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Make a copy\u2026":"Make a Copy\u2026"),this._handleContextMenuCreate.bind(this,project,path,uiSourceCode));contextMenu.appendItem(WebInspector.UIString("Delete"),this._handleContextMenuDelete.bind(this,uiSourceCode));contextMenu.appendSeparator();}
649 this._appendAddFolderItem(contextMenu);contextMenu.show();},handleFolderContextMenu:function(event,node)
650 {var contextMenu=new WebInspector.ContextMenu(event);var path="/";var projectNode=node;while(projectNode.parent!==this._rootNode){path="/"+projectNode.id+path;projectNode=projectNode.parent;}
651 var project=projectNode._project;if(project.type()===WebInspector.projectTypes.FileSystem){contextMenu.appendItem(WebInspector.UIString("Refresh"),this._handleContextMenuRefresh.bind(this,project,path));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"New file":"New File"),this._handleContextMenuCreate.bind(this,project,path));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Exclude folder":"Exclude Folder"),this._handleContextMenuExclude.bind(this,project,path));}
652 contextMenu.appendSeparator();this._appendAddFolderItem(contextMenu);function removeFolder()
653 {var shouldRemove=window.confirm(WebInspector.UIString("Are you sure you want to remove this folder?"));if(shouldRemove)
654 project.remove();}
655 if(project.type()===WebInspector.projectTypes.FileSystem&&node===projectNode){var removeFolderLabel=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove folder from workspace":"Remove Folder from Workspace");contextMenu.appendItem(removeFolderLabel,removeFolder);}
656 contextMenu.show();},rename:function(uiSourceCode,deleteIfCanceled)
657 {var node=this._uiSourceCodeNodes.get(uiSourceCode);console.assert(node);node.rename(callback.bind(this));function callback(committed)
658 {if(!committed){if(deleteIfCanceled)
659 uiSourceCode.remove();return;}
660 this.dispatchEventToListeners(WebInspector.NavigatorView.Events.ItemRenamed,uiSourceCode);this._updateIcon(uiSourceCode);this._sourceSelected(uiSourceCode,true)}},create:function(project,path,uiSourceCodeToCopy)
661 {var filePath;var uiSourceCode;function contentLoaded(content)
662 {createFile.call(this,content||"");}
663 if(uiSourceCodeToCopy)
664 uiSourceCodeToCopy.requestContent(contentLoaded.bind(this));else
665 createFile.call(this);function createFile(content)
666 {project.createFile(path,null,content||"",fileCreated.bind(this));}
667 function fileCreated(path)
668 {if(!path)
669 return;filePath=path;uiSourceCode=project.uiSourceCode(filePath);if(!uiSourceCode){console.assert(uiSourceCode)
670 return;}
671 this._sourceSelected(uiSourceCode,false);this.revealUISourceCode(uiSourceCode,true);this.rename(uiSourceCode,true);}},__proto__:WebInspector.VBox.prototype}
672 WebInspector.SourcesNavigatorView=function()
673 {WebInspector.NavigatorView.call(this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);}
674 WebInspector.SourcesNavigatorView.prototype={accept:function(uiSourceCode)
675 {if(!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
676 return false;return uiSourceCode.project().type()!==WebInspector.projectTypes.ContentScripts&&uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets;},_inspectedURLChanged:function(event)
677 {var nodes=this._uiSourceCodeNodes.values();for(var i=0;i<nodes.length;++i){var uiSourceCode=nodes[i].uiSourceCode();if(uiSourceCode.url===WebInspector.resourceTreeModel.inspectedPageURL())
678 this.revealUISourceCode(uiSourceCode,true);}},_addUISourceCode:function(uiSourceCode)
679 {WebInspector.NavigatorView.prototype._addUISourceCode.call(this,uiSourceCode);if(uiSourceCode.url===WebInspector.resourceTreeModel.inspectedPageURL())
680 this.revealUISourceCode(uiSourceCode,true);},__proto__:WebInspector.NavigatorView.prototype}
681 WebInspector.ContentScriptsNavigatorView=function()
682 {WebInspector.NavigatorView.call(this);}
683 WebInspector.ContentScriptsNavigatorView.prototype={accept:function(uiSourceCode)
684 {if(!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
685 return false;return uiSourceCode.project().type()===WebInspector.projectTypes.ContentScripts;},__proto__:WebInspector.NavigatorView.prototype}
686 WebInspector.NavigatorTreeOutline=function(element)
687 {TreeOutline.call(this,element);this.element=element;this.comparator=WebInspector.NavigatorTreeOutline._treeElementsCompare;}
688 WebInspector.NavigatorTreeOutline.Types={Root:"Root",Domain:"Domain",Folder:"Folder",UISourceCode:"UISourceCode",FileSystem:"FileSystem"}
689 WebInspector.NavigatorTreeOutline._treeElementsCompare=function compare(treeElement1,treeElement2)
690 {function typeWeight(treeElement)
691 {var type=treeElement.type();if(type===WebInspector.NavigatorTreeOutline.Types.Domain){if(treeElement.titleText===WebInspector.resourceTreeModel.inspectedPageDomain())
692 return 1;return 2;}
693 if(type===WebInspector.NavigatorTreeOutline.Types.FileSystem)
694 return 3;if(type===WebInspector.NavigatorTreeOutline.Types.Folder)
695 return 4;return 5;}
696 var typeWeight1=typeWeight(treeElement1);var typeWeight2=typeWeight(treeElement2);var result;if(typeWeight1>typeWeight2)
697 result=1;else if(typeWeight1<typeWeight2)
698 result=-1;else{var title1=treeElement1.titleText;var title2=treeElement2.titleText;result=title1.compareTo(title2);}
699 return result;}
700 WebInspector.NavigatorTreeOutline.prototype={scriptTreeElements:function()
701 {var result=[];if(this.children.length){for(var treeElement=this.children[0];treeElement;treeElement=treeElement.traverseNextTreeElement(false,this,true)){if(treeElement instanceof WebInspector.NavigatorSourceTreeElement)
702 result.push(treeElement.uiSourceCode);}}
703 return result;},__proto__:TreeOutline.prototype}
704 WebInspector.BaseNavigatorTreeElement=function(type,title,iconClasses,hasChildren,noIcon)
705 {this._type=type;TreeElement.call(this,"",null,hasChildren);this._titleText=title;this._iconClasses=iconClasses;this._noIcon=noIcon;}
706 WebInspector.BaseNavigatorTreeElement.prototype={onattach:function()
707 {this.listItemElement.removeChildren();if(this._iconClasses){for(var i=0;i<this._iconClasses.length;++i)
708 this.listItemElement.classList.add(this._iconClasses[i]);}
709 var selectionElement=document.createElement("div");selectionElement.className="selection";this.listItemElement.appendChild(selectionElement);if(!this._noIcon){this.imageElement=document.createElement("img");this.imageElement.className="icon";this.listItemElement.appendChild(this.imageElement);}
710 this.titleElement=document.createElement("div");this.titleElement.className="base-navigator-tree-element-title";this._titleTextNode=document.createTextNode("");this._titleTextNode.textContent=this._titleText;this.titleElement.appendChild(this._titleTextNode);this.listItemElement.appendChild(this.titleElement);},updateIconClasses:function(iconClasses)
711 {for(var i=0;i<this._iconClasses.length;++i)
712 this.listItemElement.classList.remove(this._iconClasses[i]);this._iconClasses=iconClasses;for(var i=0;i<this._iconClasses.length;++i)
713 this.listItemElement.classList.add(this._iconClasses[i]);},onreveal:function()
714 {if(this.listItemElement)
715 this.listItemElement.scrollIntoViewIfNeeded(true);},get titleText()
716 {return this._titleText;},set titleText(titleText)
717 {if(this._titleText===titleText)
718 return;this._titleText=titleText||"";if(this.titleElement)
719 this.titleElement.textContent=this._titleText;},type:function()
720 {return this._type;},__proto__:TreeElement.prototype}
721 WebInspector.NavigatorFolderTreeElement=function(navigatorView,type,title)
722 {var iconClass=WebInspector.NavigatorView.iconClassForType(type);WebInspector.BaseNavigatorTreeElement.call(this,type,title,[iconClass],true);this._navigatorView=navigatorView;}
723 WebInspector.NavigatorFolderTreeElement.prototype={onpopulate:function()
724 {this._node.populate();},onattach:function()
725 {WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this);this.collapse();this.listItemElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);},setNode:function(node)
726 {this._node=node;var paths=[];while(node&&!node.isRoot()){paths.push(node._title);node=node.parent;}
727 paths.reverse();this.tooltip=paths.join("/");},_handleContextMenuEvent:function(event)
728 {if(!this._node)
729 return;this.select();this._navigatorView.handleFolderContextMenu((event),this._node);},__proto__:WebInspector.BaseNavigatorTreeElement.prototype}
730 WebInspector.NavigatorSourceTreeElement=function(navigatorView,uiSourceCode,title)
731 {this._navigatorView=navigatorView;this._uiSourceCode=uiSourceCode;WebInspector.BaseNavigatorTreeElement.call(this,WebInspector.NavigatorTreeOutline.Types.UISourceCode,title,this._calculateIconClasses(),false);this.tooltip=uiSourceCode.originURL();}
732 WebInspector.NavigatorSourceTreeElement.prototype={get uiSourceCode()
733 {return this._uiSourceCode;},_calculateIconClasses:function()
734 {return["navigator-"+this._uiSourceCode.contentType().name()+"-tree-item"];},updateIcon:function()
735 {this.updateIconClasses(this._calculateIconClasses());},onattach:function()
736 {WebInspector.BaseNavigatorTreeElement.prototype.onattach.call(this);this.listItemElement.draggable=true;this.listItemElement.addEventListener("click",this._onclick.bind(this),false);this.listItemElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);this.listItemElement.addEventListener("mousedown",this._onmousedown.bind(this),false);this.listItemElement.addEventListener("dragstart",this._ondragstart.bind(this),false);},_onmousedown:function(event)
737 {if(event.which===1)
738 this._uiSourceCode.requestContent(callback.bind(this));function callback(content)
739 {this._warmedUpContent=content;}},_shouldRenameOnMouseDown:function()
740 {if(!this._uiSourceCode.canRename())
741 return false;var isSelected=this===this.treeOutline.selectedTreeElement;var isFocused=this.treeOutline.childrenListElement.isSelfOrAncestor(document.activeElement);return isSelected&&isFocused&&!WebInspector.isBeingEdited(this.treeOutline.element);},selectOnMouseDown:function(event)
742 {if(event.which!==1||!this._shouldRenameOnMouseDown()){TreeElement.prototype.selectOnMouseDown.call(this,event);return;}
743 setTimeout(rename.bind(this),300);function rename()
744 {if(this._shouldRenameOnMouseDown())
745 this._navigatorView.rename(this.uiSourceCode,false);}},_ondragstart:function(event)
746 {event.dataTransfer.setData("text/plain",this._warmedUpContent);event.dataTransfer.effectAllowed="copy";return true;},onspace:function()
747 {this._navigatorView._sourceSelected(this.uiSourceCode,true);return true;},_onclick:function(event)
748 {this._navigatorView._sourceSelected(this.uiSourceCode,false);},ondblclick:function(event)
749 {var middleClick=event.button===1;this._navigatorView._sourceSelected(this.uiSourceCode,!middleClick);return false;},onenter:function()
750 {this._navigatorView._sourceSelected(this.uiSourceCode,true);return true;},ondelete:function()
751 {this._navigatorView.sourceDeleted(this.uiSourceCode);return true;},_handleContextMenuEvent:function(event)
752 {this.select();this._navigatorView.handleFileContextMenu(event,this._uiSourceCode);},__proto__:WebInspector.BaseNavigatorTreeElement.prototype}
753 WebInspector.NavigatorTreeNode=function(id)
754 {this.id=id;this._children=new StringMap();}
755 WebInspector.NavigatorTreeNode.prototype={treeElement:function(){throw"Not implemented";},dispose:function(){},isRoot:function()
756 {return false;},hasChildren:function()
757 {return true;},populate:function()
758 {if(this.isPopulated())
759 return;if(this.parent)
760 this.parent.populate();this._populated=true;this.wasPopulated();},wasPopulated:function()
761 {var children=this.children();for(var i=0;i<children.length;++i)
762 this.treeElement().appendChild(children[i].treeElement());},didAddChild:function(node)
763 {if(this.isPopulated())
764 this.treeElement().appendChild(node.treeElement());},willRemoveChild:function(node)
765 {if(this.isPopulated())
766 this.treeElement().removeChild(node.treeElement());},isPopulated:function()
767 {return this._populated;},isEmpty:function()
768 {return!this._children.size();},child:function(id)
769 {return this._children.get(id)||null;},children:function()
770 {return this._children.values();},appendChild:function(node)
771 {this._children.put(node.id,node);node.parent=this;this.didAddChild(node);},removeChild:function(node)
772 {this.willRemoveChild(node);this._children.remove(node.id);delete node.parent;node.dispose();},reset:function()
773 {this._children.clear();}}
774 WebInspector.NavigatorRootTreeNode=function(navigatorView)
775 {WebInspector.NavigatorTreeNode.call(this,"");this._navigatorView=navigatorView;}
776 WebInspector.NavigatorRootTreeNode.prototype={isRoot:function()
777 {return true;},treeElement:function()
778 {return this._navigatorView._scriptsTree;},__proto__:WebInspector.NavigatorTreeNode.prototype}
779 WebInspector.NavigatorUISourceCodeTreeNode=function(navigatorView,uiSourceCode)
780 {WebInspector.NavigatorTreeNode.call(this,uiSourceCode.name());this._navigatorView=navigatorView;this._uiSourceCode=uiSourceCode;this._treeElement=null;}
781 WebInspector.NavigatorUISourceCodeTreeNode.prototype={uiSourceCode:function()
782 {return this._uiSourceCode;},updateIcon:function()
783 {if(this._treeElement)
784 this._treeElement.updateIcon();},treeElement:function()
785 {if(this._treeElement)
786 return this._treeElement;this._treeElement=new WebInspector.NavigatorSourceTreeElement(this._navigatorView,this._uiSourceCode,"");this.updateTitle();this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged,this._titleChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);return this._treeElement;},updateTitle:function(ignoreIsDirty)
787 {if(!this._treeElement)
788 return;var titleText=this._uiSourceCode.displayName();if(!ignoreIsDirty&&(this._uiSourceCode.isDirty()||this._uiSourceCode.hasUnsavedCommittedChanges()))
789 titleText="*"+titleText;this._treeElement.titleText=titleText;},hasChildren:function()
790 {return false;},dispose:function()
791 {if(!this._treeElement)
792 return;this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged,this._titleChanged,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);},_titleChanged:function(event)
793 {this.updateTitle();},_workingCopyChanged:function(event)
794 {this.updateTitle();},_workingCopyCommitted:function(event)
795 {this.updateTitle();},reveal:function(select)
796 {this.parent.populate();this.parent.treeElement().expand();this._treeElement.reveal();if(select)
797 this._treeElement.select(true);},rename:function(callback)
798 {if(!this._treeElement)
799 return;var treeOutlineElement=this._treeElement.treeOutline.element;WebInspector.markBeingEdited(treeOutlineElement,true);function commitHandler(element,newTitle,oldTitle)
800 {if(newTitle!==oldTitle){this._treeElement.titleText=newTitle;this._uiSourceCode.rename(newTitle,renameCallback.bind(this));return;}
801 afterEditing.call(this,true);}
802 function renameCallback(success)
803 {if(!success){WebInspector.markBeingEdited(treeOutlineElement,false);this.updateTitle();this.rename(callback);return;}
804 afterEditing.call(this,true);}
805 function cancelHandler()
806 {afterEditing.call(this,false);}
807 function afterEditing(committed)
808 {WebInspector.markBeingEdited(treeOutlineElement,false);this.updateTitle();this._treeElement.treeOutline.childrenListElement.focus();if(callback)
809 callback(committed);}
810 var editingConfig=new WebInspector.InplaceEditor.Config(commitHandler.bind(this),cancelHandler.bind(this));this.updateTitle(true);WebInspector.InplaceEditor.startEditing(this._treeElement.titleElement,editingConfig);window.getSelection().setBaseAndExtent(this._treeElement.titleElement,0,this._treeElement.titleElement,1);},__proto__:WebInspector.NavigatorTreeNode.prototype}
811 WebInspector.NavigatorFolderTreeNode=function(navigatorView,project,id,type,folderPath,title)
812 {WebInspector.NavigatorTreeNode.call(this,id);this._navigatorView=navigatorView;this._project=project;this._type=type;this._folderPath=folderPath;this._title=title;}
813 WebInspector.NavigatorFolderTreeNode.prototype={treeElement:function()
814 {if(this._treeElement)
815 return this._treeElement;this._treeElement=this._createTreeElement(this._title,this);return this._treeElement;},_createTreeElement:function(title,node)
816 {var treeElement=new WebInspector.NavigatorFolderTreeElement(this._navigatorView,this._type,title);treeElement.setNode(node);return treeElement;},wasPopulated:function()
817 {if(!this._treeElement||this._treeElement._node!==this)
818 return;this._addChildrenRecursive();},_addChildrenRecursive:function()
819 {var children=this.children();for(var i=0;i<children.length;++i){var child=children[i];this.didAddChild(child);if(child instanceof WebInspector.NavigatorFolderTreeNode)
820 child._addChildrenRecursive();}},_shouldMerge:function(node)
821 {return this._type!==WebInspector.NavigatorTreeOutline.Types.Domain&&node instanceof WebInspector.NavigatorFolderTreeNode;},didAddChild:function(node)
822 {function titleForNode(node)
823 {return node._title;}
824 if(!this._treeElement)
825 return;var children=this.children();if(children.length===1&&this._shouldMerge(node)){node._isMerged=true;this._treeElement.titleText=this._treeElement.titleText+"/"+node._title;node._treeElement=this._treeElement;this._treeElement.setNode(node);return;}
826 var oldNode;if(children.length===2)
827 oldNode=children[0]!==node?children[0]:children[1];if(oldNode&&oldNode._isMerged){delete oldNode._isMerged;var mergedToNodes=[];mergedToNodes.push(this);var treeNode=this;while(treeNode._isMerged){treeNode=treeNode.parent;mergedToNodes.push(treeNode);}
828 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._isMerged);if(!this.isPopulated()){this._treeElement.titleText=titleText;this._treeElement.setNode(this);for(var i=0;i<nodes.length;++i){delete nodes[i]._treeElement;delete nodes[i]._isMerged;}
829 return;}
830 var oldTreeElement=this._treeElement;var treeElement=this._createTreeElement(titleText,this);for(var i=0;i<mergedToNodes.length;++i)
831 mergedToNodes[i]._treeElement=treeElement;oldTreeElement.parent.appendChild(treeElement);oldTreeElement.setNode(nodes[nodes.length-1]);oldTreeElement.titleText=nodes.map(titleForNode).join("/");oldTreeElement.parent.removeChild(oldTreeElement);this._treeElement.appendChild(oldTreeElement);if(oldTreeElement.expanded)
832 treeElement.expand();}
833 if(this.isPopulated())
834 this._treeElement.appendChild(node.treeElement());},willRemoveChild:function(node)
835 {if(node._isMerged||!this.isPopulated())
836 return;this._treeElement.removeChild(node._treeElement);},__proto__:WebInspector.NavigatorTreeNode.prototype};WebInspector.RevisionHistoryView=function()
837 {WebInspector.VBox.call(this);this.registerRequiredCSS("revisionHistory.css");this.element.classList.add("revision-history-drawer");this.element.classList.add("outline-disclosure");this._uiSourceCodeItems=new Map();var olElement=this.element.createChild("ol");this._treeOutline=new TreeOutline(olElement);function populateRevisions(uiSourceCode)
838 {if(uiSourceCode.history.length)
839 this._createUISourceCodeItem(uiSourceCode);}
840 WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this));WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,this._revisionAdded,this);WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved,this);}
841 WebInspector.RevisionHistoryView.showHistory=function(uiSourceCode)
842 {if(!WebInspector.RevisionHistoryView._view)
843 WebInspector.RevisionHistoryView._view=new WebInspector.RevisionHistoryView();var view=WebInspector.RevisionHistoryView._view;WebInspector.inspectorView.showCloseableViewInDrawer("history",WebInspector.UIString("History"),view);view._revealUISourceCode(uiSourceCode);}
844 WebInspector.RevisionHistoryView.prototype={_createUISourceCodeItem:function(uiSourceCode)
845 {var uiSourceCodeItem=new TreeElement(uiSourceCode.displayName(),null,true);uiSourceCodeItem.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;}}
846 if(i===this._treeOutline.children.length)
847 this._treeOutline.appendChild(uiSourceCodeItem);this._uiSourceCodeItems.put(uiSourceCode,uiSourceCodeItem);var revisionCount=uiSourceCode.history.length;for(var i=revisionCount-1;i>=0;--i){var revision=uiSourceCode.history[i];var historyItem=new WebInspector.RevisionHistoryTreeElement(revision,uiSourceCode.history[i-1],i!==revisionCount-1);uiSourceCodeItem.appendChild(historyItem);}
848 var linkItem=new TreeElement("",null,false);linkItem.selectable=false;uiSourceCodeItem.appendChild(linkItem);var revertToOriginal=linkItem.listItemElement.createChild("span","revision-history-link revision-history-link-row");revertToOriginal.textContent=WebInspector.UIString("apply original content");revertToOriginal.addEventListener("click",uiSourceCode.revertToOriginal.bind(uiSourceCode));var clearHistoryElement=uiSourceCodeItem.listItemElement.createChild("span","revision-history-link");clearHistoryElement.textContent=WebInspector.UIString("revert");clearHistoryElement.addEventListener("click",this._clearHistory.bind(this,uiSourceCode));return uiSourceCodeItem;},_clearHistory:function(uiSourceCode)
849 {uiSourceCode.revertAndClearHistory(this._removeUISourceCode.bind(this));},_revisionAdded:function(event)
850 {var uiSourceCode=(event.data.uiSourceCode);var uiSourceCodeItem=this._uiSourceCodeItems.get(uiSourceCode);if(!uiSourceCodeItem){uiSourceCodeItem=this._createUISourceCodeItem(uiSourceCode);return;}
851 var historyLength=uiSourceCode.history.length;var historyItem=new WebInspector.RevisionHistoryTreeElement(uiSourceCode.history[historyLength-1],uiSourceCode.history[historyLength-2],false);if(uiSourceCodeItem.children.length)
852 uiSourceCodeItem.children[0].allowRevert();uiSourceCodeItem.insertChild(historyItem,0);},_revealUISourceCode:function(uiSourceCode)
853 {var uiSourceCodeItem=this._uiSourceCodeItems.get(uiSourceCode);if(uiSourceCodeItem){uiSourceCodeItem.reveal();uiSourceCodeItem.expand();}},_uiSourceCodeRemoved:function(event)
854 {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_removeUISourceCode:function(uiSourceCode)
855 {var uiSourceCodeItem=this._uiSourceCodeItems.get(uiSourceCode);if(!uiSourceCodeItem)
856 return;this._treeOutline.removeChild(uiSourceCodeItem);this._uiSourceCodeItems.remove(uiSourceCode);},_projectRemoved:function(event)
857 {var project=event.data;project.uiSourceCodes().forEach(this._removeUISourceCode.bind(this));},__proto__:WebInspector.VBox.prototype}
858 WebInspector.RevisionHistoryTreeElement=function(revision,baseRevision,allowRevert)
859 {TreeElement.call(this,revision.timestamp.toLocaleTimeString(),null,true);this.selectable=false;this._revision=revision;this._baseRevision=baseRevision;this._revertElement=document.createElement("span");this._revertElement.className="revision-history-link";this._revertElement.textContent=WebInspector.UIString("apply revision content");this._revertElement.addEventListener("click",this._revision.revertToThis.bind(this._revision),false);if(!allowRevert)
860 this._revertElement.classList.add("hidden");}
861 WebInspector.RevisionHistoryTreeElement.prototype={onattach:function()
862 {this.listItemElement.classList.add("revision-history-revision");},onexpand:function()
863 {this.listItemElement.appendChild(this._revertElement);if(this._wasExpandedOnce)
864 return;this._wasExpandedOnce=true;this.childrenListElement.classList.add("source-code");if(this._baseRevision)
865 this._baseRevision.requestContent(step1.bind(this));else
866 this._revision.uiSourceCode.requestOriginalContent(step1.bind(this));function step1(baseContent)
867 {this._revision.requestContent(step2.bind(this,baseContent));}
868 function step2(baseContent,newContent)
869 {var baseLines=difflib.stringAsLines(baseContent);var newLines=difflib.stringAsLines(newContent);var sm=new difflib.SequenceMatcher(baseLines,newLines);var opcodes=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];var n=code[3];var ne=code[4];var rowCount=Math.max(be-b,ne-n);var topRows=[];var bottomRows=[];for(var i=0;i<rowCount;i++){if(change==="delete"||(change==="replace"&&b<be)){var lineNumber=b++;this._createLine(lineNumber,null,baseLines[lineNumber],"removed");lastWasSeparator=false;}
870 if(change==="insert"||(change==="replace"&&n<ne)){var lineNumber=n++;this._createLine(null,lineNumber,newLines[lineNumber],"added");lastWasSeparator=false;}
871 if(change==="equal"){b++;n++;if(!lastWasSeparator)
872 this._createLine(null,null,"    \u2026","separator");lastWasSeparator=true;}}}}},oncollapse:function()
873 {this._revertElement.remove();},_createLine:function(baseLineNumber,newLineNumber,lineContent,changeType)
874 {var child=new TreeElement("",null,false);child.selectable=false;this.appendChild(child);var lineElement=document.createElement("span");function appendLineNumber(lineNumber)
875 {var numberString=lineNumber!==null?numberToStringWithSpacesPadding(lineNumber+1,4):"    ";var lineNumberSpan=document.createElement("span");lineNumberSpan.classList.add("webkit-line-number");lineNumberSpan.textContent=numberString;child.listItemElement.appendChild(lineNumberSpan);}
876 appendLineNumber(baseLineNumber);appendLineNumber(newLineNumber);var contentSpan=document.createElement("span");contentSpan.textContent=lineContent;child.listItemElement.appendChild(contentSpan);child.listItemElement.classList.add("revision-history-line");child.listItemElement.classList.add("revision-history-line-"+changeType);},allowRevert:function()
877 {this._revertElement.classList.remove("hidden");},__proto__:TreeElement.prototype};WebInspector.ScopeChainSidebarPane=function()
878 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Scope Variables"));this._sections=[];this._expandedSections={};this._expandedProperties=[];}
879 WebInspector.ScopeChainSidebarPane.prototype={update:function(callFrame)
880 {this.bodyElement.removeChildren();if(!callFrame){var infoElement=document.createElement("div");infoElement.className="info";infoElement.textContent=WebInspector.UIString("Not Paused");this.bodyElement.appendChild(infoElement);return;}
881 for(var i=0;i<this._sections.length;++i){var section=this._sections[i];if(!section.title)
882 continue;if(section.expanded)
883 this._expandedSections[section.title]=true;else
884 delete this._expandedSections[section.title];}
885 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=[];var declarativeScope;switch(scope.type){case DebuggerAgent.ScopeType.Local:foundLocalScope=true;title=WebInspector.UIString("Local");emptyPlaceholder=WebInspector.UIString("No Variables");subtitle=undefined;var thisObject=callFrame.thisObject();if(thisObject)
886 extraProperties.push(new WebInspector.RemoteObjectProperty("this",thisObject));if(i==0){var details=callFrame.target().debuggerModel.debuggerPausedDetails();if(!callFrame.isAsync()){var exception=details.exception();if(exception)
887 extraProperties.push(new WebInspector.RemoteObjectProperty("<exception>",exception));}
888 var returnValue=callFrame.returnValue();if(returnValue)
889 extraProperties.push(new WebInspector.RemoteObjectProperty("<return>",returnValue));}
890 declarativeScope=true;break;case DebuggerAgent.ScopeType.Closure:title=WebInspector.UIString("Closure");emptyPlaceholder=WebInspector.UIString("No Variables");subtitle=undefined;declarativeScope=true;break;case DebuggerAgent.ScopeType.Catch:title=WebInspector.UIString("Catch");subtitle=undefined;declarativeScope=true;break;case DebuggerAgent.ScopeType.With:title=WebInspector.UIString("With Block");declarativeScope=false;break;case DebuggerAgent.ScopeType.Global:title=WebInspector.UIString("Global");declarativeScope=false;break;}
891 if(!title||title===subtitle)
892 subtitle=undefined;var runtimeModel=callFrame.target().runtimeModel;if(declarativeScope)
893 var scopeObject=runtimeModel.createScopeRemoteObject(scope.object,new WebInspector.ScopeRef(i,callFrame.id,undefined));else
894 var scopeObject=runtimeModel.createRemoteObject(scope.object);var section=new WebInspector.ObjectPropertiesSection(scopeObject,title,subtitle,emptyPlaceholder,true,extraProperties,WebInspector.ScopeVariableTreeElement);section.editInSelectedCallFrameWhenPaused=true;section.pane=this;if(scope.type===DebuggerAgent.ScopeType.Global)
895 section.expanded=false;else if(!foundLocalScope||scope.type===DebuggerAgent.ScopeType.Local||title in this._expandedSections)
896 section.expanded=true;this._sections.push(section);this.bodyElement.appendChild(section.element);}},__proto__:WebInspector.SidebarPane.prototype}
897 WebInspector.ScopeVariableTreeElement=function(property)
898 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
899 WebInspector.ScopeVariableTreeElement.prototype={onattach:function()
900 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.hasChildren&&this.propertyIdentifier in this.treeOutline.section.pane._expandedProperties)
901 this.expand();},onexpand:function()
902 {this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier]=true;},oncollapse:function()
903 {delete this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier];},get propertyIdentifier()
904 {if("_propertyIdentifier"in this)
905 return this._propertyIdentifier;var section=this.treeOutline.section;this._propertyIdentifier=section.title+":"+(section.subtitle?section.subtitle+":":"")+this.propertyPath();return this._propertyIdentifier;},__proto__:WebInspector.ObjectPropertyTreeElement.prototype};WebInspector.SourcesNavigator=function(workspace)
906 {WebInspector.Object.call(this);this._workspace=workspace;this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.shrinkableTabs=true;this._tabbedPane.element.classList.add("navigator-tabbed-pane");new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane,"navigator-view",this._navigatorViewCreated.bind(this));this._navigatorViews=new StringMap();}
907 WebInspector.SourcesNavigator.Events={SourceSelected:"SourceSelected",SourceRenamed:"SourceRenamed"}
908 WebInspector.SourcesNavigator.prototype={_navigatorViewCreated:function(id,view)
909 {var navigatorView=(view);navigatorView.addEventListener(WebInspector.NavigatorView.Events.ItemSelected,this._sourceSelected,this);navigatorView.addEventListener(WebInspector.NavigatorView.Events.ItemRenamed,this._sourceRenamed,this);this._navigatorViews.put(id,navigatorView);navigatorView.setWorkspace(this._workspace);},get view()
910 {return this._tabbedPane;},_navigatorViewIdForUISourceCode:function(uiSourceCode)
911 {var ids=this._navigatorViews.keys();for(var i=0;i<ids.length;++i){var id=ids[i]
912 var navigatorView=this._navigatorViews.get(id);if(navigatorView.accept(uiSourceCode))
913 return id;}
914 return null;},revealUISourceCode:function(uiSourceCode)
915 {var id=this._navigatorViewIdForUISourceCode(uiSourceCode);if(!id)
916 return;var navigatorView=this._navigatorViews.get(id);console.assert(navigatorView);navigatorView.revealUISourceCode(uiSourceCode,true);this._tabbedPane.selectTab(id);},_sourceSelected:function(event)
917 {this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.SourceSelected,event.data);},_sourceRenamed:function(event)
918 {this.dispatchEventToListeners(WebInspector.SourcesNavigator.Events.SourceRenamed,event.data);},__proto__:WebInspector.Object.prototype}
919 WebInspector.SnippetsNavigatorView=function()
920 {WebInspector.NavigatorView.call(this);}
921 WebInspector.SnippetsNavigatorView.prototype={accept:function(uiSourceCode)
922 {if(!WebInspector.NavigatorView.prototype.accept(uiSourceCode))
923 return false;return uiSourceCode.project().type()===WebInspector.projectTypes.Snippets;},handleContextMenu:function(event)
924 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("New"),this._handleCreateSnippet.bind(this));contextMenu.show();},handleFileContextMenu:function(event,uiSourceCode)
925 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Run"),this._handleEvaluateSnippet.bind(this,uiSourceCode));contextMenu.appendItem(WebInspector.UIString("Rename"),this.rename.bind(this,uiSourceCode));contextMenu.appendItem(WebInspector.UIString("Remove"),this._handleRemoveSnippet.bind(this,uiSourceCode));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("New"),this._handleCreateSnippet.bind(this));contextMenu.show();},_handleEvaluateSnippet:function(uiSourceCode)
926 {var executionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets||!executionContext)
927 return;WebInspector.scriptSnippetModel.evaluateScriptSnippet(executionContext,uiSourceCode);},_handleRemoveSnippet:function(uiSourceCode)
928 {if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets)
929 return;uiSourceCode.remove();},_handleCreateSnippet:function()
930 {this.create(WebInspector.scriptSnippetModel.project(),"")},sourceDeleted:function(uiSourceCode)
931 {this._handleRemoveSnippet(uiSourceCode);},__proto__:WebInspector.NavigatorView.prototype};WebInspector.StyleSheetOutlineDialog=function(uiSourceCode,selectItemCallback)
932 {WebInspector.SelectionDialogContentProvider.call(this);this._selectItemCallback=selectItemCallback;this._cssParser=new WebInspector.CSSParser();this._cssParser.addEventListener(WebInspector.CSSParser.Events.RulesParsed,this.refresh.bind(this));this._cssParser.parse(uiSourceCode.workingCopy());}
933 WebInspector.StyleSheetOutlineDialog.show=function(view,uiSourceCode,selectItemCallback)
934 {if(WebInspector.Dialog.currentInstance())
935 return;var delegate=new WebInspector.StyleSheetOutlineDialog(uiSourceCode,selectItemCallback);var filteredItemSelectionDialog=new WebInspector.FilteredItemSelectionDialog(delegate);WebInspector.Dialog.show(view.element,filteredItemSelectionDialog);}
936 WebInspector.StyleSheetOutlineDialog.prototype={itemCount:function()
937 {return this._cssParser.rules().length;},itemKeyAt:function(itemIndex)
938 {var rule=this._cssParser.rules()[itemIndex];return rule.selectorText||rule.atRule;},itemScoreAt:function(itemIndex,query)
939 {var rule=this._cssParser.rules()[itemIndex];return-rule.lineNumber;},renderItem:function(itemIndex,query,titleElement,subtitleElement)
940 {var rule=this._cssParser.rules()[itemIndex];titleElement.textContent=rule.selectorText||rule.atRule;this.highlightRanges(titleElement,query);subtitleElement.textContent=":"+(rule.lineNumber+1);},selectItem:function(itemIndex,promptValue)
941 {var rule=this._cssParser.rules()[itemIndex];var lineNumber=rule.lineNumber;if(!isNaN(lineNumber)&&lineNumber>=0)
942 this._selectItemCallback(lineNumber,rule.columnNumber);},dispose:function()
943 {this._cssParser.dispose();},__proto__:WebInspector.SelectionDialogContentProvider.prototype};WebInspector.TabbedEditorContainerDelegate=function(){}
944 WebInspector.TabbedEditorContainerDelegate.prototype={viewForFile:function(uiSourceCode){},}
945 WebInspector.TabbedEditorContainer=function(delegate,settingName,placeholderText)
946 {WebInspector.Object.call(this);this._delegate=delegate;this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.setPlaceholderText(placeholderText);this._tabbedPane.setTabDelegate(new WebInspector.EditorContainerTabDelegate(this));this._tabbedPane.closeableTabs=true;this._tabbedPane.element.id="sources-editor-container-tabbed-pane";this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabClosed,this._tabClosed,this);this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._tabIds=new Map();this._files={};this._previouslyViewedFilesSetting=WebInspector.settings.createSetting(settingName,[]);this._history=WebInspector.TabbedEditorContainer.History.fromObject(this._previouslyViewedFilesSetting.get());}
947 WebInspector.TabbedEditorContainer.Events={EditorSelected:"EditorSelected",EditorClosed:"EditorClosed"}
948 WebInspector.TabbedEditorContainer._tabId=0;WebInspector.TabbedEditorContainer.maximalPreviouslyViewedFilesCount=30;WebInspector.TabbedEditorContainer.prototype={get view()
949 {return this._tabbedPane;},get visibleView()
950 {return this._tabbedPane.visibleView;},fileViews:function()
951 {return(this._tabbedPane.tabViews());},show:function(parentElement)
952 {this._tabbedPane.show(parentElement);},showFile:function(uiSourceCode)
953 {this._innerShowFile(uiSourceCode,true);},closeFile:function(uiSourceCode)
954 {var tabId=this._tabIds.get(uiSourceCode);if(!tabId)
955 return;this._closeTabs([tabId]);},historyUISourceCodes:function()
956 {var uriToUISourceCode={};for(var id in this._files){var uiSourceCode=this._files[id];uriToUISourceCode[uiSourceCode.uri()]=uiSourceCode;}
957 var result=[];var uris=this._history._urls();for(var i=0;i<uris.length;++i){var uiSourceCode=uriToUISourceCode[uris[i]];if(uiSourceCode)
958 result.push(uiSourceCode);}
959 return result;},_addViewListeners:function()
960 {if(!this._currentView)
961 return;this._currentView.addEventListener(WebInspector.SourceFrame.Events.ScrollChanged,this._scrollChanged,this);this._currentView.addEventListener(WebInspector.SourceFrame.Events.SelectionChanged,this._selectionChanged,this);},_removeViewListeners:function()
962 {if(!this._currentView)
963 return;this._currentView.removeEventListener(WebInspector.SourceFrame.Events.ScrollChanged,this._scrollChanged,this);this._currentView.removeEventListener(WebInspector.SourceFrame.Events.SelectionChanged,this._selectionChanged,this);},_scrollChanged:function(event)
964 {var lineNumber=(event.data);this._history.updateScrollLineNumber(this._currentFile.uri(),lineNumber);this._history.save(this._previouslyViewedFilesSetting);},_selectionChanged:function(event)
965 {var range=(event.data);this._history.updateSelectionRange(this._currentFile.uri(),range);this._history.save(this._previouslyViewedFilesSetting);},_innerShowFile:function(uiSourceCode,userGesture)
966 {if(this._currentFile===uiSourceCode)
967 return;this._removeViewListeners();this._currentFile=uiSourceCode;var tabId=this._tabIds.get(uiSourceCode)||this._appendFileTab(uiSourceCode,userGesture);this._tabbedPane.selectTab(tabId,userGesture);if(userGesture)
968 this._editorSelectedByUserAction();this._currentView=this.visibleView;this._addViewListeners();var eventData={currentFile:this._currentFile,userGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedEditorContainer.Events.EditorSelected,eventData);},_titleForFile:function(uiSourceCode)
969 {var maxDisplayNameLength=30;var title=uiSourceCode.displayName(true).trimMiddle(maxDisplayNameLength);if(uiSourceCode.isDirty()||uiSourceCode.hasUnsavedCommittedChanges())
970 title+="*";return title;},_maybeCloseTab:function(id,nextTabId)
971 {var uiSourceCode=this._files[id];var shouldPrompt=uiSourceCode.isDirty()&&uiSourceCode.project().canSetFileContent();if(!shouldPrompt||confirm(WebInspector.UIString("Are you sure you want to close unsaved file: %s?",uiSourceCode.name()))){uiSourceCode.resetWorkingCopy();if(nextTabId)
972 this._tabbedPane.selectTab(nextTabId,true);this._tabbedPane.closeTab(id,true);return true;}
973 return false;},_closeTabs:function(ids)
974 {var dirtyTabs=[];var cleanTabs=[];for(var i=0;i<ids.length;++i){var id=ids[i];var uiSourceCode=this._files[id];if(uiSourceCode.isDirty())
975 dirtyTabs.push(id);else
976 cleanTabs.push(id);}
977 if(dirtyTabs.length)
978 this._tabbedPane.selectTab(dirtyTabs[0],true);this._tabbedPane.closeTabs(cleanTabs,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))
979 break;}},addUISourceCode:function(uiSourceCode)
980 {var uri=uiSourceCode.uri();if(this._userSelectedFiles)
981 return;var index=this._history.index(uri)
982 if(index===-1)
983 return;var tabId=this._tabIds.get(uiSourceCode)||this._appendFileTab(uiSourceCode,false);if(!this._currentFile)
984 return;if(!index){this._innerShowFile(uiSourceCode,false);return;}
985 var currentProjectType=this._currentFile.project().type();var addedProjectType=uiSourceCode.project().type();var snippetsProjectType=WebInspector.projectTypes.Snippets;if(this._history.index(this._currentFile.uri())&&currentProjectType===snippetsProjectType&&addedProjectType!==snippetsProjectType)
986 this._innerShowFile(uiSourceCode,false);},removeUISourceCode:function(uiSourceCode)
987 {this.removeUISourceCodes([uiSourceCode]);},removeUISourceCodes:function(uiSourceCodes)
988 {var tabIds=[];for(var i=0;i<uiSourceCodes.length;++i){var uiSourceCode=uiSourceCodes[i];var tabId=this._tabIds.get(uiSourceCode);if(tabId)
989 tabIds.push(tabId);}
990 this._tabbedPane.closeTabs(tabIds);},_editorClosedByUserAction:function(uiSourceCode)
991 {this._userSelectedFiles=true;this._history.remove(uiSourceCode.uri());this._updateHistory();},_editorSelectedByUserAction:function()
992 {this._userSelectedFiles=true;this._updateHistory();},_updateHistory:function()
993 {var tabIds=this._tabbedPane.lastOpenedTabIds(WebInspector.TabbedEditorContainer.maximalPreviouslyViewedFilesCount);function tabIdToURI(tabId)
994 {return this._files[tabId].uri();}
995 this._history.update(tabIds.map(tabIdToURI.bind(this)));this._history.save(this._previouslyViewedFilesSetting);},_tooltipForFile:function(uiSourceCode)
996 {return uiSourceCode.originURL();},_appendFileTab:function(uiSourceCode,userGesture)
997 {var view=this._delegate.viewForFile(uiSourceCode);var title=this._titleForFile(uiSourceCode);var tooltip=this._tooltipForFile(uiSourceCode);var tabId=this._generateTabId();this._tabIds.put(uiSourceCode,tabId);this._files[tabId]=uiSourceCode;var savedSelectionRange=this._history.selectionRange(uiSourceCode.uri());if(savedSelectionRange)
998 view.setSelection(savedSelectionRange);var savedScrollLineNumber=this._history.scrollLineNumber(uiSourceCode.uri());if(savedScrollLineNumber)
999 view.scrollToLine(savedScrollLineNumber);this._tabbedPane.appendTab(tabId,title,view,tooltip,userGesture);this._updateFileTitle(uiSourceCode);this._addUISourceCodeListeners(uiSourceCode);return tabId;},_tabClosed:function(event)
1000 {var tabId=(event.data.tabId);var userGesture=(event.data.isUserGesture);var uiSourceCode=this._files[tabId];if(this._currentFile===uiSourceCode){this._removeViewListeners();delete this._currentView;delete this._currentFile;}
1001 this._tabIds.remove(uiSourceCode);delete this._files[tabId];this._removeUISourceCodeListeners(uiSourceCode);this.dispatchEventToListeners(WebInspector.TabbedEditorContainer.Events.EditorClosed,uiSourceCode);if(userGesture)
1002 this._editorClosedByUserAction(uiSourceCode);},_tabSelected:function(event)
1003 {var tabId=(event.data.tabId);var userGesture=(event.data.isUserGesture);var uiSourceCode=this._files[tabId];this._innerShowFile(uiSourceCode,userGesture);},_addUISourceCodeListeners:function(uiSourceCode)
1004 {uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleChanged,this._uiSourceCodeTitleChanged,this);uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._uiSourceCodeWorkingCopyChanged,this);uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._uiSourceCodeWorkingCopyCommitted,this);uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SavedStateUpdated,this._uiSourceCodeSavedStateUpdated,this);},_removeUISourceCodeListeners:function(uiSourceCode)
1005 {uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.TitleChanged,this._uiSourceCodeTitleChanged,this);uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._uiSourceCodeWorkingCopyChanged,this);uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._uiSourceCodeWorkingCopyCommitted,this);uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SavedStateUpdated,this._uiSourceCodeSavedStateUpdated,this);},_updateFileTitle:function(uiSourceCode)
1006 {var tabId=this._tabIds.get(uiSourceCode);if(tabId){var title=this._titleForFile(uiSourceCode);this._tabbedPane.changeTabTitle(tabId,title);if(uiSourceCode.hasUnsavedCommittedChanges())
1007 this._tabbedPane.setTabIcon(tabId,"editor-container-unsaved-committed-changes-icon",WebInspector.UIString("Changes to this file were not saved to file system."));else
1008 this._tabbedPane.setTabIcon(tabId,"");}},_uiSourceCodeTitleChanged:function(event)
1009 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);this._updateHistory();},_uiSourceCodeWorkingCopyChanged:function(event)
1010 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},_uiSourceCodeWorkingCopyCommitted:function(event)
1011 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},_uiSourceCodeSavedStateUpdated:function(event)
1012 {var uiSourceCode=(event.target);this._updateFileTitle(uiSourceCode);},reset:function()
1013 {delete this._userSelectedFiles;},_generateTabId:function()
1014 {return"tab_"+(WebInspector.TabbedEditorContainer._tabId++);},currentFile:function()
1015 {return this._currentFile;},__proto__:WebInspector.Object.prototype}
1016 WebInspector.TabbedEditorContainer.HistoryItem=function(url,selectionRange,scrollLineNumber)
1017 {this.url=url;this._isSerializable=url.length<WebInspector.TabbedEditorContainer.HistoryItem.serializableUrlLengthLimit;this.selectionRange=selectionRange;this.scrollLineNumber=scrollLineNumber;}
1018 WebInspector.TabbedEditorContainer.HistoryItem.serializableUrlLengthLimit=4096;WebInspector.TabbedEditorContainer.HistoryItem.fromObject=function(serializedHistoryItem)
1019 {var selectionRange=serializedHistoryItem.selectionRange?WebInspector.TextRange.fromObject(serializedHistoryItem.selectionRange):undefined;return new WebInspector.TabbedEditorContainer.HistoryItem(serializedHistoryItem.url,selectionRange,serializedHistoryItem.scrollLineNumber);}
1020 WebInspector.TabbedEditorContainer.HistoryItem.prototype={serializeToObject:function()
1021 {if(!this._isSerializable)
1022 return null;var serializedHistoryItem={};serializedHistoryItem.url=this.url;serializedHistoryItem.selectionRange=this.selectionRange;serializedHistoryItem.scrollLineNumber=this.scrollLineNumber;return serializedHistoryItem;}}
1023 WebInspector.TabbedEditorContainer.History=function(items)
1024 {this._items=items;this._rebuildItemIndex();}
1025 WebInspector.TabbedEditorContainer.History.fromObject=function(serializedHistory)
1026 {var items=[];for(var i=0;i<serializedHistory.length;++i)
1027 items.push(WebInspector.TabbedEditorContainer.HistoryItem.fromObject(serializedHistory[i]));return new WebInspector.TabbedEditorContainer.History(items);}
1028 WebInspector.TabbedEditorContainer.History.prototype={index:function(url)
1029 {var index=this._itemsIndex[url];if(typeof index==="number")
1030 return index;return-1;},_rebuildItemIndex:function()
1031 {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)
1032 {var index=this.index(url);return index!==-1?this._items[index].selectionRange:undefined;},updateSelectionRange:function(url,selectionRange)
1033 {if(!selectionRange)
1034 return;var index=this.index(url);if(index===-1)
1035 return;this._items[index].selectionRange=selectionRange;},scrollLineNumber:function(url)
1036 {var index=this.index(url);return index!==-1?this._items[index].scrollLineNumber:undefined;},updateScrollLineNumber:function(url,scrollLineNumber)
1037 {var index=this.index(url);if(index===-1)
1038 return;this._items[index].scrollLineNumber=scrollLineNumber;},update:function(urls)
1039 {for(var i=urls.length-1;i>=0;--i){var index=this.index(urls[i]);var item;if(index!==-1){item=this._items[index];this._items.splice(index,1);}else
1040 item=new WebInspector.TabbedEditorContainer.HistoryItem(urls[i]);this._items.unshift(item);this._rebuildItemIndex();}},remove:function(url)
1041 {var index=this.index(url);if(index!==-1){this._items.splice(index,1);this._rebuildItemIndex();}},save:function(setting)
1042 {setting.set(this._serializeToObject());},_serializeToObject:function()
1043 {var serializedHistory=[];for(var i=0;i<this._items.length;++i){var serializedItem=this._items[i].serializeToObject();if(serializedItem)
1044 serializedHistory.push(serializedItem);if(serializedHistory.length===WebInspector.TabbedEditorContainer.maximalPreviouslyViewedFilesCount)
1045 break;}
1046 return serializedHistory;},_urls:function()
1047 {var result=[];for(var i=0;i<this._items.length;++i)
1048 result.push(this._items[i].url);return result;}}
1049 WebInspector.EditorContainerTabDelegate=function(editorContainer)
1050 {this._editorContainer=editorContainer;}
1051 WebInspector.EditorContainerTabDelegate.prototype={closeTabs:function(tabbedPane,ids)
1052 {this._editorContainer._closeTabs(ids);}};WebInspector.WatchExpressionsSidebarPane=function()
1053 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Watch Expressions"));this.section=new WebInspector.WatchExpressionsSection();this.bodyElement.appendChild(this.section.element);var refreshButton=document.createElement("button");refreshButton.className="pane-title-button refresh";refreshButton.addEventListener("click",this._refreshButtonClicked.bind(this),false);refreshButton.title=WebInspector.UIString("Refresh");this.titleElement.appendChild(refreshButton);var addButton=document.createElement("button");addButton.className="pane-title-button add";addButton.addEventListener("click",this._addButtonClicked.bind(this),false);this.titleElement.appendChild(addButton);addButton.title=WebInspector.UIString("Add watch expression");this._requiresUpdate=true;WebInspector.context.addFlavorChangeListener(WebInspector.ExecutionContext,this.refreshExpressions,this);}
1054 WebInspector.WatchExpressionsSidebarPane.prototype={wasShown:function()
1055 {this._refreshExpressionsIfNeeded();},refreshExpressions:function()
1056 {this._requiresUpdate=true;this._refreshExpressionsIfNeeded();},addExpression:function(expression)
1057 {this.section.addExpression(expression);this.expand();},_refreshExpressionsIfNeeded:function()
1058 {if(this._requiresUpdate&&this.isShowing()){this.section.update();delete this._requiresUpdate;}else
1059 this._requiresUpdate=true;},_addButtonClicked:function(event)
1060 {event.consume();this.expand();this.section.addNewExpressionAndEdit();},_refreshButtonClicked:function(event)
1061 {event.consume();this.refreshExpressions();},__proto__:WebInspector.SidebarPane.prototype}
1062 WebInspector.WatchExpressionsSection=function()
1063 {this._watchObjectGroupId="watch-group";WebInspector.ObjectPropertiesSection.call(this,WebInspector.runtimeModel.createRemoteObjectFromPrimitiveValue(""));this.treeElementConstructor=WebInspector.WatchedPropertyTreeElement;this._expandedExpressions={};this._expandedProperties={};this.emptyElement=document.createElement("div");this.emptyElement.className="info";this.emptyElement.textContent=WebInspector.UIString("No Watch Expressions");this.watchExpressions=WebInspector.settings.watchExpressions.get();this.headerElement.className="hidden";this.editable=true;this.expanded=true;this.propertiesElement.classList.add("watch-expressions");this.element.addEventListener("mousemove",this._mouseMove.bind(this),true);this.element.addEventListener("mouseout",this._mouseOut.bind(this),true);this.element.addEventListener("dblclick",this._sectionDoubleClick.bind(this),false);this.emptyElement.addEventListener("contextmenu",this._emptyElementContextMenu.bind(this),false);}
1064 WebInspector.WatchExpressionsSection.NewWatchExpression="\xA0";WebInspector.WatchExpressionsSection.prototype={update:function(e)
1065 {if(e)
1066 e.consume();function appendResult(expression,watchIndex,result,wasThrown)
1067 {if(!result)
1068 return;var property=new WebInspector.RemoteObjectProperty(expression,result);property.watchIndex=watchIndex;property.wasThrown=wasThrown;properties.push(property);if(properties.length==propertyCount){this.updateProperties(properties,[],WebInspector.WatchExpressionTreeElement,WebInspector.WatchExpressionsSection.CompareProperties);if(this._newExpressionAdded){delete this._newExpressionAdded;var treeElement=this.findAddedTreeElement();if(treeElement)
1069 treeElement.startEditing();}
1070 if(this._lastMouseMovePageY)
1071 this._updateHoveredElement(this._lastMouseMovePageY);}}
1072 WebInspector.targetManager.targets().forEach(function(target){target.runtimeAgent().releaseObjectGroup(this._watchObjectGroupId)},this);var properties=[];var propertyCount=0;for(var i=0;i<this.watchExpressions.length;++i){if(!this.watchExpressions[i])
1073 continue;++propertyCount;}
1074 var currentExecutionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(currentExecutionContext){for(var i=0;i<this.watchExpressions.length;++i){var expression=this.watchExpressions[i];if(!expression)
1075 continue;currentExecutionContext.evaluate(expression,this._watchObjectGroupId,false,true,false,false,appendResult.bind(this,expression,i));}}
1076 if(!propertyCount){if(!this.emptyElement.parentNode)
1077 this.element.appendChild(this.emptyElement);}else{if(this.emptyElement.parentNode)
1078 this.element.removeChild(this.emptyElement);}
1079 this.expanded=(propertyCount!=0);},addExpression:function(expression)
1080 {this.watchExpressions.push(expression);this.saveExpressions();this.update();},addNewExpressionAndEdit:function()
1081 {this._newExpressionAdded=true;this.watchExpressions.push(WebInspector.WatchExpressionsSection.NewWatchExpression);this.update();},_sectionDoubleClick:function(event)
1082 {if(event.target!==this.element&&event.target!==this.propertiesElement&&event.target!==this.emptyElement)
1083 return;event.consume();this.addNewExpressionAndEdit();},updateExpression:function(element,value)
1084 {if(value===null){var index=element.property.watchIndex;this.watchExpressions.splice(index,1);}
1085 else
1086 this.watchExpressions[element.property.watchIndex]=value;this.saveExpressions();this.update();},_deleteAllExpressions:function()
1087 {this.watchExpressions=[];this.saveExpressions();this.update();},findAddedTreeElement:function()
1088 {var children=this.propertiesTreeOutline.children;for(var i=0;i<children.length;++i){if(children[i].property.name===WebInspector.WatchExpressionsSection.NewWatchExpression)
1089 return children[i];}
1090 return null;},saveExpressions:function()
1091 {var toSave=[];for(var i=0;i<this.watchExpressions.length;i++)
1092 if(this.watchExpressions[i])
1093 toSave.push(this.watchExpressions[i]);WebInspector.settings.watchExpressions.set(toSave);return toSave.length;},_mouseMove:function(e)
1094 {if(this.propertiesElement.firstChild)
1095 this._updateHoveredElement(e.pageY);},_mouseOut:function()
1096 {if(this._hoveredElement){this._hoveredElement.classList.remove("hovered");delete this._hoveredElement;}
1097 delete this._lastMouseMovePageY;},_updateHoveredElement:function(pageY)
1098 {var candidateElement=this.propertiesElement.firstChild;while(true){var next=candidateElement.nextSibling;while(next&&!next.clientHeight)
1099 next=next.nextSibling;if(!next||next.totalOffsetTop()>pageY)
1100 break;candidateElement=next;}
1101 if(this._hoveredElement!==candidateElement){if(this._hoveredElement)
1102 this._hoveredElement.classList.remove("hovered");if(candidateElement)
1103 candidateElement.classList.add("hovered");this._hoveredElement=candidateElement;}
1104 this._lastMouseMovePageY=pageY;},_emptyElementContextMenu:function(event)
1105 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add watch expression":"Add Watch Expression"),this.addNewExpressionAndEdit.bind(this));contextMenu.show();},__proto__:WebInspector.ObjectPropertiesSection.prototype}
1106 WebInspector.WatchExpressionsSection.CompareProperties=function(propertyA,propertyB)
1107 {if(propertyA.watchIndex==propertyB.watchIndex)
1108 return 0;else if(propertyA.watchIndex<propertyB.watchIndex)
1109 return-1;else
1110 return 1;}
1111 WebInspector.WatchExpressionTreeElement=function(property)
1112 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
1113 WebInspector.WatchExpressionTreeElement.prototype={onexpand:function()
1114 {WebInspector.ObjectPropertyTreeElement.prototype.onexpand.call(this);this.treeOutline.section._expandedExpressions[this._expression()]=true;},oncollapse:function()
1115 {WebInspector.ObjectPropertyTreeElement.prototype.oncollapse.call(this);delete this.treeOutline.section._expandedExpressions[this._expression()];},onattach:function()
1116 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.treeOutline.section._expandedExpressions[this._expression()])
1117 this.expanded=true;},_expression:function()
1118 {return this.property.name;},update:function()
1119 {WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);if(this.property.wasThrown){this.valueElement.textContent=WebInspector.UIString("<not available>");this.listItemElement.classList.add("dimmed");}else
1120 this.listItemElement.classList.remove("dimmed");var deleteButton=document.createElement("input");deleteButton.type="button";deleteButton.title=WebInspector.UIString("Delete watch expression.");deleteButton.classList.add("enabled-button");deleteButton.classList.add("delete-button");deleteButton.addEventListener("click",this._deleteButtonClicked.bind(this),false);this.listItemElement.addEventListener("contextmenu",this._contextMenu.bind(this),false);this.listItemElement.insertBefore(deleteButton,this.listItemElement.firstChild);},populateContextMenu:function(contextMenu)
1121 {if(!this.isEditing()){contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add watch expression":"Add Watch Expression"),this.treeOutline.section.addNewExpressionAndEdit.bind(this.treeOutline.section));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Delete watch expression":"Delete Watch Expression"),this._deleteButtonClicked.bind(this));}
1122 if(this.treeOutline.section.watchExpressions.length>1)
1123 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Delete all watch expressions":"Delete All Watch Expressions"),this._deleteAllButtonClicked.bind(this));},_contextMenu:function(event)
1124 {var contextMenu=new WebInspector.ContextMenu(event);this.populateContextMenu(contextMenu);contextMenu.show();},_deleteAllButtonClicked:function()
1125 {this.treeOutline.section._deleteAllExpressions();},_deleteButtonClicked:function()
1126 {this.treeOutline.section.updateExpression(this,null);},renderPromptAsBlock:function()
1127 {return true;},elementAndValueToEdit:function()
1128 {return{element:this.nameElement,value:this.property.name.trim()};},editingCancelled:function(element,context)
1129 {if(!context.elementToEdit.textContent)
1130 this.treeOutline.section.updateExpression(this,null);WebInspector.ObjectPropertyTreeElement.prototype.editingCancelled.call(this,element,context);},applyExpression:function(expression)
1131 {expression=expression.trim();this.property.name=expression||null;this.treeOutline.section.updateExpression(this,expression);},__proto__:WebInspector.ObjectPropertyTreeElement.prototype}
1132 WebInspector.WatchedPropertyTreeElement=function(property)
1133 {WebInspector.ObjectPropertyTreeElement.call(this,property);}
1134 WebInspector.WatchedPropertyTreeElement.prototype={onattach:function()
1135 {WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);if(this.hasChildren&&this.propertyPath()in this.treeOutline.section._expandedProperties)
1136 this.expand();},onexpand:function()
1137 {WebInspector.ObjectPropertyTreeElement.prototype.onexpand.call(this);this.treeOutline.section._expandedProperties[this.propertyPath()]=true;},oncollapse:function()
1138 {WebInspector.ObjectPropertyTreeElement.prototype.oncollapse.call(this);delete this.treeOutline.section._expandedProperties[this.propertyPath()];},__proto__:WebInspector.ObjectPropertyTreeElement.prototype};WebInspector.WorkersSidebarPane=function()
1139 {WebInspector.SidebarPane.call(this,WebInspector.UIString("Workers"));this._enableWorkersCheckbox=new WebInspector.Checkbox(WebInspector.UIString("Pause on start"),"sidebar-label",WebInspector.UIString("Automatically attach to new workers and pause them. Enabling this option will force opening inspector for all new workers."));this._enableWorkersCheckbox.element.id="pause-workers-checkbox";this.bodyElement.appendChild(this._enableWorkersCheckbox.element);this._enableWorkersCheckbox.addEventListener(this._autoattachToWorkersClicked.bind(this));this._enableWorkersCheckbox.checked=false;var note=this.bodyElement.createChild("div");note.id="shared-workers-list";note.classList.add("sidebar-label")
1140 note.textContent=WebInspector.UIString("Shared workers can be inspected in the Task Manager");var separator=this.bodyElement.createChild("div","sidebar-separator");separator.textContent=WebInspector.UIString("Dedicated worker inspectors");this._workerListElement=document.createElement("ol");this._workerListElement.tabIndex=0;this._workerListElement.classList.add("properties-tree");this._workerListElement.classList.add("sidebar-label");this.bodyElement.appendChild(this._workerListElement);this._idToWorkerItem={};var threadList=WebInspector.workerManager.threadsList();for(var i=0;i<threadList.length;++i){var threadId=threadList[i];if(threadId===WebInspector.WorkerManager.MainThreadId)
1141 continue;this._addWorker(threadId,WebInspector.workerManager.threadUrl(threadId));}
1142 WebInspector.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded,this._workerAdded,this);WebInspector.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerRemoved,this._workerRemoved,this);WebInspector.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared,this._workersCleared,this);}
1143 WebInspector.WorkersSidebarPane.prototype={_workerAdded:function(event)
1144 {this._addWorker(event.data.workerId,event.data.url);},_workerRemoved:function(event)
1145 {this._idToWorkerItem[event.data].remove();delete this._idToWorkerItem[event.data];},_workersCleared:function(event)
1146 {this._idToWorkerItem={};this._workerListElement.removeChildren();},_addWorker:function(workerId,url)
1147 {var item=this._workerListElement.createChild("div","dedicated-worker-item");var link=item.createChild("a");link.textContent=url;link.href="#";link.target="_blank";link.addEventListener("click",this._workerItemClicked.bind(this,workerId),true);this._idToWorkerItem[workerId]=item;},_workerItemClicked:function(workerId,event)
1148 {event.consume(true);WebInspector.workerFrontendManager.openWorkerInspector(workerId);},_autoattachToWorkersClicked:function(event)
1149 {WorkerAgent.setAutoconnectToWorkers(this._enableWorkersCheckbox.checked);},__proto__:WebInspector.SidebarPane.prototype};WebInspector.TargetsToolbar=function()
1150 {this.element=document.createElement("div");this.element.className="status-bar scripts-debug-toolbar targets-toolbar hidden";this._comboBox=new WebInspector.StatusBarComboBox(this._onComboBoxSelectionChange.bind(this));this.element.appendChild(this._comboBox.element);this._targetToOption=new Map();if(!WebInspector.experimentsSettings.workersInMainWindow.isEnabled())
1151 return;WebInspector.context.addFlavorChangeListener(WebInspector.Target,this._targetChangedExternally,this);WebInspector.targetManager.observeTargets(this);}
1152 WebInspector.TargetsToolbar.prototype={targetAdded:function(target)
1153 {var option=this._comboBox.createOption(target.name());option.__target=target;this._targetToOption.put(target,option);if(WebInspector.context.flavor(WebInspector.Target)===target)
1154 this._comboBox.select(option);this._updateVisibility();},targetRemoved:function(target)
1155 {var option=this._targetToOption.remove(target);this._comboBox.removeOption(option);this._updateVisibility();},_onComboBoxSelectionChange:function()
1156 {var selectedOption=this._comboBox.selectedOption();if(!selectedOption)
1157 return;WebInspector.context.setFlavor(WebInspector.Target,selectedOption.__target);},_updateVisibility:function()
1158 {var hidden=this._comboBox.size()===1;this.element.classList.toggle("hidden",hidden);},_targetChangedExternally:function(event)
1159 {var target=(event.data);if(target){var option=(this._targetToOption.get(target));this._comboBox.select(option);}}};WebInspector.FormatterScriptMapping=function(workspace,debuggerModel)
1160 {this._workspace=workspace;this._debuggerModel=debuggerModel;this._init();this._projectId="formatter:";this._projectDelegate=new WebInspector.FormatterProjectDelegate(workspace,this._projectId);this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
1161 WebInspector.FormatterScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
1162 {var debuggerModelLocation=(rawLocation);var script=debuggerModelLocation.script();var uiSourceCode=this._uiSourceCodes.get(script);if(!uiSourceCode)
1163 return null;var formatData=this._formatData.get(uiSourceCode);if(!formatData)
1164 return null;var mapping=formatData.mapping;var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;var formattedLocation=mapping.originalToFormatted(lineNumber,columnNumber);return uiSourceCode.uiLocation(formattedLocation[0],formattedLocation[1]);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
1165 {var formatData=this._formatData.get(uiSourceCode);if(!formatData)
1166 return null;var originalLocation=formatData.mapping.formattedToOriginal(lineNumber,columnNumber)
1167 return this._debuggerModel.createRawLocation(formatData.scripts[0],originalLocation[0],originalLocation[1]);},isIdentity:function()
1168 {return false;},_scriptsForUISourceCode:function(uiSourceCode)
1169 {function isInlineScript(script)
1170 {return script.isInlineScript();}
1171 if(uiSourceCode.contentType()===WebInspector.resourceTypes.Document)
1172 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).filter(isInlineScript);if(uiSourceCode.contentType()===WebInspector.resourceTypes.Script){var rawLocation=(uiSourceCode.uiLocationToRawLocation(this._debuggerModel.target(),0,0));return rawLocation?[rawLocation.script()]:[];}
1173 return[];},_init:function()
1174 {this._uiSourceCodes=new Map();this._formattedPaths=new StringMap();this._formatData=new Map();},_debuggerReset:function()
1175 {var formattedPaths=this._formattedPaths.values();for(var i=0;i<formattedPaths.length;++i)
1176 this._projectDelegate._removeFormatted(formattedPaths[i]);this._init();},_performUISourceCodeScriptFormatting:function(uiSourceCode,callback)
1177 {var path=this._formattedPaths.get(uiSourceCode.project().id()+":"+uiSourceCode.path());if(path){var uiSourceCodePath=path;var formattedUISourceCode=this._workspace.uiSourceCode(this._projectId,uiSourceCodePath);var formatData=formattedUISourceCode?this._formatData.get(formattedUISourceCode):null;if(!formatData)
1178 callback(null);else
1179 callback(formattedUISourceCode,formatData.mapping);return;}
1180 uiSourceCode.requestContent(contentLoaded.bind(this));function contentLoaded(content)
1181 {var formatter=WebInspector.Formatter.createFormatter(uiSourceCode.contentType());formatter.formatContent(uiSourceCode.highlighterType(),content||"",innerCallback.bind(this));}
1182 function innerCallback(formattedContent,formatterMapping)
1183 {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length){callback(null);return;}
1184 var name;if(uiSourceCode.contentType()===WebInspector.resourceTypes.Document)
1185 name=uiSourceCode.displayName();else
1186 name=uiSourceCode.name()||scripts[0].scriptId;path=this._projectDelegate._addFormatted(name,uiSourceCode.url,uiSourceCode.contentType(),formattedContent);var formattedUISourceCode=(this._workspace.uiSourceCode(this._projectId,path));var formatData=new WebInspector.FormatterScriptMapping.FormatData(uiSourceCode.project().id(),uiSourceCode.path(),formatterMapping,scripts);this._formatData.put(formattedUISourceCode,formatData);this._formattedPaths.put(uiSourceCode.project().id()+":"+uiSourceCode.path(),path);for(var i=0;i<scripts.length;++i){this._uiSourceCodes.put(scripts[i],formattedUISourceCode);scripts[i].pushSourceMapping(this);}
1187 formattedUISourceCode.setSourceMappingForTarget(this._debuggerModel.target(),this);callback(formattedUISourceCode,formatterMapping);}},_discardFormattedUISourceCodeScript:function(formattedUISourceCode)
1188 {var formatData=this._formatData.get(formattedUISourceCode);if(!formatData)
1189 return null;this._formatData.remove(formattedUISourceCode);this._formattedPaths.remove(formatData.projectId+":"+formatData.path);for(var i=0;i<formatData.scripts.length;++i){this._uiSourceCodes.remove(formatData.scripts[i]);formatData.scripts[i].popSourceMapping();}
1190 this._projectDelegate._removeFormatted(formattedUISourceCode.path());return formatData.mapping;}}
1191 WebInspector.FormatterScriptMapping.FormatData=function(projectId,path,mapping,scripts)
1192 {this.projectId=projectId;this.path=path;this.mapping=mapping;this.scripts=scripts;}
1193 WebInspector.FormatterProjectDelegate=function(workspace,id)
1194 {WebInspector.ContentProviderBasedProjectDelegate.call(this,workspace,id,WebInspector.projectTypes.Formatter);}
1195 WebInspector.FormatterProjectDelegate.prototype={displayName:function()
1196 {return"formatter";},_addFormatted:function(name,sourceURL,contentType,content)
1197 {var contentProvider=new WebInspector.StaticContentProvider(contentType,content);return this.addContentProvider(sourceURL,name+":formatted","deobfuscated:"+sourceURL,contentProvider);},_removeFormatted:function(path)
1198 {this.removeFile(path);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
1199 WebInspector.ScriptFormatterEditorAction=function()
1200 {this._scriptMapping=new WebInspector.FormatterScriptMapping(WebInspector.workspace,WebInspector.debuggerModel);}
1201 WebInspector.ScriptFormatterEditorAction.prototype={_editorSelected:function(event)
1202 {var uiSourceCode=(event.data);this._updateButton(uiSourceCode);},_editorClosed:function(event)
1203 {var uiSourceCode=(event.data.uiSourceCode);var wasSelected=(event.data.wasSelected);if(wasSelected)
1204 this._updateButton(null);this._discardFormattedUISourceCodeScript(uiSourceCode);},_updateButton:function(uiSourceCode)
1205 {this._button.element.classList.toggle("hidden",!this._isFormatableScript(uiSourceCode));},button:function(sourcesView)
1206 {if(this._button)
1207 return this._button.element;this._sourcesView=sourcesView;this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSelected,this._editorSelected.bind(this));this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClosed,this._editorClosed.bind(this));this._button=new WebInspector.StatusBarButton(WebInspector.UIString("Pretty print"),"sources-toggle-pretty-print-status-bar-item");this._button.toggled=false;this._button.addEventListener("click",this._toggleFormatScriptSource,this);this._updateButton(null);return this._button.element;},_isFormatableScript:function(uiSourceCode)
1208 {if(!uiSourceCode)
1209 return false;var supportedProjectTypes=[WebInspector.projectTypes.Network,WebInspector.projectTypes.Debugger,WebInspector.projectTypes.ContentScripts];if(supportedProjectTypes.indexOf(uiSourceCode.project().type())===-1)
1210 return false;var contentType=uiSourceCode.contentType();return contentType===WebInspector.resourceTypes.Script||contentType===WebInspector.resourceTypes.Document;},_toggleFormatScriptSource:function()
1211 {var uiSourceCode=this._sourcesView.currentUISourceCode();if(!this._isFormatableScript(uiSourceCode))
1212 return;this._formatUISourceCodeScript(uiSourceCode);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.TogglePrettyPrint,enabled:true,url:uiSourceCode.originURL()});},_formatUISourceCodeScript:function(uiSourceCode)
1213 {this._scriptMapping._performUISourceCodeScriptFormatting(uiSourceCode,innerCallback.bind(this));function innerCallback(formattedUISourceCode,mapping)
1214 {if(!formattedUISourceCode)
1215 return;if(uiSourceCode!==this._sourcesView.currentUISourceCode())
1216 return;var sourceFrame=this._sourcesView.viewForFile(uiSourceCode);var start=[0,0];if(sourceFrame){var selection=sourceFrame.selection();start=mapping.originalToFormatted(selection.startLine,selection.startColumn);}
1217 this._sourcesView.showSourceLocation(formattedUISourceCode,start[0],start[1]);this._updateButton(formattedUISourceCode);}},_discardFormattedUISourceCodeScript:function(uiSourceCode)
1218 {this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode);}};WebInspector.InplaceFormatterEditorAction=function()
1219 {}
1220 WebInspector.InplaceFormatterEditorAction.prototype={_editorSelected:function(event)
1221 {var uiSourceCode=(event.data);this._updateButton(uiSourceCode);},_editorClosed:function(event)
1222 {var wasSelected=(event.data.wasSelected);if(wasSelected)
1223 this._updateButton(null);},_updateButton:function(uiSourceCode)
1224 {this._button.element.classList.toggle("hidden",!this._isFormattable(uiSourceCode));},button:function(sourcesView)
1225 {if(this._button)
1226 return this._button.element;this._sourcesView=sourcesView;this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSelected,this._editorSelected.bind(this));this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClosed,this._editorClosed.bind(this));this._button=new WebInspector.StatusBarButton(WebInspector.UIString("Format"),"sources-toggle-pretty-print-status-bar-item");this._button.toggled=false;this._button.addEventListener("click",this._formatSourceInPlace,this);this._updateButton(null);return this._button.element;},_isFormattable:function(uiSourceCode)
1227 {if(!uiSourceCode)
1228 return false;return uiSourceCode.contentType()===WebInspector.resourceTypes.Stylesheet||uiSourceCode.project().type()===WebInspector.projectTypes.Snippets;},_formatSourceInPlace:function()
1229 {var uiSourceCode=this._sourcesView.currentUISourceCode();if(!this._isFormattable(uiSourceCode))
1230 return;if(uiSourceCode.isDirty())
1231 contentLoaded.call(this,uiSourceCode.workingCopy());else
1232 uiSourceCode.requestContent(contentLoaded.bind(this));function contentLoaded(content)
1233 {var formatter=WebInspector.Formatter.createFormatter(uiSourceCode.contentType());formatter.formatContent(uiSourceCode.highlighterType(),content||"",innerCallback.bind(this));}
1234 function innerCallback(formattedContent,formatterMapping)
1235 {if(uiSourceCode.workingCopy()===formattedContent)
1236 return;var sourceFrame=this._sourcesView.viewForFile(uiSourceCode);var start=[0,0];if(sourceFrame){var selection=sourceFrame.selection();start=formatterMapping.originalToFormatted(selection.startLine,selection.startColumn);}
1237 uiSourceCode.setWorkingCopy(formattedContent);this._sourcesView.showSourceLocation(uiSourceCode,start[0],start[1]);}},};WebInspector.Formatter=function()
1238 {}
1239 WebInspector.Formatter.createFormatter=function(contentType)
1240 {if(contentType===WebInspector.resourceTypes.Script||contentType===WebInspector.resourceTypes.Document||contentType===WebInspector.resourceTypes.Stylesheet)
1241 return new WebInspector.ScriptFormatter();return new WebInspector.IdentityFormatter();}
1242 WebInspector.Formatter.locationToPosition=function(lineEndings,lineNumber,columnNumber)
1243 {var position=lineNumber?lineEndings[lineNumber-1]+1:0;return position+columnNumber;}
1244 WebInspector.Formatter.positionToLocation=function(lineEndings,position)
1245 {var lineNumber=lineEndings.upperBound(position-1);if(!lineNumber)
1246 var columnNumber=position;else
1247 var columnNumber=position-lineEndings[lineNumber-1]-1;return[lineNumber,columnNumber];}
1248 WebInspector.Formatter.prototype={formatContent:function(mimeType,content,callback)
1249 {}}
1250 WebInspector.ScriptFormatter=function()
1251 {this._tasks=[];}
1252 WebInspector.ScriptFormatter.prototype={formatContent:function(mimeType,content,callback)
1253 {content=content.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,'');const method="format";var parameters={mimeType:mimeType,content:content,indentString:WebInspector.settings.textEditorIndent.get()};this._tasks.push({data:parameters,callback:callback});this._worker.postMessage({method:method,params:parameters});},_didFormatContent:function(event)
1254 {var task=this._tasks.shift();var originalContent=task.data.content;var formattedContent=event.data.content;var mapping=event.data["mapping"];var sourceMapping=new WebInspector.FormatterSourceMappingImpl(originalContent.lineEndings(),formattedContent.lineEndings(),mapping);task.callback(formattedContent,sourceMapping);},get _worker()
1255 {if(!this._cachedWorker){this._cachedWorker=new Worker("script_formatter_worker/ScriptFormatterWorker.js");this._cachedWorker.onmessage=(this._didFormatContent.bind(this));}
1256 return this._cachedWorker;}}
1257 WebInspector.IdentityFormatter=function()
1258 {this._tasks=[];}
1259 WebInspector.IdentityFormatter.prototype={formatContent:function(mimeType,content,callback)
1260 {callback(content,new WebInspector.IdentityFormatterSourceMapping());}}
1261 WebInspector.FormatterMappingPayload=function()
1262 {this.original=[];this.formatted=[];}
1263 WebInspector.FormatterSourceMapping=function()
1264 {}
1265 WebInspector.FormatterSourceMapping.prototype={originalToFormatted:function(lineNumber,columnNumber){},formattedToOriginal:function(lineNumber,columnNumber){}}
1266 WebInspector.IdentityFormatterSourceMapping=function()
1267 {}
1268 WebInspector.IdentityFormatterSourceMapping.prototype={originalToFormatted:function(lineNumber,columnNumber)
1269 {return[lineNumber,columnNumber||0];},formattedToOriginal:function(lineNumber,columnNumber)
1270 {return[lineNumber,columnNumber||0];}}
1271 WebInspector.FormatterSourceMappingImpl=function(originalLineEndings,formattedLineEndings,mapping)
1272 {this._originalLineEndings=originalLineEndings;this._formattedLineEndings=formattedLineEndings;this._mapping=mapping;}
1273 WebInspector.FormatterSourceMappingImpl.prototype={originalToFormatted:function(lineNumber,columnNumber)
1274 {var originalPosition=WebInspector.Formatter.locationToPosition(this._originalLineEndings,lineNumber,columnNumber||0);var formattedPosition=this._convertPosition(this._mapping.original,this._mapping.formatted,originalPosition||0);return WebInspector.Formatter.positionToLocation(this._formattedLineEndings,formattedPosition);},formattedToOriginal:function(lineNumber,columnNumber)
1275 {var formattedPosition=WebInspector.Formatter.locationToPosition(this._formattedLineEndings,lineNumber,columnNumber||0);var originalPosition=this._convertPosition(this._mapping.formatted,this._mapping.original,formattedPosition);return WebInspector.Formatter.positionToLocation(this._originalLineEndings,originalPosition||0);},_convertPosition:function(positions1,positions2,position)
1276 {var index=positions1.upperBound(position)-1;var convertedPosition=positions2[index]+position-positions1[index];if(index<positions2.length-1&&convertedPosition>positions2[index+1])
1277 convertedPosition=positions2[index+1];return convertedPosition;}};WebInspector.SourcesView=function(workspace,sourcesPanel)
1278 {WebInspector.VBox.call(this);this.registerRequiredCSS("sourcesView.css");this.element.id="sources-panel-sources-view";this.setMinimumAndPreferredSizes(50,25,150,100);this._workspace=workspace;this._sourcesPanel=sourcesPanel;this._searchableView=new WebInspector.SearchableView(this);this._searchableView.setMinimalSearchQuerySize(0);this._searchableView.show(this.element);this._sourceFramesByUISourceCode=new Map();var tabbedEditorPlaceholderText=WebInspector.isMac()?WebInspector.UIString("Hit Cmd+P to open a file"):WebInspector.UIString("Hit Ctrl+P to open a file");this._editorContainer=new WebInspector.TabbedEditorContainer(this,"previouslyViewedFiles",tabbedEditorPlaceholderText);this._editorContainer.show(this._searchableView.element);this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Events.EditorSelected,this._editorSelected,this);this._editorContainer.addEventListener(WebInspector.TabbedEditorContainer.Events.EditorClosed,this._editorClosed,this);this._historyManager=new WebInspector.EditingLocationHistoryManager(this,this.currentSourceFrame.bind(this));this._scriptViewStatusBarItemsContainer=document.createElement("div");this._scriptViewStatusBarItemsContainer.className="inline-block";this._scriptViewStatusBarTextContainer=document.createElement("div");this._scriptViewStatusBarTextContainer.className="hbox";this._statusBarContainerElement=this.element.createChild("div","sources-status-bar");function appendButtonForExtension(EditorAction)
1279 {this._statusBarContainerElement.appendChild(EditorAction.button(this));}
1280 var editorActions=(WebInspector.moduleManager.instances(WebInspector.SourcesView.EditorAction));editorActions.forEach(appendButtonForExtension.bind(this));this._statusBarContainerElement.appendChild(this._scriptViewStatusBarItemsContainer);this._statusBarContainerElement.appendChild(this._scriptViewStatusBarTextContainer);WebInspector.startBatchUpdate();this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this));WebInspector.endBatchUpdate();this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,this._projectRemoved.bind(this),this);function handleBeforeUnload(event)
1281 {if(event.returnValue)
1282 return;var unsavedSourceCodes=WebInspector.workspace.unsavedSourceCodes();if(!unsavedSourceCodes.length)
1283 return;event.returnValue=WebInspector.UIString("DevTools have unsaved changes that will be permanently lost.");WebInspector.inspectorView.showPanel("sources");for(var i=0;i<unsavedSourceCodes.length;++i)
1284 WebInspector.Revealer.reveal(unsavedSourceCodes[i]);}
1285 window.addEventListener("beforeunload",handleBeforeUnload,true);this._shortcuts={};this.element.addEventListener("keydown",this._handleKeyDown.bind(this),false);}
1286 WebInspector.SourcesView.Events={EditorClosed:"EditorClosed",EditorSelected:"EditorSelected",}
1287 WebInspector.SourcesView.prototype={registerShortcuts:function(registerShortcutDelegate)
1288 {function registerShortcut(shortcuts,handler)
1289 {registerShortcutDelegate(shortcuts,handler);this._registerShortcuts(shortcuts,handler);}
1290 registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToPreviousLocation,this._onJumpToPreviousLocation.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToNextLocation,this._onJumpToNextLocation.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.CloseEditorTab,this._onCloseEditorTab.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToLine,this._showGoToLineDialog.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToMember,this._showOutlineDialog.bind(this));registerShortcut.call(this,[WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift)],this._showOutlineDialog.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleBreakpoint,this._toggleBreakpoint.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Save,this._save.bind(this));registerShortcut.call(this,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.SaveAll,this._saveAll.bind(this));},_registerShortcuts:function(keys,handler)
1291 {for(var i=0;i<keys.length;++i)
1292 this._shortcuts[keys[i].key]=handler;},_handleKeyDown:function(event)
1293 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler())
1294 event.consume(true);},statusBarContainerElement:function()
1295 {return this._statusBarContainerElement;},defaultFocusedElement:function()
1296 {return this._editorContainer.view.defaultFocusedElement();},searchableView:function()
1297 {return this._searchableView;},visibleView:function()
1298 {return this._editorContainer.visibleView;},currentSourceFrame:function()
1299 {var view=this.visibleView();if(!(view instanceof WebInspector.SourceFrame))
1300 return null;return(view);},currentUISourceCode:function()
1301 {return this._currentUISourceCode;},_onCloseEditorTab:function(event)
1302 {var uiSourceCode=this.currentUISourceCode();if(!uiSourceCode)
1303 return false;this._editorContainer.closeFile(uiSourceCode);return true;},_onJumpToPreviousLocation:function(event)
1304 {this._historyManager.rollback();return true;},_onJumpToNextLocation:function(event)
1305 {this._historyManager.rollover();return true;},_uiSourceCodeAdded:function(event)
1306 {var uiSourceCode=(event.data);this._addUISourceCode(uiSourceCode);},_addUISourceCode:function(uiSourceCode)
1307 {if(uiSourceCode.project().isServiceProject())
1308 return;this._editorContainer.addUISourceCode(uiSourceCode);var currentUISourceCode=this._currentUISourceCode;if(currentUISourceCode&&currentUISourceCode.project().isServiceProject()&&currentUISourceCode!==uiSourceCode&&currentUISourceCode.url===uiSourceCode.url){this._showFile(uiSourceCode);this._editorContainer.removeUISourceCode(currentUISourceCode);}},_uiSourceCodeRemoved:function(event)
1309 {var uiSourceCode=(event.data);this._removeUISourceCodes([uiSourceCode]);},_removeUISourceCodes:function(uiSourceCodes)
1310 {this._editorContainer.removeUISourceCodes(uiSourceCodes);for(var i=0;i<uiSourceCodes.length;++i){this._removeSourceFrame(uiSourceCodes[i]);this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]);}},_projectRemoved:function(event)
1311 {var project=event.data;var uiSourceCodes=project.uiSourceCodes();this._removeUISourceCodes(uiSourceCodes);if(project.type()===WebInspector.projectTypes.Network)
1312 this._editorContainer.reset();},_updateScriptViewStatusBarItems:function()
1313 {this._scriptViewStatusBarItemsContainer.removeChildren();this._scriptViewStatusBarTextContainer.removeChildren();var sourceFrame=this.currentSourceFrame();if(!sourceFrame)
1314 return;var statusBarItems=sourceFrame.statusBarItems()||[];for(var i=0;i<statusBarItems.length;++i)
1315 this._scriptViewStatusBarItemsContainer.appendChild(statusBarItems[i]);var statusBarText=sourceFrame.statusBarText();if(statusBarText)
1316 this._scriptViewStatusBarTextContainer.appendChild(statusBarText);},showSourceLocation:function(uiSourceCode,lineNumber,columnNumber,omitFocus,omitHighlight)
1317 {this._historyManager.updateCurrentState();var sourceFrame=this._showFile(uiSourceCode);if(typeof lineNumber==="number")
1318 sourceFrame.revealPosition(lineNumber,columnNumber,!omitHighlight);this._historyManager.pushNewState();if(!omitFocus)
1319 sourceFrame.focus();WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.OpenSourceLink,url:uiSourceCode.originURL(),lineNumber:lineNumber});},_showFile:function(uiSourceCode)
1320 {var sourceFrame=this._getOrCreateSourceFrame(uiSourceCode);if(this._currentUISourceCode===uiSourceCode)
1321 return sourceFrame;this._currentUISourceCode=uiSourceCode;this._editorContainer.showFile(uiSourceCode);this._updateScriptViewStatusBarItems();return sourceFrame;},_createSourceFrame:function(uiSourceCode)
1322 {var sourceFrame;switch(uiSourceCode.contentType()){case WebInspector.resourceTypes.Script:sourceFrame=new WebInspector.JavaScriptSourceFrame(this._sourcesPanel,uiSourceCode);break;case WebInspector.resourceTypes.Document:sourceFrame=new WebInspector.JavaScriptSourceFrame(this._sourcesPanel,uiSourceCode);break;case WebInspector.resourceTypes.Stylesheet:sourceFrame=new WebInspector.CSSSourceFrame(uiSourceCode);break;default:sourceFrame=new WebInspector.UISourceCodeFrame(uiSourceCode);break;}
1323 sourceFrame.setHighlighterType(uiSourceCode.highlighterType());this._sourceFramesByUISourceCode.put(uiSourceCode,sourceFrame);this._historyManager.trackSourceFrameCursorJumps(sourceFrame);return sourceFrame;},_getOrCreateSourceFrame:function(uiSourceCode)
1324 {return this._sourceFramesByUISourceCode.get(uiSourceCode)||this._createSourceFrame(uiSourceCode);},_sourceFrameMatchesUISourceCode:function(sourceFrame,uiSourceCode)
1325 {switch(uiSourceCode.contentType()){case WebInspector.resourceTypes.Script:case WebInspector.resourceTypes.Document:return sourceFrame instanceof WebInspector.JavaScriptSourceFrame;case WebInspector.resourceTypes.Stylesheet:return sourceFrame instanceof WebInspector.CSSSourceFrame;default:return!(sourceFrame instanceof WebInspector.JavaScriptSourceFrame);}},_recreateSourceFrameIfNeeded:function(uiSourceCode)
1326 {var oldSourceFrame=this._sourceFramesByUISourceCode.get(uiSourceCode);if(!oldSourceFrame)
1327 return;if(this._sourceFrameMatchesUISourceCode(oldSourceFrame,uiSourceCode)){oldSourceFrame.setHighlighterType(uiSourceCode.highlighterType());}else{this._editorContainer.removeUISourceCode(uiSourceCode);this._removeSourceFrame(uiSourceCode);}},viewForFile:function(uiSourceCode)
1328 {return this._getOrCreateSourceFrame(uiSourceCode);},_removeSourceFrame:function(uiSourceCode)
1329 {var sourceFrame=this._sourceFramesByUISourceCode.get(uiSourceCode);if(!sourceFrame)
1330 return;this._sourceFramesByUISourceCode.remove(uiSourceCode);sourceFrame.dispose();},clearCurrentExecutionLine:function()
1331 {if(this._executionSourceFrame)
1332 this._executionSourceFrame.clearExecutionLine();delete this._executionSourceFrame;},setExecutionLine:function(uiLocation)
1333 {var sourceFrame=this._getOrCreateSourceFrame(uiLocation.uiSourceCode);sourceFrame.setExecutionLine(uiLocation.lineNumber);this._executionSourceFrame=sourceFrame;},_editorClosed:function(event)
1334 {var uiSourceCode=(event.data);this._historyManager.removeHistoryForSourceCode(uiSourceCode);var wasSelected=false;if(this._currentUISourceCode===uiSourceCode){delete this._currentUISourceCode;wasSelected=true;}
1335 this._updateScriptViewStatusBarItems();this._searchableView.resetSearch();var data={};data.uiSourceCode=uiSourceCode;data.wasSelected=wasSelected;this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorClosed,data);},_editorSelected:function(event)
1336 {var uiSourceCode=(event.data.currentFile);var shouldUseHistoryManager=uiSourceCode!==this._currentUISourceCode&&event.data.userGesture;if(shouldUseHistoryManager)
1337 this._historyManager.updateCurrentState();var sourceFrame=this._showFile(uiSourceCode);if(shouldUseHistoryManager)
1338 this._historyManager.pushNewState();this._searchableView.setReplaceable(!!sourceFrame&&sourceFrame.canEditSource());this._searchableView.resetSearch();this.dispatchEventToListeners(WebInspector.SourcesView.Events.EditorSelected,uiSourceCode);},sourceRenamed:function(uiSourceCode)
1339 {this._recreateSourceFrameIfNeeded(uiSourceCode);},searchCanceled:function()
1340 {if(this._searchView)
1341 this._searchView.searchCanceled();delete this._searchView;delete this._searchQuery;},performSearch:function(query,shouldJump,jumpBackwards)
1342 {this._searchableView.updateSearchMatchesCount(0);var sourceFrame=this.currentSourceFrame();if(!sourceFrame)
1343 return;this._searchView=sourceFrame;this._searchQuery=query;function finishedCallback(view,searchMatches)
1344 {if(!searchMatches)
1345 return;this._searchableView.updateSearchMatchesCount(searchMatches);}
1346 function currentMatchChanged(currentMatchIndex)
1347 {this._searchableView.updateCurrentMatchIndex(currentMatchIndex);}
1348 function searchResultsChanged()
1349 {this._searchableView.cancelSearch();}
1350 this._searchView.performSearch(query,shouldJump,!!jumpBackwards,finishedCallback.bind(this),currentMatchChanged.bind(this),searchResultsChanged.bind(this));},jumpToNextSearchResult:function()
1351 {if(!this._searchView)
1352 return;if(this._searchView!==this.currentSourceFrame()){this.performSearch(this._searchQuery,true);return;}
1353 this._searchView.jumpToNextSearchResult();},jumpToPreviousSearchResult:function()
1354 {if(!this._searchView)
1355 return;if(this._searchView!==this.currentSourceFrame()){this.performSearch(this._searchQuery,true);if(this._searchView)
1356 this._searchView.jumpToLastSearchResult();return;}
1357 this._searchView.jumpToPreviousSearchResult();},replaceSelectionWith:function(text)
1358 {var sourceFrame=this.currentSourceFrame();if(!sourceFrame){console.assert(sourceFrame);return;}
1359 sourceFrame.replaceSelectionWith(text);},replaceAllWith:function(query,text)
1360 {var sourceFrame=this.currentSourceFrame();if(!sourceFrame){console.assert(sourceFrame);return;}
1361 sourceFrame.replaceAllWith(query,text);},_showOutlineDialog:function(event)
1362 {var uiSourceCode=this._editorContainer.currentFile();if(!uiSourceCode)
1363 return false;switch(uiSourceCode.contentType()){case WebInspector.resourceTypes.Document:case WebInspector.resourceTypes.Script:WebInspector.JavaScriptOutlineDialog.show(this,uiSourceCode,this.showSourceLocation.bind(this,uiSourceCode));return true;case WebInspector.resourceTypes.Stylesheet:WebInspector.StyleSheetOutlineDialog.show(this,uiSourceCode,this.showSourceLocation.bind(this,uiSourceCode));return true;}
1364 return false;},showOpenResourceDialog:function(query)
1365 {var uiSourceCodes=this._editorContainer.historyUISourceCodes();var defaultScores=new Map();for(var i=1;i<uiSourceCodes.length;++i)
1366 defaultScores.put(uiSourceCodes[i],uiSourceCodes.length-i);WebInspector.OpenResourceDialog.show(this,this.element,query,defaultScores);},_showGoToLineDialog:function(event)
1367 {if(this._currentUISourceCode)
1368 this.showOpenResourceDialog(":");return true;},_save:function()
1369 {this._saveSourceFrame(this.currentSourceFrame());return true;},_saveAll:function()
1370 {var sourceFrames=this._editorContainer.fileViews();sourceFrames.forEach(this._saveSourceFrame.bind(this));return true;},_saveSourceFrame:function(sourceFrame)
1371 {if(!sourceFrame)
1372 return;if(!(sourceFrame instanceof WebInspector.UISourceCodeFrame))
1373 return;var uiSourceCodeFrame=(sourceFrame);uiSourceCodeFrame.commitEditing();},_toggleBreakpoint:function()
1374 {var sourceFrame=this.currentSourceFrame();if(!sourceFrame)
1375 return false;if(sourceFrame instanceof WebInspector.JavaScriptSourceFrame){var javaScriptSourceFrame=(sourceFrame);javaScriptSourceFrame.toggleBreakpointOnCurrentLine();return true;}
1376 return false;},toggleBreakpointsActiveState:function(active)
1377 {this._editorContainer.view.element.classList.toggle("breakpoints-deactivated",!active);},__proto__:WebInspector.VBox.prototype}
1378 WebInspector.SourcesView.EditorAction=function()
1379 {}
1380 WebInspector.SourcesView.EditorAction.prototype={button:function(sourcesView){}};WebInspector.SourcesPanel=function(workspaceForTest)
1381 {WebInspector.Panel.call(this,"sources");this.registerRequiredCSS("sourcesPanel.css");this.registerRequiredCSS("suggestBox.css");new WebInspector.UpgradeFileSystemDropTarget(this.element);WebInspector.settings.showEditorInDrawer=WebInspector.settings.createSetting("showEditorInDrawer",true);this._workspace=workspaceForTest||WebInspector.workspace;var helpSection=WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));this.debugToolbar=this._createDebugToolbar();this._debugToolbarDrawer=this._createDebugToolbarDrawer();this._targetsToolbar=new WebInspector.TargetsToolbar();const initialDebugSidebarWidth=225;this._splitView=new WebInspector.SplitView(true,true,"sourcesPanelSplitViewState",initialDebugSidebarWidth);this._splitView.enableShowModeSaving();this._splitView.show(this.element);const initialNavigatorWidth=225;this.editorView=new WebInspector.SplitView(true,false,"sourcesPanelNavigatorSplitViewState",initialNavigatorWidth);this.editorView.enableShowModeSaving();this.editorView.element.id="scripts-editor-split-view";this.editorView.element.tabIndex=0;this.editorView.show(this._splitView.mainElement());this._navigator=new WebInspector.SourcesNavigator(this._workspace);this._navigator.view.setMinimumSize(100,25);this._navigator.view.show(this.editorView.sidebarElement());this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.SourceSelected,this._sourceSelected,this);this._navigator.addEventListener(WebInspector.SourcesNavigator.Events.SourceRenamed,this._sourceRenamed,this);this._sourcesView=new WebInspector.SourcesView(this._workspace,this);this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorSelected,this._editorSelected.bind(this));this._sourcesView.addEventListener(WebInspector.SourcesView.Events.EditorClosed,this._editorClosed.bind(this));this._sourcesView.registerShortcuts(this.registerShortcuts.bind(this));if(WebInspector.experimentsSettings.editorInDrawer.isEnabled()){this._drawerEditorView=new WebInspector.SourcesPanel.DrawerEditorView();this._sourcesView.show(this._drawerEditorView.element);}else{this._sourcesView.show(this.editorView.mainElement());}
1382 this._debugSidebarResizeWidgetElement=document.createElementWithClass("div","resizer-widget");this._debugSidebarResizeWidgetElement.id="scripts-debug-sidebar-resizer-widget";this._splitView.addEventListener(WebInspector.SplitView.Events.ShowModeChanged,this._updateDebugSidebarResizeWidget,this);this._updateDebugSidebarResizeWidget();this._splitView.installResizer(this._debugSidebarResizeWidgetElement);this.sidebarPanes={};this.sidebarPanes.watchExpressions=new WebInspector.WatchExpressionsSidebarPane();this.sidebarPanes.callstack=new WebInspector.CallStackSidebarPane();this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPane.Events.CallFrameSelected,this._callFrameSelectedInSidebar.bind(this));this.sidebarPanes.callstack.addEventListener(WebInspector.CallStackSidebarPane.Events.CallFrameRestarted,this._callFrameRestartedInSidebar.bind(this));this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this));this.sidebarPanes.scopechain=new WebInspector.ScopeChainSidebarPane();this.sidebarPanes.jsBreakpoints=new WebInspector.JavaScriptBreakpointsSidebarPane(WebInspector.debuggerModel,WebInspector.breakpointManager,this.showUISourceCode.bind(this));this.sidebarPanes.domBreakpoints=WebInspector.domBreakpointsSidebarPane.createProxy(this);this.sidebarPanes.xhrBreakpoints=new WebInspector.XHRBreakpointsSidebarPane();this.sidebarPanes.eventListenerBreakpoints=new WebInspector.EventListenerBreakpointsSidebarPane();if(Capabilities.isMainFrontend)
1383 this.sidebarPanes.workerList=new WebInspector.WorkersSidebarPane();this._extensionSidebarPanes=[];this._installDebuggerSidebarController();WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged,this._dockSideChanged.bind(this));WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(this._dockSideChanged.bind(this));this._dockSideChanged();this._updateDebuggerButtons();this._pauseOnExceptionEnabledChanged();WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseOnExceptionEnabledChanged,this);WebInspector.targetManager.observeTargets(this);this._setTarget(WebInspector.context.flavor(WebInspector.Target));WebInspector.context.addFlavorChangeListener(WebInspector.Target,this._onCurrentTargetChanged,this);}
1384 WebInspector.SourcesPanel.minToolbarWidth=215;WebInspector.SourcesPanel.prototype={targetAdded:function(target)
1385 {target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled,this._debuggerWasEnabled,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled,this._debuggerReset,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed,this._debuggerResumed,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.CallFrameSelected,this._callFrameSelected,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame,this._consoleCommandEvaluatedInSelectedCallFrame,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged,this._breakpointsActiveStateChanged,this);target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);},targetRemoved:function(target)
1386 {target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasEnabled,this._debuggerWasEnabled,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerWasDisabled,this._debuggerReset,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed,this._debuggerResumed,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.CallFrameSelected,this._callFrameSelected,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame,this._consoleCommandEvaluatedInSelectedCallFrame,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged,this._breakpointsActiveStateChanged,this);target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);},_setTarget:function(target)
1387 {if(!target)
1388 return;if(target.debuggerModel.isPaused()){this._showDebuggerPausedDetails((target.debuggerModel.debuggerPausedDetails()));var callFrame=target.debuggerModel.selectedCallFrame();if(callFrame)
1389 this._selectCallFrame(callFrame);}else{this._paused=false;this._clearInterface();this._toggleDebuggerSidebarButton.setEnabled(true);}},_onCurrentTargetChanged:function(event)
1390 {var target=(event.data);this._setTarget(target);},defaultFocusedElement:function()
1391 {return this._sourcesView.defaultFocusedElement()||this._navigator.view.defaultFocusedElement();},paused:function()
1392 {return this._paused;},_drawerEditor:function()
1393 {var drawerEditorInstance=WebInspector.moduleManager.instance(WebInspector.DrawerEditor);console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel.DrawerEditor,"WebInspector.DrawerEditor module instance does not use WebInspector.SourcesPanel.DrawerEditor as an implementation. ");return(drawerEditorInstance);},wasShown:function()
1394 {WebInspector.context.setFlavor(WebInspector.SourcesPanel,this);if(WebInspector.experimentsSettings.editorInDrawer.isEnabled()){this._drawerEditor()._panelWasShown();this._sourcesView.show(this.editorView.mainElement());}
1395 WebInspector.Panel.prototype.wasShown.call(this);},willHide:function()
1396 {WebInspector.Panel.prototype.willHide.call(this);if(WebInspector.experimentsSettings.editorInDrawer.isEnabled()){this._drawerEditor()._panelWillHide();this._sourcesView.show(this._drawerEditorView.element);}
1397 WebInspector.context.setFlavor(WebInspector.SourcesPanel,null);},searchableView:function()
1398 {return this._sourcesView.searchableView();},_consoleCommandEvaluatedInSelectedCallFrame:function(event)
1399 {this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedCallFrame());},_debuggerPaused:function(event)
1400 {var details=(event.data);if(!this._paused)
1401 WebInspector.inspectorView.setCurrentPanel(this);if(WebInspector.context.flavor(WebInspector.Target)===details.target())
1402 this._showDebuggerPausedDetails(details);else if(!this._paused)
1403 WebInspector.context.setFlavor(WebInspector.Target,details.target());},_showDebuggerPausedDetails:function(details)
1404 {this._paused=true;this._updateDebuggerButtons();this.sidebarPanes.callstack.update(details);function didCreateBreakpointHitStatusMessage(element)
1405 {this.sidebarPanes.callstack.setStatus(element);}
1406 function didGetUILocation(uiLocation)
1407 {var breakpoint=WebInspector.breakpointManager.findBreakpointOnLine(uiLocation.uiSourceCode,uiLocation.lineNumber);if(!breakpoint)
1408 return;this.sidebarPanes.jsBreakpoints.highlightBreakpoint(breakpoint);this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a JavaScript breakpoint."));}
1409 if(details.reason===WebInspector.DebuggerModel.BreakReason.DOM){WebInspector.domBreakpointsSidebarPane.highlightBreakpoint(details.auxData);WebInspector.domBreakpointsSidebarPane.createBreakpointHitStatusMessage(details,didCreateBreakpointHitStatusMessage.bind(this));}else if(details.reason===WebInspector.DebuggerModel.BreakReason.EventListener){var eventName=details.auxData["eventName"];var targetName=details.auxData["targetName"];this.sidebarPanes.eventListenerBreakpoints.highlightBreakpoint(eventName,targetName);var eventNameForUI=WebInspector.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName,details.auxData);this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a \"%s\" Event Listener.",eventNameForUI));}else if(details.reason===WebInspector.DebuggerModel.BreakReason.XHR){this.sidebarPanes.xhrBreakpoints.highlightBreakpoint(details.auxData["breakpointURL"]);this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a XMLHttpRequest."));}else if(details.reason===WebInspector.DebuggerModel.BreakReason.Exception)
1410 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on exception: '%s'.",details.auxData["description"]));else if(details.reason===WebInspector.DebuggerModel.BreakReason.Assert)
1411 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on assertion."));else if(details.reason===WebInspector.DebuggerModel.BreakReason.CSPViolation)
1412 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a script blocked due to Content Security Policy directive: \"%s\".",details.auxData["directiveText"]));else if(details.reason===WebInspector.DebuggerModel.BreakReason.DebugCommand)
1413 this.sidebarPanes.callstack.setStatus(WebInspector.UIString("Paused on a debugged function"));else{if(details.callFrames.length)
1414 details.callFrames[0].createLiveLocation(didGetUILocation.bind(this));else
1415 console.warn("ScriptsPanel paused, but callFrames.length is zero.");}
1416 this._splitView.showBoth(true);this._toggleDebuggerSidebarButton.setEnabled(false);window.focus();InspectorFrontendHost.bringToFront();},_debuggerResumed:function(event)
1417 {var target=(event.target.target());if(WebInspector.context.flavor(WebInspector.Target)!==target)
1418 return;this._paused=false;this._clearInterface();this._toggleDebuggerSidebarButton.setEnabled(true);},_debuggerWasEnabled:function(event)
1419 {var target=(event.target.target());if(WebInspector.context.flavor(WebInspector.Target)!==target)
1420 return;this._updateDebuggerButtons();},_debuggerReset:function(event)
1421 {this._debuggerResumed(event);delete this._skipExecutionLineRevealing;},get visibleView()
1422 {return this._sourcesView.visibleView();},showUISourceCode:function(uiSourceCode,lineNumber,columnNumber,forceShowInPanel)
1423 {this._showEditor(forceShowInPanel);this._sourcesView.showSourceLocation(uiSourceCode,lineNumber,columnNumber);},_showEditor:function(forceShowInPanel)
1424 {if(this._sourcesView.isShowing())
1425 return;if(this._shouldShowEditorInDrawer()&&!forceShowInPanel)
1426 this._drawerEditor()._show();else
1427 WebInspector.inspectorView.showPanel("sources");},showUILocation:function(uiLocation,forceShowInPanel)
1428 {this.showUISourceCode(uiLocation.uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber,forceShowInPanel);},_shouldShowEditorInDrawer:function()
1429 {return WebInspector.experimentsSettings.editorInDrawer.isEnabled()&&WebInspector.settings.showEditorInDrawer.get()&&WebInspector.inspectorView.isDrawerEditorShown();},_revealInNavigator:function(uiSourceCode)
1430 {this._navigator.revealUISourceCode(uiSourceCode);},_executionLineChanged:function(uiLocation)
1431 {this._sourcesView.clearCurrentExecutionLine();this._sourcesView.setExecutionLine(uiLocation);if(this._skipExecutionLineRevealing)
1432 return;this._skipExecutionLineRevealing=true;this._sourcesView.showSourceLocation(uiLocation.uiSourceCode,uiLocation.lineNumber,0,undefined,true);},_callFrameSelected:function(event)
1433 {var callFrame=(event.data);if(!callFrame||callFrame.target()!==WebInspector.context.flavor(WebInspector.Target))
1434 return;this._selectCallFrame(callFrame);},_selectCallFrame:function(callFrame)
1435 {this.sidebarPanes.scopechain.update(callFrame);this.sidebarPanes.watchExpressions.refreshExpressions();this.sidebarPanes.callstack.setSelectedCallFrame(callFrame);callFrame.createLiveLocation(this._executionLineChanged.bind(this));},_sourceSelected:function(event)
1436 {var uiSourceCode=(event.data.uiSourceCode);this._sourcesView.showSourceLocation(uiSourceCode,undefined,undefined,!event.data.focusSource)},_sourceRenamed:function(event)
1437 {var uiSourceCode=(event.data);this._sourcesView.sourceRenamed(uiSourceCode);},_pauseOnExceptionEnabledChanged:function()
1438 {var enabled=WebInspector.settings.pauseOnExceptionEnabled.get();this._pauseOnExceptionButton.toggled=enabled;this._pauseOnExceptionButton.title=WebInspector.UIString(enabled?"Don't pause on exceptions.":"Pause on exceptions.");this._debugToolbarDrawer.classList.toggle("expanded",enabled);},_updateDebuggerButtons:function()
1439 {var currentTarget=WebInspector.context.flavor(WebInspector.Target);if(!currentTarget)
1440 return;if(this._paused){this._updateButtonTitle(this._pauseButton,WebInspector.UIString("Resume script execution (%s)."))
1441 this._pauseButton.state=true;this._pauseButton.setLongClickOptionsEnabled((function(){return[this._longResumeButton]}).bind(this));this._pauseButton.setEnabled(true);this._stepOverButton.setEnabled(true);this._stepIntoButton.setEnabled(true);this._stepOutButton.setEnabled(true);}else{this._updateButtonTitle(this._pauseButton,WebInspector.UIString("Pause script execution (%s)."))
1442 this._pauseButton.state=false;this._pauseButton.setLongClickOptionsEnabled(null);this._pauseButton.setEnabled(!currentTarget.debuggerModel.isPausing());this._stepOverButton.setEnabled(false);this._stepIntoButton.setEnabled(false);this._stepOutButton.setEnabled(false);}},_clearInterface:function()
1443 {this.sidebarPanes.callstack.update(null);this.sidebarPanes.scopechain.update(null);this.sidebarPanes.jsBreakpoints.clearBreakpointHighlight();WebInspector.domBreakpointsSidebarPane.clearBreakpointHighlight();this.sidebarPanes.eventListenerBreakpoints.clearBreakpointHighlight();this.sidebarPanes.xhrBreakpoints.clearBreakpointHighlight();this._sourcesView.clearCurrentExecutionLine();this._updateDebuggerButtons();},_togglePauseOnExceptions:function()
1444 {WebInspector.settings.pauseOnExceptionEnabled.set(!this._pauseOnExceptionButton.toggled);},_runSnippet:function()
1445 {var uiSourceCode=this._sourcesView.currentUISourceCode();if(uiSourceCode.project().type()!==WebInspector.projectTypes.Snippets)
1446 return false;var currentExecutionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(!currentExecutionContext)
1447 return false;WebInspector.scriptSnippetModel.evaluateScriptSnippet(currentExecutionContext,uiSourceCode);return true;},_editorSelected:function(event)
1448 {var uiSourceCode=(event.data);this._editorChanged(uiSourceCode);},_editorClosed:function(event)
1449 {var wasSelected=(event.data.wasSelected);if(wasSelected)
1450 this._editorChanged(null);},_editorChanged:function(uiSourceCode)
1451 {var isSnippet=uiSourceCode&&uiSourceCode.project().type()===WebInspector.projectTypes.Snippets;this._runSnippetButton.element.classList.toggle("hidden",!isSnippet);},togglePause:function()
1452 {var target=WebInspector.context.flavor(WebInspector.Target);if(!target)
1453 return true;if(this._paused){delete this._skipExecutionLineRevealing;this._paused=false;target.debuggerModel.resume();}else{target.debuggerModel.pause();}
1454 this._clearInterface();return true;},_prepareToResume:function()
1455 {if(!this._paused)
1456 return null;delete this._skipExecutionLineRevealing;this._paused=false;this._clearInterface();var target=WebInspector.context.flavor(WebInspector.Target);return target?target.debuggerModel:null;},_longResume:function()
1457 {var debuggerModel=this._prepareToResume();if(!debuggerModel)
1458 return true;debuggerModel.skipAllPausesUntilReloadOrTimeout(500);debuggerModel.resume();return true;},_stepOverClicked:function()
1459 {var debuggerModel=this._prepareToResume();if(!debuggerModel)
1460 return true;debuggerModel.stepOver();return true;},_stepIntoClicked:function()
1461 {var debuggerModel=this._prepareToResume();if(!debuggerModel)
1462 return true;debuggerModel.stepInto();return true;},_stepOutClicked:function()
1463 {var debuggerModel=this._prepareToResume();if(!debuggerModel)
1464 return true;debuggerModel.stepOut();return true;},_callFrameSelectedInSidebar:function(event)
1465 {var callFrame=(event.data);delete this._skipExecutionLineRevealing;callFrame.target().debuggerModel.setSelectedCallFrame(callFrame);},_callFrameRestartedInSidebar:function()
1466 {delete this._skipExecutionLineRevealing;},continueToLocation:function(rawLocation)
1467 {if(!this._prepareToResume())
1468 return;rawLocation.continueToLocation();},_toggleBreakpointsClicked:function(event)
1469 {WebInspector.debuggerModel.setBreakpointsActive(!WebInspector.debuggerModel.breakpointsActive());},_breakpointsActiveStateChanged:function(event)
1470 {var active=event.data;this._toggleBreakpointsButton.toggled=!active;this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoints-list-deactivated",!active);this._sourcesView.toggleBreakpointsActiveState(active);if(active)
1471 this._toggleBreakpointsButton.title=WebInspector.UIString("Deactivate breakpoints.");else
1472 this._toggleBreakpointsButton.title=WebInspector.UIString("Activate breakpoints.");},_createDebugToolbar:function()
1473 {var debugToolbar=document.createElement("div");debugToolbar.className="scripts-debug-toolbar";var title,handler;var platformSpecificModifier=WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;title=WebInspector.UIString("Run snippet (%s).");handler=this._runSnippet.bind(this);this._runSnippetButton=this._createButtonAndRegisterShortcuts("scripts-run-snippet",title,handler,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.RunSnippet);debugToolbar.appendChild(this._runSnippetButton.element);this._runSnippetButton.element.classList.add("hidden");handler=function(){return WebInspector.actionRegistry.execute("debugger.toggle-pause");};this._pauseButton=this._createButtonAndRegisterShortcuts("scripts-pause","",handler,[]);debugToolbar.appendChild(this._pauseButton.element);title=WebInspector.UIString("Resume with all pauses blocked for 500 ms");this._longResumeButton=new WebInspector.StatusBarButton(title,"scripts-long-resume");this._longResumeButton.addEventListener("click",this._longResume.bind(this),this);title=WebInspector.UIString("Step over next function call (%s).");handler=this._stepOverClicked.bind(this);this._stepOverButton=this._createButtonAndRegisterShortcuts("scripts-step-over",title,handler,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOver);debugToolbar.appendChild(this._stepOverButton.element);title=WebInspector.UIString("Step into next function call (%s).");handler=this._stepIntoClicked.bind(this);this._stepIntoButton=this._createButtonAndRegisterShortcuts("scripts-step-into",title,handler,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepInto);debugToolbar.appendChild(this._stepIntoButton.element);title=WebInspector.UIString("Step out of current function (%s).");handler=this._stepOutClicked.bind(this);this._stepOutButton=this._createButtonAndRegisterShortcuts("scripts-step-out",title,handler,WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOut);debugToolbar.appendChild(this._stepOutButton.element);this._toggleBreakpointsButton=new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate breakpoints."),"scripts-toggle-breakpoints");this._toggleBreakpointsButton.toggled=false;this._toggleBreakpointsButton.addEventListener("click",this._toggleBreakpointsClicked,this);debugToolbar.appendChild(this._toggleBreakpointsButton.element);this._pauseOnExceptionButton=new WebInspector.StatusBarButton("","scripts-pause-on-exceptions-status-bar-item");this._pauseOnExceptionButton.addEventListener("click",this._togglePauseOnExceptions,this);debugToolbar.appendChild(this._pauseOnExceptionButton.element);return debugToolbar;},_createDebugToolbarDrawer:function()
1474 {var debugToolbarDrawer=document.createElement("div");debugToolbarDrawer.className="scripts-debug-toolbar-drawer";var label=WebInspector.UIString("Pause On Caught Exceptions");var setting=WebInspector.settings.pauseOnCaughtException;debugToolbarDrawer.appendChild(WebInspector.SettingsUI.createSettingCheckbox(label,setting,true));return debugToolbarDrawer;},_updateButtonTitle:function(button,buttonTitle)
1475 {var hasShortcuts=button.shortcuts&&button.shortcuts.length;if(hasShortcuts)
1476 button.title=String.vsprintf(buttonTitle,[button.shortcuts[0].name]);else
1477 button.title=buttonTitle;},_createButtonAndRegisterShortcuts:function(buttonId,buttonTitle,handler,shortcuts)
1478 {var button=new WebInspector.StatusBarButton(buttonTitle,buttonId);button.element.addEventListener("click",handler,false);button.shortcuts=shortcuts;this._updateButtonTitle(button,buttonTitle);this.registerShortcuts(shortcuts,handler);return button;},addToWatch:function(expression)
1479 {this.sidebarPanes.watchExpressions.addExpression(expression);},_installDebuggerSidebarController:function()
1480 {this._toggleNavigatorSidebarButton=this.editorView.createShowHideSidebarButton("navigator","scripts-navigator-show-hide-button");this.editorView.mainElement().appendChild(this._toggleNavigatorSidebarButton.element);this._toggleDebuggerSidebarButton=this._splitView.createShowHideSidebarButton("debugger","scripts-debugger-show-hide-button");this._splitView.mainElement().appendChild(this._toggleDebuggerSidebarButton.element);this._splitView.mainElement().appendChild(this._debugSidebarResizeWidgetElement);},_updateDebugSidebarResizeWidget:function()
1481 {this._debugSidebarResizeWidgetElement.classList.toggle("hidden",this._splitView.showMode()!==WebInspector.SplitView.ShowMode.Both);},_showLocalHistory:function(uiSourceCode)
1482 {WebInspector.RevisionHistoryView.showHistory(uiSourceCode);},appendApplicableItems:function(event,contextMenu,target)
1483 {this._appendUISourceCodeItems(event,contextMenu,target);this._appendRemoteObjectItems(contextMenu,target);},_suggestReload:function()
1484 {if(window.confirm(WebInspector.UIString("It is recommended to restart inspector after making these changes. Would you like to restart it?")))
1485 WebInspector.reload();},_mapFileSystemToNetwork:function(uiSourceCode)
1486 {WebInspector.SelectUISourceCodeForProjectTypesDialog.show(uiSourceCode.name(),[WebInspector.projectTypes.Network,WebInspector.projectTypes.ContentScripts],mapFileSystemToNetwork.bind(this),this.editorView.mainElement())
1487 function mapFileSystemToNetwork(networkUISourceCode)
1488 {this._workspace.addMapping(networkUISourceCode,uiSourceCode,WebInspector.fileSystemWorkspaceBinding);this._suggestReload();}},_removeNetworkMapping:function(uiSourceCode)
1489 {if(confirm(WebInspector.UIString("Are you sure you want to remove network mapping?"))){this._workspace.removeMapping(uiSourceCode);this._suggestReload();}},_mapNetworkToFileSystem:function(networkUISourceCode)
1490 {WebInspector.SelectUISourceCodeForProjectTypesDialog.show(networkUISourceCode.name(),[WebInspector.projectTypes.FileSystem],mapNetworkToFileSystem.bind(this),this.editorView.mainElement())
1491 function mapNetworkToFileSystem(uiSourceCode)
1492 {this._workspace.addMapping(networkUISourceCode,uiSourceCode,WebInspector.fileSystemWorkspaceBinding);this._suggestReload();}},_appendUISourceCodeMappingItems:function(contextMenu,uiSourceCode)
1493 {if(uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem){var hasMappings=!!uiSourceCode.url;if(!hasMappings)
1494 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Map to network resource\u2026":"Map to Network Resource\u2026"),this._mapFileSystemToNetwork.bind(this,uiSourceCode));else
1495 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove network mapping":"Remove Network Mapping"),this._removeNetworkMapping.bind(this,uiSourceCode));}
1496 function filterProject(project)
1497 {return project.type()===WebInspector.projectTypes.FileSystem;}
1498 if(uiSourceCode.project().type()===WebInspector.projectTypes.Network||uiSourceCode.project().type()===WebInspector.projectTypes.ContentScripts){if(!this._workspace.projects().filter(filterProject).length)
1499 return;if(this._workspace.uiSourceCodeForURL(uiSourceCode.url)===uiSourceCode)
1500 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Map to file system resource\u2026":"Map to File System Resource\u2026"),this._mapNetworkToFileSystem.bind(this,uiSourceCode));}},_appendUISourceCodeItems:function(event,contextMenu,target)
1501 {if(!(target instanceof WebInspector.UISourceCode))
1502 return;var uiSourceCode=(target);var project=uiSourceCode.project();if(project.type()!==WebInspector.projectTypes.FileSystem)
1503 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Local modifications\u2026":"Local Modifications\u2026"),this._showLocalHistory.bind(this,uiSourceCode));this._appendUISourceCodeMappingItems(contextMenu,uiSourceCode);if(!event.target.isSelfOrDescendant(this.editorView.sidebarElement())){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Reveal in navigator":"Reveal in Navigator"),this._handleContextMenuReveal.bind(this,uiSourceCode));}},_handleContextMenuReveal:function(uiSourceCode)
1504 {this.editorView.showBoth();this._revealInNavigator(uiSourceCode);},_appendRemoteObjectItems:function(contextMenu,target)
1505 {if(!(target instanceof WebInspector.RemoteObject))
1506 return;var remoteObject=(target);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Store as global variable":"Store as Global Variable"),this._saveToTempVariable.bind(this,remoteObject));if(remoteObject.type==="function")
1507 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Show function definition":"Show Function Definition"),this._showFunctionDefinition.bind(this,remoteObject));},_saveToTempVariable:function(remoteObject)
1508 {var currentExecutionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);if(!currentExecutionContext)
1509 return;currentExecutionContext.evaluate("window","",false,true,false,false,didGetGlobalObject.bind(null,currentExecutionContext.target()));function didGetGlobalObject(target,global,wasThrown)
1510 {function remoteFunction(value)
1511 {var prefix="temp";var index=1;while((prefix+index)in this)
1512 ++index;var name=prefix+index;this[name]=value;return name;}
1513 if(wasThrown||!global)
1514 failedToSave(target,global);else
1515 global.callFunction(remoteFunction,[WebInspector.RemoteObject.toCallArgument(remoteObject)],didSave.bind(null,global));}
1516 function didSave(global,result,wasThrown)
1517 {var currentExecutionContext=WebInspector.context.flavor(WebInspector.ExecutionContext);global.release();if(!currentExecutionContext||wasThrown||!result||result.type!=="string")
1518 failedToSave(global.target(),result);else
1519 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionContext,result.value);}
1520 function failedToSave(target,result)
1521 {var message=WebInspector.UIString("Failed to save to temp variable.");if(result){message+=" "+result.description;result.release();}
1522 target.consoleModel.showErrorMessage(message);}},_showFunctionDefinition:function(remoteObject)
1523 {var target=remoteObject.target();function didGetFunctionDetails(error,response)
1524 {if(error){console.error(error);return;}
1525 var uiLocation=target.debuggerModel.rawLocationToUILocation(response.location);if(!uiLocation)
1526 return;this.showUILocation(uiLocation,true);}
1527 target.debuggerAgent().getFunctionDetails(remoteObject.objectId,didGetFunctionDetails.bind(this));},showGoToSourceDialog:function()
1528 {this._sourcesView.showOpenResourceDialog();},_dockSideChanged:function()
1529 {var vertically=WebInspector.dockController.isVertical()&&WebInspector.settings.splitVerticallyWhenDockedToRight.get();this._splitVertically(vertically);},_splitVertically:function(vertically)
1530 {if(this.sidebarPaneView&&vertically===!this._splitView.isVertical())
1531 return;if(this.sidebarPaneView)
1532 this.sidebarPaneView.detach();this._splitView.setVertical(!vertically);if(!vertically)
1533 this._splitView.uninstallResizer(this._sourcesView.statusBarContainerElement());else
1534 this._splitView.installResizer(this._sourcesView.statusBarContainerElement());var vbox=new WebInspector.VBox();vbox.element.appendChild(this._debugToolbarDrawer);vbox.element.appendChild(this.debugToolbar);vbox.element.appendChild(this._targetsToolbar.element);vbox.setMinimumAndPreferredSizes(25,25,WebInspector.SourcesPanel.minToolbarWidth,100);var sidebarPaneStack=new WebInspector.SidebarPaneStack();sidebarPaneStack.element.classList.add("flex-auto");sidebarPaneStack.show(vbox.element);if(!vertically){for(var pane in this.sidebarPanes)
1535 sidebarPaneStack.addPane(this.sidebarPanes[pane]);this._extensionSidebarPanesContainer=sidebarPaneStack;this.sidebarPaneView=vbox;}else{var splitView=new WebInspector.SplitView(true,true,"sourcesPanelDebuggerSidebarSplitViewState",0.5);vbox.show(splitView.mainElement());sidebarPaneStack.addPane(this.sidebarPanes.callstack);sidebarPaneStack.addPane(this.sidebarPanes.jsBreakpoints);sidebarPaneStack.addPane(this.sidebarPanes.domBreakpoints);sidebarPaneStack.addPane(this.sidebarPanes.xhrBreakpoints);sidebarPaneStack.addPane(this.sidebarPanes.eventListenerBreakpoints);if(this.sidebarPanes.workerList)
1536 sidebarPaneStack.addPane(this.sidebarPanes.workerList);var tabbedPane=new WebInspector.SidebarTabbedPane();tabbedPane.show(splitView.sidebarElement());tabbedPane.addPane(this.sidebarPanes.scopechain);tabbedPane.addPane(this.sidebarPanes.watchExpressions);this._extensionSidebarPanesContainer=tabbedPane;this.sidebarPaneView=splitView;}
1537 for(var i=0;i<this._extensionSidebarPanes.length;++i)
1538 this._extensionSidebarPanesContainer.addPane(this._extensionSidebarPanes[i]);this.sidebarPaneView.show(this._splitView.sidebarElement());this.sidebarPanes.scopechain.expand();this.sidebarPanes.jsBreakpoints.expand();this.sidebarPanes.callstack.expand();if(WebInspector.settings.watchExpressions.get().length>0)
1539 this.sidebarPanes.watchExpressions.expand();},addExtensionSidebarPane:function(id,pane)
1540 {this._extensionSidebarPanes.push(pane);this._extensionSidebarPanesContainer.addPane(pane);this.setHideOnDetach();},sourcesView:function()
1541 {return this._sourcesView;},__proto__:WebInspector.Panel.prototype}
1542 WebInspector.UpgradeFileSystemDropTarget=function(element)
1543 {element.addEventListener("dragenter",this._onDragEnter.bind(this),true);element.addEventListener("dragover",this._onDragOver.bind(this),true);this._element=element;}
1544 WebInspector.UpgradeFileSystemDropTarget.dragAndDropFilesType="Files";WebInspector.UpgradeFileSystemDropTarget.prototype={_onDragEnter:function(event)
1545 {if(event.dataTransfer.types.indexOf(WebInspector.UpgradeFileSystemDropTarget.dragAndDropFilesType)===-1)
1546 return;event.consume(true);},_onDragOver:function(event)
1547 {if(event.dataTransfer.types.indexOf(WebInspector.UpgradeFileSystemDropTarget.dragAndDropFilesType)===-1)
1548 return;event.dataTransfer.dropEffect="copy";event.consume(true);if(this._dragMaskElement)
1549 return;this._dragMaskElement=this._element.createChild("div","fill drag-mask");this._dragMaskElement.createChild("div","fill drag-mask-inner").textContent=WebInspector.UIString("Drop workspace folder here");this._dragMaskElement.addEventListener("drop",this._onDrop.bind(this),true);this._dragMaskElement.addEventListener("dragleave",this._onDragLeave.bind(this),true);},_onDrop:function(event)
1550 {event.consume(true);this._removeMask();var items=(event.dataTransfer.items);if(!items.length)
1551 return;var entry=items[0].webkitGetAsEntry();if(!entry.isDirectory)
1552 return;InspectorFrontendHost.upgradeDraggedFileSystemPermissions(entry.filesystem);},_onDragLeave:function(event)
1553 {event.consume(true);this._removeMask();},_removeMask:function()
1554 {this._dragMaskElement.remove();delete this._dragMaskElement;}}
1555 WebInspector.SourcesPanel.DrawerEditor=function()
1556 {this._panel=WebInspector.inspectorView.panel("sources");}
1557 WebInspector.SourcesPanel.DrawerEditor.prototype={view:function()
1558 {return this._panel._drawerEditorView;},installedIntoDrawer:function()
1559 {if(this._panel.isShowing())
1560 this._panelWasShown();else
1561 this._panelWillHide();},_panelWasShown:function()
1562 {WebInspector.inspectorView.setDrawerEditorAvailable(false);WebInspector.inspectorView.hideDrawerEditor();},_panelWillHide:function()
1563 {WebInspector.inspectorView.setDrawerEditorAvailable(true);if(WebInspector.inspectorView.isDrawerEditorShown())
1564 WebInspector.inspectorView.showDrawerEditor();},_show:function()
1565 {WebInspector.inspectorView.showDrawerEditor();},}
1566 WebInspector.SourcesPanel.DrawerEditorView=function()
1567 {WebInspector.VBox.call(this);this.element.id="drawer-editor-view";}
1568 WebInspector.SourcesPanel.DrawerEditorView.prototype={__proto__:WebInspector.VBox.prototype}
1569 WebInspector.SourcesPanel.ContextMenuProvider=function()
1570 {}
1571 WebInspector.SourcesPanel.ContextMenuProvider.prototype={appendApplicableItems:function(event,contextMenu,target)
1572 {WebInspector.inspectorView.panel("sources").appendApplicableItems(event,contextMenu,target);}}
1573 WebInspector.SourcesPanel.UILocationRevealer=function()
1574 {}
1575 WebInspector.SourcesPanel.UILocationRevealer.prototype={reveal:function(uiLocation)
1576 {if(uiLocation instanceof WebInspector.UILocation)
1577 (WebInspector.inspectorView.panel("sources")).showUILocation(uiLocation);}}
1578 WebInspector.SourcesPanel.UISourceCodeRevealer=function()
1579 {}
1580 WebInspector.SourcesPanel.UISourceCodeRevealer.prototype={reveal:function(uiSourceCode)
1581 {if(uiSourceCode instanceof WebInspector.UISourceCode)
1582 (WebInspector.inspectorView.panel("sources")).showUISourceCode(uiSourceCode);}}
1583 WebInspector.SourcesPanel.ShowGoToSourceDialogActionDelegate=function(){}
1584 WebInspector.SourcesPanel.ShowGoToSourceDialogActionDelegate.prototype={handleAction:function()
1585 {(WebInspector.inspectorView.showPanel("sources")).showGoToSourceDialog();return true;}}
1586 WebInspector.SourcesPanel.SkipStackFramePatternSettingDelegate=function()
1587 {WebInspector.UISettingDelegate.call(this);}
1588 WebInspector.SourcesPanel.SkipStackFramePatternSettingDelegate.prototype={settingElement:function()
1589 {return WebInspector.SettingsUI.createSettingInputField(WebInspector.UIString("Pattern"),WebInspector.settings.skipStackFramesPattern,false,1000,"100px",WebInspector.SettingsUI.regexValidator);},__proto__:WebInspector.UISettingDelegate.prototype}
1590 WebInspector.SourcesPanel.DisableJavaScriptSettingDelegate=function()
1591 {WebInspector.UISettingDelegate.call(this);}
1592 WebInspector.SourcesPanel.DisableJavaScriptSettingDelegate.prototype={settingElement:function()
1593 {var disableJSElement=WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Disable JavaScript"),WebInspector.settings.javaScriptDisabled);this._disableJSCheckbox=disableJSElement.getElementsByTagName("input")[0];WebInspector.settings.javaScriptDisabled.addChangeListener(this._settingChanged,this);var disableJSInfoParent=this._disableJSCheckbox.parentElement.createChild("span","monospace");this._disableJSInfo=disableJSInfoParent.createChild("span","object-info-state-note hidden");this._disableJSInfo.title=WebInspector.UIString("JavaScript is blocked on the inspected page (may be disabled in browser settings).");WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._updateScriptDisabledCheckbox,this);this._updateScriptDisabledCheckbox();return disableJSElement;},_settingChanged:function(event)
1594 {PageAgent.setScriptExecutionDisabled(event.data,this._updateScriptDisabledCheckbox.bind(this));},_updateScriptDisabledCheckbox:function()
1595 {PageAgent.getScriptExecutionStatus(executionStatusCallback.bind(this));function executionStatusCallback(error,status)
1596 {if(error||!status)
1597 return;var forbidden=(status==="forbidden");var disabled=forbidden||(status==="disabled");this._disableJSInfo.classList.toggle("hidden",!forbidden);this._disableJSCheckbox.checked=disabled;this._disableJSCheckbox.disabled=forbidden;}},__proto__:WebInspector.UISettingDelegate.prototype}
1598 WebInspector.SourcesPanel.TogglePauseActionDelegate=function()
1599 {}
1600 WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype={handleAction:function()
1601 {(WebInspector.inspectorView.showPanel("sources")).togglePause();return true;}}