Upstream version 9.37.195.0
[platform/framework/web/crosswalk.git] / src / chrome / tools / test / reference_build / chrome_linux / resources / inspector / Main.js
1 Object.isEmpty=function(obj)
2 {for(var i in obj)
3 return false;return true;}
4 Object.values=function(obj)
5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i)
6 result[i]=obj[result[i]];return result;}
7 String.prototype.findAll=function(string)
8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this.indexOf(string,i+string.length);}
9 return matches;}
10 String.prototype.lineEndings=function()
11 {if(!this._lineEndings){this._lineEndings=this.findAll("\n");this._lineEndings.push(this.length);}
12 return this._lineEndings;}
13 String.prototype.lineCount=function()
14 {var lineEndings=this.lineEndings();return lineEndings.length;}
15 String.prototype.lineAt=function(lineNumber)
16 {var lineEndings=this.lineEndings();var lineStart=lineNumber>0?lineEndings[lineNumber-1]+1:0;var lineEnd=lineEndings[lineNumber];var lineContent=this.substring(lineStart,lineEnd);if(lineContent.length>0&&lineContent.charAt(lineContent.length-1)==="\r")
17 lineContent=lineContent.substring(0,lineContent.length-1);return lineContent;}
18 String.prototype.escapeCharacters=function(chars)
19 {var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charAt(i))!==-1){foundChar=true;break;}}
20 if(!foundChar)
21 return String(this);var result="";for(var i=0;i<this.length;++i){if(chars.indexOf(this.charAt(i))!==-1)
22 result+="\\";result+=this.charAt(i);}
23 return result;}
24 String.regexSpecialCharacters=function()
25 {return"^[]{}()\\.^$*+?|-,";}
26 String.prototype.escapeForRegExp=function()
27 {return this.escapeCharacters(String.regexSpecialCharacters());}
28 String.prototype.escapeHTML=function()
29 {return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");}
30 String.prototype.collapseWhitespace=function()
31 {return this.replace(/[\s\xA0]+/g," ");}
32 String.prototype.trimMiddle=function(maxLength)
33 {if(this.length<=maxLength)
34 return String(this);var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1;return this.substr(0,leftHalf)+"\u2026"+this.substr(this.length-rightHalf,rightHalf);}
35 String.prototype.trimEnd=function(maxLength)
36 {if(this.length<=maxLength)
37 return String(this);return this.substr(0,maxLength-1)+"\u2026";}
38 String.prototype.trimURL=function(baseURLDomain)
39 {var result=this.replace(/^(https|http|file):\/\//i,"");if(baseURLDomain)
40 result=result.replace(new RegExp("^"+baseURLDomain.escapeForRegExp(),"i"),"");return result;}
41 String.prototype.toTitleCase=function()
42 {return this.substring(0,1).toUpperCase()+this.substring(1);}
43 String.prototype.compareTo=function(other)
44 {if(this>other)
45 return 1;if(this<other)
46 return-1;return 0;}
47 function sanitizeHref(href)
48 {return href&&href.trim().toLowerCase().startsWith("javascript:")?null:href;}
49 String.prototype.removeURLFragment=function()
50 {var fragmentIndex=this.indexOf("#");if(fragmentIndex==-1)
51 fragmentIndex=this.length;return this.substring(0,fragmentIndex);}
52 String.prototype.startsWith=function(substring)
53 {return!this.lastIndexOf(substring,0);}
54 String.prototype.endsWith=function(substring)
55 {return this.indexOf(substring,this.length-substring.length)!==-1;}
56 String.prototype.hashCode=function()
57 {var result=0;for(var i=0;i<this.length;++i)
58 result=result*3+this.charCodeAt(i);return result;}
59 String.naturalOrderComparator=function(a,b)
60 {var chunk=/^\d+|^\D+/;var chunka,chunkb,anum,bnum;while(1){if(a){if(!b)
61 return 1;}else{if(b)
62 return-1;else
63 return 0;}
64 chunka=a.match(chunk)[0];chunkb=b.match(chunk)[0];anum=!isNaN(chunka);bnum=!isNaN(chunkb);if(anum&&!bnum)
65 return-1;if(bnum&&!anum)
66 return 1;if(anum&&bnum){var diff=chunka-chunkb;if(diff)
67 return diff;if(chunka.length!==chunkb.length){if(!+chunka&&!+chunkb)
68 return chunka.length-chunkb.length;else
69 return chunkb.length-chunka.length;}}else if(chunka!==chunkb)
70 return(chunka<chunkb)?-1:1;a=a.substring(chunka.length);b=b.substring(chunkb.length);}}
71 Number.constrain=function(num,min,max)
72 {if(num<min)
73 num=min;else if(num>max)
74 num=max;return num;}
75 Number.gcd=function(a,b)
76 {if(b===0)
77 return a;else
78 return Number.gcd(b,a%b);}
79 Number.toFixedIfFloating=function(value)
80 {if(!value||isNaN(value))
81 return value;var number=Number(value);return number%1?number.toFixed(3):String(number);}
82 Date.prototype.toISO8601Compact=function()
83 {function leadZero(x)
84 {return(x>9?"":"0")+x;}
85 return this.getFullYear()+
86 leadZero(this.getMonth()+1)+
87 leadZero(this.getDate())+"T"+
88 leadZero(this.getHours())+
89 leadZero(this.getMinutes())+
90 leadZero(this.getSeconds());}
91 Date.prototype.toConsoleTime=function()
92 {function leadZero2(x)
93 {return(x>9?"":"0")+x;}
94 function leadZero3(x)
95 {return(Array(4-x.toString().length)).join('0')+x;}
96 return this.getFullYear()+"-"+
97 leadZero2(this.getMonth()+1)+"-"+
98 leadZero2(this.getDate())+" "+
99 leadZero2(this.getHours())+":"+
100 leadZero2(this.getMinutes())+":"+
101 leadZero2(this.getSeconds())+"."+
102 leadZero3(this.getMilliseconds());}
103 Object.defineProperty(Array.prototype,"remove",{value:function(value,firstOnly)
104 {var index=this.indexOf(value);if(index===-1)
105 return;if(firstOnly){this.splice(index,1);return;}
106 for(var i=index+1,n=this.length;i<n;++i){if(this[i]!==value)
107 this[index++]=this[i];}
108 this.length=index;}});Object.defineProperty(Array.prototype,"keySet",{value:function()
109 {var keys={};for(var i=0;i<this.length;++i)
110 keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"rotate",{value:function(index)
111 {var result=[];for(var i=index;i<index+this.length;++i)
112 result.push(this[i%this.length]);return result;}});Object.defineProperty(Uint32Array.prototype,"sort",{value:Array.prototype.sort});(function(){var partition={value:function(comparator,left,right,pivotIndex)
113 {function swap(array,i1,i2)
114 {var temp=array[i1];array[i1]=array[i2];array[i2]=temp;}
115 var pivotValue=this[pivotIndex];swap(this,right,pivotIndex);var storeIndex=left;for(var i=left;i<right;++i){if(comparator(this[i],pivotValue)<0){swap(this,storeIndex,i);++storeIndex;}}
116 swap(this,right,storeIndex);return storeIndex;}};Object.defineProperty(Array.prototype,"partition",partition);Object.defineProperty(Uint32Array.prototype,"partition",partition);var sortRange={value:function(comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight)
117 {function quickSortRange(array,comparator,left,right,sortWindowLeft,sortWindowRight)
118 {if(right<=left)
119 return;var pivotIndex=Math.floor(Math.random()*(right-left))+left;var pivotNewIndex=array.partition(comparator,left,right,pivotIndex);if(sortWindowLeft<pivotNewIndex)
120 quickSortRange(array,comparator,left,pivotNewIndex-1,sortWindowLeft,sortWindowRight);if(pivotNewIndex<sortWindowRight)
121 quickSortRange(array,comparator,pivotNewIndex+1,right,sortWindowLeft,sortWindowRight);}
122 if(leftBound===0&&rightBound===(this.length-1)&&sortWindowLeft===0&&sortWindowRight>=rightBound)
123 this.sort(comparator);else
124 quickSortRange(this,comparator,leftBound,rightBound,sortWindowLeft,sortWindowRight);return this;}}
125 Object.defineProperty(Array.prototype,"sortRange",sortRange);Object.defineProperty(Uint32Array.prototype,"sortRange",sortRange);})();Object.defineProperty(Array.prototype,"stableSort",{value:function(comparator)
126 {function defaultComparator(a,b)
127 {return a<b?-1:(a>b?1:0);}
128 comparator=comparator||defaultComparator;var indices=new Array(this.length);for(var i=0;i<this.length;++i)
129 indices[i]=i;var self=this;function indexComparator(a,b)
130 {var result=comparator(self[a],self[b]);return result?result:a-b;}
131 indices.sort(indexComparator);for(var i=0;i<this.length;++i){if(indices[i]<0||i===indices[i])
132 continue;var cyclical=i;var saved=this[i];while(true){var next=indices[cyclical];indices[cyclical]=-1;if(next===i){this[cyclical]=saved;break;}else{this[cyclical]=this[next];cyclical=next;}}}
133 return this;}});Object.defineProperty(Array.prototype,"qselect",{value:function(k,comparator)
134 {if(k<0||k>=this.length)
135 return;if(!comparator)
136 comparator=function(a,b){return a-b;}
137 var low=0;var high=this.length-1;for(;;){var pivotPosition=this.partition(comparator,low,high,Math.floor((high+low)/2));if(pivotPosition===k)
138 return this[k];else if(pivotPosition>k)
139 high=pivotPosition-1;else
140 low=pivotPosition+1;}}});Object.defineProperty(Array.prototype,"lowerBound",{value:function(object,comparator,left,right)
141 {function defaultComparator(a,b)
142 {return a<b?-1:(a>b?1:0);}
143 comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?right:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>0)
144 l=m+1;else
145 r=m;}
146 return r;}});Object.defineProperty(Array.prototype,"upperBound",{value:function(object,comparator,left,right)
147 {function defaultComparator(a,b)
148 {return a<b?-1:(a>b?1:0);}
149 comparator=comparator||defaultComparator;var l=left||0;var r=right!==undefined?right:this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>=0)
150 l=m+1;else
151 r=m;}
152 return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:function(value,comparator)
153 {var index=this.lowerBound(value,comparator);return index<this.length&&comparator(value,this[index])===0?index:-1;}});Object.defineProperty(Array.prototype,"select",{value:function(field)
154 {var result=new Array(this.length);for(var i=0;i<this.length;++i)
155 result[i]=this[i][field];return result;}});Object.defineProperty(Array.prototype,"peekLast",{value:function()
156 {return this[this.length-1];}});(function(){function mergeOrIntersect(array1,array2,comparator,mergeNotIntersect)
157 {var result=[];var i=0;var j=0;while(i<array1.length&&j<array2.length){var compareValue=comparator(array1[i],array2[j]);if(mergeNotIntersect||!compareValue)
158 result.push(compareValue<=0?array1[i]:array2[j]);if(compareValue<=0)
159 i++;if(compareValue>=0)
160 j++;}
161 if(mergeNotIntersect){while(i<array1.length)
162 result.push(array1[i++]);while(j<array2.length)
163 result.push(array2[j++]);}
164 return result;}
165 Object.defineProperty(Array.prototype,"intersectOrdered",{value:function(array,comparator)
166 {return mergeOrIntersect(this,array,comparator,false);}});Object.defineProperty(Array.prototype,"mergeOrdered",{value:function(array,comparator)
167 {return mergeOrIntersect(this,array,comparator,true);}});}());function insertionIndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter)
168 {if(insertionIndexAfter)
169 return list.upperBound(object,comparator);else
170 return list.lowerBound(object,comparator);}
171 String.sprintf=function(format,var_arg)
172 {return String.vsprintf(format,Array.prototype.slice.call(arguments,1));}
173 String.tokenizeFormatString=function(format,formatters)
174 {var tokens=[];var substitutionIndex=0;function addStringToken(str)
175 {tokens.push({type:"string",value:str});}
176 function addSpecifierToken(specifier,precision,substitutionIndex)
177 {tokens.push({type:"specifier",specifier:specifier,precision:precision,substitutionIndex:substitutionIndex});}
178 function isDigit(c)
179 {return!!/[0-9]/.exec(c);}
180 var index=0;for(var precentIndex=format.indexOf("%",index);precentIndex!==-1;precentIndex=format.indexOf("%",index)){addStringToken(format.substring(index,precentIndex));index=precentIndex+1;if(isDigit(format[index])){var number=parseInt(format.substring(index),10);while(isDigit(format[index]))
181 ++index;if(number>0&&format[index]==="$"){substitutionIndex=(number-1);++index;}}
182 var precision=-1;if(format[index]==="."){++index;precision=parseInt(format.substring(index),10);if(isNaN(precision))
183 precision=0;while(isDigit(format[index]))
184 ++index;}
185 if(!(format[index]in formatters)){addStringToken(format.substring(precentIndex,index+1));++index;continue;}
186 addSpecifierToken(format[index],precision,substitutionIndex);++substitutionIndex;++index;}
187 addStringToken(format.substring(index));return tokens;}
188 String.standardFormatters={d:function(substitution)
189 {return!isNaN(substitution)?substitution:0;},f:function(substitution,token)
190 {if(substitution&&token.precision>-1)
191 substitution=substitution.toFixed(token.precision);return!isNaN(substitution)?substitution:(token.precision>-1?Number(0).toFixed(token.precision):0);},s:function(substitution)
192 {return substitution;}}
193 String.vsprintf=function(format,substitutions)
194 {return String.format(format,substitutions,String.standardFormatters,"",function(a,b){return a+b;}).formattedResult;}
195 String.format=function(format,substitutions,formatters,initialValue,append)
196 {if(!format||!substitutions||!substitutions.length)
197 return{formattedResult:append(initialValue,format),unusedSubstitutions:substitutions};function prettyFunctionName()
198 {return"String.format(\""+format+"\", \""+substitutions.join("\", \"")+"\")";}
199 function warn(msg)
200 {console.warn(prettyFunctionName()+": "+msg);}
201 function error(msg)
202 {console.error(prettyFunctionName()+": "+msg);}
203 var result=initialValue;var tokens=String.tokenizeFormatString(format,formatters);var usedSubstitutionIndexes={};for(var i=0;i<tokens.length;++i){var token=tokens[i];if(token.type==="string"){result=append(result,token.value);continue;}
204 if(token.type!=="specifier"){error("Unknown token type \""+token.type+"\" found.");continue;}
205 if(token.substitutionIndex>=substitutions.length){error("not enough substitution arguments. Had "+substitutions.length+" but needed "+(token.substitutionIndex+1)+", so substitution was skipped.");result=append(result,"%"+(token.precision>-1?token.precision:"")+token.specifier);continue;}
206 usedSubstitutionIndexes[token.substitutionIndex]=true;if(!(token.specifier in formatters)){warn("unsupported format character \u201C"+token.specifier+"\u201D. Treating as a string.");result=append(result,substitutions[token.substitutionIndex]);continue;}
207 result=append(result,formatters[token.specifier](substitutions[token.substitutionIndex],token));}
208 var unusedSubstitutions=[];for(var i=0;i<substitutions.length;++i){if(i in usedSubstitutionIndexes)
209 continue;unusedSubstitutions.push(substitutions[i]);}
210 return{formattedResult:result,unusedSubstitutions:unusedSubstitutions};}
211 function createSearchRegex(query,caseSensitive,isRegex)
212 {var regexFlags=caseSensitive?"g":"gi";var regexObject;if(isRegex){try{regexObject=new RegExp(query,regexFlags);}catch(e){}}
213 if(!regexObject)
214 regexObject=createPlainTextSearchRegex(query,regexFlags);return regexObject;}
215 function createPlainTextSearchRegex(query,flags)
216 {var regexSpecialCharacters=String.regexSpecialCharacters();var regex="";for(var i=0;i<query.length;++i){var c=query.charAt(i);if(regexSpecialCharacters.indexOf(c)!=-1)
217 regex+="\\";regex+=c;}
218 return new RegExp(regex,flags||"");}
219 function countRegexMatches(regex,content)
220 {var text=content;var result=0;var match;while(text&&(match=regex.exec(text))){if(match[0].length>0)
221 ++result;text=text.substring(match.index+1);}
222 return result;}
223 function numberToStringWithSpacesPadding(value,symbolsCount)
224 {var numberString=value.toString();var paddingLength=Math.max(0,symbolsCount-numberString.length);var paddingString=Array(paddingLength+1).join("\u00a0");return paddingString+numberString;}
225 var createObjectIdentifier=function()
226 {return"_"+ ++createObjectIdentifier._last;}
227 createObjectIdentifier._last=0;var Set=function()
228 {this._set={};this._size=0;}
229 Set.prototype={add:function(item)
230 {var objectIdentifier=item.__identifier;if(!objectIdentifier){objectIdentifier=createObjectIdentifier();item.__identifier=objectIdentifier;}
231 if(!this._set[objectIdentifier])
232 ++this._size;this._set[objectIdentifier]=item;},remove:function(item)
233 {if(this._set[item.__identifier]){--this._size;delete this._set[item.__identifier];return true;}
234 return false;},items:function()
235 {var result=new Array(this._size);var i=0;for(var objectIdentifier in this._set)
236 result[i++]=this._set[objectIdentifier];return result;},hasItem:function(item)
237 {return!!this._set[item.__identifier];},size:function()
238 {return this._size;},clear:function()
239 {this._set={};this._size=0;}}
240 var Map=function()
241 {this._map={};this._size=0;}
242 Map.prototype={put:function(key,value)
243 {var objectIdentifier=key.__identifier;if(!objectIdentifier){objectIdentifier=createObjectIdentifier();key.__identifier=objectIdentifier;}
244 if(!this._map[objectIdentifier])
245 ++this._size;this._map[objectIdentifier]=[key,value];},remove:function(key)
246 {var result=this._map[key.__identifier];if(!result)
247 return undefined;--this._size;delete this._map[key.__identifier];return result[1];},keys:function()
248 {return this._list(0);},values:function()
249 {return this._list(1);},_list:function(index)
250 {var result=new Array(this._size);var i=0;for(var objectIdentifier in this._map)
251 result[i++]=this._map[objectIdentifier][index];return result;},get:function(key)
252 {var entry=this._map[key.__identifier];return entry?entry[1]:undefined;},contains:function(key)
253 {var entry=this._map[key.__identifier];return!!entry;},size:function()
254 {return this._size;},clear:function()
255 {this._map={};this._size=0;}}
256 var StringMap=function()
257 {this._map={};this._size=0;}
258 StringMap.prototype={put:function(key,value)
259 {if(key==="__proto__"){if(!this._hasProtoKey){++this._size;this._hasProtoKey=true;}
260 this._protoValue=value;return;}
261 if(!Object.prototype.hasOwnProperty.call(this._map,key))
262 ++this._size;this._map[key]=value;},remove:function(key)
263 {var result;if(key==="__proto__"){if(!this._hasProtoKey)
264 return undefined;--this._size;delete this._hasProtoKey;result=this._protoValue;delete this._protoValue;return result;}
265 if(!Object.prototype.hasOwnProperty.call(this._map,key))
266 return undefined;--this._size;result=this._map[key];delete this._map[key];return result;},keys:function()
267 {var result=Object.keys(this._map)||[];if(this._hasProtoKey)
268 result.push("__proto__");return result;},values:function()
269 {var result=Object.values(this._map);if(this._hasProtoKey)
270 result.push(this._protoValue);return result;},get:function(key)
271 {if(key==="__proto__")
272 return this._protoValue;if(!Object.prototype.hasOwnProperty.call(this._map,key))
273 return undefined;return this._map[key];},contains:function(key)
274 {var result;if(key==="__proto__")
275 return this._hasProtoKey;return Object.prototype.hasOwnProperty.call(this._map,key);},size:function()
276 {return this._size;},clear:function()
277 {this._map={};this._size=0;delete this._hasProtoKey;delete this._protoValue;}}
278 var StringSet=function()
279 {this._map=new StringMap();}
280 StringSet.prototype={put:function(value)
281 {this._map.put(value,true);},remove:function(value)
282 {return!!this._map.remove(value);},values:function()
283 {return this._map.keys();},contains:function(value)
284 {return this._map.contains(value);},size:function()
285 {return this._map.size();},clear:function()
286 {this._map.clear();}}
287 function loadXHR(url,async,callback)
288 {function onReadyStateChanged()
289 {if(xhr.readyState!==XMLHttpRequest.DONE)
290 return;if(xhr.status===200){callback(xhr.responseText);return;}
291 callback(null);}
292 var xhr=new XMLHttpRequest();xhr.open("GET",url,async);if(async)
293 xhr.onreadystatechange=onReadyStateChanged;xhr.send(null);if(!async){if(xhr.status===200)
294 return xhr.responseText;return null;}
295 return null;}
296 var _importedScripts={};function importScript(scriptName)
297 {if(_importedScripts[scriptName])
298 return;var xhr=new XMLHttpRequest();_importedScripts[scriptName]=true;xhr.open("GET",scriptName,false);xhr.send(null);if(!xhr.responseText)
299 throw"empty response arrived for script '"+scriptName+"'";var baseUrl=location.origin+location.pathname;baseUrl=baseUrl.substring(0,baseUrl.lastIndexOf("/"));var sourceURL=baseUrl+"/"+scriptName;self.eval(xhr.responseText+"\n//# sourceURL="+sourceURL);}
300 var loadScript=importScript;function CallbackBarrier()
301 {this._pendingIncomingCallbacksCount=0;}
302 CallbackBarrier.prototype={createCallback:function(userCallback)
303 {console.assert(!this._outgoingCallback,"CallbackBarrier.createCallback() is called after CallbackBarrier.callWhenDone()");++this._pendingIncomingCallbacksCount;return this._incomingCallback.bind(this,userCallback);},callWhenDone:function(callback)
304 {console.assert(!this._outgoingCallback,"CallbackBarrier.callWhenDone() is called multiple times");this._outgoingCallback=callback;if(!this._pendingIncomingCallbacksCount)
305 this._outgoingCallback();},_incomingCallback:function(userCallback)
306 {console.assert(this._pendingIncomingCallbacksCount>0);if(userCallback){var args=Array.prototype.slice.call(arguments,1);userCallback.apply(null,args);}
307 if(!--this._pendingIncomingCallbacksCount&&this._outgoingCallback)
308 this._outgoingCallback();}}
309 function suppressUnused(value)
310 {}
311 var allDescriptors=[{name:"main",extensions:[{type:"@WebInspector.ActionDelegate",bindings:[{platform:"windows,linux",shortcut:"F5 Ctrl+R"},{platform:"mac",shortcut:"Meta+R"}],className:"WebInspector.Main.ReloadActionDelegate"},{type:"@WebInspector.ActionDelegate",bindings:[{platform:"windows,linux",shortcut:"Shift+F5 Ctrl+F5 Ctrl+Shift+F5 Shift+Ctrl+R"},{platform:"mac",shortcut:"Shift+Meta+R"}],className:"WebInspector.Main.HardReloadActionDelegate"},{type:"@WebInspector.ActionDelegate",bindings:[{shortcut:"Esc"}],className:"WebInspector.InspectorView.DrawerToggleActionDelegate"},{type:"@WebInspector.ActionDelegate",bindings:[{shortcut:"Alt+R"}],className:"WebInspector.Main.DebugReloadActionDelegate"}]},{name:"elements",extensions:[{type:"@WebInspector.Panel",name:"elements",title:"Elements",order:0,className:"WebInspector.ElementsPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.RemoteObject","WebInspector.DOMNode"],className:"WebInspector.ElementsPanel.ContextMenuProvider"},{type:"drawer-view",name:"emulation",title:"Emulation",order:"10",className:"WebInspector.OverridesView"},{type:"drawer-view",name:"rendering",title:"Rendering",order:"11",className:"WebInspector.RenderingOptionsView"},{type:"@WebInspector.Renderer",contextTypes:["WebInspector.DOMNode"],className:"WebInspector.ElementsTreeOutline.Renderer"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.DOMNode"],className:"WebInspector.ElementsPanel.DOMNodeRevealer"}],scripts:["ElementsPanel.js"]},{name:"network",extensions:[{type:"@WebInspector.Panel",name:"network",title:"Network",order:1,className:"WebInspector.NetworkPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.NetworkRequest","WebInspector.Resource","WebInspector.UISourceCode"],className:"WebInspector.NetworkPanel.ContextMenuProvider"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.NetworkRequest"],className:"WebInspector.NetworkPanel.RequestRevealer"}],scripts:["NetworkPanel.js"]},{name:"codemirror",extensions:[{type:"@WebInspector.InplaceEditor",className:"WebInspector.CodeMirrorUtils"},{type:"@WebInspector.TokenizerFactory",className:"WebInspector.CodeMirrorUtils.TokenizerFactory"},],scripts:["CodeMirrorTextEditor.js"]},{name:"sources",extensions:[{type:"@WebInspector.Panel",name:"sources",title:"Sources",order:2,className:"WebInspector.SourcesPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.UISourceCode","WebInspector.RemoteObject"],className:"WebInspector.SourcesPanel.ContextMenuProvider"},{type:"@WebInspector.SearchScope",className:"WebInspector.SourcesSearchScope"},{type:"drawer-view",name:"search",title:"Search",order:"1",className:"WebInspector.SearchView"},{type:"@WebInspector.DrawerEditor",className:"WebInspector.SourcesPanel.DrawerEditor"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.UILocation"],className:"WebInspector.SourcesPanel.UILocationRevealer"},{type:"@WebInspector.SourcesView.EditorAction",className:"WebInspector.InplaceFormatterEditorAction"},{type:"@WebInspector.SourcesView.EditorAction",className:"WebInspector.ScriptFormatterEditorAction"},{type:"navigator-view",name:"sources",title:"Sources",order:1,className:"WebInspector.SourcesNavigatorView"},{type:"navigator-view",name:"contentScripts",title:"Content scripts",order:2,className:"WebInspector.ContentScriptsNavigatorView"},{type:"navigator-view",name:"snippets",title:"Snippets",order:3,className:"WebInspector.SnippetsNavigatorView"},{type:"@WebInspector.ActionDelegate",bindings:[{platform:"mac",shortcut:"Meta+O Meta+P"},{platform:"windows,linux",shortcut:"Ctrl+O Ctrl+P"}],className:"WebInspector.SourcesPanel.ShowGoToSourceDialogActionDelegate"}],scripts:["SourcesPanel.js"]},{name:"timeline",extensions:[{type:"@WebInspector.Panel",name:"timeline",title:"Timeline",order:3,className:"WebInspector.TimelinePanel"}],scripts:["TimelinePanel.js"]},{name:"profiles",extensions:[{type:"@WebInspector.Panel",name:"profiles",title:"Profiles",order:4,className:"WebInspector.ProfilesPanel"},{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.RemoteObject"],className:"WebInspector.ProfilesPanel.ContextMenuProvider"}],scripts:["ProfilesPanel.js"]},{name:"resources",extensions:[{type:"@WebInspector.Panel",name:"resources",title:"Resources",order:5,className:"WebInspector.ResourcesPanel"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.Resource"],className:"WebInspector.ResourcesPanel.ResourceRevealer"}],scripts:["ResourcesPanel.js"]},{name:"audits",extensions:[{type:"@WebInspector.Panel",name:"audits",title:"Audits",order:6,className:"WebInspector.AuditsPanel"}],scripts:["AuditsPanel.js"]},{name:"console",extensions:[{type:"@WebInspector.Panel",name:"console",title:"Console",order:20,className:"WebInspector.ConsolePanel"},{type:"drawer-view",name:"console",title:"Console",order:"0",className:"WebInspector.ConsolePanel.WrapperView"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.ConsoleModel"],className:"WebInspector.ConsolePanel.ConsoleRevealer"},{type:"@WebInspector.ActionDelegate",bindings:[{shortcut:"Ctrl+`"}],className:"WebInspector.ConsoleView.ShowConsoleActionDelegate"}],scripts:["ConsolePanel.js"]},{name:"settings",extensions:[{type:"@WebInspector.ActionDelegate",bindings:[{shortcut:"F1 Shift+?"}],className:"WebInspector.SettingsController.SettingsScreenActionDelegate"}]},{name:"extensions",extensions:[{type:"@WebInspector.ExtensionServerAPI",className:"WebInspector.ExtensionServer"}],scripts:["ExtensionServer.js"]},{name:"layers",extensions:[{type:"@WebInspector.Panel",name:"layers",title:"Layers",order:7,className:"WebInspector.LayersPanel"},{type:"@WebInspector.Revealer",contextTypes:["WebInspector.LayerTreeSnapshot"],className:"WebInspector.LayersPanel.LayerTreeRevealer"}],scripts:["LayersPanel.js"]},{name:"handler-registry",extensions:[{type:"@WebInspector.ContextMenu.Provider",contextTypes:["WebInspector.UISourceCode","WebInspector.Resource","WebInspector.NetworkRequest","Node"],className:"WebInspector.HandlerRegistry.ContextMenuProvider"}]}];__whitespace={" ":true,"\t":true,"\n":true,"\f":true,"\r":true};difflib={defaultJunkFunction:function(c){return __whitespace.hasOwnProperty(c);},stripLinebreaks:function(str){return str.replace(/^[\n\r]*|[\n\r]*$/g,"");},stringAsLines:function(str){var lfpos=str.indexOf("\n");var crpos=str.indexOf("\r");var linebreak=((lfpos>-1&&crpos>-1)||crpos<0)?"\n":"\r";var lines=str.split(linebreak);for(var i=0;i<lines.length;i++){lines[i]=difflib.stripLinebreaks(lines[i]);}
312 return lines;},__reduce:function(func,list,initial){if(initial!=null){var value=initial;var idx=0;}else if(list){var value=list[0];var idx=1;}else{return null;}
313 for(;idx<list.length;idx++){value=func(value,list[idx]);}
314 return value;},__ntuplecomp:function(a,b){var mlen=Math.max(a.length,b.length);for(var i=0;i<mlen;i++){if(a[i]<b[i])return-1;if(a[i]>b[i])return 1;}
315 return a.length==b.length?0:(a.length<b.length?-1:1);},__calculate_ratio:function(matches,length){return length?2.0*matches/length:1.0;},__isindict:function(dict){return function(key){return dict.hasOwnProperty(key);};},__dictget:function(dict,key,defaultValue){return dict.hasOwnProperty(key)?dict[key]:defaultValue;},SequenceMatcher:function(a,b,isjunk){this.set_seqs=function(a,b){this.set_seq1(a);this.set_seq2(b);}
316 this.set_seq1=function(a){if(a==this.a)return;this.a=a;this.matching_blocks=this.opcodes=null;}
317 this.set_seq2=function(b){if(b==this.b)return;this.b=b;this.matching_blocks=this.opcodes=this.fullbcount=null;this.__chain_b();}
318 this.__chain_b=function(){var b=this.b;var n=b.length;var b2j=this.b2j={};var populardict={};for(var i=0;i<b.length;i++){var elt=b[i];if(b2j.hasOwnProperty(elt)){var indices=b2j[elt];if(n>=200&&indices.length*100>n){populardict[elt]=1;delete b2j[elt];}else{indices.push(i);}}else{b2j[elt]=[i];}}
319 for(var elt in populardict){if(populardict.hasOwnProperty(elt)){delete b2j[elt];}}
320 var isjunk=this.isjunk;var junkdict={};if(isjunk){for(var elt in populardict){if(populardict.hasOwnProperty(elt)&&isjunk(elt)){junkdict[elt]=1;delete populardict[elt];}}
321 for(var elt in b2j){if(b2j.hasOwnProperty(elt)&&isjunk(elt)){junkdict[elt]=1;delete b2j[elt];}}}
322 this.isbjunk=difflib.__isindict(junkdict);this.isbpopular=difflib.__isindict(populardict);}
323 this.find_longest_match=function(alo,ahi,blo,bhi){var a=this.a;var b=this.b;var b2j=this.b2j;var isbjunk=this.isbjunk;var besti=alo;var bestj=blo;var bestsize=0;var j=null;var j2len={};var nothing=[];for(var i=alo;i<ahi;i++){var newj2len={};var jdict=difflib.__dictget(b2j,a[i],nothing);for(var jkey in jdict){if(jdict.hasOwnProperty(jkey)){j=jdict[jkey];if(j<blo)continue;if(j>=bhi)break;newj2len[j]=k=difflib.__dictget(j2len,j-1,0)+1;if(k>bestsize){besti=i-k+1;bestj=j-k+1;bestsize=k;}}}
324 j2len=newj2len;}
325 while(besti>alo&&bestj>blo&&!isbjunk(b[bestj-1])&&a[besti-1]==b[bestj-1]){besti--;bestj--;bestsize++;}
326 while(besti+bestsize<ahi&&bestj+bestsize<bhi&&!isbjunk(b[bestj+bestsize])&&a[besti+bestsize]==b[bestj+bestsize]){bestsize++;}
327 while(besti>alo&&bestj>blo&&isbjunk(b[bestj-1])&&a[besti-1]==b[bestj-1]){besti--;bestj--;bestsize++;}
328 while(besti+bestsize<ahi&&bestj+bestsize<bhi&&isbjunk(b[bestj+bestsize])&&a[besti+bestsize]==b[bestj+bestsize]){bestsize++;}
329 return[besti,bestj,bestsize];}
330 this.get_matching_blocks=function(){if(this.matching_blocks!=null)return this.matching_blocks;var la=this.a.length;var lb=this.b.length;var queue=[[0,la,0,lb]];var matching_blocks=[];var alo,ahi,blo,bhi,qi,i,j,k,x;while(queue.length){qi=queue.pop();alo=qi[0];ahi=qi[1];blo=qi[2];bhi=qi[3];x=this.find_longest_match(alo,ahi,blo,bhi);i=x[0];j=x[1];k=x[2];if(k){matching_blocks.push(x);if(alo<i&&blo<j)
331 queue.push([alo,i,blo,j]);if(i+k<ahi&&j+k<bhi)
332 queue.push([i+k,ahi,j+k,bhi]);}}
333 matching_blocks.sort(difflib.__ntuplecomp);var i1=j1=k1=block=0;var non_adjacent=[];for(var idx in matching_blocks){if(matching_blocks.hasOwnProperty(idx)){block=matching_blocks[idx];i2=block[0];j2=block[1];k2=block[2];if(i1+k1==i2&&j1+k1==j2){k1+=k2;}else{if(k1)non_adjacent.push([i1,j1,k1]);i1=i2;j1=j2;k1=k2;}}}
334 if(k1)non_adjacent.push([i1,j1,k1]);non_adjacent.push([la,lb,0]);this.matching_blocks=non_adjacent;return this.matching_blocks;}
335 this.get_opcodes=function(){if(this.opcodes!=null)return this.opcodes;var i=0;var j=0;var answer=[];this.opcodes=answer;var block,ai,bj,size,tag;var blocks=this.get_matching_blocks();for(var idx in blocks){if(blocks.hasOwnProperty(idx)){block=blocks[idx];ai=block[0];bj=block[1];size=block[2];tag='';if(i<ai&&j<bj){tag='replace';}else if(i<ai){tag='delete';}else if(j<bj){tag='insert';}
336 if(tag)answer.push([tag,i,ai,j,bj]);i=ai+size;j=bj+size;if(size)answer.push(['equal',ai,i,bj,j]);}}
337 return answer;}
338 this.get_grouped_opcodes=function(n){if(!n)n=3;var codes=this.get_opcodes();if(!codes)codes=[["equal",0,1,0,1]];var code,tag,i1,i2,j1,j2;if(codes[0][0]=='equal'){code=codes[0];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[0]=[tag,Math.max(i1,i2-n),i2,Math.max(j1,j2-n),j2];}
339 if(codes[codes.length-1][0]=='equal'){code=codes[codes.length-1];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];codes[codes.length-1]=[tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)];}
340 var nn=n+n;var groups=[];for(var idx in codes){if(codes.hasOwnProperty(idx)){code=codes[idx];tag=code[0];i1=code[1];i2=code[2];j1=code[3];j2=code[4];if(tag=='equal'&&i2-i1>nn){groups.push([tag,i1,Math.min(i2,i1+n),j1,Math.min(j2,j1+n)]);i1=Math.max(i1,i2-n);j1=Math.max(j1,j2-n);}
341 groups.push([tag,i1,i2,j1,j2]);}}
342 if(groups&&groups[groups.length-1][0]=='equal')groups.pop();return groups;}
343 this.ratio=function(){matches=difflib.__reduce(function(sum,triple){return sum+triple[triple.length-1];},this.get_matching_blocks(),0);return difflib.__calculate_ratio(matches,this.a.length+this.b.length);}
344 this.quick_ratio=function(){var fullbcount,elt;if(this.fullbcount==null){this.fullbcount=fullbcount={};for(var i=0;i<this.b.length;i++){elt=this.b[i];fullbcount[elt]=difflib.__dictget(fullbcount,elt,0)+1;}}
345 fullbcount=this.fullbcount;var avail={};var availhas=difflib.__isindict(avail);var matches=numb=0;for(var i=0;i<this.a.length;i++){elt=this.a[i];if(availhas(elt)){numb=avail[elt];}else{numb=difflib.__dictget(fullbcount,elt,0);}
346 avail[elt]=numb-1;if(numb>0)matches++;}
347 return difflib.__calculate_ratio(matches,this.a.length+this.b.length);}
348 this.real_quick_ratio=function(){var la=this.a.length;var lb=this.b.length;return _calculate_ratio(Math.min(la,lb),la+lb);}
349 this.isjunk=isjunk?isjunk:difflib.defaultJunkFunction;this.a=this.b=null;this.set_seqs(a,b);}}
350 Node.prototype.rangeOfWord=function(offset,stopCharacters,stayWithinNode,direction)
351 {var startNode;var startOffset=0;var endNode;var endOffset=0;if(!stayWithinNode)
352 stayWithinNode=this;if(!direction||direction==="backward"||direction==="both"){var node=this;while(node){if(node===stayWithinNode){if(!startNode)
353 startNode=stayWithinNode;break;}
354 if(node.nodeType===Node.TEXT_NODE){var start=(node===this?(offset-1):(node.nodeValue.length-1));for(var i=start;i>=0;--i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){startNode=node;startOffset=i+1;break;}}}
355 if(startNode)
356 break;node=node.traversePreviousNode(stayWithinNode);}
357 if(!startNode){startNode=stayWithinNode;startOffset=0;}}else{startNode=this;startOffset=offset;}
358 if(!direction||direction==="forward"||direction==="both"){node=this;while(node){if(node===stayWithinNode){if(!endNode)
359 endNode=stayWithinNode;break;}
360 if(node.nodeType===Node.TEXT_NODE){var start=(node===this?offset:0);for(var i=start;i<node.nodeValue.length;++i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){endNode=node;endOffset=i;break;}}}
361 if(endNode)
362 break;node=node.traverseNextNode(stayWithinNode);}
363 if(!endNode){endNode=stayWithinNode;endOffset=stayWithinNode.nodeType===Node.TEXT_NODE?stayWithinNode.nodeValue.length:stayWithinNode.childNodes.length;}}else{endNode=this;endOffset=offset;}
364 var result=this.ownerDocument.createRange();result.setStart(startNode,startOffset);result.setEnd(endNode,endOffset);return result;}
365 Node.prototype.traverseNextTextNode=function(stayWithin)
366 {var node=this.traverseNextNode(stayWithin);if(!node)
367 return;while(node&&node.nodeType!==Node.TEXT_NODE)
368 node=node.traverseNextNode(stayWithin);return node;}
369 Node.prototype.rangeBoundaryForOffset=function(offset)
370 {var node=this.traverseNextTextNode(this);while(node&&offset>node.nodeValue.length){offset-=node.nodeValue.length;node=node.traverseNextTextNode(this);}
371 if(!node)
372 return{container:this,offset:0};return{container:node,offset:offset};}
373 Element.prototype.removeMatchingStyleClasses=function(classNameRegex)
374 {var regex=new RegExp("(^|\\s+)"+classNameRegex+"($|\\s+)");if(regex.test(this.className))
375 this.className=this.className.replace(regex," ");}
376 Element.prototype.positionAt=function(x,y,relativeTo)
377 {var shift={x:0,y:0};if(relativeTo)
378 shift=relativeTo.boxInWindow(this.ownerDocument.defaultView);if(typeof x==="number")
379 this.style.setProperty("left",(shift.x+x)+"px");else
380 this.style.removeProperty("left");if(typeof y==="number")
381 this.style.setProperty("top",(shift.y+y)+"px");else
382 this.style.removeProperty("top");}
383 Element.prototype.isScrolledToBottom=function()
384 {return Math.abs(this.scrollTop+this.clientHeight-this.scrollHeight)<=1;}
385 function removeSubsequentNodes(fromNode,toNode)
386 {for(var node=fromNode;node&&node!==toNode;){var nodeToRemove=node;node=node.nextSibling;nodeToRemove.remove();}}
387 function Size(width,height)
388 {this.width=width;this.height=height;}
389 Size.prototype.isEqual=function(size)
390 {return!!size&&this.width===size.width&&this.height===size.height;};Element.prototype.measurePreferredSize=function(containerElement)
391 {containerElement=containerElement||document.body;containerElement.appendChild(this);this.positionAt(0,0);var result=new Size(this.offsetWidth,this.offsetHeight);this.positionAt(undefined,undefined);this.remove();return result;}
392 Element.prototype.containsEventPoint=function(event)
393 {var box=this.getBoundingClientRect();return box.left<event.x&&event.x<box.right&&box.top<event.y&&event.y<box.bottom;}
394 Node.prototype.enclosingNodeOrSelfWithNodeNameInArray=function(nameArray)
395 {for(var node=this;node&&node!==this.ownerDocument;node=node.parentNode)
396 for(var i=0;i<nameArray.length;++i)
397 if(node.nodeName.toLowerCase()===nameArray[i].toLowerCase())
398 return node;return null;}
399 Node.prototype.enclosingNodeOrSelfWithNodeName=function(nodeName)
400 {return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);}
401 Node.prototype.enclosingNodeOrSelfWithClass=function(className,stayWithin)
402 {for(var node=this;node&&node!==stayWithin&&node!==this.ownerDocument;node=node.parentNode)
403 if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains(className))
404 return node;return null;}
405 Element.prototype.query=function(query)
406 {return this.ownerDocument.evaluate(query,this,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;}
407 Element.prototype.removeChildren=function()
408 {if(this.firstChild)
409 this.textContent="";}
410 Element.prototype.isInsertionCaretInside=function()
411 {var selection=window.getSelection();if(!selection.rangeCount||!selection.isCollapsed)
412 return false;var selectionRange=selection.getRangeAt(0);return selectionRange.startContainer.isSelfOrDescendant(this);}
413 Document.prototype.createElementWithClass=function(elementName,className)
414 {var element=this.createElement(elementName);if(className)
415 element.className=className;return element;}
416 Element.prototype.createChild=function(elementName,className)
417 {var element=this.ownerDocument.createElementWithClass(elementName,className);this.appendChild(element);return element;}
418 DocumentFragment.prototype.createChild=Element.prototype.createChild;Element.prototype.createTextChild=function(text)
419 {var element=this.ownerDocument.createTextNode(text);this.appendChild(element);return element;}
420 DocumentFragment.prototype.createTextChild=Element.prototype.createTextChild;Element.prototype.totalOffsetLeft=function()
421 {return this.totalOffset().left;}
422 Element.prototype.totalOffsetTop=function()
423 {return this.totalOffset().top;}
424 Element.prototype.totalOffset=function()
425 {var rect=this.getBoundingClientRect();return{left:rect.left,top:rect.top};}
426 Element.prototype.scrollOffset=function()
427 {var curLeft=0;var curTop=0;for(var element=this;element;element=element.scrollParent){curLeft+=element.scrollLeft;curTop+=element.scrollTop;}
428 return{left:curLeft,top:curTop};}
429 function AnchorBox(x,y,width,height)
430 {this.x=x||0;this.y=y||0;this.width=width||0;this.height=height||0;}
431 AnchorBox.prototype.relativeTo=function(box)
432 {return new AnchorBox(this.x-box.x,this.y-box.y,this.width,this.height);};AnchorBox.prototype.relativeToElement=function(element)
433 {return this.relativeTo(element.boxInWindow(element.ownerDocument.defaultView));};Element.prototype.offsetRelativeToWindow=function(targetWindow)
434 {var elementOffset=new AnchorBox();var curElement=this;var curWindow=this.ownerDocument.defaultView;while(curWindow&&curElement){elementOffset.x+=curElement.totalOffsetLeft();elementOffset.y+=curElement.totalOffsetTop();if(curWindow===targetWindow)
435 break;curElement=curWindow.frameElement;curWindow=curWindow.parent;}
436 return elementOffset;}
437 Element.prototype.boxInWindow=function(targetWindow)
438 {targetWindow=targetWindow||this.ownerDocument.defaultView;var anchorBox=this.offsetRelativeToWindow(window);anchorBox.width=Math.min(this.offsetWidth,window.innerWidth-anchorBox.x);anchorBox.height=Math.min(this.offsetHeight,window.innerHeight-anchorBox.y);return anchorBox;}
439 Element.prototype.setTextAndTitle=function(text)
440 {this.textContent=text;this.title=text;}
441 KeyboardEvent.prototype.__defineGetter__("data",function()
442 {switch(this.type){case"keypress":if(!this.ctrlKey&&!this.metaKey)
443 return String.fromCharCode(this.charCode);else
444 return"";case"keydown":case"keyup":if(!this.ctrlKey&&!this.metaKey&&!this.altKey)
445 return String.fromCharCode(this.which);else
446 return"";}});Event.prototype.consume=function(preventDefault)
447 {this.stopImmediatePropagation();if(preventDefault)
448 this.preventDefault();this.handled=true;}
449 Text.prototype.select=function(start,end)
450 {start=start||0;end=end||this.textContent.length;if(start<0)
451 start=end+start;var selection=this.ownerDocument.defaultView.getSelection();selection.removeAllRanges();var range=this.ownerDocument.createRange();range.setStart(this,start);range.setEnd(this,end);selection.addRange(range);return this;}
452 Element.prototype.selectionLeftOffset=function()
453 {var selection=window.getSelection();if(!selection.containsNode(this,true))
454 return null;var leftOffset=selection.anchorOffset;var node=selection.anchorNode;while(node!==this){while(node.previousSibling){node=node.previousSibling;leftOffset+=node.textContent.length;}
455 node=node.parentNode;}
456 return leftOffset;}
457 Node.prototype.isAncestor=function(node)
458 {if(!node)
459 return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
460 return true;currentNode=currentNode.parentNode;}
461 return false;}
462 Node.prototype.isDescendant=function(descendant)
463 {return!!descendant&&descendant.isAncestor(this);}
464 Node.prototype.isSelfOrAncestor=function(node)
465 {return!!node&&(node===this||this.isAncestor(node));}
466 Node.prototype.isSelfOrDescendant=function(node)
467 {return!!node&&(node===this||this.isDescendant(node));}
468 Node.prototype.traverseNextNode=function(stayWithin)
469 {var node=this.firstChild;if(node)
470 return node;if(stayWithin&&this===stayWithin)
471 return null;node=this.nextSibling;if(node)
472 return node;node=this;while(node&&!node.nextSibling&&(!stayWithin||!node.parentNode||node.parentNode!==stayWithin))
473 node=node.parentNode;if(!node)
474 return null;return node.nextSibling;}
475 Node.prototype.traversePreviousNode=function(stayWithin)
476 {if(stayWithin&&this===stayWithin)
477 return null;var node=this.previousSibling;while(node&&node.lastChild)
478 node=node.lastChild;if(node)
479 return node;return this.parentNode;}
480 Node.prototype.setTextContentTruncatedIfNeeded=function(text,placeholder)
481 {const maxTextContentLength=65535;if(typeof text==="string"&&text.length>maxTextContentLength){this.textContent=typeof placeholder==="string"?placeholder:text.trimEnd(maxTextContentLength);return true;}
482 this.textContent=text;return false;}
483 function isEnterKey(event){return event.keyCode!==229&&event.keyIdentifier==="Enter";}
484 function consumeEvent(e)
485 {e.consume();}
486 function TreeOutline(listNode,nonFocusable)
487 {this.children=[];this.selectedTreeElement=null;this._childrenListNode=listNode;this.childrenListElement=this._childrenListNode;this._childrenListNode.removeChildren();this.expandTreeElementsWhenArrowing=false;this.root=true;this.hasChildren=false;this.expanded=true;this.selected=false;this.treeOutline=this;this.comparator=null;this.setFocusable(!nonFocusable);this._childrenListNode.addEventListener("keydown",this._treeKeyDown.bind(this),true);this._treeElementsMap=new Map();this._expandedStateMap=new Map();this.element=listNode;}
488 TreeOutline.prototype.setFocusable=function(focusable)
489 {if(focusable)
490 this._childrenListNode.setAttribute("tabIndex",0);else
491 this._childrenListNode.removeAttribute("tabIndex");}
492 TreeOutline.prototype.appendChild=function(child)
493 {var insertionIndex;if(this.treeOutline.comparator)
494 insertionIndex=insertionIndexForObjectInListSortedByFunction(child,this.children,this.treeOutline.comparator);else
495 insertionIndex=this.children.length;this.insertChild(child,insertionIndex);}
496 TreeOutline.prototype.insertBeforeChild=function(child,beforeChild)
497 {if(!child)
498 throw("child can't be undefined or null");if(!beforeChild)
499 throw("beforeChild can't be undefined or null");var childIndex=this.children.indexOf(beforeChild);if(childIndex===-1)
500 throw("beforeChild not found in this node's children");this.insertChild(child,childIndex);}
501 TreeOutline.prototype.insertChild=function(child,index)
502 {if(!child)
503 throw("child can't be undefined or null");var previousChild=(index>0?this.children[index-1]:null);if(previousChild){previousChild.nextSibling=child;child.previousSibling=previousChild;}else{child.previousSibling=null;}
504 var nextChild=this.children[index];if(nextChild){nextChild.previousSibling=child;child.nextSibling=nextChild;}else{child.nextSibling=null;}
505 this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);}
506 if(child.hasChildren&&typeof(child.treeOutline._expandedStateMap.get(child.representedObject))!=="undefined")
507 child.expanded=child.treeOutline._expandedStateMap.get(child.representedObject);if(!this._childrenListNode){this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
508 this._childrenListNode.classList.add("hidden");}
509 child._attach();}
510 TreeOutline.prototype.removeChildAtIndex=function(childIndex)
511 {if(childIndex<0||childIndex>=this.children.length)
512 throw("childIndex out of range");var child=this.children[childIndex];this.children.splice(childIndex,1);var parent=child.parent;if(child.deselect()){if(child.previousSibling)
513 child.previousSibling.select();else if(child.nextSibling)
514 child.nextSibling.select();else
515 parent.select();}
516 if(child.previousSibling)
517 child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
518 child.nextSibling.previousSibling=child.previousSibling;if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
519 child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
520 TreeOutline.prototype.removeChild=function(child)
521 {if(!child)
522 throw("child can't be undefined or null");var childIndex=this.children.indexOf(child);if(childIndex===-1)
523 throw("child not found in this node's children");this.removeChildAtIndex.call(this,childIndex);}
524 TreeOutline.prototype.removeChildren=function()
525 {for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();if(child.treeOutline){child.treeOutline._forgetTreeElement(child);child.treeOutline._forgetChildrenRecursive(child);}
526 child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
527 this.children=[];}
528 TreeOutline.prototype._rememberTreeElement=function(element)
529 {if(!this._treeElementsMap.get(element.representedObject))
530 this._treeElementsMap.put(element.representedObject,[]);var elements=this._treeElementsMap.get(element.representedObject);if(elements.indexOf(element)!==-1)
531 return;elements.push(element);}
532 TreeOutline.prototype._forgetTreeElement=function(element)
533 {if(this._treeElementsMap.get(element.representedObject)){var elements=this._treeElementsMap.get(element.representedObject);elements.remove(element,true);if(!elements.length)
534 this._treeElementsMap.remove(element.representedObject);}}
535 TreeOutline.prototype._forgetChildrenRecursive=function(parentElement)
536 {var child=parentElement.children[0];while(child){this._forgetTreeElement(child);child=child.traverseNextTreeElement(false,parentElement,true);}}
537 TreeOutline.prototype.getCachedTreeElement=function(representedObject)
538 {if(!representedObject)
539 return null;var elements=this._treeElementsMap.get(representedObject);if(elements&&elements.length)
540 return elements[0];return null;}
541 TreeOutline.prototype.findTreeElement=function(representedObject,isAncestor,getParent)
542 {if(!representedObject)
543 return null;var cachedElement=this.getCachedTreeElement(representedObject);if(cachedElement)
544 return cachedElement;var ancestors=[];for(var currentObject=getParent(representedObject);currentObject;currentObject=getParent(currentObject)){ancestors.push(currentObject);if(this.getCachedTreeElement(currentObject))
545 break;}
546 if(!currentObject)
547 return null;for(var i=ancestors.length-1;i>=0;--i){var treeElement=this.getCachedTreeElement(ancestors[i]);if(treeElement)
548 treeElement.onpopulate();}
549 return this.getCachedTreeElement(representedObject);}
550 TreeOutline.prototype.treeElementFromPoint=function(x,y)
551 {var node=this._childrenListNode.ownerDocument.elementFromPoint(x,y);if(!node)
552 return null;var listNode=node.enclosingNodeOrSelfWithNodeNameInArray(["ol","li"]);if(listNode)
553 return listNode.parentTreeElement||listNode.treeElement;return null;}
554 TreeOutline.prototype._treeKeyDown=function(event)
555 {if(event.target!==this._childrenListNode)
556 return;if(!this.selectedTreeElement||event.shiftKey||event.metaKey||event.ctrlKey)
557 return;var handled=false;var nextSelectedElement;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traversePreviousTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
558 nextSelectedElement=nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traverseNextTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
559 nextSelectedElement=nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedTreeElement.expanded){if(event.altKey)
560 this.selectedTreeElement.collapseRecursively();else
561 this.selectedTreeElement.collapse();handled=true;}else if(this.selectedTreeElement.parent&&!this.selectedTreeElement.parent.root){handled=true;if(this.selectedTreeElement.parent.selectable){nextSelectedElement=this.selectedTreeElement.parent;while(nextSelectedElement&&!nextSelectedElement.selectable)
562 nextSelectedElement=nextSelectedElement.parent;handled=nextSelectedElement?true:false;}else if(this.selectedTreeElement.parent)
563 this.selectedTreeElement.parent.collapse();}}else if(event.keyIdentifier==="Right"){if(!this.selectedTreeElement.revealed()){this.selectedTreeElement.reveal();handled=true;}else if(this.selectedTreeElement.hasChildren){handled=true;if(this.selectedTreeElement.expanded){nextSelectedElement=this.selectedTreeElement.children[0];while(nextSelectedElement&&!nextSelectedElement.selectable)
564 nextSelectedElement=nextSelectedElement.nextSibling;handled=nextSelectedElement?true:false;}else{if(event.altKey)
565 this.selectedTreeElement.expandRecursively();else
566 this.selectedTreeElement.expand();}}}else if(event.keyCode===8||event.keyCode===46)
567 handled=this.selectedTreeElement.ondelete();else if(isEnterKey(event))
568 handled=this.selectedTreeElement.onenter();else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
569 handled=this.selectedTreeElement.onspace();if(nextSelectedElement){nextSelectedElement.reveal();nextSelectedElement.select(false,true);}
570 if(handled)
571 event.consume(true);}
572 TreeOutline.prototype.expand=function()
573 {}
574 TreeOutline.prototype.collapse=function()
575 {}
576 TreeOutline.prototype.revealed=function()
577 {return true;}
578 TreeOutline.prototype.reveal=function()
579 {}
580 TreeOutline.prototype.select=function()
581 {}
582 TreeOutline.prototype.revealAndSelect=function(omitFocus)
583 {}
584 function TreeElement(title,representedObject,hasChildren)
585 {this._title=title;this.representedObject=(representedObject||{});this.root=false;this._hidden=false;this._selectable=true;this.expanded=false;this.selected=false;this.hasChildren=hasChildren;this.children=[];this.treeOutline=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this._listItemNode=null;}
586 TreeElement.prototype={arrowToggleWidth:10,get selectable(){if(this._hidden)
587 return false;return this._selectable;},set selectable(x){this._selectable=x;},get listItemElement(){return this._listItemNode;},get childrenListElement(){return this._childrenListNode;},get title(){return this._title;},set title(x){this._title=x;this._setListItemNodeContent();},get tooltip(){return this._tooltip;},set tooltip(x){this._tooltip=x;if(this._listItemNode)
588 this._listItemNode.title=x?x:"";},get hasChildren(){return this._hasChildren;},set hasChildren(x){if(this._hasChildren===x)
589 return;this._hasChildren=x;if(!this._listItemNode)
590 return;if(x)
591 this._listItemNode.classList.add("parent");else{this._listItemNode.classList.remove("parent");this.collapse();}},get hidden(){return this._hidden;},set hidden(x){if(this._hidden===x)
592 return;this._hidden=x;if(x){if(this._listItemNode)
593 this._listItemNode.classList.add("hidden");if(this._childrenListNode)
594 this._childrenListNode.classList.add("hidden");}else{if(this._listItemNode)
595 this._listItemNode.classList.remove("hidden");if(this._childrenListNode)
596 this._childrenListNode.classList.remove("hidden");}},get shouldRefreshChildren(){return this._shouldRefreshChildren;},set shouldRefreshChildren(x){this._shouldRefreshChildren=x;if(x&&this.expanded)
597 this.expand();},_setListItemNodeContent:function()
598 {if(!this._listItemNode)
599 return;if(typeof this._title==="string")
600 this._listItemNode.textContent=this._title;else{this._listItemNode.removeChildren();if(this._title)
601 this._listItemNode.appendChild(this._title);}}}
602 TreeElement.prototype.appendChild=TreeOutline.prototype.appendChild;TreeElement.prototype.insertChild=TreeOutline.prototype.insertChild;TreeElement.prototype.insertBeforeChild=TreeOutline.prototype.insertBeforeChild;TreeElement.prototype.removeChild=TreeOutline.prototype.removeChild;TreeElement.prototype.removeChildAtIndex=TreeOutline.prototype.removeChildAtIndex;TreeElement.prototype.removeChildren=TreeOutline.prototype.removeChildren;TreeElement.prototype._attach=function()
603 {if(!this._listItemNode||this.parent._shouldRefreshChildren){if(this._listItemNode&&this._listItemNode.parentNode)
604 this._listItemNode.parentNode.removeChild(this._listItemNode);this._listItemNode=this.treeOutline._childrenListNode.ownerDocument.createElement("li");this._listItemNode.treeElement=this;this._setListItemNodeContent();this._listItemNode.title=this._tooltip?this._tooltip:"";if(this.hidden)
605 this._listItemNode.classList.add("hidden");if(this.hasChildren)
606 this._listItemNode.classList.add("parent");if(this.expanded)
607 this._listItemNode.classList.add("expanded");if(this.selected)
608 this._listItemNode.classList.add("selected");this._listItemNode.addEventListener("mousedown",TreeElement.treeElementMouseDown,false);this._listItemNode.addEventListener("click",TreeElement.treeElementToggled,false);this._listItemNode.addEventListener("dblclick",TreeElement.treeElementDoubleClicked,false);this.onattach();}
609 var nextSibling=null;if(this.nextSibling&&this.nextSibling._listItemNode&&this.nextSibling._listItemNode.parentNode===this.parent._childrenListNode)
610 nextSibling=this.nextSibling._listItemNode;this.parent._childrenListNode.insertBefore(this._listItemNode,nextSibling);if(this._childrenListNode)
611 this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);if(this.selected)
612 this.select();if(this.expanded)
613 this.expand();}
614 TreeElement.prototype._detach=function()
615 {if(this._listItemNode&&this._listItemNode.parentNode)
616 this._listItemNode.parentNode.removeChild(this._listItemNode);if(this._childrenListNode&&this._childrenListNode.parentNode)
617 this._childrenListNode.parentNode.removeChild(this._childrenListNode);}
618 TreeElement.treeElementMouseDown=function(event)
619 {var element=event.currentTarget;if(!element||!element.treeElement||!element.treeElement.selectable)
620 return;if(element.treeElement.isEventWithinDisclosureTriangle(event))
621 return;element.treeElement.selectOnMouseDown(event);}
622 TreeElement.treeElementToggled=function(event)
623 {var element=event.currentTarget;if(!element||!element.treeElement)
624 return;var toggleOnClick=element.treeElement.toggleOnClick&&!element.treeElement.selectable;var isInTriangle=element.treeElement.isEventWithinDisclosureTriangle(event);if(!toggleOnClick&&!isInTriangle)
625 return;if(element.treeElement.expanded){if(event.altKey)
626 element.treeElement.collapseRecursively();else
627 element.treeElement.collapse();}else{if(event.altKey)
628 element.treeElement.expandRecursively();else
629 element.treeElement.expand();}
630 event.consume();}
631 TreeElement.treeElementDoubleClicked=function(event)
632 {var element=event.currentTarget;if(!element||!element.treeElement)
633 return;var handled=element.treeElement.ondblclick.call(element.treeElement,event);if(handled)
634 return;if(element.treeElement.hasChildren&&!element.treeElement.expanded)
635 element.treeElement.expand();}
636 TreeElement.prototype.collapse=function()
637 {if(this._listItemNode)
638 this._listItemNode.classList.remove("expanded");if(this._childrenListNode)
639 this._childrenListNode.classList.remove("expanded");this.expanded=false;if(this.treeOutline)
640 this.treeOutline._expandedStateMap.put(this.representedObject,false);this.oncollapse();}
641 TreeElement.prototype.collapseRecursively=function()
642 {var item=this;while(item){if(item.expanded)
643 item.collapse();item=item.traverseNextTreeElement(false,this,true);}}
644 TreeElement.prototype.expand=function()
645 {if(!this.hasChildren||(this.expanded&&!this._shouldRefreshChildren&&this._childrenListNode))
646 return;this.expanded=true;if(this.treeOutline)
647 this.treeOutline._expandedStateMap.put(this.representedObject,true);if(this.treeOutline&&(!this._childrenListNode||this._shouldRefreshChildren)){if(this._childrenListNode&&this._childrenListNode.parentNode)
648 this._childrenListNode.parentNode.removeChild(this._childrenListNode);this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");if(this.hidden)
649 this._childrenListNode.classList.add("hidden");this.onpopulate();for(var i=0;i<this.children.length;++i)
650 this.children[i]._attach();delete this._shouldRefreshChildren;}
651 if(this._listItemNode){this._listItemNode.classList.add("expanded");if(this._childrenListNode&&this._childrenListNode.parentNode!=this._listItemNode.parentNode)
652 this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);}
653 if(this._childrenListNode)
654 this._childrenListNode.classList.add("expanded");this.onexpand();}
655 TreeElement.prototype.expandRecursively=function(maxDepth)
656 {var item=this;var info={};var depth=0;if(isNaN(maxDepth))
657 maxDepth=3;while(item){if(depth<maxDepth)
658 item.expand();item=item.traverseNextTreeElement(false,this,(depth>=maxDepth),info);depth+=info.depthChange;}}
659 TreeElement.prototype.hasAncestor=function(ancestor){if(!ancestor)
660 return false;var currentNode=this.parent;while(currentNode){if(ancestor===currentNode)
661 return true;currentNode=currentNode.parent;}
662 return false;}
663 TreeElement.prototype.reveal=function()
664 {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
665 currentAncestor.expand();currentAncestor=currentAncestor.parent;}
666 this.onreveal();}
667 TreeElement.prototype.revealed=function()
668 {var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
669 return false;currentAncestor=currentAncestor.parent;}
670 return true;}
671 TreeElement.prototype.selectOnMouseDown=function(event)
672 {if(this.select(false,true))
673 event.consume(true);}
674 TreeElement.prototype.select=function(omitFocus,selectedByUser)
675 {if(!this.treeOutline||!this.selectable||this.selected)
676 return false;if(this.treeOutline.selectedTreeElement)
677 this.treeOutline.selectedTreeElement.deselect();this.selected=true;if(!omitFocus)
678 this.treeOutline._childrenListNode.focus();if(!this.treeOutline)
679 return false;this.treeOutline.selectedTreeElement=this;if(this._listItemNode)
680 this._listItemNode.classList.add("selected");return this.onselect(selectedByUser);}
681 TreeElement.prototype.revealAndSelect=function(omitFocus)
682 {this.reveal();this.select(omitFocus);}
683 TreeElement.prototype.deselect=function(supressOnDeselect)
684 {if(!this.treeOutline||this.treeOutline.selectedTreeElement!==this||!this.selected)
685 return false;this.selected=false;this.treeOutline.selectedTreeElement=null;if(this._listItemNode)
686 this._listItemNode.classList.remove("selected");return true;}
687 TreeElement.prototype.onpopulate=function(){}
688 TreeElement.prototype.onenter=function(){return false;}
689 TreeElement.prototype.ondelete=function(){return false;}
690 TreeElement.prototype.onspace=function(){return false;}
691 TreeElement.prototype.onattach=function(){}
692 TreeElement.prototype.onexpand=function(){}
693 TreeElement.prototype.oncollapse=function(){}
694 TreeElement.prototype.ondblclick=function(e){return false;}
695 TreeElement.prototype.onreveal=function(){}
696 TreeElement.prototype.onselect=function(selectedByUser){return false;}
697 TreeElement.prototype.traverseNextTreeElement=function(skipUnrevealed,stayWithin,dontPopulate,info)
698 {if(!dontPopulate&&this.hasChildren)
699 this.onpopulate();if(info)
700 info.depthChange=0;var element=skipUnrevealed?(this.revealed()?this.children[0]:null):this.children[0];if(element&&(!skipUnrevealed||(skipUnrevealed&&this.expanded))){if(info)
701 info.depthChange=1;return element;}
702 if(this===stayWithin)
703 return null;element=skipUnrevealed?(this.revealed()?this.nextSibling:null):this.nextSibling;if(element)
704 return element;element=this;while(element&&!element.root&&!(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling)&&element.parent!==stayWithin){if(info)
705 info.depthChange-=1;element=element.parent;}
706 if(!element)
707 return null;return(skipUnrevealed?(element.revealed()?element.nextSibling:null):element.nextSibling);}
708 TreeElement.prototype.traversePreviousTreeElement=function(skipUnrevealed,dontPopulate)
709 {var element=skipUnrevealed?(this.revealed()?this.previousSibling:null):this.previousSibling;if(!dontPopulate&&element&&element.hasChildren)
710 element.onpopulate();while(element&&(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1])){if(!dontPopulate&&element.hasChildren)
711 element.onpopulate();element=(skipUnrevealed?(element.revealed()&&element.expanded?element.children[element.children.length-1]:null):element.children[element.children.length-1]);}
712 if(element)
713 return element;if(!this.parent||this.parent.root)
714 return null;return this.parent;}
715 TreeElement.prototype.isEventWithinDisclosureTriangle=function(event)
716 {var paddingLeftValue=window.getComputedStyle(this._listItemNode).getPropertyCSSValue("padding-left");var computedLeftPadding=paddingLeftValue?paddingLeftValue.getFloatValue(CSSPrimitiveValue.CSS_PX):0;var left=this._listItemNode.totalOffsetLeft()+computedLeftPadding;return event.pageX>=left&&event.pageX<=left+this.arrowToggleWidth&&this.hasChildren;}
717 window.WebInspector={_queryParamsObject:{}}
718 WebInspector.Events={InspectorLoaded:"InspectorLoaded"}
719 WebInspector.queryParam=function(name)
720 {return WebInspector._queryParamsObject.hasOwnProperty(name)?WebInspector._queryParamsObject[name]:null;}
721 {(function parseQueryParameters()
722 {var queryParams=window.location.search;if(!queryParams)
723 return;var params=queryParams.substring(1).split("&");for(var i=0;i<params.length;++i){var pair=params[i].split("=");WebInspector._queryParamsObject[pair[0]]=pair[1];}
724 var settingsParam=WebInspector.queryParam("settings");if(settingsParam){try{var settings=JSON.parse(window.decodeURI(settingsParam));for(var key in settings)
725 window.localStorage[key]=settings[key];}catch(e){}}})();}
726 WebInspector.Main=function()
727 {var boundListener=windowLoaded.bind(this);function windowLoaded()
728 {this._loaded();window.removeEventListener("DOMContentLoaded",boundListener,false);}
729 window.addEventListener("DOMContentLoaded",boundListener,false);}
730 WebInspector.Main.prototype={_registerModules:function()
731 {var configuration;if(!Capabilities.isMainFrontend){configuration=["main","sources","timeline","profiles","console","codemirror"];}else{configuration=["main","elements","network","sources","timeline","profiles","resources","audits","console","codemirror","extensions","settings"];if(WebInspector.experimentsSettings.layersPanel.isEnabled())
732 configuration.push("layers");}
733 WebInspector.moduleManager.registerModules(configuration);},_createGlobalStatusBarItems:function()
734 {if(WebInspector.inspectElementModeController)
735 WebInspector.inspectorView.appendToLeftToolbar(WebInspector.inspectElementModeController.toggleSearchButton.element);WebInspector.inspectorView.appendToRightToolbar(WebInspector.settingsController.statusBarItem);if(WebInspector.dockController.element)
736 WebInspector.inspectorView.appendToRightToolbar(WebInspector.dockController.element);if(this._screencastController)
737 WebInspector.inspectorView.appendToRightToolbar(this._screencastController.statusBarItem());},_createRootView:function()
738 {var rootView=new WebInspector.RootView();this._rootSplitView=new WebInspector.SplitView(false,true,WebInspector.dockController.canDock()?"InspectorView.splitViewState":"InspectorView.dummySplitViewState",300,300);this._rootSplitView.show(rootView.element);WebInspector.inspectorView.show(this._rootSplitView.sidebarElement());var inspectedPagePlaceholder=new WebInspector.InspectedPagePlaceholder();inspectedPagePlaceholder.show(this._rootSplitView.mainElement());WebInspector.dockController.addEventListener(WebInspector.DockController.Events.DockSideChanged,this._updateRootSplitViewOnDockSideChange,this);this._updateRootSplitViewOnDockSideChange();rootView.attachToBody();},_updateRootSplitViewOnDockSideChange:function()
739 {var dockSide=WebInspector.dockController.dockSide();if(dockSide===WebInspector.DockController.State.Undocked){this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(),false);this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResizerElement(),false);this._rootSplitView.hideMain();return;}
740 this._rootSplitView.setVertical(dockSide===WebInspector.DockController.State.DockedToLeft||dockSide===WebInspector.DockController.State.DockedToRight);this._rootSplitView.setSecondIsSidebar(dockSide===WebInspector.DockController.State.DockedToRight||dockSide===WebInspector.DockController.State.DockedToBottom);this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(),true);this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResizerElement(),dockSide===WebInspector.DockController.State.DockedToBottom);this._rootSplitView.showBoth();},_calculateWorkerInspectorTitle:function()
741 {var expression="location.href";if(WebInspector.queryParam("isSharedWorker"))
742 expression+=" + (this.name ? ' (' + this.name + ')' : '')";RuntimeAgent.invoke_evaluate({expression:expression,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:true},evalCallback);function evalCallback(error,result,wasThrown)
743 {if(error||wasThrown){console.error(error);return;}
744 InspectorFrontendHost.inspectedURLChanged(result.value);}},_loadCompletedForWorkers:function()
745 {if(WebInspector.queryParam("workerPaused")){DebuggerAgent.pause();RuntimeAgent.run(calculateTitle.bind(this));}else if(!Capabilities.isMainFrontend){calculateTitle.call(this);}
746 function calculateTitle()
747 {this._calculateWorkerInspectorTitle();}},_resetErrorAndWarningCounts:function()
748 {WebInspector.inspectorView.setErrorAndWarningCounts(0,0);},_updateErrorAndWarningCounts:function()
749 {var errors=WebInspector.console.errors;var warnings=WebInspector.console.warnings;WebInspector.inspectorView.setErrorAndWarningCounts(errors,warnings);},_debuggerPaused:function()
750 {WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);WebInspector.inspectorView.showPanel("sources");},_loaded:function()
751 {if(!InspectorFrontendHost.sendMessageToEmbedder){var helpScreen=new WebInspector.HelpScreen(WebInspector.UIString("Incompatible Chrome version"));var p=helpScreen.contentElement.createChild("p","help-section");p.textContent=WebInspector.UIString("Please upgrade to a newer Chrome version (you might need a Dev or Canary build).");helpScreen.showModal();return;}
752 InspectorBackend.loadFromJSONIfNeeded("../protocol.json");WebInspector.dockController=new WebInspector.DockController(!!WebInspector.queryParam("can_dock"));var onConnectionReady=this._doLoadedDone.bind(this);var workerId=WebInspector.queryParam("dedicatedWorkerId");if(workerId){new WebInspector.ExternalWorkerConnection(workerId,onConnectionReady);return;}
753 var ws;if(WebInspector.queryParam("ws")){ws="ws://"+WebInspector.queryParam("ws");}else if(WebInspector.queryParam("page")){var page=WebInspector.queryParam("page");var host=WebInspector.queryParam("host")||window.location.host;ws="ws://"+host+"/devtools/page/"+page;}
754 if(ws){document.body.classList.add("remote");new InspectorBackendClass.WebSocketConnection(ws,onConnectionReady);return;}
755 if(!InspectorFrontendHost.isStub){new InspectorBackendClass.MainConnection(onConnectionReady);return;}
756 InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParam("dispatch"));new InspectorBackendClass.StubConnection(onConnectionReady);},_doLoadedDone:function(connection)
757 {connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected,onDisconnected);function onDisconnected(event)
758 {if(WebInspector._disconnectedScreenWithReasonWasShown)
759 return;new WebInspector.RemoteDebuggingTerminatedScreen(event.data.reason).showModal();}
760 InspectorBackend.setConnection(connection);WebInspector.installPortStyles();if(WebInspector.queryParam("toolbarColor")&&WebInspector.queryParam("textColor"))
761 WebInspector.setToolbarColors(WebInspector.queryParam("toolbarColor"),WebInspector.queryParam("textColor"));WebInspector.targetManager=new WebInspector.TargetManager();WebInspector.targetManager.createTarget(connection,this._doLoadedDoneWithCapabilities.bind(this));},_doLoadedDoneWithCapabilities:function(mainTarget)
762 {new WebInspector.VersionController().updateVersion();WebInspector.shortcutsScreen=new WebInspector.ShortcutsScreen();this._registerShortcuts();WebInspector.shortcutsScreen.section(WebInspector.UIString("Console"));WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));WebInspector.ShortcutsScreen.registerShortcuts();if(WebInspector.experimentsSettings.workersInMainWindow.isEnabled())
763 new WebInspector.WorkerTargetManager(mainTarget,WebInspector.targetManager);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._resetErrorAndWarningCounts,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._updateErrorAndWarningCounts,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPaused,this);WebInspector.networkLog=new WebInspector.NetworkLog();WebInspector.zoomManager=new WebInspector.ZoomManager();WebInspector.advancedSearchController=new WebInspector.AdvancedSearchController();InspectorBackend.registerInspectorDispatcher(this);WebInspector.isolatedFileSystemManager=new WebInspector.IsolatedFileSystemManager();WebInspector.isolatedFileSystemDispatcher=new WebInspector.IsolatedFileSystemDispatcher(WebInspector.isolatedFileSystemManager);WebInspector.workspace=new WebInspector.Workspace(WebInspector.isolatedFileSystemManager.mapping());WebInspector.cssModel=new WebInspector.CSSStyleModel(WebInspector.workspace);WebInspector.timelineManager=new WebInspector.TimelineManager();WebInspector.tracingAgent=new WebInspector.TracingAgent();if(Capabilities.isMainFrontend){WebInspector.inspectElementModeController=new WebInspector.InspectElementModeController();WebInspector.workerFrontendManager=new WebInspector.WorkerFrontendManager();}else{mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerDisconnected,onWorkerDisconnected);}
764 function onWorkerDisconnected()
765 {var screen=new WebInspector.WorkerTerminatedScreen();var listener=hideScreen.bind(null,screen);mainTarget.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,listener);function hideScreen(screen)
766 {mainTarget.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,listener);screen.hide();}
767 screen.showModal();}
768 WebInspector.settingsController=new WebInspector.SettingsController();WebInspector.domBreakpointsSidebarPane=new WebInspector.DOMBreakpointsSidebarPane();var autoselectPanel=WebInspector.UIString("a panel chosen automatically");var openAnchorLocationSetting=WebInspector.settings.createSetting("openLinkHandler",autoselectPanel);WebInspector.openAnchorLocationRegistry=new WebInspector.HandlerRegistry(openAnchorLocationSetting);WebInspector.openAnchorLocationRegistry.registerHandler(autoselectPanel,function(){return false;});WebInspector.Linkifier.setLinkHandler(new WebInspector.HandlerRegistry.LinkHandler());new WebInspector.WorkspaceController(WebInspector.workspace);WebInspector.fileSystemWorkspaceProvider=new WebInspector.FileSystemWorkspaceProvider(WebInspector.isolatedFileSystemManager,WebInspector.workspace);WebInspector.networkWorkspaceProvider=new WebInspector.SimpleWorkspaceProvider(WebInspector.workspace,WebInspector.projectTypes.Network);new WebInspector.NetworkUISourceCodeProvider(WebInspector.networkWorkspaceProvider,WebInspector.workspace);WebInspector.breakpointManager=new WebInspector.BreakpointManager(WebInspector.settings.breakpoints,WebInspector.debuggerModel,WebInspector.workspace);WebInspector.scriptSnippetModel=new WebInspector.ScriptSnippetModel(WebInspector.workspace);WebInspector.overridesSupport=new WebInspector.OverridesSupport();WebInspector.overridesSupport.applyInitialOverrides();new WebInspector.DebuggerScriptMapping(WebInspector.debuggerModel,WebInspector.workspace,WebInspector.networkWorkspaceProvider);WebInspector.liveEditSupport=new WebInspector.LiveEditSupport(WebInspector.workspace);new WebInspector.CSSStyleSheetMapping(WebInspector.cssModel,WebInspector.workspace,WebInspector.networkWorkspaceProvider);new WebInspector.PresentationConsoleMessageHelper(WebInspector.workspace);WebInspector.settings.initializeBackendSettings();this._registerModules();WebInspector.KeyboardShortcut.registerActions();WebInspector.panels={};WebInspector.inspectorView=new WebInspector.InspectorView();if(mainTarget.canScreencast)
769 this._screencastController=new WebInspector.ScreencastController();else
770 this._createRootView();this._createGlobalStatusBarItems();this._addMainEventListeners(document);function onResize()
771 {if(WebInspector.settingsController)
772 WebInspector.settingsController.resize();}
773 window.addEventListener("resize",onResize,true);var errorWarningCount=document.getElementById("error-warning-count");function showConsole()
774 {WebInspector.console.show();}
775 errorWarningCount.addEventListener("click",showConsole,false);this._updateErrorAndWarningCounts();WebInspector.extensionServerProxy.setFrontendReady();WebInspector.databaseModel=new WebInspector.DatabaseModel();WebInspector.domStorageModel=new WebInspector.DOMStorageModel();WebInspector.cpuProfilerModel=new WebInspector.CPUProfilerModel();InspectorAgent.enable(inspectorAgentEnableCallback.bind(this));function inspectorAgentEnableCallback()
776 {WebInspector.inspectorView.showInitialPanel();if(WebInspector.overridesSupport.hasActiveOverrides())
777 WebInspector.inspectorView.showViewInDrawer("emulation",true);WebInspector.settings.showMetricsRulers.addChangeListener(showRulersChanged);function showRulersChanged()
778 {PageAgent.setShowViewportSizeOnResize(true,WebInspector.settings.showMetricsRulers.get());}
779 showRulersChanged();if(this._screencastController)
780 this._screencastController.initialize();}
781 this._loadCompletedForWorkers();InspectorFrontendAPI.loadCompleted();WebInspector.notifications.dispatchEventToListeners(WebInspector.NotificationService.Events.InspectorLoaded);},_documentClick:function(event)
782 {var anchor=event.target.enclosingNodeOrSelfWithNodeName("a");if(!anchor||!anchor.href||(anchor.target==="_blank"))
783 return;event.consume(true);function followLink()
784 {if(WebInspector.isBeingEdited(event.target))
785 return;if(WebInspector.openAnchorLocationRegistry.dispatch({url:anchor.href,lineNumber:anchor.lineNumber}))
786 return;var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(anchor.href);if(uiSourceCode){WebInspector.Revealer.reveal(new WebInspector.UILocation(uiSourceCode,anchor.lineNumber||0,anchor.columnNumber||0));return;}
787 var resource=WebInspector.resourceForURL(anchor.href);if(resource){WebInspector.Revealer.reveal(resource);return;}
788 var request=WebInspector.networkLog.requestForURL(anchor.href);if(request){WebInspector.Revealer.reveal(request);return;}
789 InspectorFrontendHost.openInNewTab(anchor.href);}
790 if(WebInspector.followLinkTimeout)
791 clearTimeout(WebInspector.followLinkTimeout);if(anchor.preventFollowOnDoubleClick){if(event.detail===1)
792 WebInspector.followLinkTimeout=setTimeout(followLink,333);return;}
793 followLink();},_registerShortcuts:function()
794 {var shortcut=WebInspector.KeyboardShortcut;var section=WebInspector.shortcutsScreen.section(WebInspector.UIString("All Panels"));var keys=[shortcut.makeDescriptor("[",shortcut.Modifiers.CtrlOrMeta),shortcut.makeDescriptor("]",shortcut.Modifiers.CtrlOrMeta)];section.addRelatedKeys(keys,WebInspector.UIString("Go to the panel to the left/right"));keys=[shortcut.makeDescriptor("[",shortcut.Modifiers.CtrlOrMeta|shortcut.Modifiers.Alt),shortcut.makeDescriptor("]",shortcut.Modifiers.CtrlOrMeta|shortcut.Modifiers.Alt)];section.addRelatedKeys(keys,WebInspector.UIString("Go back/forward in panel history"));var toggleConsoleLabel=WebInspector.UIString("Show console");section.addKey(shortcut.makeDescriptor(shortcut.Keys.Tilde,shortcut.Modifiers.Ctrl),toggleConsoleLabel);var doNotOpenDrawerOnEsc=WebInspector.experimentsSettings.doNotOpenDrawerOnEsc.isEnabled();var toggleDrawerLabel=doNotOpenDrawerOnEsc?WebInspector.UIString("Hide drawer"):WebInspector.UIString("Toggle drawer");section.addKey(shortcut.makeDescriptor(shortcut.Keys.Esc),toggleDrawerLabel);section.addKey(shortcut.makeDescriptor("f",shortcut.Modifiers.CtrlOrMeta),WebInspector.UIString("Search"));var advancedSearchShortcut=WebInspector.AdvancedSearchController.createShortcut();section.addKey(advancedSearchShortcut,WebInspector.UIString("Search across all sources"));var inspectElementModeShortcut=WebInspector.InspectElementModeController.createShortcut();section.addKey(inspectElementModeShortcut,WebInspector.UIString("Select node to inspect"));var openResourceShortcut=WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);section.addKey(openResourceShortcut,WebInspector.UIString("Go to source"));if(WebInspector.isMac()){keys=[shortcut.makeDescriptor("g",shortcut.Modifiers.Meta),shortcut.makeDescriptor("g",shortcut.Modifiers.Meta|shortcut.Modifiers.Shift)];section.addRelatedKeys(keys,WebInspector.UIString("Find next/previous"));}},_handleZoomEvent:function(event)
795 {switch(event.keyCode){case 107:case 187:InspectorFrontendHost.zoomIn();return true;case 109:case 189:InspectorFrontendHost.zoomOut();return true;case 48:case 96:if(!event.shiftKey){InspectorFrontendHost.resetZoom();return true;}
796 break;}
797 return false;},_postDocumentKeyDown:function(event)
798 {if(event.handled)
799 return;if(!WebInspector.Dialog.currentInstance()&&WebInspector.inspectorView.currentPanel()){WebInspector.inspectorView.currentPanel().handleShortcut(event);if(event.handled){event.consume(true);return;}}
800 if(!WebInspector.Dialog.currentInstance()&&WebInspector.advancedSearchController.handleShortcut(event))
801 return;if(!WebInspector.Dialog.currentInstance()&&WebInspector.inspectElementModeController&&WebInspector.inspectElementModeController.handleShortcut(event))
802 return;var isValidZoomShortcut=WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)&&!event.altKey&&!InspectorFrontendHost.isStub;if(!WebInspector.Dialog.currentInstance()&&isValidZoomShortcut&&this._handleZoomEvent(event)){event.consume(true);return;}
803 WebInspector.KeyboardShortcut.handleShortcut(event);},_documentCanCopy:function(event)
804 {if(WebInspector.inspectorView.currentPanel()&&WebInspector.inspectorView.currentPanel()["handleCopyEvent"])
805 event.preventDefault();},_documentCopy:function(event)
806 {if(WebInspector.inspectorView.currentPanel()&&WebInspector.inspectorView.currentPanel()["handleCopyEvent"])
807 WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event);},_contextMenuEventFired:function(event)
808 {if(event.handled||event.target.classList.contains("popup-glasspane"))
809 event.preventDefault();},_inspectNodeRequested:function(event)
810 {this._updateFocusedNode(event.data);},_updateFocusedNode:function(nodeId)
811 {var node=WebInspector.domModel.nodeForId(nodeId);console.assert(node);WebInspector.Revealer.reveal(node);},_addMainEventListeners:function(doc)
812 {doc.addEventListener("keydown",this._postDocumentKeyDown.bind(this),false);doc.addEventListener("beforecopy",this._documentCanCopy.bind(this),true);doc.addEventListener("copy",this._documentCopy.bind(this),false);doc.addEventListener("contextmenu",this._contextMenuEventFired.bind(this),true);doc.addEventListener("click",this._documentClick.bind(this),false);},inspect:function(payload,hints)
813 {var object=WebInspector.RemoteObject.fromPayload(payload);if(object.subtype==="node"){object.pushNodeToFrontend(callback);var elementsPanel=(WebInspector.inspectorView.panel("elements"));elementsPanel.omitDefaultSelection();WebInspector.inspectorView.setCurrentPanel(elementsPanel);return;}
814 function callback(nodeId)
815 {elementsPanel.stopOmittingDefaultSelection();WebInspector.Revealer.reveal(WebInspector.domModel.nodeForId(nodeId));if(!WebInspector.inspectorView.drawerVisible()&&!WebInspector._notFirstInspectElement)
816 InspectorFrontendHost.inspectElementCompleted();WebInspector._notFirstInspectElement=true;object.release();}
817 if(object.type==="function"){DebuggerAgent.getFunctionDetails(object.objectId,didGetDetails);return;}
818 function didGetDetails(error,response)
819 {object.release();if(error){console.error(error);return;}
820 var uiLocation=WebInspector.debuggerModel.rawLocationToUILocation(response.location);if(!uiLocation)
821 return;(WebInspector.inspectorView.panel("sources")).showUILocation(uiLocation,true);}
822 if(hints.copyToClipboard)
823 InspectorFrontendHost.copyText(object.value);object.release();},detached:function(reason)
824 {WebInspector._disconnectedScreenWithReasonWasShown=true;new WebInspector.RemoteDebuggingTerminatedScreen(reason).showModal();},targetCrashed:function()
825 {(new WebInspector.HelpScreenUntilReload(WebInspector.UIString("Inspected target crashed"),WebInspector.UIString("Inspected target has crashed. Once it reloads we will attach to it automatically."))).showModal();},evaluateForTestInFrontend:function(callId,script)
826 {WebInspector.evaluateForTestInFrontend(callId,script);}}
827 WebInspector.reload=function()
828 {InspectorAgent.reset();window.location.reload();}
829 WebInspector.Main.ReloadActionDelegate=function()
830 {}
831 WebInspector.Main.ReloadActionDelegate.prototype={handleAction:function()
832 {if(!WebInspector.Dialog.currentInstance()){WebInspector.debuggerModel.skipAllPauses(true,true);WebInspector.resourceTreeModel.reloadPage(false);}
833 return true;}}
834 WebInspector.Main.HardReloadActionDelegate=function()
835 {}
836 WebInspector.Main.HardReloadActionDelegate.prototype={handleAction:function()
837 {if(!WebInspector.Dialog.currentInstance()){WebInspector.debuggerModel.skipAllPauses(true,true);WebInspector.resourceTreeModel.reloadPage(true);}
838 return true;}}
839 WebInspector.Main.DebugReloadActionDelegate=function()
840 {}
841 WebInspector.Main.DebugReloadActionDelegate.prototype={handleAction:function()
842 {WebInspector.reload();return true;}}
843 new WebInspector.Main();window.DEBUG=true;WebInspector.__defineGetter__("inspectedPageURL",function()
844 {return WebInspector.resourceTreeModel.inspectedPageURL();});WebInspector.panel=function(name)
845 {return WebInspector.inspectorView.panel(name);}
846 WebInspector.ModuleManager=function(descriptors)
847 {this._modules=[];this._modulesMap={};this._extensions=[];this._cachedTypeClasses={};this._descriptorsMap={};for(var i=0;i<descriptors.length;++i)
848 this._descriptorsMap[descriptors[i]["name"]]=descriptors[i];}
849 WebInspector.ModuleManager.prototype={registerModules:function(configuration)
850 {for(var i=0;i<configuration.length;++i)
851 this.registerModule(configuration[i]);},registerModule:function(moduleName)
852 {if(!this._descriptorsMap[moduleName])
853 throw new Error("Module is not defined: "+moduleName+" "+new Error().stack);var module=new WebInspector.ModuleManager.Module(this,this._descriptorsMap[moduleName]);this._modules.push(module);this._modulesMap[moduleName]=module;},loadModule:function(moduleName)
854 {this._modulesMap[moduleName]._load();},extensions:function(type,context)
855 {function filter(extension)
856 {if(extension._type!==type&&extension._typeClass()!==type)
857 return false;return!context||extension.isApplicable(context);}
858 return this._extensions.filter(filter);},extension:function(type,context)
859 {return this.extensions(type,context)[0]||null;},instances:function(type,context)
860 {function instantiate(extension)
861 {return extension.instance();}
862 return this.extensions(type,context).filter(instantiate).map(instantiate);},instance:function(type,context)
863 {var extension=this.extension(type,context);return extension?extension.instance():null;},orderComparator:function(type,nameProperty,orderProperty)
864 {var extensions=this.extensions(type);var orderForName={};for(var i=0;i<extensions.length;++i){var descriptor=extensions[i].descriptor();orderForName[descriptor[nameProperty]]=descriptor[orderProperty];}
865 function result(name1,name2)
866 {if(name1 in orderForName&&name2 in orderForName)
867 return orderForName[name1]-orderForName[name2];if(name1 in orderForName)
868 return-1;if(name2 in orderForName)
869 return 1;return name1.compareTo(name2);}
870 return result;},resolve:function(typeName)
871 {if(!this._cachedTypeClasses[typeName]){try{this._cachedTypeClasses[typeName]=(window.eval(typeName.substring(1)));}catch(e){}}
872 return this._cachedTypeClasses[typeName];}}
873 WebInspector.ModuleManager.ModuleDescriptor=function()
874 {this.name;this.extensions;this.scripts;}
875 WebInspector.ModuleManager.ExtensionDescriptor=function()
876 {this.type;this.className;this.contextTypes;}
877 WebInspector.ModuleManager.Module=function(manager,descriptor)
878 {this._manager=manager;this._descriptor=descriptor;this._name=descriptor.name;var extensions=(descriptor.extensions);for(var i=0;extensions&&i<extensions.length;++i)
879 this._manager._extensions.push(new WebInspector.ModuleManager.Extension(this,extensions[i]));this._loaded=false;}
880 WebInspector.ModuleManager.Module.prototype={name:function()
881 {return this._name;},_load:function()
882 {if(this._loaded)
883 return;if(this._isLoading){var oldStackTraceLimit=Error.stackTraceLimit;Error.stackTraceLimit=50;console.assert(false,"Module "+this._name+" is loaded from itself: "+new Error().stack);Error.stackTraceLimit=oldStackTraceLimit;return;}
884 this._isLoading=true;var scripts=this._descriptor.scripts;for(var i=0;scripts&&i<scripts.length;++i)
885 loadScript(scripts[i]);this._isLoading=false;this._loaded=true;}}
886 WebInspector.ModuleManager.Extension=function(module,descriptor)
887 {this._module=module;this._descriptor=descriptor;this._type=descriptor.type;this._hasTypeClass=!!this._type.startsWith("@");this._className=descriptor.className||null;}
888 WebInspector.ModuleManager.Extension.prototype={descriptor:function()
889 {return this._descriptor;},module:function()
890 {return this._module;},_typeClass:function()
891 {if(!this._hasTypeClass)
892 return null;return this._module._manager.resolve(this._type);},isApplicable:function(context)
893 {var contextTypes=(this._descriptor.contextTypes);if(!contextTypes)
894 return true;for(var i=0;i<contextTypes.length;++i){var contextType=(window.eval(contextTypes[i]));if(context instanceof contextType)
895 return true;}
896 return false;},instance:function()
897 {if(!this._className)
898 return null;if(!this._instance){this._module._load();var constructorFunction=window.eval(this._className);if(!(constructorFunction instanceof Function))
899 return null;this._instance=new constructorFunction();}
900 return this._instance;}}
901 WebInspector.Renderer=function()
902 {}
903 WebInspector.Renderer.prototype={render:function(object){}}
904 WebInspector.Revealer=function()
905 {}
906 WebInspector.Revealer.reveal=function(revealable,lineNumber)
907 {if(!revealable)
908 return;var revealer=WebInspector.moduleManager.instance(WebInspector.Revealer,revealable);if(revealer)
909 revealer.reveal(revealable,lineNumber);}
910 WebInspector.Revealer.prototype={reveal:function(object){}}
911 WebInspector.ActionDelegate=function()
912 {}
913 WebInspector.ActionDelegate.prototype={handleAction:function(event){}}
914 WebInspector.moduleManager=new WebInspector.ModuleManager(allDescriptors);WebInspector.platform=function()
915 {if(!WebInspector._platform)
916 WebInspector._platform=InspectorFrontendHost.platform();return WebInspector._platform;}
917 WebInspector.isMac=function()
918 {if(typeof WebInspector._isMac==="undefined")
919 WebInspector._isMac=WebInspector.platform()==="mac";return WebInspector._isMac;}
920 WebInspector.isWin=function()
921 {if(typeof WebInspector._isWin==="undefined")
922 WebInspector._isWin=WebInspector.platform()==="windows";return WebInspector._isWin;}
923 WebInspector.PlatformFlavor={WindowsVista:"windows-vista",MacTiger:"mac-tiger",MacLeopard:"mac-leopard",MacSnowLeopard:"mac-snowleopard",MacLion:"mac-lion"}
924 WebInspector.platformFlavor=function()
925 {function detectFlavor()
926 {const userAgent=navigator.userAgent;if(WebInspector.platform()==="windows"){var match=userAgent.match(/Windows NT (\d+)\.(?:\d+)/);if(match&&match[1]>=6)
927 return WebInspector.PlatformFlavor.WindowsVista;return null;}else if(WebInspector.platform()==="mac"){var match=userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);if(!match||match[1]!=10)
928 return WebInspector.PlatformFlavor.MacSnowLeopard;switch(Number(match[2])){case 4:return WebInspector.PlatformFlavor.MacTiger;case 5:return WebInspector.PlatformFlavor.MacLeopard;case 6:return WebInspector.PlatformFlavor.MacSnowLeopard;case 7:return WebInspector.PlatformFlavor.MacLion;case 8:case 9:default:return"";}}}
929 if(!WebInspector._platformFlavor)
930 WebInspector._platformFlavor=detectFlavor();return WebInspector._platformFlavor;}
931 WebInspector.port=function()
932 {if(!WebInspector._port)
933 WebInspector._port=InspectorFrontendHost.port();return WebInspector._port;}
934 WebInspector.fontFamily=function()
935 {if(WebInspector._fontFamily)
936 return WebInspector._fontFamily;switch(WebInspector.platform()){case"linux":WebInspector._fontFamily="Ubuntu, Arial, sans-serif";break;case"mac":WebInspector._fontFamily="'Lucida Grande', sans-serif";break;case"windows":WebInspector._fontFamily="'Segoe UI', Tahoma, sans-serif";break;}
937 return WebInspector._fontFamily;}
938 WebInspector.Geometry={};WebInspector.Geometry._Eps=1e-5;WebInspector.Geometry.Vector=function(x,y,z)
939 {this.x=x;this.y=y;this.z=z;}
940 WebInspector.Geometry.Vector.prototype={length:function()
941 {return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);},normalize:function()
942 {var length=this.length();if(length<=WebInspector.Geometry._Eps)
943 return;this.x/=length;this.y/=length;this.z/=length;}}
944 WebInspector.Geometry.EulerAngles=function(alpha,beta,gamma)
945 {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
946 WebInspector.Geometry.EulerAngles.fromRotationMatrix=function(rotationMatrix)
947 {var beta=Math.atan2(rotationMatrix.m23,rotationMatrix.m33);var gamma=Math.atan2(-rotationMatrix.m13,Math.sqrt(rotationMatrix.m11*rotationMatrix.m11+rotationMatrix.m12*rotationMatrix.m12));var alpha=Math.atan2(rotationMatrix.m12,rotationMatrix.m11);return new WebInspector.Geometry.EulerAngles(WebInspector.Geometry.radToDeg(alpha),WebInspector.Geometry.radToDeg(beta),WebInspector.Geometry.radToDeg(gamma));}
948 WebInspector.Geometry.scalarProduct=function(u,v)
949 {return u.x*v.x+u.y*v.y+u.z*v.z;}
950 WebInspector.Geometry.crossProduct=function(u,v)
951 {var x=u.y*v.z-u.z*v.y;var y=u.z*v.x-u.x*v.z;var z=u.x*v.y-u.y*v.x;return new WebInspector.Geometry.Vector(x,y,z);}
952 WebInspector.Geometry.calculateAngle=function(u,v)
953 {var uLength=u.length();var vLength=v.length();if(uLength<=WebInspector.Geometry._Eps||vLength<=WebInspector.Geometry._Eps)
954 return 0;var cos=WebInspector.Geometry.scalarProduct(u,v)/uLength/vLength;if(Math.abs(cos)>1)
955 return 0;return WebInspector.Geometry.radToDeg(Math.acos(cos));}
956 WebInspector.Geometry.radToDeg=function(rad)
957 {return rad*180/Math.PI;}
958 WebInspector.UIString=function(string,vararg)
959 {return String.vsprintf(string,Array.prototype.slice.call(arguments,1));}
960 WebInspector.Object=function(){}
961 WebInspector.Object.prototype={addEventListener:function(eventType,listener,thisObject)
962 {if(!listener)
963 console.assert(false);if(!this._listeners)
964 this._listeners={};if(!this._listeners[eventType])
965 this._listeners[eventType]=[];this._listeners[eventType].push({thisObject:thisObject,listener:listener});},removeEventListener:function(eventType,listener,thisObject)
966 {console.assert(listener);if(!this._listeners||!this._listeners[eventType])
967 return;var listeners=this._listeners[eventType];for(var i=0;i<listeners.length;++i){if(listener&&listeners[i].listener===listener&&listeners[i].thisObject===thisObject)
968 listeners.splice(i,1);else if(!listener&&thisObject&&listeners[i].thisObject===thisObject)
969 listeners.splice(i,1);}
970 if(!listeners.length)
971 delete this._listeners[eventType];},removeAllListeners:function()
972 {delete this._listeners;},hasEventListeners:function(eventType)
973 {if(!this._listeners||!this._listeners[eventType])
974 return false;return true;},dispatchEventToListeners:function(eventType,eventData)
975 {if(!this._listeners||!this._listeners[eventType])
976 return false;var event=new WebInspector.Event(this,eventType,eventData);var listeners=this._listeners[eventType].slice(0);for(var i=0;i<listeners.length;++i){listeners[i].listener.call(listeners[i].thisObject,event);if(event._stoppedPropagation)
977 break;}
978 return event.defaultPrevented;}}
979 WebInspector.Event=function(target,type,data)
980 {this.target=target;this.type=type;this.data=data;this.defaultPrevented=false;this._stoppedPropagation=false;}
981 WebInspector.Event.prototype={stopPropagation:function()
982 {this._stoppedPropagation=true;},preventDefault:function()
983 {this.defaultPrevented=true;},consume:function(preventDefault)
984 {this.stopPropagation();if(preventDefault)
985 this.preventDefault();}}
986 WebInspector.EventTarget=function()
987 {}
988 WebInspector.EventTarget.prototype={addEventListener:function(eventType,listener,thisObject){},removeEventListener:function(eventType,listener,thisObject){},removeAllListeners:function(){},hasEventListeners:function(eventType){},dispatchEventToListeners:function(eventType,eventData){},}
989 function InspectorBackendClass()
990 {this._connection=null;this._agentPrototypes={};this._dispatcherPrototypes={};this._initialized=false;this._enums={};this._initProtocolAgentsConstructor();}
991 InspectorBackendClass.prototype={_initProtocolAgentsConstructor:function()
992 {window.Protocol={};window.Protocol.Agents=function(agentsMap){this._agentsMap=agentsMap;};},_addAgentGetterMethodToProtocolAgentsPrototype:function(domain)
993 {var upperCaseLength=0;while(upperCaseLength<domain.length&&domain[upperCaseLength].toLowerCase()!==domain[upperCaseLength])
994 ++upperCaseLength;var methodName=domain.substr(0,upperCaseLength).toLowerCase()+domain.slice(upperCaseLength)+"Agent";function agentGetter()
995 {return this._agentsMap[domain];}
996 window.Protocol.Agents.prototype[methodName]=agentGetter;function registerDispatcher(dispatcher)
997 {this.registerDispatcher(domain,dispatcher)}
998 window.Protocol.Agents.prototype["register"+domain+"Dispatcher"]=registerDispatcher;},connection:function()
999 {if(!this._connection)
1000 throw"Main connection was not initialized";return this._connection;},setConnection:function(connection)
1001 {this._connection=connection;this._connection.registerAgentsOn(window);for(var type in this._enums){var domainAndMethod=type.split(".");window[domainAndMethod[0]+"Agent"][domainAndMethod[1]]=this._enums[type];}},_agentPrototype:function(domain)
1002 {if(!this._agentPrototypes[domain]){this._agentPrototypes[domain]=new InspectorBackendClass.AgentPrototype(domain);this._addAgentGetterMethodToProtocolAgentsPrototype(domain);}
1003 return this._agentPrototypes[domain];},_dispatcherPrototype:function(domain)
1004 {if(!this._dispatcherPrototypes[domain])
1005 this._dispatcherPrototypes[domain]=new InspectorBackendClass.DispatcherPrototype();return this._dispatcherPrototypes[domain];},registerCommand:function(method,signature,replyArgs,hasErrorData)
1006 {var domainAndMethod=method.split(".");this._agentPrototype(domainAndMethod[0]).registerCommand(domainAndMethod[1],signature,replyArgs,hasErrorData);this._initialized=true;},registerEnum:function(type,values)
1007 {this._enums[type]=values;this._initialized=true;},registerEvent:function(eventName,params)
1008 {var domain=eventName.split(".")[0];this._dispatcherPrototype(domain).registerEvent(eventName,params);this._initialized=true;},registerDomainDispatcher:function(domain,dispatcher)
1009 {this._connection.registerDispatcher(domain,dispatcher);},loadFromJSONIfNeeded:function(jsonUrl)
1010 {if(this._initialized)
1011 return;var xhr=new XMLHttpRequest();xhr.open("GET",jsonUrl,false);xhr.send(null);var schema=JSON.parse(xhr.responseText);var code=InspectorBackendClass._generateCommands(schema);eval(code);},wrapClientCallback:function(clientCallback,errorPrefix,constructor,defaultValue)
1012 {function callbackWrapper(error,value)
1013 {if(error){console.error(errorPrefix+error);clientCallback(defaultValue);return;}
1014 if(constructor)
1015 clientCallback(new constructor(value));else
1016 clientCallback(value);}
1017 return callbackWrapper;}}
1018 InspectorBackendClass._generateCommands=function(schema){var jsTypes={integer:"number",array:"object"};var rawTypes={};var result=[];var domains=schema["domains"]||[];for(var i=0;i<domains.length;++i){var domain=domains[i];for(var j=0;domain.types&&j<domain.types.length;++j){var type=domain.types[j];rawTypes[domain.domain+"."+type.id]=jsTypes[type.type]||type.type;}}
1019 function toUpperCase(groupIndex,group0,group1)
1020 {return[group0,group1][groupIndex].toUpperCase();}
1021 function generateEnum(enumName,items)
1022 {var members=[]
1023 for(var m=0;m<items.length;++m){var value=items[m];var name=value.replace(/-(\w)/g,toUpperCase.bind(null,1)).toTitleCase();name=name.replace(/HTML|XML|WML|API/ig,toUpperCase.bind(null,0));members.push(name+": \""+value+"\"");}
1024 return"InspectorBackend.registerEnum(\""+enumName+"\", {"+members.join(", ")+"});";}
1025 for(var i=0;i<domains.length;++i){var domain=domains[i];var types=domain["types"]||[];for(var j=0;j<types.length;++j){var type=types[j];if((type["type"]==="string")&&type["enum"])
1026 result.push(generateEnum(domain.domain+"."+type.id,type["enum"]));else if(type["type"]==="object"){var properties=type["properties"]||[];for(var k=0;k<properties.length;++k){var property=properties[k];if((property["type"]==="string")&&property["enum"])
1027 result.push(generateEnum(domain.domain+"."+type.id+property["name"].toTitleCase(),property["enum"]));}}}
1028 var commands=domain["commands"]||[];for(var j=0;j<commands.length;++j){var command=commands[j];var parameters=command["parameters"];var paramsText=[];for(var k=0;parameters&&k<parameters.length;++k){var parameter=parameters[k];var type;if(parameter.type)
1029 type=jsTypes[parameter.type]||parameter.type;else{var ref=parameter["$ref"];if(ref.indexOf(".")!==-1)
1030 type=rawTypes[ref];else
1031 type=rawTypes[domain.domain+"."+ref];}
1032 var text="{\"name\": \""+parameter.name+"\", \"type\": \""+type+"\", \"optional\": "+(parameter.optional?"true":"false")+"}";paramsText.push(text);}
1033 var returnsText=[];var returns=command["returns"]||[];for(var k=0;k<returns.length;++k){var parameter=returns[k];returnsText.push("\""+parameter.name+"\"");}
1034 var hasErrorData=String(Boolean(command.error));result.push("InspectorBackend.registerCommand(\""+domain.domain+"."+command.name+"\", ["+paramsText.join(", ")+"], ["+returnsText.join(", ")+"], "+hasErrorData+");");}
1035 for(var j=0;domain.events&&j<domain.events.length;++j){var event=domain.events[j];var paramsText=[];for(var k=0;event.parameters&&k<event.parameters.length;++k){var parameter=event.parameters[k];paramsText.push("\""+parameter.name+"\"");}
1036 result.push("InspectorBackend.registerEvent(\""+domain.domain+"."+event.name+"\", ["+paramsText.join(", ")+"]);");}
1037 result.push("InspectorBackend.register"+domain.domain+"Dispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, \""+domain.domain+"\");");}
1038 return result.join("\n");}
1039 InspectorBackendClass.Connection=function()
1040 {this._lastMessageId=1;this._pendingResponsesCount=0;this._agents={};this._dispatchers={};this._callbacks={};this._initialize(InspectorBackend._agentPrototypes,InspectorBackend._dispatcherPrototypes);}
1041 InspectorBackendClass.Connection.Events={Disconnected:"Disconnected",}
1042 InspectorBackendClass.Connection.prototype={_initialize:function(agentPrototypes,dispatcherPrototypes)
1043 {for(var domain in agentPrototypes){this._agents[domain]=Object.create(agentPrototypes[domain]);this._agents[domain].setConnection(this);}
1044 for(var domain in dispatcherPrototypes)
1045 this._dispatchers[domain]=Object.create(dispatcherPrototypes[domain])},registerAgentsOn:function(object)
1046 {for(var domain in this._agents)
1047 object[domain+"Agent"]=this._agents[domain];},nextMessageId:function()
1048 {return this._lastMessageId++;},agent:function(domain)
1049 {return this._agents[domain];},agentsMap:function()
1050 {return this._agents;},_wrapCallbackAndSendMessageObject:function(domain,method,params,callback)
1051 {var messageObject={};messageObject.method=method;if(params)
1052 messageObject.params=params;var wrappedCallback=this._wrap(callback,domain,method);var messageId=this.nextMessageId();messageObject.id=messageId;if(InspectorBackendClass.Options.dumpInspectorProtocolMessages)
1053 console.log("frontend: "+JSON.stringify(messageObject));this.sendMessage(messageObject);++this._pendingResponsesCount;this._callbacks[messageId]=wrappedCallback;},_wrap:function(callback,domain,method)
1054 {if(!callback)
1055 callback=function(){};callback.methodName=method;callback.domain=domain;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
1056 callback.sendRequestTime=Date.now();return callback;},sendMessage:function(messageObject)
1057 {throw"Not implemented";},reportProtocolError:function(messageObject)
1058 {console.error("Protocol Error: the message with wrong id. Message =  "+JSON.stringify(messageObject));},dispatch:function(message)
1059 {if(InspectorBackendClass.Options.dumpInspectorProtocolMessages)
1060 console.log("backend: "+((typeof message==="string")?message:JSON.stringify(message)));var messageObject=((typeof message==="string")?JSON.parse(message):message);if("id"in messageObject){var callback=this._callbacks[messageObject.id];if(!callback){this.reportProtocolError(messageObject);return;}
1061 var processingStartTime;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
1062 processingStartTime=Date.now();this.agent(callback.domain).dispatchResponse(messageObject.id,messageObject,callback.methodName,callback);--this._pendingResponsesCount;delete this._callbacks[messageObject.id];if(InspectorBackendClass.Options.dumpInspectorTimeStats)
1063 console.log("time-stats: "+callback.methodName+" = "+(processingStartTime-callback.sendRequestTime)+" + "+(Date.now()-processingStartTime));if(this._scripts&&!this._pendingResponsesCount)
1064 this.runAfterPendingDispatches();return;}else{var method=messageObject.method.split(".");var domainName=method[0];if(!(domainName in this._dispatchers)){console.error("Protocol Error: the message "+messageObject.method+" is for non-existing domain '"+domainName+"'");return;}
1065 this._dispatchers[domainName].dispatch(method[1],messageObject);}},registerDispatcher:function(domain,dispatcher)
1066 {if(!this._dispatchers[domain])
1067 return;this._dispatchers[domain].setDomainDispatcher(dispatcher);},runAfterPendingDispatches:function(script)
1068 {if(!this._scripts)
1069 this._scripts=[];if(script)
1070 this._scripts.push(script);if(!this._pendingResponsesCount){var scripts=this._scripts;this._scripts=[]
1071 for(var id=0;id<scripts.length;++id)
1072 scripts[id].call(this);}},fireDisconnected:function(reason)
1073 {this.dispatchEventToListeners(InspectorBackendClass.Connection.Events.Disconnected,{reason:reason});},__proto__:WebInspector.Object.prototype}
1074 InspectorBackendClass.MainConnection=function(onConnectionReady)
1075 {InspectorBackendClass.Connection.call(this);onConnectionReady(this);}
1076 InspectorBackendClass.MainConnection.prototype={sendMessage:function(messageObject)
1077 {var message=JSON.stringify(messageObject);InspectorFrontendHost.sendMessageToBackend(message);},__proto__:InspectorBackendClass.Connection.prototype}
1078 InspectorBackendClass.WebSocketConnection=function(url,onConnectionReady)
1079 {InspectorBackendClass.Connection.call(this);this._socket=new WebSocket(url);this._socket.onmessage=this._onMessage.bind(this);this._socket.onerror=this._onError.bind(this);this._socket.onopen=onConnectionReady.bind(null,this);this._socket.onclose=this.fireDisconnected.bind(this,"websocket_closed");}
1080 InspectorBackendClass.WebSocketConnection.prototype={_onMessage:function(message)
1081 {var data=(message.data)
1082 this.dispatch(data);},_onError:function(error)
1083 {console.error(error);},sendMessage:function(messageObject)
1084 {var message=JSON.stringify(messageObject);this._socket.send(message);},__proto__:InspectorBackendClass.Connection.prototype}
1085 InspectorBackendClass.StubConnection=function(onConnectionReady)
1086 {InspectorBackendClass.Connection.call(this);onConnectionReady(this);}
1087 InspectorBackendClass.StubConnection.prototype={sendMessage:function(messageObject)
1088 {var message=JSON.stringify(messageObject);setTimeout(this._echoResponse.bind(this,messageObject),0);},_echoResponse:function(messageObject)
1089 {this.dispatch(messageObject)},__proto__:InspectorBackendClass.Connection.prototype}
1090 InspectorBackendClass.AgentPrototype=function(domain)
1091 {this._replyArgs={};this._hasErrorData={};this._domain=domain;}
1092 InspectorBackendClass.AgentPrototype.prototype={setConnection:function(connection)
1093 {this._connection=connection;},registerCommand:function(methodName,signature,replyArgs,hasErrorData)
1094 {var domainAndMethod=this._domain+"."+methodName;function sendMessage(vararg)
1095 {var params=[domainAndMethod,signature].concat(Array.prototype.slice.call(arguments));InspectorBackendClass.AgentPrototype.prototype._sendMessageToBackend.apply(this,params);}
1096 this[methodName]=sendMessage;function invoke(vararg)
1097 {var params=[domainAndMethod].concat(Array.prototype.slice.call(arguments));InspectorBackendClass.AgentPrototype.prototype._invoke.apply(this,params);}
1098 this["invoke_"+methodName]=invoke;this._replyArgs[domainAndMethod]=replyArgs;if(hasErrorData)
1099 this._hasErrorData[domainAndMethod]=true;},_sendMessageToBackend:function(method,signature,vararg)
1100 {var args=Array.prototype.slice.call(arguments,2);var callback=(args.length&&typeof args[args.length-1]==="function")?args.pop():null;var params={};var hasParams=false;for(var i=0;i<signature.length;++i){var param=signature[i];var paramName=param["name"];var typeName=param["type"];var optionalFlag=param["optional"];if(!args.length&&!optionalFlag){console.error("Protocol Error: Invalid number of arguments for method '"+method+"' call. It must have the following arguments '"+JSON.stringify(signature)+"'.");return;}
1101 var value=args.shift();if(optionalFlag&&typeof value==="undefined"){continue;}
1102 if(typeof value!==typeName){console.error("Protocol Error: Invalid type of argument '"+paramName+"' for method '"+method+"' call. It must be '"+typeName+"' but it is '"+typeof value+"'.");return;}
1103 params[paramName]=value;hasParams=true;}
1104 if(args.length===1&&!callback&&(typeof args[0]!=="undefined")){console.error("Protocol Error: Optional callback argument for method '"+method+"' call must be a function but its type is '"+typeof args[0]+"'.");return;}
1105 this._connection._wrapCallbackAndSendMessageObject(this._domain,method,hasParams?params:null,callback);},_invoke:function(method,args,callback)
1106 {this._connection._wrapCallbackAndSendMessageObject(this._domain,method,args,callback);},dispatchResponse:function(messageId,messageObject,methodName,callback)
1107 {if(messageObject.error&&messageObject.error.code!==-32000)
1108 console.error("Request with id = "+messageObject.id+" failed. "+JSON.stringify(messageObject.error));var argumentsArray=[];argumentsArray[0]=messageObject.error?messageObject.error.message:null;if(this._hasErrorData[methodName])
1109 argumentsArray[1]=messageObject.error?messageObject.error.data:null;if(messageObject.result){var paramNames=this._replyArgs[methodName]||[];for(var i=0;i<paramNames.length;++i)
1110 argumentsArray.push(messageObject.result[paramNames[i]]);}
1111 callback.apply(null,argumentsArray);}}
1112 InspectorBackendClass.DispatcherPrototype=function()
1113 {this._eventArgs={};this._dispatcher=null;}
1114 InspectorBackendClass.DispatcherPrototype.prototype={registerEvent:function(eventName,params)
1115 {this._eventArgs[eventName]=params},setDomainDispatcher:function(dispatcher)
1116 {this._dispatcher=dispatcher;},dispatch:function(functionName,messageObject)
1117 {if(!this._dispatcher)
1118 return;if(!(functionName in this._dispatcher)){console.error("Protocol Error: Attempted to dispatch an unimplemented method '"+messageObject.method+"'");return;}
1119 if(!this._eventArgs[messageObject.method]){console.error("Protocol Error: Attempted to dispatch an unspecified method '"+messageObject.method+"'");return;}
1120 var params=[];if(messageObject.params){var paramNames=this._eventArgs[messageObject.method];for(var i=0;i<paramNames.length;++i)
1121 params.push(messageObject.params[paramNames[i]]);}
1122 var processingStartTime;if(InspectorBackendClass.Options.dumpInspectorTimeStats)
1123 processingStartTime=Date.now();this._dispatcher[functionName].apply(this._dispatcher,params);if(InspectorBackendClass.Options.dumpInspectorTimeStats)
1124 console.log("time-stats: "+messageObject.method+" = "+(Date.now()-processingStartTime));}}
1125 InspectorBackendClass.Options={dumpInspectorTimeStats:false,dumpInspectorProtocolMessages:false}
1126 InspectorBackend=new InspectorBackendClass();InspectorBackend.registerInspectorDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Inspector");InspectorBackend.registerEvent("Inspector.evaluateForTestInFrontend",["testCallId","script"]);InspectorBackend.registerEvent("Inspector.inspect",["object","hints"]);InspectorBackend.registerEvent("Inspector.detached",["reason"]);InspectorBackend.registerEvent("Inspector.targetCrashed",[]);InspectorBackend.registerCommand("Inspector.enable",[],[],false);InspectorBackend.registerCommand("Inspector.disable",[],[],false);InspectorBackend.registerCommand("Inspector.reset",[],[],false);InspectorBackend.registerMemoryDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Memory");InspectorBackend.registerCommand("Memory.getDOMCounters",[],["documents","nodes","jsEventListeners"],false);InspectorBackend.registerPageDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Page");InspectorBackend.registerEnum("Page.ResourceType",{Document:"Document",Stylesheet:"Stylesheet",Image:"Image",Font:"Font",Script:"Script",XHR:"XHR",WebSocket:"WebSocket",Other:"Other"});InspectorBackend.registerEnum("Page.UsageItemId",{Filesystem:"filesystem",Database:"database",Appcache:"appcache",Indexeddatabase:"indexeddatabase"});InspectorBackend.registerEvent("Page.domContentEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.loadEventFired",["timestamp"]);InspectorBackend.registerEvent("Page.frameAttached",["frameId","parentFrameId"]);InspectorBackend.registerEvent("Page.frameNavigated",["frame"]);InspectorBackend.registerEvent("Page.frameDetached",["frameId"]);InspectorBackend.registerEvent("Page.frameStartedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameStoppedLoading",["frameId"]);InspectorBackend.registerEvent("Page.frameScheduledNavigation",["frameId","delay"]);InspectorBackend.registerEvent("Page.frameClearedScheduledNavigation",["frameId"]);InspectorBackend.registerEvent("Page.frameResized",[]);InspectorBackend.registerEvent("Page.javascriptDialogOpening",["message"]);InspectorBackend.registerEvent("Page.javascriptDialogClosed",[]);InspectorBackend.registerEvent("Page.scriptsEnabled",["isEnabled"]);InspectorBackend.registerEvent("Page.screencastFrame",["data","metadata"]);InspectorBackend.registerEvent("Page.screencastVisibilityChanged",["visible"]);InspectorBackend.registerCommand("Page.enable",[],[],false);InspectorBackend.registerCommand("Page.disable",[],[],false);InspectorBackend.registerCommand("Page.addScriptToEvaluateOnLoad",[{"name":"scriptSource","type":"string","optional":false}],["identifier"],false);InspectorBackend.registerCommand("Page.removeScriptToEvaluateOnLoad",[{"name":"identifier","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.reload",[{"name":"ignoreCache","type":"boolean","optional":true},{"name":"scriptToEvaluateOnLoad","type":"string","optional":true},{"name":"scriptPreprocessor","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.navigate",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.getNavigationHistory",[],["currentIndex","entries"],false);InspectorBackend.registerCommand("Page.navigateToHistoryEntry",[{"name":"entryId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.getCookies",[],["cookies"],false);InspectorBackend.registerCommand("Page.deleteCookie",[{"name":"cookieName","type":"string","optional":false},{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.getResourceTree",[],["frameTree"],false);InspectorBackend.registerCommand("Page.getResourceContent",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false}],["content","base64Encoded"],false);InspectorBackend.registerCommand("Page.searchInResource",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Page.setDocumentContent",[{"name":"frameId","type":"string","optional":false},{"name":"html","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.setDeviceMetricsOverride",[{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"deviceScaleFactor","type":"number","optional":false},{"name":"emulateViewport","type":"boolean","optional":false},{"name":"fitWindow","type":"boolean","optional":false},{"name":"textAutosizing","type":"boolean","optional":true},{"name":"fontScaleFactor","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.setShowPaintRects",[{"name":"result","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowDebugBorders",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowFPSCounter",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setContinuousPaintingEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setShowScrollBottleneckRects",[{"name":"show","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.getScriptExecutionStatus",[],["result"],false);InspectorBackend.registerCommand("Page.setScriptExecutionDisabled",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setGeolocationOverride",[{"name":"latitude","type":"number","optional":true},{"name":"longitude","type":"number","optional":true},{"name":"accuracy","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.clearGeolocationOverride",[],[],false);InspectorBackend.registerCommand("Page.setDeviceOrientationOverride",[{"name":"alpha","type":"number","optional":false},{"name":"beta","type":"number","optional":false},{"name":"gamma","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Page.clearDeviceOrientationOverride",[],[],false);InspectorBackend.registerCommand("Page.setTouchEmulationEnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Page.setEmulatedMedia",[{"name":"media","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Page.captureScreenshot",[],["data"],false);InspectorBackend.registerCommand("Page.canScreencast",[],["result"],false);InspectorBackend.registerCommand("Page.startScreencast",[{"name":"format","type":"string","optional":true},{"name":"quality","type":"number","optional":true},{"name":"maxWidth","type":"number","optional":true},{"name":"maxHeight","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Page.stopScreencast",[],[],false);InspectorBackend.registerCommand("Page.handleJavaScriptDialog",[{"name":"accept","type":"boolean","optional":false},{"name":"promptText","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Page.setShowViewportSizeOnResize",[{"name":"show","type":"boolean","optional":false},{"name":"showGrid","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Page.queryUsageAndQuota",[{"name":"securityOrigin","type":"string","optional":false}],["quota","usage"],false);InspectorBackend.registerRuntimeDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Runtime");InspectorBackend.registerEnum("Runtime.RemoteObjectType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEnum("Runtime.RemoteObjectSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEnum("Runtime.PropertyPreviewType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean",Accessor:"accessor"});InspectorBackend.registerEnum("Runtime.PropertyPreviewSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEnum("Runtime.CallArgumentType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEvent("Runtime.executionContextCreated",["context"]);InspectorBackend.registerCommand("Runtime.evaluate",[{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"contextId","type":"number","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Runtime.callFunctionOn",[{"name":"objectId","type":"string","optional":false},{"name":"functionDeclaration","type":"string","optional":false},{"name":"arguments","type":"object","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Runtime.getProperties",[{"name":"objectId","type":"string","optional":false},{"name":"ownProperties","type":"boolean","optional":true},{"name":"accessorPropertiesOnly","type":"boolean","optional":true}],["result","internalProperties"],false);InspectorBackend.registerCommand("Runtime.releaseObject",[{"name":"objectId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.releaseObjectGroup",[{"name":"objectGroup","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Runtime.run",[],[],false);InspectorBackend.registerCommand("Runtime.enable",[],[],false);InspectorBackend.registerCommand("Runtime.disable",[],[],false);InspectorBackend.registerConsoleDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Console");InspectorBackend.registerEnum("Console.ConsoleMessageSource",{XML:"xml",Javascript:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",Appcache:"appcache",Rendering:"rendering",Css:"css",Security:"security",Other:"other",Deprecation:"deprecation"});InspectorBackend.registerEnum("Console.ConsoleMessageLevel",{Log:"log",Warning:"warning",Error:"error",Debug:"debug",Info:"info"});InspectorBackend.registerEnum("Console.ConsoleMessageType",{Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Profile:"profile",ProfileEnd:"profileEnd"});InspectorBackend.registerEvent("Console.messageAdded",["message"]);InspectorBackend.registerEvent("Console.messageRepeatCountUpdated",["count","timestamp"]);InspectorBackend.registerEvent("Console.messagesCleared",[]);InspectorBackend.registerCommand("Console.enable",[],[],false);InspectorBackend.registerCommand("Console.disable",[],[],false);InspectorBackend.registerCommand("Console.clearMessages",[],[],false);InspectorBackend.registerCommand("Console.setMonitoringXHREnabled",[{"name":"enabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Console.addInspectedHeapObject",[{"name":"heapObjectId","type":"number","optional":false}],[],false);InspectorBackend.registerNetworkDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Network");InspectorBackend.registerEnum("Network.InitiatorType",{Parser:"parser",Script:"script",Other:"other"});InspectorBackend.registerEvent("Network.requestWillBeSent",["requestId","frameId","loaderId","documentURL","request","timestamp","initiator","redirectResponse"]);InspectorBackend.registerEvent("Network.requestServedFromCache",["requestId"]);InspectorBackend.registerEvent("Network.responseReceived",["requestId","frameId","loaderId","timestamp","type","response"]);InspectorBackend.registerEvent("Network.dataReceived",["requestId","timestamp","dataLength","encodedDataLength"]);InspectorBackend.registerEvent("Network.loadingFinished",["requestId","timestamp","encodedDataLength"]);InspectorBackend.registerEvent("Network.loadingFailed",["requestId","timestamp","errorText","canceled"]);InspectorBackend.registerEvent("Network.webSocketWillSendHandshakeRequest",["requestId","timestamp","request"]);InspectorBackend.registerEvent("Network.webSocketHandshakeResponseReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketCreated",["requestId","url"]);InspectorBackend.registerEvent("Network.webSocketClosed",["requestId","timestamp"]);InspectorBackend.registerEvent("Network.webSocketFrameReceived",["requestId","timestamp","response"]);InspectorBackend.registerEvent("Network.webSocketFrameError",["requestId","timestamp","errorMessage"]);InspectorBackend.registerEvent("Network.webSocketFrameSent",["requestId","timestamp","response"]);InspectorBackend.registerCommand("Network.enable",[],[],false);InspectorBackend.registerCommand("Network.disable",[],[],false);InspectorBackend.registerCommand("Network.setUserAgentOverride",[{"name":"userAgent","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.setExtraHTTPHeaders",[{"name":"headers","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Network.getResponseBody",[{"name":"requestId","type":"string","optional":false}],["body","base64Encoded"],false);InspectorBackend.registerCommand("Network.replayXHR",[{"name":"requestId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCache",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCache",[],[],false);InspectorBackend.registerCommand("Network.canClearBrowserCookies",[],["result"],false);InspectorBackend.registerCommand("Network.clearBrowserCookies",[],[],false);InspectorBackend.registerCommand("Network.setCacheDisabled",[{"name":"cacheDisabled","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Network.loadResourceForFrontend",[{"name":"frameId","type":"string","optional":false},{"name":"url","type":"string","optional":false},{"name":"requestHeaders","type":"object","optional":true}],["statusCode","responseHeaders","content"],false);InspectorBackend.registerDatabaseDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Database");InspectorBackend.registerEvent("Database.addDatabase",["database"]);InspectorBackend.registerCommand("Database.enable",[],[],false);InspectorBackend.registerCommand("Database.disable",[],[],false);InspectorBackend.registerCommand("Database.getDatabaseTableNames",[{"name":"databaseId","type":"string","optional":false}],["tableNames"],false);InspectorBackend.registerCommand("Database.executeSQL",[{"name":"databaseId","type":"string","optional":false},{"name":"query","type":"string","optional":false}],["columnNames","values","sqlError"],false);InspectorBackend.registerIndexedDBDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"IndexedDB");InspectorBackend.registerEnum("IndexedDB.KeyType",{Number:"number",String:"string",Date:"date",Array:"array"});InspectorBackend.registerEnum("IndexedDB.KeyPathType",{Null:"null",String:"string",Array:"array"});InspectorBackend.registerCommand("IndexedDB.enable",[],[],false);InspectorBackend.registerCommand("IndexedDB.disable",[],[],false);InspectorBackend.registerCommand("IndexedDB.requestDatabaseNames",[{"name":"securityOrigin","type":"string","optional":false}],["databaseNames"],false);InspectorBackend.registerCommand("IndexedDB.requestDatabase",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false}],["databaseWithObjectStores"],false);InspectorBackend.registerCommand("IndexedDB.requestData",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false},{"name":"indexName","type":"string","optional":false},{"name":"skipCount","type":"number","optional":false},{"name":"pageSize","type":"number","optional":false},{"name":"keyRange","type":"object","optional":true}],["objectStoreDataEntries","hasMore"],false);InspectorBackend.registerCommand("IndexedDB.clearObjectStore",[{"name":"securityOrigin","type":"string","optional":false},{"name":"databaseName","type":"string","optional":false},{"name":"objectStoreName","type":"string","optional":false}],[],false);InspectorBackend.registerDOMStorageDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOMStorage");InspectorBackend.registerEvent("DOMStorage.domStorageItemsCleared",["storageId"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemRemoved",["storageId","key"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemAdded",["storageId","key","newValue"]);InspectorBackend.registerEvent("DOMStorage.domStorageItemUpdated",["storageId","key","oldValue","newValue"]);InspectorBackend.registerCommand("DOMStorage.enable",[],[],false);InspectorBackend.registerCommand("DOMStorage.disable",[],[],false);InspectorBackend.registerCommand("DOMStorage.getDOMStorageItems",[{"name":"storageId","type":"object","optional":false}],["entries"],false);InspectorBackend.registerCommand("DOMStorage.setDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMStorage.removeDOMStorageItem",[{"name":"storageId","type":"object","optional":false},{"name":"key","type":"string","optional":false}],[],false);InspectorBackend.registerApplicationCacheDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"ApplicationCache");InspectorBackend.registerEvent("ApplicationCache.applicationCacheStatusUpdated",["frameId","manifestURL","status"]);InspectorBackend.registerEvent("ApplicationCache.networkStateUpdated",["isNowOnline"]);InspectorBackend.registerCommand("ApplicationCache.getFramesWithManifests",[],["frameIds"],false);InspectorBackend.registerCommand("ApplicationCache.enable",[],[],false);InspectorBackend.registerCommand("ApplicationCache.getManifestForFrame",[{"name":"frameId","type":"string","optional":false}],["manifestURL"],false);InspectorBackend.registerCommand("ApplicationCache.getApplicationCacheForFrame",[{"name":"frameId","type":"string","optional":false}],["applicationCache"],false);InspectorBackend.registerFileSystemDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"FileSystem");InspectorBackend.registerCommand("FileSystem.enable",[],[],false);InspectorBackend.registerCommand("FileSystem.disable",[],[],false);InspectorBackend.registerCommand("FileSystem.requestFileSystemRoot",[{"name":"origin","type":"string","optional":false},{"name":"type","type":"string","optional":false}],["errorCode","root"],false);InspectorBackend.registerCommand("FileSystem.requestDirectoryContent",[{"name":"url","type":"string","optional":false}],["errorCode","entries"],false);InspectorBackend.registerCommand("FileSystem.requestMetadata",[{"name":"url","type":"string","optional":false}],["errorCode","metadata"],false);InspectorBackend.registerCommand("FileSystem.requestFileContent",[{"name":"url","type":"string","optional":false},{"name":"readAsText","type":"boolean","optional":false},{"name":"start","type":"number","optional":true},{"name":"end","type":"number","optional":true},{"name":"charset","type":"string","optional":true}],["errorCode","content","charset"],false);InspectorBackend.registerCommand("FileSystem.deleteEntry",[{"name":"url","type":"string","optional":false}],["errorCode"],false);InspectorBackend.registerDOMDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOM");InspectorBackend.registerEnum("DOM.PseudoType",{Before:"before",After:"after"});InspectorBackend.registerEnum("DOM.ShadowRootType",{UserAgent:"user-agent",Author:"author"});InspectorBackend.registerEvent("DOM.documentUpdated",[]);InspectorBackend.registerEvent("DOM.inspectNodeRequested",["nodeId"]);InspectorBackend.registerEvent("DOM.setChildNodes",["parentId","nodes"]);InspectorBackend.registerEvent("DOM.attributeModified",["nodeId","name","value"]);InspectorBackend.registerEvent("DOM.attributeRemoved",["nodeId","name"]);InspectorBackend.registerEvent("DOM.inlineStyleInvalidated",["nodeIds"]);InspectorBackend.registerEvent("DOM.characterDataModified",["nodeId","characterData"]);InspectorBackend.registerEvent("DOM.childNodeCountUpdated",["nodeId","childNodeCount"]);InspectorBackend.registerEvent("DOM.childNodeInserted",["parentNodeId","previousNodeId","node"]);InspectorBackend.registerEvent("DOM.childNodeRemoved",["parentNodeId","nodeId"]);InspectorBackend.registerEvent("DOM.shadowRootPushed",["hostId","root"]);InspectorBackend.registerEvent("DOM.shadowRootPopped",["hostId","rootId"]);InspectorBackend.registerEvent("DOM.pseudoElementAdded",["parentId","pseudoElement"]);InspectorBackend.registerEvent("DOM.pseudoElementRemoved",["parentId","pseudoElementId"]);InspectorBackend.registerCommand("DOM.getDocument",[],["root"],false);InspectorBackend.registerCommand("DOM.requestChildNodes",[{"name":"nodeId","type":"number","optional":false},{"name":"depth","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("DOM.querySelector",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.querySelectorAll",[{"name":"nodeId","type":"number","optional":false},{"name":"selector","type":"string","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.setNodeName",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setNodeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.removeNode",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributeValue",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false},{"name":"value","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setAttributesAsText",[{"name":"nodeId","type":"number","optional":false},{"name":"text","type":"string","optional":false},{"name":"name","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.removeAttribute",[{"name":"nodeId","type":"number","optional":false},{"name":"name","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getEventListenersForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["listeners"],false);InspectorBackend.registerCommand("DOM.getOuterHTML",[{"name":"nodeId","type":"number","optional":false}],["outerHTML"],false);InspectorBackend.registerCommand("DOM.setOuterHTML",[{"name":"nodeId","type":"number","optional":false},{"name":"outerHTML","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.performSearch",[{"name":"query","type":"string","optional":false}],["searchId","resultCount"],false);InspectorBackend.registerCommand("DOM.getSearchResults",[{"name":"searchId","type":"string","optional":false},{"name":"fromIndex","type":"number","optional":false},{"name":"toIndex","type":"number","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.discardSearchResults",[{"name":"searchId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.requestNode",[{"name":"objectId","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.setInspectModeEnabled",[{"name":"enabled","type":"boolean","optional":false},{"name":"inspectUAShadowDOM","type":"boolean","optional":true},{"name":"highlightConfig","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightRect",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"width","type":"number","optional":false},{"name":"height","type":"number","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightQuad",[{"name":"quad","type":"object","optional":false},{"name":"color","type":"object","optional":true},{"name":"outlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.highlightNode",[{"name":"highlightConfig","type":"object","optional":false},{"name":"nodeId","type":"number","optional":true},{"name":"objectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("DOM.hideHighlight",[],[],false);InspectorBackend.registerCommand("DOM.highlightFrame",[{"name":"frameId","type":"string","optional":false},{"name":"contentColor","type":"object","optional":true},{"name":"contentOutlineColor","type":"object","optional":true}],[],false);InspectorBackend.registerCommand("DOM.pushNodeByPathToFrontend",[{"name":"path","type":"string","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.pushNodesByBackendIdsToFrontend",[{"name":"backendNodeIds","type":"object","optional":false}],["nodeIds"],false);InspectorBackend.registerCommand("DOM.releaseBackendNodeIds",[{"name":"nodeGroup","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOM.resolveNode",[{"name":"nodeId","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["object"],false);InspectorBackend.registerCommand("DOM.getAttributes",[{"name":"nodeId","type":"number","optional":false}],["attributes"],false);InspectorBackend.registerCommand("DOM.moveTo",[{"name":"nodeId","type":"number","optional":false},{"name":"targetNodeId","type":"number","optional":false},{"name":"insertBeforeNodeId","type":"number","optional":true}],["nodeId"],false);InspectorBackend.registerCommand("DOM.undo",[],[],false);InspectorBackend.registerCommand("DOM.redo",[],[],false);InspectorBackend.registerCommand("DOM.markUndoableState",[],[],false);InspectorBackend.registerCommand("DOM.focus",[{"name":"nodeId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DOM.setFileInputFiles",[{"name":"nodeId","type":"number","optional":false},{"name":"files","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("DOM.getBoxModel",[{"name":"nodeId","type":"number","optional":false}],["model"],false);InspectorBackend.registerCommand("DOM.getNodeForLocation",[{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCommand("DOM.getRelayoutBoundary",[{"name":"nodeId","type":"number","optional":false}],["nodeId"],false);InspectorBackend.registerCSSDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"CSS");InspectorBackend.registerEnum("CSS.StyleSheetOrigin",{User:"user",UserAgent:"user-agent",Inspector:"inspector",Regular:"regular"});InspectorBackend.registerEnum("CSS.CSSMediaSource",{MediaRule:"mediaRule",ImportRule:"importRule",LinkedSheet:"linkedSheet",InlineSheet:"inlineSheet"});InspectorBackend.registerEvent("CSS.mediaQueryResultChanged",[]);InspectorBackend.registerEvent("CSS.styleSheetChanged",["styleSheetId"]);InspectorBackend.registerEvent("CSS.styleSheetAdded",["header"]);InspectorBackend.registerEvent("CSS.styleSheetRemoved",["styleSheetId"]);InspectorBackend.registerCommand("CSS.enable",[],[],false);InspectorBackend.registerCommand("CSS.disable",[],[],false);InspectorBackend.registerCommand("CSS.getMatchedStylesForNode",[{"name":"nodeId","type":"number","optional":false},{"name":"includePseudo","type":"boolean","optional":true},{"name":"includeInherited","type":"boolean","optional":true}],["matchedCSSRules","pseudoElements","inherited"],false);InspectorBackend.registerCommand("CSS.getInlineStylesForNode",[{"name":"nodeId","type":"number","optional":false}],["inlineStyle","attributesStyle"],false);InspectorBackend.registerCommand("CSS.getComputedStyleForNode",[{"name":"nodeId","type":"number","optional":false}],["computedStyle"],false);InspectorBackend.registerCommand("CSS.getPlatformFontsForNode",[{"name":"nodeId","type":"number","optional":false}],["cssFamilyName","fonts"],false);InspectorBackend.registerCommand("CSS.getStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false}],["text"],false);InspectorBackend.registerCommand("CSS.setStyleSheetText",[{"name":"styleSheetId","type":"string","optional":false},{"name":"text","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("CSS.setPropertyText",[{"name":"styleId","type":"object","optional":false},{"name":"propertyIndex","type":"number","optional":false},{"name":"text","type":"string","optional":false},{"name":"overwrite","type":"boolean","optional":false}],["style"],false);InspectorBackend.registerCommand("CSS.setRuleSelector",[{"name":"ruleId","type":"object","optional":false},{"name":"selector","type":"string","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.createStyleSheet",[{"name":"frameId","type":"string","optional":false}],["styleSheetId"],false);InspectorBackend.registerCommand("CSS.addRule",[{"name":"styleSheetId","type":"string","optional":false},{"name":"selector","type":"string","optional":false}],["rule"],false);InspectorBackend.registerCommand("CSS.forcePseudoState",[{"name":"nodeId","type":"number","optional":false},{"name":"forcedPseudoClasses","type":"object","optional":false}],[],false);InspectorBackend.registerTimelineDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Timeline");InspectorBackend.registerEvent("Timeline.eventRecorded",["record"]);InspectorBackend.registerEvent("Timeline.progress",["count"]);InspectorBackend.registerEvent("Timeline.started",["consoleTimeline"]);InspectorBackend.registerEvent("Timeline.stopped",["consoleTimeline"]);InspectorBackend.registerCommand("Timeline.enable",[],[],false);InspectorBackend.registerCommand("Timeline.disable",[],[],false);InspectorBackend.registerCommand("Timeline.start",[{"name":"maxCallStackDepth","type":"number","optional":true},{"name":"bufferEvents","type":"boolean","optional":true},{"name":"liveEvents","type":"string","optional":true},{"name":"includeCounters","type":"boolean","optional":true},{"name":"includeGPUEvents","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Timeline.stop",[],["events"],false);InspectorBackend.registerDebuggerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Debugger");InspectorBackend.registerEnum("Debugger.ScopeType",{Global:"global",Local:"local",With:"with",Closure:"closure",Catch:"catch"});InspectorBackend.registerEvent("Debugger.globalObjectCleared",[]);InspectorBackend.registerEvent("Debugger.scriptParsed",["scriptId","url","startLine","startColumn","endLine","endColumn","isContentScript","sourceMapURL","hasSourceURL"]);InspectorBackend.registerEvent("Debugger.scriptFailedToParse",["url","scriptSource","startLine","errorLine","errorMessage"]);InspectorBackend.registerEvent("Debugger.breakpointResolved",["breakpointId","location"]);InspectorBackend.registerEvent("Debugger.paused",["callFrames","reason","data","hitBreakpoints","asyncStackTrace"]);InspectorBackend.registerEvent("Debugger.resumed",[]);InspectorBackend.registerCommand("Debugger.enable",[],[],false);InspectorBackend.registerCommand("Debugger.disable",[],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointsActive",[{"name":"active","type":"boolean","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.setSkipAllPauses",[{"name":"skipped","type":"boolean","optional":false},{"name":"untilReload","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setBreakpointByUrl",[{"name":"lineNumber","type":"number","optional":false},{"name":"url","type":"string","optional":true},{"name":"urlRegex","type":"string","optional":true},{"name":"columnNumber","type":"number","optional":true},{"name":"condition","type":"string","optional":true},{"name":"isAntibreakpoint","type":"boolean","optional":true}],["breakpointId","locations"],false);InspectorBackend.registerCommand("Debugger.setBreakpoint",[{"name":"location","type":"object","optional":false},{"name":"condition","type":"string","optional":true}],["breakpointId","actualLocation"],false);InspectorBackend.registerCommand("Debugger.removeBreakpoint",[{"name":"breakpointId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.continueToLocation",[{"name":"location","type":"object","optional":false},{"name":"interstatementLocation","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.stepOver",[{"name":"callFrameId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.stepInto",[],[],false);InspectorBackend.registerCommand("Debugger.stepOut",[{"name":"callFrameId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.pause",[],[],false);InspectorBackend.registerCommand("Debugger.resume",[],[],false);InspectorBackend.registerCommand("Debugger.searchInContent",[{"name":"scriptId","type":"string","optional":false},{"name":"query","type":"string","optional":false},{"name":"caseSensitive","type":"boolean","optional":true},{"name":"isRegex","type":"boolean","optional":true}],["result"],false);InspectorBackend.registerCommand("Debugger.canSetScriptSource",[],["result"],false);InspectorBackend.registerCommand("Debugger.setScriptSource",[{"name":"scriptId","type":"string","optional":false},{"name":"scriptSource","type":"string","optional":false},{"name":"preview","type":"boolean","optional":true}],["callFrames","result","asyncStackTrace"],true);InspectorBackend.registerCommand("Debugger.restartFrame",[{"name":"callFrameId","type":"string","optional":false}],["callFrames","result","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.getScriptSource",[{"name":"scriptId","type":"string","optional":false}],["scriptSource"],false);InspectorBackend.registerCommand("Debugger.getFunctionDetails",[{"name":"functionId","type":"string","optional":false}],["details"],false);InspectorBackend.registerCommand("Debugger.setPauseOnExceptions",[{"name":"state","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Debugger.evaluateOnCallFrame",[{"name":"callFrameId","type":"string","optional":false},{"name":"expression","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true},{"name":"includeCommandLineAPI","type":"boolean","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true},{"name":"returnByValue","type":"boolean","optional":true},{"name":"generatePreview","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Debugger.compileScript",[{"name":"expression","type":"string","optional":false},{"name":"sourceURL","type":"string","optional":false}],["scriptId","syntaxErrorMessage"],false);InspectorBackend.registerCommand("Debugger.runScript",[{"name":"scriptId","type":"string","optional":false},{"name":"contextId","type":"number","optional":true},{"name":"objectGroup","type":"string","optional":true},{"name":"doNotPauseOnExceptionsAndMuteConsole","type":"boolean","optional":true}],["result","wasThrown"],false);InspectorBackend.registerCommand("Debugger.setOverlayMessage",[{"name":"message","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setVariableValue",[{"name":"scopeNumber","type":"number","optional":false},{"name":"variableName","type":"string","optional":false},{"name":"newValue","type":"object","optional":false},{"name":"callFrameId","type":"string","optional":true},{"name":"functionObjectId","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.getStepInPositions",[{"name":"callFrameId","type":"string","optional":false}],["stepInPositions"],false);InspectorBackend.registerCommand("Debugger.getBacktrace",[],["callFrames","asyncStackTrace"],false);InspectorBackend.registerCommand("Debugger.skipStackFrames",[{"name":"script","type":"string","optional":true}],[],false);InspectorBackend.registerCommand("Debugger.setAsyncCallStackDepth",[{"name":"maxDepth","type":"number","optional":false}],[],false);InspectorBackend.registerDOMDebuggerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DOMDebugger");InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType",{SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"});InspectorBackend.registerCommand("DOMDebugger.setDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeDOMBreakpoint",[{"name":"nodeId","type":"number","optional":false},{"name":"type","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeEventListenerBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeInstrumentationBreakpoint",[{"name":"eventName","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.setXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("DOMDebugger.removeXHRBreakpoint",[{"name":"url","type":"string","optional":false}],[],false);InspectorBackend.registerProfilerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Profiler");InspectorBackend.registerEvent("Profiler.consoleProfileStarted",["id","location","title"]);InspectorBackend.registerEvent("Profiler.consoleProfileFinished",["id","location","profile","title"]);InspectorBackend.registerCommand("Profiler.enable",[],[],false);InspectorBackend.registerCommand("Profiler.disable",[],[],false);InspectorBackend.registerCommand("Profiler.setSamplingInterval",[{"name":"interval","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Profiler.start",[],[],false);InspectorBackend.registerCommand("Profiler.stop",[],["profile"],false);InspectorBackend.registerHeapProfilerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"HeapProfiler");InspectorBackend.registerEvent("HeapProfiler.addHeapSnapshotChunk",["chunk"]);InspectorBackend.registerEvent("HeapProfiler.resetProfiles",[]);InspectorBackend.registerEvent("HeapProfiler.reportHeapSnapshotProgress",["done","total","finished"]);InspectorBackend.registerEvent("HeapProfiler.lastSeenObjectId",["lastSeenObjectId","timestamp"]);InspectorBackend.registerEvent("HeapProfiler.heapStatsUpdate",["statsUpdate"]);InspectorBackend.registerCommand("HeapProfiler.enable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.disable",[],[],false);InspectorBackend.registerCommand("HeapProfiler.startTrackingHeapObjects",[{"name":"trackAllocations","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.stopTrackingHeapObjects",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.takeHeapSnapshot",[{"name":"reportProgress","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("HeapProfiler.collectGarbage",[],[],false);InspectorBackend.registerCommand("HeapProfiler.getObjectByHeapObjectId",[{"name":"objectId","type":"string","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result"],false);InspectorBackend.registerCommand("HeapProfiler.getHeapObjectId",[{"name":"objectId","type":"string","optional":false}],["heapSnapshotObjectId"],false);InspectorBackend.registerWorkerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Worker");InspectorBackend.registerEvent("Worker.workerCreated",["workerId","url","inspectorConnected"]);InspectorBackend.registerEvent("Worker.workerTerminated",["workerId"]);InspectorBackend.registerEvent("Worker.dispatchMessageFromWorker",["workerId","message"]);InspectorBackend.registerEvent("Worker.disconnectedFromWorker",[]);InspectorBackend.registerCommand("Worker.enable",[],[],false);InspectorBackend.registerCommand("Worker.disable",[],[],false);InspectorBackend.registerCommand("Worker.sendMessageToWorker",[{"name":"workerId","type":"number","optional":false},{"name":"message","type":"object","optional":false}],[],false);InspectorBackend.registerCommand("Worker.canInspectWorkers",[],["result"],false);InspectorBackend.registerCommand("Worker.connectToWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.disconnectFromWorker",[{"name":"workerId","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("Worker.setAutoconnectToWorkers",[{"name":"value","type":"boolean","optional":false}],[],false);InspectorBackend.registerCanvasDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Canvas");InspectorBackend.registerEnum("Canvas.CallArgumentType",{Object:"object",Function:"function",Undefined:"undefined",String:"string",Number:"number",Boolean:"boolean"});InspectorBackend.registerEnum("Canvas.CallArgumentSubtype",{Array:"array",Null:"null",Node:"node",Regexp:"regexp",Date:"date"});InspectorBackend.registerEvent("Canvas.contextCreated",["frameId"]);InspectorBackend.registerEvent("Canvas.traceLogsRemoved",["frameId","traceLogId"]);InspectorBackend.registerCommand("Canvas.enable",[],[],false);InspectorBackend.registerCommand("Canvas.disable",[],[],false);InspectorBackend.registerCommand("Canvas.dropTraceLog",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.hasUninstrumentedCanvases",[],["result"],false);InspectorBackend.registerCommand("Canvas.captureFrame",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.startCapturing",[{"name":"frameId","type":"string","optional":true}],["traceLogId"],false);InspectorBackend.registerCommand("Canvas.stopCapturing",[{"name":"traceLogId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Canvas.getTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"startOffset","type":"number","optional":true},{"name":"maxLength","type":"number","optional":true}],["traceLog"],false);InspectorBackend.registerCommand("Canvas.replayTraceLog",[{"name":"traceLogId","type":"string","optional":false},{"name":"stepNo","type":"number","optional":false}],["resourceState","replayTime"],false);InspectorBackend.registerCommand("Canvas.getResourceState",[{"name":"traceLogId","type":"string","optional":false},{"name":"resourceId","type":"string","optional":false}],["resourceState"],false);InspectorBackend.registerCommand("Canvas.evaluateTraceLogCallArgument",[{"name":"traceLogId","type":"string","optional":false},{"name":"callIndex","type":"number","optional":false},{"name":"argumentIndex","type":"number","optional":false},{"name":"objectGroup","type":"string","optional":true}],["result","resourceState"],false);InspectorBackend.registerInputDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Input");InspectorBackend.registerEnum("Input.TouchPointState",{TouchPressed:"touchPressed",TouchReleased:"touchReleased",TouchMoved:"touchMoved",TouchStationary:"touchStationary",TouchCancelled:"touchCancelled"});InspectorBackend.registerCommand("Input.dispatchKeyEvent",[{"name":"type","type":"string","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"text","type":"string","optional":true},{"name":"unmodifiedText","type":"string","optional":true},{"name":"keyIdentifier","type":"string","optional":true},{"name":"windowsVirtualKeyCode","type":"number","optional":true},{"name":"nativeVirtualKeyCode","type":"number","optional":true},{"name":"macCharCode","type":"number","optional":true},{"name":"autoRepeat","type":"boolean","optional":true},{"name":"isKeypad","type":"boolean","optional":true},{"name":"isSystemKey","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchMouseEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true},{"name":"button","type":"string","optional":true},{"name":"clickCount","type":"number","optional":true},{"name":"deviceSpace","type":"boolean","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchTouchEvent",[{"name":"type","type":"string","optional":false},{"name":"touchPoints","type":"object","optional":false},{"name":"modifiers","type":"number","optional":true},{"name":"timestamp","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Input.dispatchGestureEvent",[{"name":"type","type":"string","optional":false},{"name":"x","type":"number","optional":false},{"name":"y","type":"number","optional":false},{"name":"timestamp","type":"number","optional":true},{"name":"deltaX","type":"number","optional":true},{"name":"deltaY","type":"number","optional":true},{"name":"pinchScale","type":"number","optional":true}],[],false);InspectorBackend.registerLayerTreeDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"LayerTree");InspectorBackend.registerEnum("LayerTree.ScrollRectType",{RepaintsOnScroll:"RepaintsOnScroll",TouchEventHandler:"TouchEventHandler",WheelEventHandler:"WheelEventHandler"});InspectorBackend.registerEvent("LayerTree.layerTreeDidChange",["layers"]);InspectorBackend.registerEvent("LayerTree.layerPainted",["layerId","clip"]);InspectorBackend.registerCommand("LayerTree.enable",[],[],false);InspectorBackend.registerCommand("LayerTree.disable",[],[],false);InspectorBackend.registerCommand("LayerTree.compositingReasons",[{"name":"layerId","type":"string","optional":false}],["compositingReasons"],false);InspectorBackend.registerCommand("LayerTree.makeSnapshot",[{"name":"layerId","type":"string","optional":false}],["snapshotId"],false);InspectorBackend.registerCommand("LayerTree.releaseSnapshot",[{"name":"snapshotId","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("LayerTree.profileSnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"minRepeatCount","type":"number","optional":true},{"name":"minDuration","type":"number","optional":true}],["timings"],false);InspectorBackend.registerCommand("LayerTree.replaySnapshot",[{"name":"snapshotId","type":"string","optional":false},{"name":"fromStep","type":"number","optional":true},{"name":"toStep","type":"number","optional":true}],["dataURL"],false);InspectorBackend.registerGeolocationDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Geolocation");InspectorBackend.registerCommand("Geolocation.setGeolocationOverride",[{"name":"latitude","type":"number","optional":true},{"name":"longitude","type":"number","optional":true},{"name":"accuracy","type":"number","optional":true}],[],false);InspectorBackend.registerCommand("Geolocation.clearGeolocationOverride",[],[],false);InspectorBackend.registerDeviceOrientationDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"DeviceOrientation");InspectorBackend.registerCommand("DeviceOrientation.setDeviceOrientationOverride",[{"name":"alpha","type":"number","optional":false},{"name":"beta","type":"number","optional":false},{"name":"gamma","type":"number","optional":false}],[],false);InspectorBackend.registerCommand("DeviceOrientation.clearDeviceOrientationOverride",[],[],false);InspectorBackend.registerTracingDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Tracing");InspectorBackend.registerEvent("Tracing.dataCollected",["value"]);InspectorBackend.registerEvent("Tracing.tracingComplete",[]);InspectorBackend.registerCommand("Tracing.start",[{"name":"categories","type":"string","optional":false},{"name":"options","type":"string","optional":false}],[],false);InspectorBackend.registerCommand("Tracing.end",[],[],false);InspectorBackend.registerPowerDispatcher=InspectorBackend.registerDomainDispatcher.bind(InspectorBackend,"Power");InspectorBackend.registerEvent("Power.dataAvailable",["value"]);InspectorBackend.registerCommand("Power.start",[],[],false);InspectorBackend.registerCommand("Power.end",[],[],false);InspectorBackend.registerCommand("Power.canProfilePower",[],["result"],false);var InspectorFrontendAPI={_pendingCommands:[],showConsole:function()
1127 {InspectorFrontendAPI._runOnceLoaded(function(){WebInspector.inspectorView.showPanel("console");});},enterInspectElementMode:function()
1128 {InspectorFrontendAPI._runOnceLoaded(function(){WebInspector.inspectorView.showPanel("elements");if(WebInspector.inspectElementModeController)
1129 WebInspector.inspectElementModeController.toggleSearch();});},revealSourceLine:function(url,lineNumber,columnNumber)
1130 {InspectorFrontendAPI._runOnceLoaded(function(){var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(url);if(uiSourceCode){WebInspector.Revealer.reveal(new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber));return;}
1131 function listener(event)
1132 {var uiSourceCode=(event.data);if(uiSourceCode.url===url){WebInspector.Revealer.reveal(new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber));WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener);}}
1133 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,listener);});},setToolbarColors:function(backgroundColor,color)
1134 {WebInspector.setToolbarColors(backgroundColor,color);},loadTimelineFromURL:function(url)
1135 {InspectorFrontendAPI._runOnceLoaded(function(){(WebInspector.inspectorView.showPanel("timeline")).loadFromURL(url);});},setUseSoftMenu:function(useSoftMenu)
1136 {WebInspector.ContextMenu.setUseSoftMenu(useSoftMenu);},dispatchMessage:function(messageObject)
1137 {InspectorBackend.connection().dispatch(messageObject);},contextMenuItemSelected:function(id)
1138 {WebInspector.contextMenuItemSelected(id);},contextMenuCleared:function()
1139 {WebInspector.contextMenuCleared();},fileSystemsLoaded:function(fileSystems)
1140 {WebInspector.isolatedFileSystemDispatcher.fileSystemsLoaded(fileSystems);},fileSystemRemoved:function(fileSystemPath)
1141 {WebInspector.isolatedFileSystemDispatcher.fileSystemRemoved(fileSystemPath);},fileSystemAdded:function(errorMessage,fileSystem)
1142 {WebInspector.isolatedFileSystemDispatcher.fileSystemAdded(errorMessage,fileSystem);},indexingTotalWorkCalculated:function(requestId,fileSystemPath,totalWork)
1143 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingTotalWorkCalculated(requestId,totalWork);},indexingWorked:function(requestId,fileSystemPath,worked)
1144 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingWorked(requestId,worked);},indexingDone:function(requestId,fileSystemPath)
1145 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.indexingDone(requestId);},searchCompleted:function(requestId,fileSystemPath,files)
1146 {var projectDelegate=WebInspector.fileSystemWorkspaceProvider.delegate(fileSystemPath);projectDelegate.searchCompleted(requestId,files);},savedURL:function(url)
1147 {WebInspector.fileManager.savedURL(url);},canceledSaveURL:function(url)
1148 {WebInspector.fileManager.canceledSaveURL(url);},appendedToURL:function(url)
1149 {WebInspector.fileManager.appendedToURL(url);},embedderMessageAck:function(id,error)
1150 {InspectorFrontendHost.embedderMessageAck(id,error);},loadCompleted:function()
1151 {InspectorFrontendAPI._isLoaded=true;for(var i=0;i<InspectorFrontendAPI._pendingCommands.length;++i)
1152 InspectorFrontendAPI._pendingCommands[i]();InspectorFrontendAPI._pendingCommands=[];if(window.opener)
1153 window.opener.postMessage(["loadCompleted"],"*");},dispatchQueryParameters:function(dispatchParameter)
1154 {if(dispatchParameter)
1155 InspectorFrontendAPI._dispatch(JSON.parse(window.decodeURI(dispatchParameter)));},evaluateForTest:function(callId,script)
1156 {WebInspector.evaluateForTestInFrontend(callId,script);},dispatchMessageAsync:function(messageObject)
1157 {WebInspector.dispatch(messageObject);},_dispatch:function(signature)
1158 {InspectorFrontendAPI._runOnceLoaded(function(){var methodName=signature.shift();return InspectorFrontendAPI[methodName].apply(InspectorFrontendAPI,signature);});},_runOnceLoaded:function(command)
1159 {if(InspectorFrontendAPI._isLoaded){command();return;}
1160 InspectorFrontendAPI._pendingCommands.push(command);}}
1161 function onMessageFromOpener(event)
1162 {if(event.source===window.opener)
1163 InspectorFrontendAPI._dispatch(event.data);}
1164 if(window.opener&&window.dispatchStandaloneTestRunnerMessages)
1165 window.addEventListener("message",onMessageFromOpener,true);WebInspector.Target=function(connection,callback)
1166 {Protocol.Agents.call(this,connection.agentsMap());this._connection=connection;this.isMainFrontend=false;this.pageAgent().canScreencast(this._initializeCapability.bind(this,"canScreencast",null));if(WebInspector.experimentsSettings.powerProfiler.isEnabled())
1167 this.powerAgent().canProfilePower(this._initializeCapability.bind(this,"canProfilePower",null));this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this,"isMainFrontend",this._loadedWithCapabilities.bind(this,callback)));}
1168 WebInspector.Target.prototype={_initializeCapability:function(name,callback,error,result)
1169 {this[name]=result;if(!Capabilities[name])
1170 Capabilities[name]=result;if(callback)
1171 callback();},_loadedWithCapabilities:function(callback)
1172 {this.consoleModel=new WebInspector.ConsoleModel(this);if(!WebInspector.console)
1173 WebInspector.console=this.consoleModel;this.networkManager=new WebInspector.NetworkManager(this);if(!WebInspector.networkManager)
1174 WebInspector.networkManager=this.networkManager;this.resourceTreeModel=new WebInspector.ResourceTreeModel(this);if(!WebInspector.resourceTreeModel)
1175 WebInspector.resourceTreeModel=this.resourceTreeModel;this.debuggerModel=new WebInspector.DebuggerModel(this);if(!WebInspector.debuggerModel)
1176 WebInspector.debuggerModel=this.debuggerModel;this.runtimeModel=new WebInspector.RuntimeModel(this);if(!WebInspector.runtimeModel)
1177 WebInspector.runtimeModel=this.runtimeModel;this.domModel=new WebInspector.DOMModel();if(!WebInspector.domModel)
1178 WebInspector.domModel=this.domModel;this.workerManager=new WebInspector.WorkerManager(this,this.isMainFrontend);if(!WebInspector.workerManager)
1179 WebInspector.workerManager=this.workerManager;if(this.canProfilePower)
1180 WebInspector.powerProfiler=new WebInspector.PowerProfiler();if(callback)
1181 callback(this);},registerDispatcher:function(domain,dispatcher)
1182 {this._connection.registerDispatcher(domain,dispatcher);},isWorkerTarget:function()
1183 {return!this.isMainFrontend;},__proto__:Protocol.Agents.prototype}
1184 WebInspector.TargetManager=function()
1185 {WebInspector.Object.call(this);this._targets=[];}
1186 WebInspector.TargetManager.Events={TargetAdded:"TargetAdded",}
1187 WebInspector.TargetManager.prototype={createTarget:function(connection,callback)
1188 {var target=new WebInspector.Target(connection,callbackWrapper.bind(this));function callbackWrapper(newTarget)
1189 {if(callback)
1190 callback(newTarget);this._targets.push(newTarget);this.dispatchEventToListeners(WebInspector.TargetManager.Events.TargetAdded,newTarget);}},targets:function()
1191 {return this._targets;},mainTarget:function()
1192 {return this._targets[0];},__proto__:WebInspector.Object.prototype}
1193 WebInspector.targetManager;WebInspector.NotificationService=function(){}
1194 WebInspector.NotificationService.prototype={__proto__:WebInspector.Object.prototype}
1195 WebInspector.NotificationService.Events={InspectorLoaded:"InspectorLoaded",SelectedNodeChanged:"SelectedNodeChanged"}
1196 WebInspector.notifications=new WebInspector.NotificationService();var Preferences={maxInlineTextChildLength:80,minSidebarWidth:100,minSidebarHeight:75,applicationTitle:"Developer Tools - %s"}
1197 var Capabilities={isMainFrontend:false,canProfilePower:false,}
1198 WebInspector.Settings=function()
1199 {this._eventSupport=new WebInspector.Object();this._registry=({});this.colorFormat=this.createSetting("colorFormat","original");this.consoleHistory=this.createSetting("consoleHistory",[]);this.domWordWrap=this.createSetting("domWordWrap",true);this.eventListenersFilter=this.createSetting("eventListenersFilter","all");this.lastViewedScriptFile=this.createSetting("lastViewedScriptFile","application");this.monitoringXHREnabled=this.createSetting("monitoringXHREnabled",false);this.preserveConsoleLog=this.createSetting("preserveConsoleLog",false);this.consoleTimestampsEnabled=this.createSetting("consoleTimestampsEnabled",false);this.resourcesLargeRows=this.createSetting("resourcesLargeRows",true);this.resourcesSortOptions=this.createSetting("resourcesSortOptions",{timeOption:"responseTime",sizeOption:"transferSize"});this.resourceViewTab=this.createSetting("resourceViewTab","preview");this.showInheritedComputedStyleProperties=this.createSetting("showInheritedComputedStyleProperties",false);this.showUserAgentStyles=this.createSetting("showUserAgentStyles",true);this.watchExpressions=this.createSetting("watchExpressions",[]);this.breakpoints=this.createSetting("breakpoints",[]);this.eventListenerBreakpoints=this.createSetting("eventListenerBreakpoints",[]);this.domBreakpoints=this.createSetting("domBreakpoints",[]);this.xhrBreakpoints=this.createSetting("xhrBreakpoints",[]);this.jsSourceMapsEnabled=this.createSetting("sourceMapsEnabled",true);this.cssSourceMapsEnabled=this.createSetting("cssSourceMapsEnabled",true);this.cacheDisabled=this.createSetting("cacheDisabled",false);this.overrideUserAgent=this.createSetting("overrideUserAgent",false);this.userAgent=this.createSetting("userAgent","");this.overrideDeviceMetrics=this.createSetting("overrideDeviceMetrics",false);this.deviceMetrics=this.createSetting("deviceMetrics","");this.deviceFitWindow=this.createSetting("deviceFitWindow",true);this.emulateViewport=this.createSetting("emulateViewport",false);this.emulateTouchEvents=this.createSetting("emulateTouchEvents",false);this.showUAShadowDOM=this.createSetting("showUAShadowDOM",false);this.savedURLs=this.createSetting("savedURLs",{});this.javaScriptDisabled=this.createSetting("javaScriptDisabled",false);this.overrideGeolocation=this.createSetting("overrideGeolocation",false);this.geolocationOverride=this.createSetting("geolocationOverride","");this.overrideDeviceOrientation=this.createSetting("overrideDeviceOrientation",false);this.deviceOrientationOverride=this.createSetting("deviceOrientationOverride","");this.showAdvancedHeapSnapshotProperties=this.createSetting("showAdvancedHeapSnapshotProperties",false);this.highResolutionCpuProfiling=this.createSetting("highResolutionCpuProfiling",false);this.searchInContentScripts=this.createSetting("searchInContentScripts",false);this.textEditorIndent=this.createSetting("textEditorIndent","    ");this.textEditorAutoDetectIndent=this.createSetting("textEditorAutoIndentIndent",true);this.textEditorAutocompletion=this.createSetting("textEditorAutocompletion",true);this.textEditorBracketMatching=this.createSetting("textEditorBracketMatching",true);this.cssReloadEnabled=this.createSetting("cssReloadEnabled",false);this.timelineCaptureStacks=this.createSetting("timelineCaptureStacks",true);this.timelineLiveUpdate=this.createSetting("timelineLiveUpdate",true);this.showMetricsRulers=this.createSetting("showMetricsRulers",false);this.overrideCSSMedia=this.createSetting("overrideCSSMedia",false);this.emulatedCSSMedia=this.createSetting("emulatedCSSMedia","print");this.workerInspectorWidth=this.createSetting("workerInspectorWidth",600);this.workerInspectorHeight=this.createSetting("workerInspectorHeight",600);this.messageURLFilters=this.createSetting("messageURLFilters",{});this.networkHideDataURL=this.createSetting("networkHideDataURL",false);this.networkResourceTypeFilters=this.createSetting("networkResourceTypeFilters",{});this.messageLevelFilters=this.createSetting("messageLevelFilters",{});this.splitVerticallyWhenDockedToRight=this.createSetting("splitVerticallyWhenDockedToRight",true);this.visiblePanels=this.createSetting("visiblePanels",{});this.shortcutPanelSwitch=this.createSetting("shortcutPanelSwitch",false);this.showWhitespacesInEditor=this.createSetting("showWhitespacesInEditor",false);this.skipStackFramesSwitch=this.createSetting("skipStackFramesSwitch",false);this.skipStackFramesPattern=this.createRegExpSetting("skipStackFramesPattern","");this.pauseOnExceptionEnabled=this.createSetting("pauseOnExceptionEnabled",false);this.pauseOnCaughtException=this.createSetting("pauseOnCaughtException",false);this.enableAsyncStackTraces=this.createSetting("enableAsyncStackTraces",false);}
1200 WebInspector.Settings.prototype={createSetting:function(key,defaultValue)
1201 {if(!this._registry[key])
1202 this._registry[key]=new WebInspector.Setting(key,defaultValue,this._eventSupport,window.localStorage);return this._registry[key];},createRegExpSetting:function(key,defaultValue,regexFlags)
1203 {if(!this._registry[key])
1204 this._registry[key]=new WebInspector.RegExpSetting(key,defaultValue,this._eventSupport,window.localStorage,regexFlags);return this._registry[key];},createBackendSetting:function(key,defaultValue,setterCallback)
1205 {if(!this._registry[key])
1206 this._registry[key]=new WebInspector.BackendSetting(key,defaultValue,this._eventSupport,window.localStorage,setterCallback);return this._registry[key];},initializeBackendSettings:function()
1207 {this.showPaintRects=WebInspector.settings.createBackendSetting("showPaintRects",false,PageAgent.setShowPaintRects.bind(PageAgent));this.showDebugBorders=WebInspector.settings.createBackendSetting("showDebugBorders",false,PageAgent.setShowDebugBorders.bind(PageAgent));this.continuousPainting=WebInspector.settings.createBackendSetting("continuousPainting",false,PageAgent.setContinuousPaintingEnabled.bind(PageAgent));this.showFPSCounter=WebInspector.settings.createBackendSetting("showFPSCounter",false,PageAgent.setShowFPSCounter.bind(PageAgent));this.showScrollBottleneckRects=WebInspector.settings.createBackendSetting("showScrollBottleneckRects",false,PageAgent.setShowScrollBottleneckRects.bind(PageAgent));}}
1208 WebInspector.Setting=function(name,defaultValue,eventSupport,storage)
1209 {this._name=name;this._defaultValue=defaultValue;this._eventSupport=eventSupport;this._storage=storage;}
1210 WebInspector.Setting.prototype={addChangeListener:function(listener,thisObject)
1211 {this._eventSupport.addEventListener(this._name,listener,thisObject);},removeChangeListener:function(listener,thisObject)
1212 {this._eventSupport.removeEventListener(this._name,listener,thisObject);},get name()
1213 {return this._name;},get:function()
1214 {if(typeof this._value!=="undefined")
1215 return this._value;this._value=this._defaultValue;if(this._storage&&this._name in this._storage){try{this._value=JSON.parse(this._storage[this._name]);}catch(e){delete this._storage[this._name];}}
1216 return this._value;},set:function(value)
1217 {this._value=value;if(this._storage){try{this._storage[this._name]=JSON.stringify(value);}catch(e){console.error("Error saving setting with name:"+this._name);}}
1218 this._eventSupport.dispatchEventToListeners(this._name,value);}}
1219 WebInspector.RegExpSetting=function(name,defaultValue,eventSupport,storage,regexFlags)
1220 {WebInspector.Setting.call(this,name,defaultValue,eventSupport,storage);this._regexFlags=regexFlags;}
1221 WebInspector.RegExpSetting.prototype={set:function(value)
1222 {delete this._regex;WebInspector.Setting.prototype.set.call(this,value);},asRegExp:function()
1223 {if(typeof this._regex!=="undefined")
1224 return this._regex;this._regex=null;try{this._regex=new RegExp(this.get(),this._regexFlags||"");}catch(e){}
1225 return this._regex;},__proto__:WebInspector.Setting.prototype}
1226 WebInspector.BackendSetting=function(name,defaultValue,eventSupport,storage,setterCallback)
1227 {WebInspector.Setting.call(this,name,defaultValue,eventSupport,storage);this._setterCallback=setterCallback;var currentValue=this.get();if(currentValue!==defaultValue)
1228 this.set(currentValue);}
1229 WebInspector.BackendSetting.prototype={set:function(value)
1230 {function callback(error)
1231 {if(error){WebInspector.console.log("Error applying setting "+this._name+": "+error);this._eventSupport.dispatchEventToListeners(this._name,this._value);return;}
1232 WebInspector.Setting.prototype.set.call(this,value);}
1233 this._setterCallback(value,callback.bind(this));},__proto__:WebInspector.Setting.prototype}
1234 WebInspector.ExperimentsSettings=function(experimentsEnabled)
1235 {this._experimentsEnabled=experimentsEnabled;this._setting=WebInspector.settings.createSetting("experiments",{});this._experiments=[];this._enabledForTest={};this.fileSystemInspection=this._createExperiment("fileSystemInspection","FileSystem inspection");this.canvasInspection=this._createExperiment("canvasInspection ","Canvas inspection");this.frameworksDebuggingSupport=this._createExperiment("frameworksDebuggingSupport","Enable frameworks debugging support");this.layersPanel=this._createExperiment("layersPanel","Show Layers panel");this.doNotOpenDrawerOnEsc=this._createExperiment("doNotOpenDrawerWithEsc","Do not open drawer on Esc");this.showEditorInDrawer=this._createExperiment("showEditorInDrawer","Show editor in drawer");this.gpuTimeline=this._createExperiment("gpuTimeline","Show GPU data on timeline");this.applyCustomStylesheet=this._createExperiment("applyCustomStylesheet","Allow custom UI themes");this.workersInMainWindow=this._createExperiment("workersInMainWindow","Show workers in main window");this.dockToLeft=this._createExperiment("dockToLeft","Enable dock to left mode");this.allocationProfiler=this._createExperiment("allocationProfiler","Enable JavaScript heap allocation profiler");this.timelineFlameChart=this._createExperiment("timelineFlameChart","Enable FlameChart mode in Timeline");this.heapSnapshotStatistics=this._createExperiment("heapSnapshotStatistics","Show memory breakdown statistics in heap snapshots");this.timelineNoLiveUpdate=this._createExperiment("timelineNoLiveUpdate","Timeline w/o live update");this.powerProfiler=this._createExperiment("powerProfiler","Enable power mode in Timeline");this._cleanUpSetting();}
1236 WebInspector.ExperimentsSettings.prototype={get experiments()
1237 {return this._experiments.slice();},get experimentsEnabled()
1238 {return this._experimentsEnabled;},_createExperiment:function(experimentName,experimentTitle)
1239 {var experiment=new WebInspector.Experiment(this,experimentName,experimentTitle);this._experiments.push(experiment);return experiment;},isEnabled:function(experimentName)
1240 {if(this._enabledForTest[experimentName])
1241 return true;if(!this.experimentsEnabled)
1242 return false;var experimentsSetting=this._setting.get();return experimentsSetting[experimentName];},setEnabled:function(experimentName,enabled)
1243 {var experimentsSetting=this._setting.get();experimentsSetting[experimentName]=enabled;this._setting.set(experimentsSetting);},_enableForTest:function(experimentName)
1244 {this._enabledForTest[experimentName]=true;},_cleanUpSetting:function()
1245 {var experimentsSetting=this._setting.get();var cleanedUpExperimentSetting={};for(var i=0;i<this._experiments.length;++i){var experimentName=this._experiments[i].name;if(experimentsSetting[experimentName])
1246 cleanedUpExperimentSetting[experimentName]=true;}
1247 this._setting.set(cleanedUpExperimentSetting);}}
1248 WebInspector.Experiment=function(experimentsSettings,name,title)
1249 {this._name=name;this._title=title;this._experimentsSettings=experimentsSettings;}
1250 WebInspector.Experiment.prototype={get name()
1251 {return this._name;},get title()
1252 {return this._title;},isEnabled:function()
1253 {return this._experimentsSettings.isEnabled(this._name);},setEnabled:function(enabled)
1254 {this._experimentsSettings.setEnabled(this._name,enabled);},enableForTest:function()
1255 {this._experimentsSettings._enableForTest(this._name);}}
1256 WebInspector.VersionController=function()
1257 {}
1258 WebInspector.VersionController.currentVersion=7;WebInspector.VersionController.prototype={updateVersion:function()
1259 {var versionSetting=WebInspector.settings.createSetting("inspectorVersion",0);var currentVersion=WebInspector.VersionController.currentVersion;var oldVersion=versionSetting.get();var methodsToRun=this._methodsToRunToUpdateVersion(oldVersion,currentVersion);for(var i=0;i<methodsToRun.length;++i)
1260 this[methodsToRun[i]].call(this);versionSetting.set(currentVersion);},_methodsToRunToUpdateVersion:function(oldVersion,currentVersion)
1261 {var result=[];for(var i=oldVersion;i<currentVersion;++i)
1262 result.push("_updateVersionFrom"+i+"To"+(i+1));return result;},_updateVersionFrom0To1:function()
1263 {this._clearBreakpointsWhenTooMany(WebInspector.settings.breakpoints,500000);},_updateVersionFrom1To2:function()
1264 {var versionSetting=WebInspector.settings.createSetting("previouslyViewedFiles",[]);versionSetting.set([]);},_updateVersionFrom2To3:function()
1265 {var fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});fileSystemMappingSetting.set({});if(window.localStorage)
1266 delete window.localStorage["fileMappingEntries"];},_updateVersionFrom3To4:function()
1267 {var advancedMode=WebInspector.settings.createSetting("showHeaSnapshotObjectsHiddenProperties",false).get();WebInspector.settings.showAdvancedHeapSnapshotProperties.set(advancedMode);},_updateVersionFrom4To5:function()
1268 {if(!window.localStorage)
1269 return;var settingNames={"FileSystemViewSidebarWidth":"fileSystemViewSplitViewState","canvasProfileViewReplaySplitLocation":"canvasProfileViewReplaySplitViewState","canvasProfileViewSplitLocation":"canvasProfileViewSplitViewState","elementsSidebarWidth":"elementsPanelSplitViewState","StylesPaneSplitRatio":"stylesPaneSplitViewState","heapSnapshotRetainersViewSize":"heapSnapshotSplitViewState","InspectorView.splitView":"InspectorView.splitViewState","InspectorView.screencastSplitView":"InspectorView.screencastSplitViewState","Inspector.drawerSplitView":"Inspector.drawerSplitViewState","layerDetailsSplitView":"layerDetailsSplitViewState","networkSidebarWidth":"networkPanelSplitViewState","sourcesSidebarWidth":"sourcesPanelSplitViewState","scriptsPanelNavigatorSidebarWidth":"sourcesPanelNavigatorSplitViewState","sourcesPanelSplitSidebarRatio":"sourcesPanelDebuggerSidebarSplitViewState","timeline-details":"timelinePanelDetailsSplitViewState","timeline-split":"timelinePanelRecorsSplitViewState","timeline-view":"timelinePanelTimelineStackSplitViewState","auditsSidebarWidth":"auditsPanelSplitViewState","layersSidebarWidth":"layersPanelSplitViewState","profilesSidebarWidth":"profilesPanelSplitViewState","resourcesSidebarWidth":"resourcesPanelSplitViewState"};for(var oldName in settingNames){var newName=settingNames[oldName];var oldNameH=oldName+"H";var newValue=null;var oldSetting=WebInspector.settings.createSetting(oldName,undefined).get();if(oldSetting){newValue=newValue||{};newValue.vertical={};newValue.vertical.size=oldSetting;delete window.localStorage[oldName];}
1270 var oldSettingH=WebInspector.settings.createSetting(oldNameH,undefined).get();if(oldSettingH){newValue=newValue||{};newValue.horizontal={};newValue.horizontal.size=oldSettingH;delete window.localStorage[oldNameH];}
1271 var newSetting=WebInspector.settings.createSetting(newName,{});if(newValue)
1272 newSetting.set(newValue);}},_updateVersionFrom5To6:function()
1273 {if(!window.localStorage)
1274 return;var settingNames={"debuggerSidebarHidden":"sourcesPanelSplitViewState","navigatorHidden":"sourcesPanelNavigatorSplitViewState","WebInspector.Drawer.showOnLoad":"Inspector.drawerSplitViewState"};for(var oldName in settingNames){var newName=settingNames[oldName];var oldSetting=WebInspector.settings.createSetting(oldName,undefined).get();var invert="WebInspector.Drawer.showOnLoad"===oldName;var hidden=!!oldSetting!==invert;delete window.localStorage[oldName];var showMode=hidden?"OnlyMain":"Both";var newSetting=WebInspector.settings.createSetting(newName,null);var newValue=newSetting.get()||{};newValue.vertical=newValue.vertical||{};newValue.vertical.showMode=showMode;newValue.horizontal=newValue.horizontal||{};newValue.horizontal.showMode=showMode;newSetting.set(newValue);}},_updateVersionFrom6To7:function()
1275 {if(!window.localStorage)
1276 return;var settingNames={"sourcesPanelNavigatorSplitViewState":"sourcesPanelNavigatorSplitViewState","elementsPanelSplitViewState":"elementsPanelSplitViewState","canvasProfileViewReplaySplitViewState":"canvasProfileViewReplaySplitViewState","editorInDrawerSplitViewState":"editorInDrawerSplitViewState","stylesPaneSplitViewState":"stylesPaneSplitViewState","sourcesPanelDebuggerSidebarSplitViewState":"sourcesPanelDebuggerSidebarSplitViewState"};for(var name in settingNames){if(!(name in window.localStorage))
1277 continue;var setting=WebInspector.settings.createSetting(name,undefined);var value=setting.get();if(!value)
1278 continue;if(value.vertical&&value.vertical.size&&value.vertical.size<1)
1279 value.vertical.size=0;if(value.horizontal&&value.horizontal.size&&value.horizontal.size<1)
1280 value.horizontal.size=0;setting.set(value);}},_clearBreakpointsWhenTooMany:function(breakpointsSetting,maxBreakpointsCount)
1281 {if(breakpointsSetting.get().length>maxBreakpointsCount)
1282 breakpointsSetting.set([]);}}
1283 WebInspector.settings=new WebInspector.Settings();WebInspector.experimentsSettings=new WebInspector.ExperimentsSettings(WebInspector.queryParam("experiments")!==null);WebInspector.PauseOnExceptionStateSetting=function()
1284 {WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._enabledChanged,this);WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOnCaughtChanged,this);this._name="pauseOnExceptionStateString";this._eventSupport=new WebInspector.Object();this._value=this._calculateValue();}
1285 WebInspector.PauseOnExceptionStateSetting.prototype={addChangeListener:function(listener,thisObject)
1286 {this._eventSupport.addEventListener(this._name,listener,thisObject);},removeChangeListener:function(listener,thisObject)
1287 {this._eventSupport.removeEventListener(this._name,listener,thisObject);},get:function()
1288 {return this._value;},_calculateValue:function()
1289 {if(!WebInspector.settings.pauseOnExceptionEnabled.get())
1290 return"none";return"all";},_enabledChanged:function(event)
1291 {this._fireChangedIfNeeded();},_pauseOnCaughtChanged:function(event)
1292 {this._fireChangedIfNeeded();},_fireChangedIfNeeded:function()
1293 {var newValue=this._calculateValue();if(newValue===this._value)
1294 return;this._value=newValue;this._eventSupport.dispatchEventToListeners(this._name,this._value);}}
1295 WebInspector.settings.pauseOnExceptionStateString=new WebInspector.PauseOnExceptionStateSetting();WebInspector.SettingsUI={}
1296 WebInspector.SettingsUI.createCheckbox=function(name,getter,setter,omitParagraphElement,inputElement,tooltip)
1297 {var input=inputElement||document.createElement("input");input.type="checkbox";input.name=name;input.checked=getter();function listener()
1298 {setter(input.checked);}
1299 input.addEventListener("change",listener,false);var label=document.createElement("label");label.appendChild(input);label.createTextChild(name);if(tooltip)
1300 label.title=tooltip;if(omitParagraphElement)
1301 return label;var p=document.createElement("p");p.appendChild(label);return p;}
1302 WebInspector.SettingsUI.createSettingCheckbox=function(name,setting,omitParagraphElement,inputElement,tooltip)
1303 {return WebInspector.SettingsUI.createCheckbox(name,setting.get.bind(setting),setting.set.bind(setting),omitParagraphElement,inputElement,tooltip);}
1304 WebInspector.SettingsUI.createSettingFieldset=function(setting)
1305 {var fieldset=document.createElement("fieldset");fieldset.disabled=!setting.get();setting.addChangeListener(settingChanged);return fieldset;function settingChanged()
1306 {fieldset.disabled=!setting.get();}}
1307 WebInspector.View=function()
1308 {this.element=document.createElement("div");this.element.className="view";this.element.__view=this;this._visible=true;this._isRoot=false;this._isShowing=false;this._children=[];this._hideOnDetach=false;this._cssFiles=[];this._notificationDepth=0;}
1309 WebInspector.View._cssFileToVisibleViewCount={};WebInspector.View._cssFileToStyleElement={};WebInspector.View._cssUnloadTimeout=2000;WebInspector.View._buildSourceURL=function(cssFile)
1310 {return"\n/*# sourceURL="+WebInspector.ParsedURL.completeURL(window.location.href,cssFile)+" */";}
1311 WebInspector.View.createStyleElement=function(cssFile)
1312 {var styleElement;var xhr=new XMLHttpRequest();xhr.open("GET",cssFile,false);xhr.send(null);styleElement=document.createElement("style");styleElement.type="text/css";styleElement.textContent=xhr.responseText+WebInspector.View._buildSourceURL(cssFile);document.head.insertBefore(styleElement,document.head.firstChild);return styleElement;}
1313 WebInspector.View.prototype={markAsRoot:function()
1314 {WebInspector.View._assert(!this.element.parentElement,"Attempt to mark as root attached node");this._isRoot=true;},makeLayoutBoundary:function()
1315 {this._isLayoutBoundary=true;},parentView:function()
1316 {return this._parentView;},isShowing:function()
1317 {return this._isShowing;},setHideOnDetach:function()
1318 {this._hideOnDetach=true;},_inNotification:function()
1319 {return!!this._notificationDepth||(this._parentView&&this._parentView._inNotification());},_parentIsShowing:function()
1320 {if(this._isRoot)
1321 return true;return this._parentView&&this._parentView.isShowing();},_callOnVisibleChildren:function(method)
1322 {var copy=this._children.slice();for(var i=0;i<copy.length;++i){if(copy[i]._parentView===this&&copy[i]._visible)
1323 method.call(copy[i]);}},_processWillShow:function()
1324 {this._loadCSSIfNeeded();this._callOnVisibleChildren(this._processWillShow);this._isShowing=true;},_processWasShown:function()
1325 {if(this._inNotification())
1326 return;this.restoreScrollPositions();this._notify(this.wasShown);this._notify(this.onResize);this._callOnVisibleChildren(this._processWasShown);},_processWillHide:function()
1327 {if(this._inNotification())
1328 return;this.storeScrollPositions();this._callOnVisibleChildren(this._processWillHide);this._notify(this.willHide);this._isShowing=false;},_processWasHidden:function()
1329 {this._disableCSSIfNeeded();this._callOnVisibleChildren(this._processWasHidden);},_processOnResize:function()
1330 {if(this._inNotification())
1331 return;if(!this.isShowing())
1332 return;this._notify(this.onResize);this._callOnVisibleChildren(this._processOnResize);},_processDiscardCachedSize:function()
1333 {if(this._isLayoutBoundary){this.element.style.removeProperty("width");this.element.style.removeProperty("height");}
1334 this._callOnVisibleChildren(this._processDiscardCachedSize);},_cacheSize:function()
1335 {this._prepareCacheSize();this._applyCacheSize();},_prepareCacheSize:function()
1336 {if(this._isLayoutBoundary){this._cachedOffsetWidth=this.element.offsetWidth;this._cachedOffsetHeight=this.element.offsetHeight;}
1337 this._callOnVisibleChildren(this._prepareCacheSize);},_applyCacheSize:function()
1338 {if(this._isLayoutBoundary){this.element.style.setProperty("width",this._cachedOffsetWidth+"px");this.element.style.setProperty("height",this._cachedOffsetHeight+"px");delete this._cachedOffsetWidth;delete this._cachedOffsetHeight;}
1339 this._callOnVisibleChildren(this._applyCacheSize);},_notify:function(notification)
1340 {++this._notificationDepth;try{notification.call(this);}finally{--this._notificationDepth;}},wasShown:function()
1341 {},willHide:function()
1342 {},onResize:function()
1343 {},onLayout:function()
1344 {},show:function(parentElement,insertBefore)
1345 {WebInspector.View._assert(parentElement,"Attempt to attach view with no parent element");if(this.element.parentElement!==parentElement){if(this.element.parentElement)
1346 this.detach();var currentParent=parentElement;while(currentParent&&!currentParent.__view)
1347 currentParent=currentParent.parentElement;if(currentParent){this._parentView=currentParent.__view;this._parentView._children.push(this);this._isRoot=false;}else
1348 WebInspector.View._assert(this._isRoot,"Attempt to attach view to orphan node");}else if(this._visible){return;}
1349 this._visible=true;if(this._parentIsShowing())
1350 this._processWillShow();this.element.classList.add("visible");if(this.element.parentElement!==parentElement){WebInspector.View._incrementViewCounter(parentElement,this.element);if(insertBefore)
1351 WebInspector.View._originalInsertBefore.call(parentElement,this.element,insertBefore);else
1352 WebInspector.View._originalAppendChild.call(parentElement,this.element);}
1353 if(this._parentIsShowing()){this._processWasShown();this._cacheSize();}
1354 if(this._parentView&&this._hasNonZeroMinimumSize())
1355 this._parentView.invalidateMinimumSize();},detach:function(overrideHideOnDetach)
1356 {var parentElement=this.element.parentElement;if(!parentElement)
1357 return;if(this._parentIsShowing()){this._processDiscardCachedSize();this._processWillHide();}
1358 if(this._hideOnDetach&&!overrideHideOnDetach){this.element.classList.remove("visible");this._visible=false;if(this._parentIsShowing())
1359 this._processWasHidden();if(this._parentView&&this._hasNonZeroMinimumSize())
1360 this._parentView.invalidateMinimumSize();return;}
1361 WebInspector.View._decrementViewCounter(parentElement,this.element);WebInspector.View._originalRemoveChild.call(parentElement,this.element);this._visible=false;if(this._parentIsShowing())
1362 this._processWasHidden();if(this._parentView){var childIndex=this._parentView._children.indexOf(this);WebInspector.View._assert(childIndex>=0,"Attempt to remove non-child view");this._parentView._children.splice(childIndex,1);var parent=this._parentView;this._parentView=null;if(this._hasNonZeroMinimumSize())
1363 parent.invalidateMinimumSize();}else
1364 WebInspector.View._assert(this._isRoot,"Removing non-root view from DOM");},detachChildViews:function()
1365 {var children=this._children.slice();for(var i=0;i<children.length;++i)
1366 children[i].detach();},elementsToRestoreScrollPositionsFor:function()
1367 {return[this.element];},storeScrollPositions:function()
1368 {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];container._scrollTop=container.scrollTop;container._scrollLeft=container.scrollLeft;}},restoreScrollPositions:function()
1369 {var elements=this.elementsToRestoreScrollPositionsFor();for(var i=0;i<elements.length;++i){var container=elements[i];if(container._scrollTop)
1370 container.scrollTop=container._scrollTop;if(container._scrollLeft)
1371 container.scrollLeft=container._scrollLeft;}},doResize:function()
1372 {if(!this.isShowing())
1373 return;this._processDiscardCachedSize();if(!this._inNotification())
1374 this._callOnVisibleChildren(this._processOnResize);this._cacheSize();},doLayout:function()
1375 {if(!this.isShowing())
1376 return;this._notify(this.onLayout);this.doResize();},registerRequiredCSS:function(cssFile)
1377 {if(window.flattenImports)
1378 cssFile=cssFile.split("/").reverse()[0];this._cssFiles.push(cssFile);},_loadCSSIfNeeded:function()
1379 {for(var i=0;i<this._cssFiles.length;++i){var cssFile=this._cssFiles[i];var viewsWithCSSFile=WebInspector.View._cssFileToVisibleViewCount[cssFile];WebInspector.View._cssFileToVisibleViewCount[cssFile]=(viewsWithCSSFile||0)+1;if(!viewsWithCSSFile)
1380 this._doLoadCSS(cssFile);}},_doLoadCSS:function(cssFile)
1381 {var styleElement=WebInspector.View._cssFileToStyleElement[cssFile];if(styleElement){styleElement.disabled=false;return;}
1382 styleElement=WebInspector.View.createStyleElement(cssFile);WebInspector.View._cssFileToStyleElement[cssFile]=styleElement;},_disableCSSIfNeeded:function()
1383 {var scheduleUnload=!!WebInspector.View._cssUnloadTimer;for(var i=0;i<this._cssFiles.length;++i){var cssFile=this._cssFiles[i];if(!--WebInspector.View._cssFileToVisibleViewCount[cssFile])
1384 scheduleUnload=true;}
1385 function doUnloadCSS()
1386 {delete WebInspector.View._cssUnloadTimer;for(cssFile in WebInspector.View._cssFileToVisibleViewCount){if(WebInspector.View._cssFileToVisibleViewCount.hasOwnProperty(cssFile)&&!WebInspector.View._cssFileToVisibleViewCount[cssFile])
1387 WebInspector.View._cssFileToStyleElement[cssFile].disabled=true;}}
1388 if(scheduleUnload){if(WebInspector.View._cssUnloadTimer)
1389 clearTimeout(WebInspector.View._cssUnloadTimer);WebInspector.View._cssUnloadTimer=setTimeout(doUnloadCSS,WebInspector.View._cssUnloadTimeout)}},printViewHierarchy:function()
1390 {var lines=[];this._collectViewHierarchy("",lines);console.log(lines.join("\n"));},_collectViewHierarchy:function(prefix,lines)
1391 {lines.push(prefix+"["+this.element.className+"]"+(this._children.length?" {":""));for(var i=0;i<this._children.length;++i)
1392 this._children[i]._collectViewHierarchy(prefix+"    ",lines);if(this._children.length)
1393 lines.push(prefix+"}");},defaultFocusedElement:function()
1394 {return this._defaultFocusedElement||this.element;},setDefaultFocusedElement:function(element)
1395 {this._defaultFocusedElement=element;},focus:function()
1396 {var element=this.defaultFocusedElement();if(!element||element.isAncestor(document.activeElement))
1397 return;WebInspector.setCurrentFocusElement(element);},measurePreferredSize:function()
1398 {this._loadCSSIfNeeded();WebInspector.View._originalAppendChild.call(document.body,this.element);this.element.positionAt(0,0);var result=new Size(this.element.offsetWidth,this.element.offsetHeight);this.element.positionAt(undefined,undefined);WebInspector.View._originalRemoveChild.call(document.body,this.element);this._disableCSSIfNeeded();return result;},calculateMinimumSize:function()
1399 {return new Size(0,0);},minimumSize:function()
1400 {if(typeof this._minimumSize!=="undefined")
1401 return this._minimumSize;if(typeof this._cachedMinimumSize==="undefined")
1402 this._cachedMinimumSize=this.calculateMinimumSize();return this._cachedMinimumSize;},setMinimumSize:function(width,height)
1403 {this._minimumSize=new Size(width,height);this.invalidateMinimumSize();},_hasNonZeroMinimumSize:function()
1404 {var size=this.minimumSize();return size.width||size.height;},invalidateMinimumSize:function()
1405 {var cached=this._cachedMinimumSize;delete this._cachedMinimumSize;var actual=this.minimumSize();if(!actual.isEqual(cached)&&this._parentView)
1406 this._parentView.invalidateMinimumSize();else
1407 this.doLayout();},__proto__:WebInspector.Object.prototype}
1408 WebInspector.View._originalAppendChild=Element.prototype.appendChild;WebInspector.View._originalInsertBefore=Element.prototype.insertBefore;WebInspector.View._originalRemoveChild=Element.prototype.removeChild;WebInspector.View._originalRemoveChildren=Element.prototype.removeChildren;WebInspector.View._incrementViewCounter=function(parentElement,childElement)
1409 {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
1410 return;while(parentElement){parentElement.__viewCounter=(parentElement.__viewCounter||0)+count;parentElement=parentElement.parentElement;}}
1411 WebInspector.View._decrementViewCounter=function(parentElement,childElement)
1412 {var count=(childElement.__viewCounter||0)+(childElement.__view?1:0);if(!count)
1413 return;while(parentElement){parentElement.__viewCounter-=count;parentElement=parentElement.parentElement;}}
1414 WebInspector.View._assert=function(condition,message)
1415 {if(!condition){console.trace();throw new Error(message);}}
1416 WebInspector.VBox=function()
1417 {WebInspector.View.call(this);this.element.classList.add("vbox");};WebInspector.VBox.prototype={calculateMinimumSize:function()
1418 {var width=0;var height=0;function updateForChild()
1419 {var size=this.minimumSize();width=Math.max(width,size.width);height+=size.height;}
1420 this._callOnVisibleChildren(updateForChild);return new Size(width,height);},__proto__:WebInspector.View.prototype};WebInspector.HBox=function()
1421 {WebInspector.View.call(this);this.element.classList.add("hbox");};WebInspector.HBox.prototype={calculateMinimumSize:function()
1422 {var width=0;var height=0;function updateForChild()
1423 {var size=this.minimumSize();width+=size.width;height=Math.max(height,size.height);}
1424 this._callOnVisibleChildren(updateForChild);return new Size(width,height);},__proto__:WebInspector.View.prototype};WebInspector.VBoxWithResizeCallback=function(resizeCallback)
1425 {WebInspector.VBox.call(this);this._resizeCallback=resizeCallback;}
1426 WebInspector.VBoxWithResizeCallback.prototype={onResize:function()
1427 {this._resizeCallback();},__proto__:WebInspector.VBox.prototype}
1428 Element.prototype.appendChild=function(child)
1429 {WebInspector.View._assert(!child.__view||child.parentElement===this,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalAppendChild.call(this,child);}
1430 Element.prototype.insertBefore=function(child,anchor)
1431 {WebInspector.View._assert(!child.__view||child.parentElement===this,"Attempt to add view via regular DOM operation.");return WebInspector.View._originalInsertBefore.call(this,child,anchor);}
1432 Element.prototype.removeChild=function(child)
1433 {WebInspector.View._assert(!child.__viewCounter&&!child.__view,"Attempt to remove element containing view via regular DOM operation");return WebInspector.View._originalRemoveChild.call(this,child);}
1434 Element.prototype.removeChildren=function()
1435 {WebInspector.View._assert(!this.__viewCounter,"Attempt to remove element containing view via regular DOM operation");WebInspector.View._originalRemoveChildren.call(this);}
1436 WebInspector.installDragHandle=function(element,elementDragStart,elementDrag,elementDragEnd,cursor,hoverCursor)
1437 {element.addEventListener("mousedown",WebInspector.elementDragStart.bind(WebInspector,elementDragStart,elementDrag,elementDragEnd,cursor),false);if(hoverCursor!==null)
1438 element.style.cursor=hoverCursor||cursor;}
1439 WebInspector.elementDragStart=function(elementDragStart,elementDrag,elementDragEnd,cursor,event)
1440 {if(event.button||(WebInspector.isMac()&&event.ctrlKey))
1441 return;if(WebInspector._elementDraggingEventListener)
1442 return;if(elementDragStart&&!elementDragStart((event)))
1443 return;if(WebInspector._elementDraggingGlassPane){WebInspector._elementDraggingGlassPane.dispose();delete WebInspector._elementDraggingGlassPane;}
1444 var targetDocument=event.target.ownerDocument;WebInspector._elementDraggingEventListener=elementDrag;WebInspector._elementEndDraggingEventListener=elementDragEnd;WebInspector._mouseOutWhileDraggingTargetDocument=targetDocument;targetDocument.addEventListener("mousemove",WebInspector._elementDragMove,true);targetDocument.addEventListener("mouseup",WebInspector._elementDragEnd,true);targetDocument.addEventListener("mouseout",WebInspector._mouseOutWhileDragging,true);targetDocument.body.style.cursor=cursor;event.preventDefault();}
1445 WebInspector._mouseOutWhileDragging=function()
1446 {WebInspector._unregisterMouseOutWhileDragging();WebInspector._elementDraggingGlassPane=new WebInspector.GlassPane();}
1447 WebInspector._unregisterMouseOutWhileDragging=function()
1448 {if(!WebInspector._mouseOutWhileDraggingTargetDocument)
1449 return;WebInspector._mouseOutWhileDraggingTargetDocument.removeEventListener("mouseout",WebInspector._mouseOutWhileDragging,true);delete WebInspector._mouseOutWhileDraggingTargetDocument;}
1450 WebInspector._elementDragMove=function(event)
1451 {if(WebInspector._elementDraggingEventListener((event)))
1452 WebInspector._cancelDragEvents(event);}
1453 WebInspector._cancelDragEvents=function(event)
1454 {var targetDocument=event.target.ownerDocument;targetDocument.removeEventListener("mousemove",WebInspector._elementDragMove,true);targetDocument.removeEventListener("mouseup",WebInspector._elementDragEnd,true);WebInspector._unregisterMouseOutWhileDragging();targetDocument.body.style.removeProperty("cursor");if(WebInspector._elementDraggingGlassPane)
1455 WebInspector._elementDraggingGlassPane.dispose();delete WebInspector._elementDraggingGlassPane;delete WebInspector._elementDraggingEventListener;delete WebInspector._elementEndDraggingEventListener;}
1456 WebInspector._elementDragEnd=function(event)
1457 {var elementDragEnd=WebInspector._elementEndDraggingEventListener;WebInspector._cancelDragEvents((event));event.preventDefault();if(elementDragEnd)
1458 elementDragEnd((event));}
1459 WebInspector.GlassPane=function()
1460 {this.element=document.createElement("div");this.element.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;";this.element.id="glass-pane";document.body.appendChild(this.element);WebInspector._glassPane=this;}
1461 WebInspector.GlassPane.prototype={dispose:function()
1462 {delete WebInspector._glassPane;if(WebInspector.HelpScreen.isVisible())
1463 WebInspector.HelpScreen.focus();else
1464 WebInspector.inspectorView.focus();this.element.remove();}}
1465 WebInspector.isBeingEdited=function(element)
1466 {if(element.classList.contains("text-prompt")||element.nodeName==="INPUT"||element.nodeName==="TEXTAREA")
1467 return true;if(!WebInspector.__editingCount)
1468 return false;while(element){if(element.__editing)
1469 return true;element=element.parentElement;}
1470 return false;}
1471 WebInspector.markBeingEdited=function(element,value)
1472 {if(value){if(element.__editing)
1473 return false;element.classList.add("being-edited");element.__editing=true;WebInspector.__editingCount=(WebInspector.__editingCount||0)+1;}else{if(!element.__editing)
1474 return false;element.classList.remove("being-edited");delete element.__editing;--WebInspector.__editingCount;}
1475 return true;}
1476 WebInspector.CSSNumberRegex=/^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;WebInspector.StyleValueDelimiters=" \xA0\t\n\"':;,/()";WebInspector._valueModificationDirection=function(event)
1477 {var direction=null;if(event.type==="mousewheel"){if(event.wheelDeltaY>0)
1478 direction="Up";else if(event.wheelDeltaY<0)
1479 direction="Down";}else{if(event.keyIdentifier==="Up"||event.keyIdentifier==="PageUp")
1480 direction="Up";else if(event.keyIdentifier==="Down"||event.keyIdentifier==="PageDown")
1481 direction="Down";}
1482 return direction;}
1483 WebInspector._modifiedHexValue=function(hexString,event)
1484 {var direction=WebInspector._valueModificationDirection(event);if(!direction)
1485 return hexString;var number=parseInt(hexString,16);if(isNaN(number)||!isFinite(number))
1486 return hexString;var maxValue=Math.pow(16,hexString.length)-1;var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var delta;if(arrowKeyOrMouseWheelEvent)
1487 delta=(direction==="Up")?1:-1;else
1488 delta=(event.keyIdentifier==="PageUp")?16:-16;if(event.shiftKey)
1489 delta*=16;var result=number+delta;if(result<0)
1490 result=0;else if(result>maxValue)
1491 return hexString;var resultString=result.toString(16).toUpperCase();for(var i=0,lengthDelta=hexString.length-resultString.length;i<lengthDelta;++i)
1492 resultString="0"+resultString;return resultString;}
1493 WebInspector._modifiedFloatNumber=function(number,event)
1494 {var direction=WebInspector._valueModificationDirection(event);if(!direction)
1495 return number;var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var changeAmount=1;if(event.shiftKey&&!arrowKeyOrMouseWheelEvent)
1496 changeAmount=100;else if(event.shiftKey||!arrowKeyOrMouseWheelEvent)
1497 changeAmount=10;else if(event.altKey)
1498 changeAmount=0.1;if(direction==="Down")
1499 changeAmount*=-1;var result=Number((number+changeAmount).toFixed(6));if(!String(result).match(WebInspector.CSSNumberRegex))
1500 return null;return result;}
1501 WebInspector.handleElementValueModifications=function(event,element,finishHandler,suggestionHandler,customNumberHandler)
1502 {var arrowKeyOrMouseWheelEvent=(event.keyIdentifier==="Up"||event.keyIdentifier==="Down"||event.type==="mousewheel");var pageKeyPressed=(event.keyIdentifier==="PageUp"||event.keyIdentifier==="PageDown");if(!arrowKeyOrMouseWheelEvent&&!pageKeyPressed)
1503 return false;var selection=window.getSelection();if(!selection.rangeCount)
1504 return false;var selectionRange=selection.getRangeAt(0);if(!selectionRange.commonAncestorContainer.isSelfOrDescendant(element))
1505 return false;var originalValue=element.textContent;var wordRange=selectionRange.startContainer.rangeOfWord(selectionRange.startOffset,WebInspector.StyleValueDelimiters,element);var wordString=wordRange.toString();if(suggestionHandler&&suggestionHandler(wordString))
1506 return false;var replacementString;var prefix,suffix,number;var matches;matches=/(.*#)([\da-fA-F]+)(.*)/.exec(wordString);if(matches&&matches.length){prefix=matches[1];suffix=matches[3];number=WebInspector._modifiedHexValue(matches[2],event);if(customNumberHandler)
1507 number=customNumberHandler(number);replacementString=prefix+number+suffix;}else{matches=/(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/.exec(wordString);if(matches&&matches.length){prefix=matches[1];suffix=matches[3];number=WebInspector._modifiedFloatNumber(parseFloat(matches[2]),event);if(number===null)
1508 return false;if(customNumberHandler)
1509 number=customNumberHandler(number);replacementString=prefix+number+suffix;}}
1510 if(replacementString){var replacementTextNode=document.createTextNode(replacementString);wordRange.deleteContents();wordRange.insertNode(replacementTextNode);var finalSelectionRange=document.createRange();finalSelectionRange.setStart(replacementTextNode,0);finalSelectionRange.setEnd(replacementTextNode,replacementString.length);selection.removeAllRanges();selection.addRange(finalSelectionRange);event.handled=true;event.preventDefault();if(finishHandler)
1511 finishHandler(originalValue,replacementString);return true;}
1512 return false;}
1513 Number.preciseMillisToString=function(ms,precision)
1514 {precision=precision||0;var format="%."+precision+"f\u2009ms";return WebInspector.UIString(format,ms);}
1515 Number.millisToString=function(ms,higherResolution)
1516 {if(!isFinite(ms))
1517 return"-";if(ms===0)
1518 return"0";if(higherResolution&&ms<1000)
1519 return WebInspector.UIString("%.3f\u2009ms",ms);else if(ms<1000)
1520 return WebInspector.UIString("%.0f\u2009ms",ms);var seconds=ms/1000;if(seconds<60)
1521 return WebInspector.UIString("%.2f\u2009s",seconds);var minutes=seconds/60;if(minutes<60)
1522 return WebInspector.UIString("%.1f\u2009min",minutes);var hours=minutes/60;if(hours<24)
1523 return WebInspector.UIString("%.1f\u2009hrs",hours);var days=hours/24;return WebInspector.UIString("%.1f\u2009days",days);}
1524 Number.secondsToString=function(seconds,higherResolution)
1525 {if(!isFinite(seconds))
1526 return"-";return Number.millisToString(seconds*1000,higherResolution);}
1527 Number.bytesToString=function(bytes)
1528 {if(bytes<1024)
1529 return WebInspector.UIString("%.0f\u2009B",bytes);var kilobytes=bytes/1024;if(kilobytes<100)
1530 return WebInspector.UIString("%.1f\u2009KB",kilobytes);if(kilobytes<1024)
1531 return WebInspector.UIString("%.0f\u2009KB",kilobytes);var megabytes=kilobytes/1024;if(megabytes<100)
1532 return WebInspector.UIString("%.1f\u2009MB",megabytes);else
1533 return WebInspector.UIString("%.0f\u2009MB",megabytes);}
1534 Number.withThousandsSeparator=function(num)
1535 {var str=num+"";var re=/(\d+)(\d{3})/;while(str.match(re))
1536 str=str.replace(re,"$1\u2009$2");return str;}
1537 WebInspector.useLowerCaseMenuTitles=function()
1538 {return WebInspector.platform()==="windows";}
1539 WebInspector.formatLocalized=function(format,substitutions,formatters,initialValue,append)
1540 {return String.format(WebInspector.UIString(format),substitutions,formatters,initialValue,append);}
1541 WebInspector.openLinkExternallyLabel=function()
1542 {return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open link in new tab":"Open Link in New Tab");}
1543 WebInspector.copyLinkAddressLabel=function()
1544 {return WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy link address":"Copy Link Address");}
1545 WebInspector.installPortStyles=function()
1546 {var platform=WebInspector.platform();document.body.classList.add("platform-"+platform);var flavor=WebInspector.platformFlavor();if(flavor)
1547 document.body.classList.add("platform-"+flavor);var port=WebInspector.port();document.body.classList.add("port-"+port);}
1548 WebInspector._windowFocused=function(event)
1549 {if(event.target.document.nodeType===Node.DOCUMENT_NODE)
1550 document.body.classList.remove("inactive");}
1551 WebInspector._windowBlurred=function(event)
1552 {if(event.target.document.nodeType===Node.DOCUMENT_NODE)
1553 document.body.classList.add("inactive");}
1554 WebInspector.previousFocusElement=function()
1555 {return WebInspector._previousFocusElement;}
1556 WebInspector.currentFocusElement=function()
1557 {return WebInspector._currentFocusElement;}
1558 WebInspector._focusChanged=function(event)
1559 {WebInspector.setCurrentFocusElement(event.target);}
1560 WebInspector._documentBlurred=function(event)
1561 {if(!event.relatedTarget&&document.activeElement===document.body)
1562 WebInspector.setCurrentFocusElement(null);}
1563 WebInspector._textInputTypes=["text","search","tel","url","email","password"].keySet();WebInspector._isTextEditingElement=function(element)
1564 {if(element instanceof HTMLInputElement)
1565 return element.type in WebInspector._textInputTypes;if(element instanceof HTMLTextAreaElement)
1566 return true;return false;}
1567 WebInspector.setCurrentFocusElement=function(x)
1568 {if(WebInspector._glassPane&&x&&!WebInspector._glassPane.element.isAncestor(x))
1569 return;if(WebInspector._currentFocusElement!==x)
1570 WebInspector._previousFocusElement=WebInspector._currentFocusElement;WebInspector._currentFocusElement=x;if(WebInspector._currentFocusElement){WebInspector._currentFocusElement.focus();var selection=window.getSelection();if(!WebInspector._isTextEditingElement(WebInspector._currentFocusElement)&&selection.isCollapsed&&!WebInspector._currentFocusElement.isInsertionCaretInside()){var selectionRange=WebInspector._currentFocusElement.ownerDocument.createRange();selectionRange.setStart(WebInspector._currentFocusElement,0);selectionRange.setEnd(WebInspector._currentFocusElement,0);selection.removeAllRanges();selection.addRange(selectionRange);}}else if(WebInspector._previousFocusElement)
1571 WebInspector._previousFocusElement.blur();}
1572 WebInspector.restoreFocusFromElement=function(element)
1573 {if(element&&element.isSelfOrAncestor(WebInspector.currentFocusElement()))
1574 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());}
1575 WebInspector.setToolbarColors=function(backgroundColor,color)
1576 {if(!WebInspector._themeStyleElement){WebInspector._themeStyleElement=document.createElement("style");document.head.appendChild(WebInspector._themeStyleElement);}
1577 var parsedColor=WebInspector.Color.parse(color);var shadowColor=parsedColor?parsedColor.invert().setAlpha(0.33).toString(WebInspector.Color.Format.RGBA):"white";var prefix=WebInspector.isMac()?"body:not(.undocked)":"";WebInspector._themeStyleElement.textContent=String.sprintf("%s .toolbar-background {\
1578                  background-image: none !important;\
1579                  background-color: %s !important;\
1580                  color: %s !important;\
1581              }",prefix,backgroundColor,color)+
1582 String.sprintf("%s .toolbar-background button.status-bar-item .glyph, %s .toolbar-background button.status-bar-item .long-click-glyph {\
1583                  background-color: %s;\
1584              }",prefix,prefix,color)+
1585 String.sprintf("%s .toolbar-background button.status-bar-item .glyph.shadow, %s .toolbar-background button.status-bar-item .long-click-glyph.shadow {\
1586                  background-color: %s;\
1587              }",prefix,prefix,shadowColor);}
1588 WebInspector.resetToolbarColors=function()
1589 {if(WebInspector._themeStyleElement)
1590 WebInspector._themeStyleElement.textContent="";}
1591 WebInspector.highlightSearchResult=function(element,offset,length,domChanges)
1592 {var result=WebInspector.highlightSearchResults(element,[new WebInspector.SourceRange(offset,length)],domChanges);return result.length?result[0]:null;}
1593 WebInspector.highlightSearchResults=function(element,resultRanges,changes)
1594 {return WebInspector.highlightRangesWithStyleClass(element,resultRanges,"highlighted-search-result",changes);}
1595 WebInspector.runCSSAnimationOnce=function(element,className)
1596 {function animationEndCallback()
1597 {element.classList.remove(className);element.removeEventListener("animationend",animationEndCallback,false);}
1598 if(element.classList.contains(className))
1599 element.classList.remove(className);element.addEventListener("animationend",animationEndCallback,false);element.classList.add(className);}
1600 WebInspector.highlightRangesWithStyleClass=function(element,resultRanges,styleClass,changes)
1601 {changes=changes||[];var highlightNodes=[];var lineText=element.textContent;var ownerDocument=element.ownerDocument;var textNodeSnapshot=ownerDocument.evaluate(".//text()",element,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var snapshotLength=textNodeSnapshot.snapshotLength;if(snapshotLength===0)
1602 return highlightNodes;var nodeRanges=[];var rangeEndOffset=0;for(var i=0;i<snapshotLength;++i){var range={};range.offset=rangeEndOffset;range.length=textNodeSnapshot.snapshotItem(i).textContent.length;rangeEndOffset=range.offset+range.length;nodeRanges.push(range);}
1603 var startIndex=0;for(var i=0;i<resultRanges.length;++i){var startOffset=resultRanges[i].offset;var endOffset=startOffset+resultRanges[i].length;while(startIndex<snapshotLength&&nodeRanges[startIndex].offset+nodeRanges[startIndex].length<=startOffset)
1604 startIndex++;var endIndex=startIndex;while(endIndex<snapshotLength&&nodeRanges[endIndex].offset+nodeRanges[endIndex].length<endOffset)
1605 endIndex++;if(endIndex===snapshotLength)
1606 break;var highlightNode=ownerDocument.createElement("span");highlightNode.className=styleClass;highlightNode.textContent=lineText.substring(startOffset,endOffset);var lastTextNode=textNodeSnapshot.snapshotItem(endIndex);var lastText=lastTextNode.textContent;lastTextNode.textContent=lastText.substring(endOffset-nodeRanges[endIndex].offset);changes.push({node:lastTextNode,type:"changed",oldText:lastText,newText:lastTextNode.textContent});if(startIndex===endIndex){lastTextNode.parentElement.insertBefore(highlightNode,lastTextNode);changes.push({node:highlightNode,type:"added",nextSibling:lastTextNode,parent:lastTextNode.parentElement});highlightNodes.push(highlightNode);var prefixNode=ownerDocument.createTextNode(lastText.substring(0,startOffset-nodeRanges[startIndex].offset));lastTextNode.parentElement.insertBefore(prefixNode,highlightNode);changes.push({node:prefixNode,type:"added",nextSibling:highlightNode,parent:lastTextNode.parentElement});}else{var firstTextNode=textNodeSnapshot.snapshotItem(startIndex);var firstText=firstTextNode.textContent;var anchorElement=firstTextNode.nextSibling;firstTextNode.parentElement.insertBefore(highlightNode,anchorElement);changes.push({node:highlightNode,type:"added",nextSibling:anchorElement,parent:firstTextNode.parentElement});highlightNodes.push(highlightNode);firstTextNode.textContent=firstText.substring(0,startOffset-nodeRanges[startIndex].offset);changes.push({node:firstTextNode,type:"changed",oldText:firstText,newText:firstTextNode.textContent});for(var j=startIndex+1;j<endIndex;j++){var textNode=textNodeSnapshot.snapshotItem(j);var text=textNode.textContent;textNode.textContent="";changes.push({node:textNode,type:"changed",oldText:text,newText:textNode.textContent});}}
1607 startIndex=endIndex;nodeRanges[startIndex].offset=endOffset;nodeRanges[startIndex].length=lastTextNode.textContent.length;}
1608 return highlightNodes;}
1609 WebInspector.applyDomChanges=function(domChanges)
1610 {for(var i=0,size=domChanges.length;i<size;++i){var entry=domChanges[i];switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextSibling);break;case"changed":entry.node.textContent=entry.newText;break;}}}
1611 WebInspector.revertDomChanges=function(domChanges)
1612 {for(var i=domChanges.length-1;i>=0;--i){var entry=domChanges[i];switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.node.textContent=entry.oldText;break;}}}
1613 WebInspector._coalescingLevel=0;WebInspector.startBatchUpdate=function()
1614 {if(!WebInspector._coalescingLevel)
1615 WebInspector._postUpdateHandlers=new Map();WebInspector._coalescingLevel++;}
1616 WebInspector.endBatchUpdate=function()
1617 {if(--WebInspector._coalescingLevel)
1618 return;var handlers=WebInspector._postUpdateHandlers;delete WebInspector._postUpdateHandlers;window.requestAnimationFrame(function(){if(WebInspector._coalescingLevel)
1619 return;var keys=handlers.keys();for(var i=0;i<keys.length;++i){var object=keys[i];var methods=handlers.get(object).keys();for(var j=0;j<methods.length;++j)
1620 methods[j].call(object);}});}
1621 WebInspector.invokeOnceAfterBatchUpdate=function(object,method)
1622 {if(!WebInspector._coalescingLevel){window.requestAnimationFrame(function(){if(!WebInspector._coalescingLevel)
1623 method.call(object);});return;}
1624 var methods=WebInspector._postUpdateHandlers.get(object);if(!methods){methods=new Map();WebInspector._postUpdateHandlers.put(object,methods);}
1625 methods.put(method);};(function(){function windowLoaded()
1626 {window.addEventListener("focus",WebInspector._windowFocused,false);window.addEventListener("blur",WebInspector._windowBlurred,false);document.addEventListener("focus",WebInspector._focusChanged,true);document.addEventListener("blur",WebInspector._documentBlurred,true);window.removeEventListener("DOMContentLoaded",windowLoaded,false);}
1627 window.addEventListener("DOMContentLoaded",windowLoaded,false);})();WebInspector.HelpScreen=function(title)
1628 {WebInspector.VBox.call(this);this.markAsRoot();this.registerRequiredCSS("helpScreen.css");this.element.classList.add("help-window-outer");this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this.element.tabIndex=0;if(title){var mainWindow=this.element.createChild("div","help-window-main");var captionWindow=mainWindow.createChild("div","help-window-caption");captionWindow.appendChild(this._createCloseButton());this.contentElement=mainWindow.createChild("div","help-content");captionWindow.createChild("h1","help-window-title").textContent=title;}}
1629 WebInspector.HelpScreen._visibleScreen=null;WebInspector.HelpScreen.isVisible=function()
1630 {return!!WebInspector.HelpScreen._visibleScreen;}
1631 WebInspector.HelpScreen.focus=function()
1632 {WebInspector.HelpScreen._visibleScreen.element.focus();}
1633 WebInspector.HelpScreen.prototype={_createCloseButton:function()
1634 {var closeButton=document.createElement("div");closeButton.className="help-close-button close-button-gray";closeButton.addEventListener("click",this.hide.bind(this),false);return closeButton;},showModal:function()
1635 {var visibleHelpScreen=WebInspector.HelpScreen._visibleScreen;if(visibleHelpScreen===this)
1636 return;if(visibleHelpScreen)
1637 visibleHelpScreen.hide();WebInspector.HelpScreen._visibleScreen=this;this.show(WebInspector.inspectorView.element);this.focus();},hide:function()
1638 {if(!this.isShowing())
1639 return;WebInspector.HelpScreen._visibleScreen=null;WebInspector.restoreFocusFromElement(this.element);this.detach();},isClosingKey:function(keyCode)
1640 {return[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,WebInspector.KeyboardShortcut.Keys.Space.code,].indexOf(keyCode)>=0;},_onKeyDown:function(event)
1641 {if(this.isShowing()&&this.isClosingKey(event.keyCode)){this.hide();event.consume();}},__proto__:WebInspector.VBox.prototype}
1642 WebInspector.RemoteDebuggingTerminatedScreen=function(reason)
1643 {WebInspector.HelpScreen.call(this,WebInspector.UIString("Detached from the target"));var p=this.contentElement.createChild("p");p.classList.add("help-section");p.createChild("span").textContent=WebInspector.UIString("Remote debugging has been terminated with reason: ");p.createChild("span","error-message").textContent=reason;p.createChild("br");p.createChild("span").textContent=WebInspector.UIString("Please re-attach to the new target.");}
1644 WebInspector.RemoteDebuggingTerminatedScreen.prototype={__proto__:WebInspector.HelpScreen.prototype}
1645 WebInspector.WorkerTerminatedScreen=function()
1646 {WebInspector.HelpScreen.call(this,WebInspector.UIString("Inspected worker terminated"));var p=this.contentElement.createChild("p");p.classList.add("help-section");p.textContent=WebInspector.UIString("Inspected worker has terminated. Once it restarts we will attach to it automatically.");}
1647 WebInspector.WorkerTerminatedScreen.prototype={__proto__:WebInspector.HelpScreen.prototype}
1648 if(!window.InspectorFrontendHost){WebInspector.InspectorFrontendHostStub=function()
1649 {this.isStub=true;}
1650 WebInspector.InspectorFrontendHostStub.prototype={getSelectionBackgroundColor:function()
1651 {return"#6e86ff";},getSelectionForegroundColor:function()
1652 {return"#ffffff";},platform:function()
1653 {var match=navigator.userAgent.match(/Windows NT/);if(match)
1654 return"windows";match=navigator.userAgent.match(/Mac OS X/);if(match)
1655 return"mac";return"linux";},port:function()
1656 {return"unknown";},bringToFront:function()
1657 {this._windowVisible=true;},closeWindow:function()
1658 {this._windowVisible=false;},setIsDocked:function(isDocked)
1659 {},setContentsResizingStrategy:function(insets,minSize)
1660 {},inspectElementCompleted:function()
1661 {},moveWindowBy:function(x,y)
1662 {},setInjectedScriptForOrigin:function(origin,script)
1663 {},inspectedURLChanged:function(url)
1664 {document.title=WebInspector.UIString(Preferences.applicationTitle,url);},copyText:function(text)
1665 {WebInspector.console.log("Clipboard is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);},openInNewTab:function(url)
1666 {window.open(url,"_blank");},save:function(url,content,forceSaveAs)
1667 {WebInspector.console.log("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);WebInspector.fileManager.canceledSaveURL(url);},append:function(url,content)
1668 {WebInspector.console.log("Saving files is not enabled in hosted mode. Please inspect using chrome://inspect",WebInspector.ConsoleMessage.MessageLevel.Error,true);},sendMessageToBackend:function(message)
1669 {},sendMessageToEmbedder:function(message)
1670 {},recordActionTaken:function(actionCode)
1671 {},recordPanelShown:function(panelCode)
1672 {},requestFileSystems:function()
1673 {},addFileSystem:function()
1674 {},removeFileSystem:function(fileSystemPath)
1675 {},isolatedFileSystem:function(fileSystemId,registeredName)
1676 {return null;},upgradeDraggedFileSystemPermissions:function(domFileSystem)
1677 {},indexPath:function(requestId,fileSystemPath)
1678 {},stopIndexing:function(requestId)
1679 {},searchInPath:function(requestId,fileSystemPath,query)
1680 {},setZoomFactor:function(zoom)
1681 {},zoomFactor:function()
1682 {return 1;},zoomIn:function()
1683 {},zoomOut:function()
1684 {},resetZoom:function()
1685 {},isUnderTest:function()
1686 {return false;}}
1687 InspectorFrontendHost=new WebInspector.InspectorFrontendHostStub();}
1688 WebInspector.FileManager=function()
1689 {this._saveCallbacks={};}
1690 WebInspector.FileManager.EventTypes={SavedURL:"SavedURL",AppendedToURL:"AppendedToURL"}
1691 WebInspector.FileManager.prototype={canSave:function()
1692 {return true;},save:function(url,content,forceSaveAs,callback)
1693 {var savedURLs=WebInspector.settings.savedURLs.get();delete savedURLs[url];WebInspector.settings.savedURLs.set(savedURLs);this._saveCallbacks[url]=callback||null;InspectorFrontendHost.save(url,content,forceSaveAs);},savedURL:function(url)
1694 {var savedURLs=WebInspector.settings.savedURLs.get();savedURLs[url]=true;WebInspector.settings.savedURLs.set(savedURLs);this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.SavedURL,url);this._invokeSaveCallback(url,true);},_invokeSaveCallback:function(url,accepted)
1695 {var callback=this._saveCallbacks[url];delete this._saveCallbacks[url];if(callback)
1696 callback(accepted);},canceledSaveURL:function(url)
1697 {this._invokeSaveCallback(url,false);},isURLSaved:function(url)
1698 {var savedURLs=WebInspector.settings.savedURLs.get();return savedURLs[url];},append:function(url,content)
1699 {InspectorFrontendHost.append(url,content);},close:function(url)
1700 {},appendedToURL:function(url)
1701 {this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL,url);},__proto__:WebInspector.Object.prototype}
1702 WebInspector.fileManager=new WebInspector.FileManager();WebInspector.Checkbox=function(label,className,tooltip)
1703 {this.element=document.createElement('label');this._inputElement=document.createElement('input');this._inputElement.type="checkbox";this.element.className=className;this.element.appendChild(this._inputElement);this.element.appendChild(document.createTextNode(label));if(tooltip)
1704 this.element.title=tooltip;}
1705 WebInspector.Checkbox.prototype={set checked(checked)
1706 {this._inputElement.checked=checked;},get checked()
1707 {return this._inputElement.checked;},addEventListener:function(listener)
1708 {function listenerWrapper(event)
1709 {if(listener)
1710 listener(event);event.consume();return true;}
1711 this._inputElement.addEventListener("click",listenerWrapper,false);this.element.addEventListener("click",listenerWrapper,false);}}
1712 WebInspector.ContextMenuItem=function(topLevelMenu,type,label,disabled,checked)
1713 {this._type=type;this._label=label;this._disabled=disabled;this._checked=checked;this._contextMenu=topLevelMenu;if(type==="item"||type==="checkbox")
1714 this._id=topLevelMenu.nextId();}
1715 WebInspector.ContextMenuItem.prototype={id:function()
1716 {return this._id;},type:function()
1717 {return this._type;},isEnabled:function()
1718 {return!this._disabled;},setEnabled:function(enabled)
1719 {this._disabled=!enabled;},_buildDescriptor:function()
1720 {switch(this._type){case"item":return{type:"item",id:this._id,label:this._label,enabled:!this._disabled};case"separator":return{type:"separator"};case"checkbox":return{type:"checkbox",id:this._id,label:this._label,checked:!!this._checked,enabled:!this._disabled};}}}
1721 WebInspector.ContextSubMenuItem=function(topLevelMenu,label,disabled)
1722 {WebInspector.ContextMenuItem.call(this,topLevelMenu,"subMenu",label,disabled);this._items=[];}
1723 WebInspector.ContextSubMenuItem.prototype={appendItem:function(label,handler,disabled)
1724 {var item=new WebInspector.ContextMenuItem(this._contextMenu,"item",label,disabled);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSubMenuItem:function(label,disabled)
1725 {var item=new WebInspector.ContextSubMenuItem(this._contextMenu,label,disabled);this._pushItem(item);return item;},appendCheckboxItem:function(label,handler,checked,disabled)
1726 {var item=new WebInspector.ContextMenuItem(this._contextMenu,"checkbox",label,disabled,checked);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;},appendSeparator:function()
1727 {if(this._items.length)
1728 this._pendingSeparator=true;},_pushItem:function(item)
1729 {if(this._pendingSeparator){this._items.push(new WebInspector.ContextMenuItem(this._contextMenu,"separator"));delete this._pendingSeparator;}
1730 this._items.push(item);},isEmpty:function()
1731 {return!this._items.length;},_buildDescriptor:function()
1732 {var result={type:"subMenu",label:this._label,enabled:!this._disabled,subItems:[]};for(var i=0;i<this._items.length;++i)
1733 result.subItems.push(this._items[i]._buildDescriptor());return result;},__proto__:WebInspector.ContextMenuItem.prototype}
1734 WebInspector.ContextMenu=function(event){WebInspector.ContextSubMenuItem.call(this,this,"");this._event=event;this._handlers={};this._id=0;}
1735 WebInspector.ContextMenu.setUseSoftMenu=function(useSoftMenu)
1736 {WebInspector.ContextMenu._useSoftMenu=useSoftMenu;}
1737 WebInspector.ContextMenu.prototype={nextId:function()
1738 {return this._id++;},show:function()
1739 {var menuObject=this._buildDescriptor();if(menuObject.length){WebInspector._contextMenu=this;if(WebInspector.ContextMenu._useSoftMenu){var softMenu=new WebInspector.SoftContextMenu(menuObject);softMenu.show(this._event);}else{InspectorFrontendHost.showContextMenu(this._event,menuObject);}
1740 this._event.consume();}},_setHandler:function(id,handler)
1741 {if(handler)
1742 this._handlers[id]=handler;},_buildDescriptor:function()
1743 {var result=[];for(var i=0;i<this._items.length;++i)
1744 result.push(this._items[i]._buildDescriptor());return result;},_itemSelected:function(id)
1745 {if(this._handlers[id])
1746 this._handlers[id].call(this);},appendApplicableItems:function(target)
1747 {WebInspector.moduleManager.extensions(WebInspector.ContextMenu.Provider,target).forEach(processProviders.bind(this));function processProviders(extension)
1748 {var provider=(extension.instance());this.appendSeparator();provider.appendApplicableItems(this._event,this,target);this.appendSeparator();}},__proto__:WebInspector.ContextSubMenuItem.prototype}
1749 WebInspector.ContextMenu.Provider=function(){}
1750 WebInspector.ContextMenu.Provider.prototype={appendApplicableItems:function(event,contextMenu,target){}}
1751 WebInspector.contextMenuItemSelected=function(id)
1752 {if(WebInspector._contextMenu)
1753 WebInspector._contextMenu._itemSelected(id);}
1754 WebInspector.contextMenuCleared=function()
1755 {}
1756 WebInspector.SoftContextMenu=function(items,parentMenu)
1757 {this._items=items;this._parentMenu=parentMenu;}
1758 WebInspector.SoftContextMenu.prototype={show:function(event)
1759 {this._x=event.x;this._y=event.y;this._time=new Date().getTime();var absoluteX=event.pageX;var absoluteY=event.pageY;var targetElement=event.target;while(targetElement&&window!==targetElement.ownerDocument.defaultView){var frameElement=targetElement.ownerDocument.defaultView.frameElement;absoluteY+=frameElement.totalOffsetTop();absoluteX+=frameElement.totalOffsetLeft();targetElement=frameElement;}
1760 var targetRect;this._contextMenuElement=document.createElement("div");this._contextMenuElement.className="soft-context-menu";this._contextMenuElement.tabIndex=0;this._contextMenuElement.style.top=absoluteY+"px";this._contextMenuElement.style.left=absoluteX+"px";this._contextMenuElement.addEventListener("mouseup",consumeEvent,false);this._contextMenuElement.addEventListener("keydown",this._menuKeyDown.bind(this),false);for(var i=0;i<this._items.length;++i)
1761 this._contextMenuElement.appendChild(this._createMenuItem(this._items[i]));if(!this._parentMenu){this._glassPaneElement=document.createElement("div");this._glassPaneElement.className="soft-context-menu-glass-pane";this._glassPaneElement.tabIndex=0;this._glassPaneElement.addEventListener("mouseup",this._glassPaneMouseUp.bind(this),false);this._glassPaneElement.appendChild(this._contextMenuElement);document.body.appendChild(this._glassPaneElement);this._focus();}else
1762 this._parentMenu._parentGlassPaneElement().appendChild(this._contextMenuElement);if(document.body.offsetWidth<this._contextMenuElement.offsetLeft+this._contextMenuElement.offsetWidth)
1763 this._contextMenuElement.style.left=(absoluteX-this._contextMenuElement.offsetWidth)+"px";if(document.body.offsetHeight<this._contextMenuElement.offsetTop+this._contextMenuElement.offsetHeight)
1764 this._contextMenuElement.style.top=(document.body.offsetHeight-this._contextMenuElement.offsetHeight)+"px";event.consume(true);},_parentGlassPaneElement:function()
1765 {if(this._glassPaneElement)
1766 return this._glassPaneElement;if(this._parentMenu)
1767 return this._parentMenu._parentGlassPaneElement();return null;},_createMenuItem:function(item)
1768 {if(item.type==="separator")
1769 return this._createSeparator();if(item.type==="subMenu")
1770 return this._createSubMenu(item);var menuItemElement=document.createElement("div");menuItemElement.className="soft-context-menu-item";var checkMarkElement=document.createElement("span");checkMarkElement.textContent="\u2713 ";checkMarkElement.className="soft-context-menu-item-checkmark";if(!item.checked)
1771 checkMarkElement.style.opacity="0";menuItemElement.appendChild(checkMarkElement);menuItemElement.appendChild(document.createTextNode(item.label));menuItemElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);menuItemElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);menuItemElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);menuItemElement.addEventListener("mouseout",this._menuItemMouseOut.bind(this),false);menuItemElement._actionId=item.id;return menuItemElement;},_createSubMenu:function(item)
1772 {var menuItemElement=document.createElement("div");menuItemElement.className="soft-context-menu-item";menuItemElement._subItems=item.subItems;var checkMarkElement=document.createElement("span");checkMarkElement.textContent="\u2713 ";checkMarkElement.className="soft-context-menu-item-checkmark";checkMarkElement.style.opacity="0";menuItemElement.appendChild(checkMarkElement);var subMenuArrowElement=document.createElement("span");subMenuArrowElement.textContent="\u25B6";subMenuArrowElement.className="soft-context-menu-item-submenu-arrow";menuItemElement.appendChild(document.createTextNode(item.label));menuItemElement.appendChild(subMenuArrowElement);menuItemElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);menuItemElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);menuItemElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);menuItemElement.addEventListener("mouseout",this._menuItemMouseOut.bind(this),false);return menuItemElement;},_createSeparator:function()
1773 {var separatorElement=document.createElement("div");separatorElement.className="soft-context-menu-separator";separatorElement._isSeparator=true;separatorElement.addEventListener("mouseover",this._hideSubMenu.bind(this),false);separatorElement.createChild("div","separator-line");return separatorElement;},_menuItemMouseDown:function(event)
1774 {event.consume(true);},_menuItemMouseUp:function(event)
1775 {this._triggerAction(event.target,event);event.consume();},_focus:function()
1776 {this._contextMenuElement.focus();},_triggerAction:function(menuItemElement,event)
1777 {if(!menuItemElement._subItems){this._discardMenu(true,event);if(typeof menuItemElement._actionId!=="undefined"){WebInspector.contextMenuItemSelected(menuItemElement._actionId);delete menuItemElement._actionId;}
1778 return;}
1779 this._showSubMenu(menuItemElement,event);event.consume();},_showSubMenu:function(menuItemElement,event)
1780 {if(menuItemElement._subMenuTimer){clearTimeout(menuItemElement._subMenuTimer);delete menuItemElement._subMenuTimer;}
1781 if(this._subMenu)
1782 return;this._subMenu=new WebInspector.SoftContextMenu(menuItemElement._subItems,this);this._subMenu.show(this._buildMouseEventForSubMenu(menuItemElement));},_buildMouseEventForSubMenu:function(subMenuItemElement)
1783 {var subMenuOffset={x:subMenuItemElement.offsetWidth-3,y:subMenuItemElement.offsetTop-1};var targetX=this._x+subMenuOffset.x;var targetY=this._y+subMenuOffset.y;var targetPageX=parseInt(this._contextMenuElement.style.left,10)+subMenuOffset.x;var targetPageY=parseInt(this._contextMenuElement.style.top,10)+subMenuOffset.y;return{x:targetX,y:targetY,pageX:targetPageX,pageY:targetPageY,consume:function(){}};},_hideSubMenu:function()
1784 {if(!this._subMenu)
1785 return;this._subMenu._discardSubMenus();this._focus();},_menuItemMouseOver:function(event)
1786 {this._highlightMenuItem(event.target);},_menuItemMouseOut:function(event)
1787 {if(!this._subMenu||!event.relatedTarget){this._highlightMenuItem(null);return;}
1788 var relatedTarget=event.relatedTarget;if(this._contextMenuElement.isSelfOrAncestor(relatedTarget)||relatedTarget.classList.contains("soft-context-menu-glass-pane"))
1789 this._highlightMenuItem(null);},_highlightMenuItem:function(menuItemElement)
1790 {if(this._highlightedMenuItemElement===menuItemElement)
1791 return;this._hideSubMenu();if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.remove("soft-context-menu-item-mouse-over");if(this._highlightedMenuItemElement._subItems&&this._highlightedMenuItemElement._subMenuTimer){clearTimeout(this._highlightedMenuItemElement._subMenuTimer);delete this._highlightedMenuItemElement._subMenuTimer;}}
1792 this._highlightedMenuItemElement=menuItemElement;if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.add("soft-context-menu-item-mouse-over");this._contextMenuElement.focus();if(this._highlightedMenuItemElement._subItems&&!this._highlightedMenuItemElement._subMenuTimer)
1793 this._highlightedMenuItemElement._subMenuTimer=setTimeout(this._showSubMenu.bind(this,this._highlightedMenuItemElement,this._buildMouseEventForSubMenu(this._highlightedMenuItemElement)),150);}},_highlightPrevious:function()
1794 {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.previousSibling:this._contextMenuElement.lastChild;while(menuItemElement&&menuItemElement._isSeparator)
1795 menuItemElement=menuItemElement.previousSibling;if(menuItemElement)
1796 this._highlightMenuItem(menuItemElement);},_highlightNext:function()
1797 {var menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.nextSibling:this._contextMenuElement.firstChild;while(menuItemElement&&menuItemElement._isSeparator)
1798 menuItemElement=menuItemElement.nextSibling;if(menuItemElement)
1799 this._highlightMenuItem(menuItemElement);},_menuKeyDown:function(event)
1800 {switch(event.keyIdentifier){case"Up":this._highlightPrevious();break;case"Down":this._highlightNext();break;case"Left":if(this._parentMenu){this._highlightMenuItem(null);this._parentMenu._focus();}
1801 break;case"Right":if(!this._highlightedMenuItemElement)
1802 break;if(this._highlightedMenuItemElement._subItems){this._showSubMenu(this._highlightedMenuItemElement,this._buildMouseEventForSubMenu(this._highlightedMenuItemElement));this._subMenu._focus();this._subMenu._highlightNext();}
1803 break;case"U+001B":this._discardMenu(true,event);break;case"Enter":if(!isEnterKey(event))
1804 break;case"U+0020":if(this._highlightedMenuItemElement)
1805 this._triggerAction(this._highlightedMenuItemElement,event);break;}
1806 event.consume(true);},_glassPaneMouseUp:function(event)
1807 {if(event.x===this._x&&event.y===this._y&&new Date().getTime()-this._time<300)
1808 return;this._discardMenu(true,event);event.consume();},_discardMenu:function(closeParentMenus,event)
1809 {if(this._subMenu&&!closeParentMenus)
1810 return;if(this._glassPaneElement){var glassPane=this._glassPaneElement;delete this._glassPaneElement;document.body.removeChild(glassPane);if(this._parentMenu){delete this._parentMenu._subMenu;if(closeParentMenus)
1811 this._parentMenu._discardMenu(closeParentMenus,event);}
1812 if(event)
1813 event.consume(true);}else if(this._parentMenu&&this._contextMenuElement.parentElement){this._discardSubMenus();if(closeParentMenus)
1814 this._parentMenu._discardMenu(closeParentMenus,event);if(event)
1815 event.consume(true);}},_discardSubMenus:function()
1816 {if(this._subMenu)
1817 this._subMenu._discardSubMenus();this._contextMenuElement.remove();if(this._parentMenu)
1818 delete this._parentMenu._subMenu;}}
1819 if(!InspectorFrontendHost.showContextMenu){InspectorFrontendHost.showContextMenu=function(event,items)
1820 {new WebInspector.SoftContextMenu(items).show(event);}}
1821 WebInspector.KeyboardShortcut=function()
1822 {}
1823 WebInspector.KeyboardShortcut.Modifiers={None:0,Shift:1,Ctrl:2,Alt:4,Meta:8,get CtrlOrMeta()
1824 {return WebInspector.isMac()?this.Meta:this.Ctrl;}};WebInspector.KeyboardShortcut.Key;WebInspector.KeyboardShortcut.Keys={Backspace:{code:8,name:"\u21a4"},Tab:{code:9,name:{mac:"\u21e5",other:"Tab"}},Enter:{code:13,name:{mac:"\u21a9",other:"Enter"}},Ctrl:{code:17,name:"Ctrl"},Esc:{code:27,name:{mac:"\u238b",other:"Esc"}},Space:{code:32,name:"Space"},PageUp:{code:33,name:{mac:"\u21de",other:"PageUp"}},PageDown:{code:34,name:{mac:"\u21df",other:"PageDown"}},End:{code:35,name:{mac:"\u2197",other:"End"}},Home:{code:36,name:{mac:"\u2196",other:"Home"}},Left:{code:37,name:"\u2190"},Up:{code:38,name:"\u2191"},Right:{code:39,name:"\u2192"},Down:{code:40,name:"\u2193"},Delete:{code:46,name:"Del"},Zero:{code:48,name:"0"},H:{code:72,name:"H"},Meta:{code:91,name:"Meta"},F1:{code:112,name:"F1"},F2:{code:113,name:"F2"},F3:{code:114,name:"F3"},F4:{code:115,name:"F4"},F5:{code:116,name:"F5"},F6:{code:117,name:"F6"},F7:{code:118,name:"F7"},F8:{code:119,name:"F8"},F9:{code:120,name:"F9"},F10:{code:121,name:"F10"},F11:{code:122,name:"F11"},F12:{code:123,name:"F12"},Semicolon:{code:186,name:";"},Plus:{code:187,name:"+"},Comma:{code:188,name:","},Minus:{code:189,name:"-"},Period:{code:190,name:"."},Slash:{code:191,name:"/"},QuestionMark:{code:191,name:"?"},Apostrophe:{code:192,name:"`"},Tilde:{code:192,name:"Tilde"},Backslash:{code:220,name:"\\"},SingleQuote:{code:222,name:"\'"},get CtrlOrMeta()
1825 {return WebInspector.isMac()?this.Meta:this.Ctrl;},};WebInspector.KeyboardShortcut.KeyBindings={};(function(){for(var key in WebInspector.KeyboardShortcut.Keys){var descriptor=WebInspector.KeyboardShortcut.Keys[key];if(typeof descriptor==="object"&&descriptor["code"]){var name=typeof descriptor["name"]==="string"?descriptor["name"]:key;WebInspector.KeyboardShortcut.KeyBindings[name]={code:descriptor["code"]};}}})();WebInspector.KeyboardShortcut.makeKey=function(keyCode,modifiers)
1826 {if(typeof keyCode==="string")
1827 keyCode=keyCode.charCodeAt(0)-(/^[a-z]/.test(keyCode)?32:0);modifiers=modifiers||WebInspector.KeyboardShortcut.Modifiers.None;return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode,modifiers);}
1828 WebInspector.KeyboardShortcut.makeKeyFromEvent=function(keyboardEvent)
1829 {var modifiers=WebInspector.KeyboardShortcut.Modifiers.None;if(keyboardEvent.shiftKey)
1830 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Shift;if(keyboardEvent.ctrlKey)
1831 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Ctrl;if(keyboardEvent.altKey)
1832 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Alt;if(keyboardEvent.metaKey)
1833 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Meta;function keyCodeForEvent(keyboardEvent)
1834 {return keyboardEvent.keyCode||keyboardEvent["__keyCode"];}
1835 return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCodeForEvent(keyboardEvent),modifiers);}
1836 WebInspector.KeyboardShortcut.eventHasCtrlOrMeta=function(event)
1837 {return WebInspector.isMac()?event.metaKey&&!event.ctrlKey:event.ctrlKey&&!event.metaKey;}
1838 WebInspector.KeyboardShortcut.hasNoModifiers=function(event)
1839 {return!event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey;}
1840 WebInspector.KeyboardShortcut.Descriptor;WebInspector.KeyboardShortcut.makeDescriptor=function(key,modifiers)
1841 {return{key:WebInspector.KeyboardShortcut.makeKey(typeof key==="string"?key:key.code,modifiers),name:WebInspector.KeyboardShortcut.shortcutToString(key,modifiers)};}
1842 WebInspector.KeyboardShortcut.makeKeyFromBindingShortcut=function(shortcut)
1843 {var parts=shortcut.split(/\+(?!$)/);var modifiers=0;for(var i=0;i<parts.length;++i){if(typeof WebInspector.KeyboardShortcut.Modifiers[parts[i]]!=="undefined"){modifiers|=WebInspector.KeyboardShortcut.Modifiers[parts[i]];continue;}
1844 console.assert(i===parts.length-1,"Modifiers-only shortcuts are not allowed (encountered <"+shortcut+">)");var key=WebInspector.KeyboardShortcut.Keys[parts[i]]||WebInspector.KeyboardShortcut.KeyBindings[parts[i]];if(key&&key.shiftKey)
1845 modifiers|=WebInspector.KeyboardShortcut.Modifiers.Shift;return WebInspector.KeyboardShortcut.makeKey(key?key.code:parts[i].toLowerCase(),modifiers)}
1846 console.assert(false);return 0;}
1847 WebInspector.KeyboardShortcut.shortcutToString=function(key,modifiers)
1848 {return WebInspector.KeyboardShortcut._modifiersToString(modifiers)+WebInspector.KeyboardShortcut._keyName(key);}
1849 WebInspector.KeyboardShortcut._keyName=function(key)
1850 {if(typeof key==="string")
1851 return key.toUpperCase();if(typeof key.name==="string")
1852 return key.name;return key.name[WebInspector.platform()]||key.name.other||'';}
1853 WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers=function(keyCode,modifiers)
1854 {return(keyCode&255)|(modifiers<<8);};WebInspector.KeyboardShortcut._modifiersToString=function(modifiers)
1855 {const cmdKey="\u2318";const optKey="\u2325";const shiftKey="\u21e7";const ctrlKey="\u2303";var isMac=WebInspector.isMac();var res="";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Ctrl)
1856 res+=isMac?ctrlKey:"Ctrl + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Alt)
1857 res+=isMac?optKey:"Alt + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Shift)
1858 res+=isMac?shiftKey:"Shift + ";if(modifiers&WebInspector.KeyboardShortcut.Modifiers.Meta)
1859 res+=isMac?cmdKey:"Win + ";return res;};WebInspector.KeyboardShortcut.handleShortcut=function(event)
1860 {var key=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var extensions=WebInspector.KeyboardShortcut._keysToActionExtensions[key];if(!extensions)
1861 return;function handler(extension)
1862 {var result=extension.instance().handleAction(event);if(result)
1863 event.consume(true);delete WebInspector.KeyboardShortcut._pendingActionTimer;return result;}
1864 for(var i=0;i<extensions.length;++i){var ident=event.keyIdentifier;if(/^F\d+|Control|Shift|Alt|Meta|Win|U\+001B$/.test(ident)||event.ctrlKey||event.altKey||event.metaKey){if(handler(extensions[i]))
1865 return;}else{WebInspector.KeyboardShortcut._pendingActionTimer=setTimeout(handler.bind(null,extensions[i]),0);break;}}}
1866 WebInspector.KeyboardShortcut.SelectAll=WebInspector.KeyboardShortcut.makeKey("a",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);WebInspector.KeyboardShortcut._onKeyPress=function(event)
1867 {if(!WebInspector.KeyboardShortcut._pendingActionTimer)
1868 return;var target=event.target;if(WebInspector.isBeingEdited(event.target)){clearTimeout(WebInspector.KeyboardShortcut._pendingActionTimer);delete WebInspector.KeyboardShortcut._pendingActionTimer;}}
1869 WebInspector.KeyboardShortcut.registerActions=function()
1870 {document.addEventListener("keypress",WebInspector.KeyboardShortcut._onKeyPress,true);WebInspector.KeyboardShortcut._keysToActionExtensions={};var extensions=WebInspector.moduleManager.extensions(WebInspector.ActionDelegate);extensions.forEach(registerBindings);function registerBindings(extension)
1871 {var bindings=extension.descriptor().bindings;for(var i=0;bindings&&i<bindings.length;++i){if(!platformMatches(bindings[i].platform))
1872 continue;var shortcuts=bindings[i].shortcut.split(/\s+/);shortcuts.forEach(registerShortcut.bind(null,extension));}}
1873 function registerShortcut(extension,shortcut)
1874 {var key=WebInspector.KeyboardShortcut.makeKeyFromBindingShortcut(shortcut);if(!key)
1875 return;if(WebInspector.KeyboardShortcut._keysToActionExtensions[key])
1876 WebInspector.KeyboardShortcut._keysToActionExtensions[key].push(extension);else
1877 WebInspector.KeyboardShortcut._keysToActionExtensions[key]=[extension];}
1878 function platformMatches(platformsString)
1879 {if(!platformsString)
1880 return true;var platforms=platformsString.split(",");var isMatch=false;var currentPlatform=WebInspector.platform();for(var i=0;!isMatch&&i<platforms.length;++i)
1881 isMatch=platforms[i]===currentPlatform;return isMatch;}}
1882 WebInspector.SuggestBoxDelegate=function()
1883 {}
1884 WebInspector.SuggestBoxDelegate.prototype={applySuggestion:function(suggestion,isIntermediateSuggestion){},acceptSuggestion:function(){},}
1885 WebInspector.SuggestBox=function(suggestBoxDelegate,anchorElement,className,maxItemsHeight)
1886 {this._suggestBoxDelegate=suggestBoxDelegate;this._anchorElement=anchorElement;this._length=0;this._selectedIndex=-1;this._selectedElement=null;this._maxItemsHeight=maxItemsHeight;this._bodyElement=anchorElement.ownerDocument.body;this._element=anchorElement.ownerDocument.createElement("div");this._element.className="suggest-box "+(className||"");this._element.addEventListener("mousedown",this._onBoxMouseDown.bind(this),true);this.containerElement=this._element.createChild("div","container");this.contentElement=this.containerElement.createChild("div","content");}
1887 WebInspector.SuggestBox.prototype={visible:function()
1888 {return!!this._element.parentElement;},setPosition:function(anchorBox)
1889 {this._updateBoxPosition(anchorBox);},_updateBoxPosition:function(anchorBox)
1890 {this._anchorBox=anchorBox;anchorBox=anchorBox||this._anchorElement.boxInWindow(window);var container=WebInspector.Dialog.modalHostView().element;anchorBox=anchorBox.relativeToElement(container);var totalWidth=container.offsetWidth;var totalHeight=container.offsetHeight;this.contentElement.style.display="inline-block";document.body.appendChild(this.contentElement);this.contentElement.positionAt(0,0);var contentWidth=this.contentElement.offsetWidth;var contentHeight=this.contentElement.offsetHeight;this.contentElement.style.display="block";this.containerElement.appendChild(this.contentElement);const spacer=6;const suggestBoxPaddingX=21;const suggestBoxPaddingY=2;var maxWidth=totalWidth-anchorBox.x-spacer;var width=Math.min(contentWidth,maxWidth-suggestBoxPaddingX)+suggestBoxPaddingX;var paddedWidth=contentWidth+suggestBoxPaddingX;var boxX=anchorBox.x;if(width<paddedWidth){maxWidth=totalWidth-spacer;width=Math.min(contentWidth,maxWidth-suggestBoxPaddingX)+suggestBoxPaddingX;boxX=totalWidth-width;}
1891 var boxY;var aboveHeight=anchorBox.y;var underHeight=totalHeight-anchorBox.y-anchorBox.height;var maxHeight=this._maxItemsHeight?contentHeight*this._maxItemsHeight/this._length:Math.max(underHeight,aboveHeight)-spacer;var height=Math.min(contentHeight,maxHeight-suggestBoxPaddingY)+suggestBoxPaddingY;if(underHeight>=aboveHeight){boxY=anchorBox.y+anchorBox.height;this._element.classList.remove("above-anchor");this._element.classList.add("under-anchor");}else{boxY=anchorBox.y-height;this._element.classList.remove("under-anchor");this._element.classList.add("above-anchor");}
1892 this._element.positionAt(boxX,boxY,container);this._element.style.width=width+"px";this._element.style.height=height+"px";},_onBoxMouseDown:function(event)
1893 {event.preventDefault();},hide:function()
1894 {if(!this.visible())
1895 return;this._element.remove();delete this._selectedElement;this._selectedIndex=-1;},removeFromElement:function()
1896 {this.hide();},_applySuggestion:function(isIntermediateSuggestion)
1897 {if(!this.visible()||!this._selectedElement)
1898 return false;var suggestion=this._selectedElement.textContent;if(!suggestion)
1899 return false;this._suggestBoxDelegate.applySuggestion(suggestion,isIntermediateSuggestion);return true;},acceptSuggestion:function()
1900 {var result=this._applySuggestion();this.hide();if(!result)
1901 return false;this._suggestBoxDelegate.acceptSuggestion();return true;},_selectClosest:function(shift,isCircular)
1902 {if(!this._length)
1903 return false;if(this._selectedIndex===-1&&shift<0)
1904 shift+=1;var index=this._selectedIndex+shift;if(isCircular)
1905 index=(this._length+index)%this._length;else
1906 index=Number.constrain(index,0,this._length-1);this._selectItem(index);this._applySuggestion(true);return true;},_onItemMouseDown:function(event)
1907 {this._selectedElement=event.currentTarget;this.acceptSuggestion();event.consume(true);},_createItemElement:function(prefix,text)
1908 {var element=document.createElement("div");element.className="suggest-box-content-item source-code";element.tabIndex=-1;if(prefix&&prefix.length&&!text.indexOf(prefix)){var prefixElement=element.createChild("span","prefix");prefixElement.textContent=prefix;var suffixElement=element.createChild("span","suffix");suffixElement.textContent=text.substring(prefix.length);}else{var suffixElement=element.createChild("span","suffix");suffixElement.textContent=text;}
1909 element.addEventListener("mousedown",this._onItemMouseDown.bind(this),false);return element;},_updateItems:function(items,selectedIndex,userEnteredText)
1910 {this._length=items.length;this.contentElement.removeChildren();for(var i=0;i<items.length;++i){var item=items[i];var currentItemElement=this._createItemElement(userEnteredText,item);this.contentElement.appendChild(currentItemElement);}
1911 this._selectedElement=null;if(typeof selectedIndex==="number")
1912 this._selectItem(selectedIndex);},_selectItem:function(index)
1913 {if(this._selectedElement)
1914 this._selectedElement.classList.remove("selected");this._selectedIndex=index;if(index<0)
1915 return;this._selectedElement=this.contentElement.children[index];this._selectedElement.classList.add("selected");this._selectedElement.scrollIntoViewIfNeeded(false);},_canShowBox:function(completions,canShowForSingleItem,userEnteredText)
1916 {if(!completions||!completions.length)
1917 return false;if(completions.length>1)
1918 return true;return canShowForSingleItem&&completions[0]!==userEnteredText;},_rememberRowCountPerViewport:function()
1919 {if(!this.contentElement.firstChild)
1920 return;this._rowCountPerViewport=Math.floor(this.containerElement.offsetHeight/this.contentElement.firstChild.offsetHeight);},updateSuggestions:function(anchorBox,completions,selectedIndex,canShowForSingleItem,userEnteredText)
1921 {if(this._canShowBox(completions,canShowForSingleItem,userEnteredText)){this._updateItems(completions,selectedIndex,userEnteredText);this._updateBoxPosition(anchorBox);if(!this.visible())
1922 this._bodyElement.appendChild(this._element);this._rememberRowCountPerViewport();}else
1923 this.hide();},keyPressed:function(event)
1924 {switch(event.keyIdentifier){case"Up":return this.upKeyPressed();case"Down":return this.downKeyPressed();case"PageUp":return this.pageUpKeyPressed();case"PageDown":return this.pageDownKeyPressed();case"Enter":return this.enterKeyPressed();}
1925 return false;},upKeyPressed:function()
1926 {return this._selectClosest(-1,true);},downKeyPressed:function()
1927 {return this._selectClosest(1,true);},pageUpKeyPressed:function()
1928 {return this._selectClosest(-this._rowCountPerViewport,false);},pageDownKeyPressed:function()
1929 {return this._selectClosest(this._rowCountPerViewport,false);},enterKeyPressed:function()
1930 {var hasSelectedItem=!!this._selectedElement;this.acceptSuggestion();return hasSelectedItem;}}
1931 WebInspector.TextPrompt=function(completions,stopCharacters)
1932 {this._proxyElement;this._proxyElementDisplay="inline-block";this._loadCompletions=completions;this._completionStopCharacters=stopCharacters||" =:[({;,!+-*/&|^<>.";}
1933 WebInspector.TextPrompt.Events={ItemApplied:"text-prompt-item-applied",ItemAccepted:"text-prompt-item-accepted"};WebInspector.TextPrompt.prototype={get proxyElement()
1934 {return this._proxyElement;},setSuggestBoxEnabled:function(className)
1935 {this._suggestBoxClassName=className;},renderAsBlock:function()
1936 {this._proxyElementDisplay="block";},attach:function(element)
1937 {return this._attachInternal(element);},attachAndStartEditing:function(element,blurListener)
1938 {this._attachInternal(element);this._startEditing(blurListener);return this.proxyElement;},_attachInternal:function(element)
1939 {if(this.proxyElement)
1940 throw"Cannot attach an attached TextPrompt";this._element=element;this._boundOnKeyDown=this.onKeyDown.bind(this);this._boundOnMouseWheel=this.onMouseWheel.bind(this);this._boundSelectStart=this._selectStart.bind(this);this._boundHideSuggestBox=this.hideSuggestBox.bind(this);this._proxyElement=element.ownerDocument.createElement("span");this._proxyElement.style.display=this._proxyElementDisplay;element.parentElement.insertBefore(this.proxyElement,element);this.proxyElement.appendChild(element);this._element.classList.add("text-prompt");this._element.addEventListener("keydown",this._boundOnKeyDown,false);this._element.addEventListener("mousewheel",this._boundOnMouseWheel,false);this._element.addEventListener("selectstart",this._boundSelectStart,false);this._element.addEventListener("blur",this._boundHideSuggestBox,false);if(typeof this._suggestBoxClassName==="string")
1941 this._suggestBox=new WebInspector.SuggestBox(this,this._element,this._suggestBoxClassName);return this.proxyElement;},detach:function()
1942 {this._removeFromElement();this.proxyElement.parentElement.insertBefore(this._element,this.proxyElement);this.proxyElement.remove();delete this._proxyElement;this._element.classList.remove("text-prompt");this._element.removeEventListener("keydown",this._boundOnKeyDown,false);this._element.removeEventListener("mousewheel",this._boundOnMouseWheel,false);this._element.removeEventListener("selectstart",this._boundSelectStart,false);WebInspector.restoreFocusFromElement(this._element);},get text()
1943 {return this._element.textContent;},set text(x)
1944 {this._removeSuggestionAids();if(!x){this._element.removeChildren();this._element.appendChild(document.createElement("br"));}else
1945 this._element.textContent=x;this.moveCaretToEndOfPrompt();this._element.scrollIntoView();},_removeFromElement:function()
1946 {this.clearAutoComplete(true);this._element.removeEventListener("keydown",this._boundOnKeyDown,false);this._element.removeEventListener("selectstart",this._boundSelectStart,false);this._element.removeEventListener("blur",this._boundHideSuggestBox,false);if(this._isEditing)
1947 this._stopEditing();if(this._suggestBox)
1948 this._suggestBox.removeFromElement();},_startEditing:function(blurListener)
1949 {this._isEditing=true;this._element.classList.add("editing");if(blurListener){this._blurListener=blurListener;this._element.addEventListener("blur",this._blurListener,false);}
1950 this._oldTabIndex=this._element.tabIndex;if(this._element.tabIndex<0)
1951 this._element.tabIndex=0;WebInspector.setCurrentFocusElement(this._element);if(!this.text)
1952 this._updateAutoComplete();},_stopEditing:function()
1953 {this._element.tabIndex=this._oldTabIndex;if(this._blurListener)
1954 this._element.removeEventListener("blur",this._blurListener,false);this._element.classList.remove("editing");delete this._isEditing;},_removeSuggestionAids:function()
1955 {this.clearAutoComplete();this.hideSuggestBox();},_selectStart:function()
1956 {if(this._selectionTimeout)
1957 clearTimeout(this._selectionTimeout);this._removeSuggestionAids();function moveBackIfOutside()
1958 {delete this._selectionTimeout;if(!this.isCaretInsidePrompt()&&window.getSelection().isCollapsed){this.moveCaretToEndOfPrompt();this.autoCompleteSoon();}}
1959 this._selectionTimeout=setTimeout(moveBackIfOutside.bind(this),100);},defaultKeyHandler:function(event,force)
1960 {this._updateAutoComplete(force);return false;},_updateAutoComplete:function(force)
1961 {this.clearAutoComplete();this.autoCompleteSoon(force);},onMouseWheel:function(event)
1962 {},onKeyDown:function(event)
1963 {var handled=false;var invokeDefault=true;switch(event.keyIdentifier){case"U+0009":handled=this.tabKeyPressed(event);break;case"Left":case"Home":this._removeSuggestionAids();invokeDefault=false;break;case"Right":case"End":if(this.isCaretAtEndOfPrompt())
1964 handled=this.acceptAutoComplete();else
1965 this._removeSuggestionAids();invokeDefault=false;break;case"U+001B":if(this.isSuggestBoxVisible()){this._removeSuggestionAids();handled=true;}
1966 break;case"U+0020":if(event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey){this.defaultKeyHandler(event,true);handled=true;}
1967 break;case"Alt":case"Meta":case"Shift":case"Control":invokeDefault=false;break;}
1968 if(!handled&&this.isSuggestBoxVisible())
1969 handled=this._suggestBox.keyPressed(event);if(!handled&&invokeDefault)
1970 handled=this.defaultKeyHandler(event);if(handled)
1971 event.consume(true);return handled;},acceptAutoComplete:function()
1972 {var result=false;if(this.isSuggestBoxVisible())
1973 result=this._suggestBox.acceptSuggestion();if(!result)
1974 result=this._acceptSuggestionInternal();return result;},clearAutoComplete:function(includeTimeout)
1975 {if(includeTimeout&&this._completeTimeout){clearTimeout(this._completeTimeout);delete this._completeTimeout;}
1976 delete this._waitingForCompletions;if(!this.autoCompleteElement)
1977 return;this.autoCompleteElement.remove();delete this.autoCompleteElement;if(!this._userEnteredRange||!this._userEnteredText)
1978 return;this._userEnteredRange.deleteContents();this._element.normalize();var userTextNode=document.createTextNode(this._userEnteredText);this._userEnteredRange.insertNode(userTextNode);var selectionRange=document.createRange();selectionRange.setStart(userTextNode,this._userEnteredText.length);selectionRange.setEnd(userTextNode,this._userEnteredText.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(selectionRange);delete this._userEnteredRange;delete this._userEnteredText;},autoCompleteSoon:function(force)
1979 {var immediately=this.isSuggestBoxVisible()||force;if(!this._completeTimeout)
1980 this._completeTimeout=setTimeout(this.complete.bind(this,force),immediately?0:250);},complete:function(force,reverse)
1981 {this.clearAutoComplete(true);var selection=window.getSelection();if(!selection.rangeCount)
1982 return;var selectionRange=selection.getRangeAt(0);var shouldExit;if(!force&&!this.isCaretAtEndOfPrompt()&&!this.isSuggestBoxVisible())
1983 shouldExit=true;else if(!selection.isCollapsed)
1984 shouldExit=true;else if(!force){var wordSuffixRange=selectionRange.startContainer.rangeOfWord(selectionRange.endOffset,this._completionStopCharacters,this._element,"forward");if(wordSuffixRange.toString().length)
1985 shouldExit=true;}
1986 if(shouldExit){this.hideSuggestBox();return;}
1987 var wordPrefixRange=selectionRange.startContainer.rangeOfWord(selectionRange.startOffset,this._completionStopCharacters,this._element,"backward");this._waitingForCompletions=true;this._loadCompletions(this.proxyElement,wordPrefixRange,force,this._completionsReady.bind(this,selection,wordPrefixRange,!!reverse));},disableDefaultSuggestionForEmptyInput:function()
1988 {this._disableDefaultSuggestionForEmptyInput=true;},_boxForAnchorAtStart:function(selection,textRange)
1989 {var rangeCopy=selection.getRangeAt(0).cloneRange();var anchorElement=document.createElement("span");anchorElement.textContent="\u200B";textRange.insertNode(anchorElement);var box=anchorElement.boxInWindow(window);anchorElement.remove();selection.removeAllRanges();selection.addRange(rangeCopy);return box;},_buildCommonPrefix:function(completions,wordPrefixLength)
1990 {var commonPrefix=completions[0];for(var i=0;i<completions.length;++i){var completion=completions[i];var lastIndex=Math.min(commonPrefix.length,completion.length);for(var j=wordPrefixLength;j<lastIndex;++j){if(commonPrefix[j]!==completion[j]){commonPrefix=commonPrefix.substr(0,j);break;}}}
1991 return commonPrefix;},_completionsReady:function(selection,originalWordPrefixRange,reverse,completions,selectedIndex)
1992 {if(!this._waitingForCompletions||!completions.length){this.hideSuggestBox();return;}
1993 delete this._waitingForCompletions;var selectionRange=selection.getRangeAt(0);var fullWordRange=document.createRange();fullWordRange.setStart(originalWordPrefixRange.startContainer,originalWordPrefixRange.startOffset);fullWordRange.setEnd(selectionRange.endContainer,selectionRange.endOffset);if(originalWordPrefixRange.toString()+selectionRange.toString()!==fullWordRange.toString())
1994 return;selectedIndex=(this._disableDefaultSuggestionForEmptyInput&&!this.text)?-1:(selectedIndex||0);this._userEnteredRange=fullWordRange;this._userEnteredText=fullWordRange.toString();if(this._suggestBox)
1995 this._suggestBox.updateSuggestions(this._boxForAnchorAtStart(selection,fullWordRange),completions,selectedIndex,!this.isCaretAtEndOfPrompt(),this._userEnteredText);if(selectedIndex===-1)
1996 return;var wordPrefixLength=originalWordPrefixRange.toString().length;this._commonPrefix=this._buildCommonPrefix(completions,wordPrefixLength);if(this.isCaretAtEndOfPrompt()){this._userEnteredRange.deleteContents();this._element.normalize();var finalSelectionRange=document.createRange();var completionText=completions[selectedIndex];var prefixText=completionText.substring(0,wordPrefixLength);var suffixText=completionText.substring(wordPrefixLength);var prefixTextNode=document.createTextNode(prefixText);fullWordRange.insertNode(prefixTextNode);this.autoCompleteElement=document.createElement("span");this.autoCompleteElement.className="auto-complete-text";this.autoCompleteElement.textContent=suffixText;prefixTextNode.parentNode.insertBefore(this.autoCompleteElement,prefixTextNode.nextSibling);finalSelectionRange.setStart(prefixTextNode,wordPrefixLength);finalSelectionRange.setEnd(prefixTextNode,wordPrefixLength);selection.removeAllRanges();selection.addRange(finalSelectionRange);this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemApplied);}},_completeCommonPrefix:function()
1997 {if(!this.autoCompleteElement||!this._commonPrefix||!this._userEnteredText||!this._commonPrefix.startsWith(this._userEnteredText))
1998 return;if(!this.isSuggestBoxVisible()){this.acceptAutoComplete();return;}
1999 this.autoCompleteElement.textContent=this._commonPrefix.substring(this._userEnteredText.length);this._acceptSuggestionInternal(true);},applySuggestion:function(completionText,isIntermediateSuggestion)
2000 {this._applySuggestion(completionText,isIntermediateSuggestion);},_applySuggestion:function(completionText,isIntermediateSuggestion,originalPrefixRange)
2001 {var wordPrefixLength;if(originalPrefixRange)
2002 wordPrefixLength=originalPrefixRange.toString().length;else
2003 wordPrefixLength=this._userEnteredText?this._userEnteredText.length:0;this._userEnteredRange.deleteContents();this._element.normalize();var finalSelectionRange=document.createRange();var completionTextNode=document.createTextNode(completionText);this._userEnteredRange.insertNode(completionTextNode);if(this.autoCompleteElement){this.autoCompleteElement.remove();delete this.autoCompleteElement;}
2004 if(isIntermediateSuggestion)
2005 finalSelectionRange.setStart(completionTextNode,wordPrefixLength);else
2006 finalSelectionRange.setStart(completionTextNode,completionText.length);finalSelectionRange.setEnd(completionTextNode,completionText.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(finalSelectionRange);if(isIntermediateSuggestion)
2007 this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemApplied,{itemText:completionText});},acceptSuggestion:function()
2008 {this._acceptSuggestionInternal();},_acceptSuggestionInternal:function(prefixAccepted)
2009 {if(this._isAcceptingSuggestion)
2010 return false;if(!this.autoCompleteElement||!this.autoCompleteElement.parentNode)
2011 return false;var text=this.autoCompleteElement.textContent;var textNode=document.createTextNode(text);this.autoCompleteElement.parentNode.replaceChild(textNode,this.autoCompleteElement);delete this.autoCompleteElement;var finalSelectionRange=document.createRange();finalSelectionRange.setStart(textNode,text.length);finalSelectionRange.setEnd(textNode,text.length);var selection=window.getSelection();selection.removeAllRanges();selection.addRange(finalSelectionRange);if(!prefixAccepted){this.hideSuggestBox();this.dispatchEventToListeners(WebInspector.TextPrompt.Events.ItemAccepted);}else
2012 this.autoCompleteSoon(true);return true;},hideSuggestBox:function()
2013 {if(this.isSuggestBoxVisible())
2014 this._suggestBox.hide();},isSuggestBoxVisible:function()
2015 {return this._suggestBox&&this._suggestBox.visible();},isCaretInsidePrompt:function()
2016 {return this._element.isInsertionCaretInside();},isCaretAtEndOfPrompt:function()
2017 {var selection=window.getSelection();if(!selection.rangeCount||!selection.isCollapsed)
2018 return false;var selectionRange=selection.getRangeAt(0);var node=selectionRange.startContainer;if(!node.isSelfOrDescendant(this._element))
2019 return false;if(node.nodeType===Node.TEXT_NODE&&selectionRange.startOffset<node.nodeValue.length)
2020 return false;var foundNextText=false;while(node){if(node.nodeType===Node.TEXT_NODE&&node.nodeValue.length){if(foundNextText&&(!this.autoCompleteElement||!this.autoCompleteElement.isAncestor(node)))
2021 return false;foundNextText=true;}
2022 node=node.traverseNextNode(this._element);}
2023 return true;},isCaretOnFirstLine:function()
2024 {var selection=window.getSelection();var focusNode=selection.focusNode;if(!focusNode||focusNode.nodeType!==Node.TEXT_NODE||focusNode.parentNode!==this._element)
2025 return true;if(focusNode.textContent.substring(0,selection.focusOffset).indexOf("\n")!==-1)
2026 return false;focusNode=focusNode.previousSibling;while(focusNode){if(focusNode.nodeType!==Node.TEXT_NODE)
2027 return true;if(focusNode.textContent.indexOf("\n")!==-1)
2028 return false;focusNode=focusNode.previousSibling;}
2029 return true;},isCaretOnLastLine:function()
2030 {var selection=window.getSelection();var focusNode=selection.focusNode;if(!focusNode||focusNode.nodeType!==Node.TEXT_NODE||focusNode.parentNode!==this._element)
2031 return true;if(focusNode.textContent.substring(selection.focusOffset).indexOf("\n")!==-1)
2032 return false;focusNode=focusNode.nextSibling;while(focusNode){if(focusNode.nodeType!==Node.TEXT_NODE)
2033 return true;if(focusNode.textContent.indexOf("\n")!==-1)
2034 return false;focusNode=focusNode.nextSibling;}
2035 return true;},moveCaretToEndOfPrompt:function()
2036 {var selection=window.getSelection();var selectionRange=document.createRange();var offset=this._element.childNodes.length;selectionRange.setStart(this._element,offset);selectionRange.setEnd(this._element,offset);selection.removeAllRanges();selection.addRange(selectionRange);},tabKeyPressed:function(event)
2037 {this._completeCommonPrefix();return true;},__proto__:WebInspector.Object.prototype}
2038 WebInspector.TextPromptWithHistory=function(completions,stopCharacters)
2039 {WebInspector.TextPrompt.call(this,completions,stopCharacters);this._data=[];this._historyOffset=1;this._coalesceHistoryDupes=true;}
2040 WebInspector.TextPromptWithHistory.prototype={get historyData()
2041 {return this._data;},setCoalesceHistoryDupes:function(x)
2042 {this._coalesceHistoryDupes=x;},setHistoryData:function(data)
2043 {this._data=[].concat(data);this._historyOffset=1;},pushHistoryItem:function(text)
2044 {if(this._uncommittedIsTop){this._data.pop();delete this._uncommittedIsTop;}
2045 this._historyOffset=1;if(this._coalesceHistoryDupes&&text===this._currentHistoryItem())
2046 return;this._data.push(text);},_pushCurrentText:function()
2047 {if(this._uncommittedIsTop)
2048 this._data.pop();this._uncommittedIsTop=true;this.clearAutoComplete(true);this._data.push(this.text);},_previous:function()
2049 {if(this._historyOffset>this._data.length)
2050 return undefined;if(this._historyOffset===1)
2051 this._pushCurrentText();++this._historyOffset;return this._currentHistoryItem();},_next:function()
2052 {if(this._historyOffset===1)
2053 return undefined;--this._historyOffset;return this._currentHistoryItem();},_currentHistoryItem:function()
2054 {return this._data[this._data.length-this._historyOffset];},defaultKeyHandler:function(event,force)
2055 {var newText;var isPrevious;switch(event.keyIdentifier){case"Up":if(!this.isCaretOnFirstLine())
2056 break;newText=this._previous();isPrevious=true;break;case"Down":if(!this.isCaretOnLastLine())
2057 break;newText=this._next();break;case"U+0050":if(WebInspector.isMac()&&event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey){newText=this._previous();isPrevious=true;}
2058 break;case"U+004E":if(WebInspector.isMac()&&event.ctrlKey&&!event.metaKey&&!event.altKey&&!event.shiftKey)
2059 newText=this._next();break;}
2060 if(newText!==undefined){event.consume(true);this.text=newText;if(isPrevious){var firstNewlineIndex=this.text.indexOf("\n");if(firstNewlineIndex===-1)
2061 this.moveCaretToEndOfPrompt();else{var selection=window.getSelection();var selectionRange=document.createRange();selectionRange.setStart(this._element.firstChild,firstNewlineIndex);selectionRange.setEnd(this._element.firstChild,firstNewlineIndex);selection.removeAllRanges();selection.addRange(selectionRange);}}
2062 return true;}
2063 return WebInspector.TextPrompt.prototype.defaultKeyHandler.apply(this,arguments);},__proto__:WebInspector.TextPrompt.prototype}
2064 WebInspector.Popover=function(popoverHelper)
2065 {WebInspector.View.call(this);this.markAsRoot();this.element.className="popover custom-popup-vertical-scroll custom-popup-horizontal-scroll";this._popupArrowElement=document.createElement("div");this._popupArrowElement.className="arrow";this.element.appendChild(this._popupArrowElement);this._contentDiv=document.createElement("div");this._contentDiv.className="content";this.element.appendChild(this._contentDiv);this._popoverHelper=popoverHelper;}
2066 WebInspector.Popover.prototype={show:function(element,anchor,preferredWidth,preferredHeight,arrowDirection)
2067 {this._innerShow(null,element,anchor,preferredWidth,preferredHeight,arrowDirection);},showView:function(view,anchor,preferredWidth,preferredHeight)
2068 {this._innerShow(view,view.element,anchor,preferredWidth,preferredHeight);},_innerShow:function(view,contentElement,anchor,preferredWidth,preferredHeight,arrowDirection)
2069 {if(this._disposed)
2070 return;this.contentElement=contentElement;if(WebInspector.Popover._popover)
2071 WebInspector.Popover._popover.detach();WebInspector.Popover._popover=this;var preferredSize=view?view.measurePreferredSize():this.contentElement.measurePreferredSize();preferredWidth=preferredWidth||preferredSize.width;preferredHeight=preferredHeight||preferredSize.height;WebInspector.View.prototype.show.call(this,document.body);if(view)
2072 view.show(this._contentDiv);else
2073 this._contentDiv.appendChild(this.contentElement);this._positionElement(anchor,preferredWidth,preferredHeight,arrowDirection);if(this._popoverHelper){this._contentDiv.addEventListener("mousemove",this._popoverHelper._killHidePopoverTimer.bind(this._popoverHelper),true);this.element.addEventListener("mouseout",this._popoverHelper._popoverMouseOut.bind(this._popoverHelper),true);}},hide:function()
2074 {this.detach();delete WebInspector.Popover._popover;},get disposed()
2075 {return this._disposed;},dispose:function()
2076 {if(this.isShowing())
2077 this.hide();this._disposed=true;},setCanShrink:function(canShrink)
2078 {this._hasFixedHeight=!canShrink;this._contentDiv.classList.add("fixed-height");},_positionElement:function(anchorElement,preferredWidth,preferredHeight,arrowDirection)
2079 {const borderWidth=25;const scrollerWidth=this._hasFixedHeight?0:11;const arrowHeight=15;const arrowOffset=10;const borderRadius=10;preferredWidth=Math.max(preferredWidth,50);const container=WebInspector.Dialog.modalHostView().element;const totalWidth=container.offsetWidth;const totalHeight=container.offsetHeight;var anchorBox=anchorElement instanceof AnchorBox?anchorElement:anchorElement.boxInWindow(window);anchorBox=anchorBox.relativeToElement(container);var newElementPosition={x:0,y:0,width:preferredWidth+scrollerWidth,height:preferredHeight};var verticalAlignment;var roomAbove=anchorBox.y;var roomBelow=totalHeight-anchorBox.y-anchorBox.height;if((roomAbove>roomBelow)||(arrowDirection===WebInspector.Popover.Orientation.Bottom)){if((anchorBox.y>newElementPosition.height+arrowHeight+borderRadius)||(arrowDirection===WebInspector.Popover.Orientation.Bottom))
2080 newElementPosition.y=anchorBox.y-newElementPosition.height-arrowHeight;else{newElementPosition.y=borderRadius;newElementPosition.height=anchorBox.y-borderRadius*2-arrowHeight;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=borderRadius;newElementPosition.height=preferredHeight;}}
2081 verticalAlignment=WebInspector.Popover.Orientation.Bottom;}else{newElementPosition.y=anchorBox.y+anchorBox.height+arrowHeight;if((newElementPosition.y+newElementPosition.height+borderRadius>=totalHeight)&&(arrowDirection!==WebInspector.Popover.Orientation.Top)){newElementPosition.height=totalHeight-borderRadius-newElementPosition.y;if(this._hasFixedHeight&&newElementPosition.height<preferredHeight){newElementPosition.y=totalHeight-preferredHeight-borderRadius;newElementPosition.height=preferredHeight;}}
2082 verticalAlignment=WebInspector.Popover.Orientation.Top;}
2083 var horizontalAlignment;if(anchorBox.x+newElementPosition.width<totalWidth){newElementPosition.x=Math.max(borderRadius,anchorBox.x-borderRadius-arrowOffset);horizontalAlignment="left";}else if(newElementPosition.width+borderRadius*2<totalWidth){newElementPosition.x=totalWidth-newElementPosition.width-borderRadius;horizontalAlignment="right";var arrowRightPosition=Math.max(0,totalWidth-anchorBox.x-anchorBox.width-borderRadius-arrowOffset);arrowRightPosition+=anchorBox.width/2;arrowRightPosition=Math.min(arrowRightPosition,newElementPosition.width-borderRadius-arrowOffset);this._popupArrowElement.style.right=arrowRightPosition+"px";}else{newElementPosition.x=borderRadius;newElementPosition.width=totalWidth-borderRadius*2;newElementPosition.height+=scrollerWidth;horizontalAlignment="left";if(verticalAlignment===WebInspector.Popover.Orientation.Bottom)
2084 newElementPosition.y-=scrollerWidth;this._popupArrowElement.style.left=Math.max(0,anchorBox.x-borderRadius*2-arrowOffset)+"px";this._popupArrowElement.style.left+=anchorBox.width/2;}
2085 this.element.className="popover custom-popup-vertical-scroll custom-popup-horizontal-scroll "+verticalAlignment+"-"+horizontalAlignment+"-arrow";this.element.positionAt(newElementPosition.x-borderWidth,newElementPosition.y-borderWidth,container);this.element.style.width=newElementPosition.width+borderWidth*2+"px";this.element.style.height=newElementPosition.height+borderWidth*2+"px";},__proto__:WebInspector.View.prototype}
2086 WebInspector.PopoverHelper=function(panelElement,getAnchor,showPopover,onHide,disableOnClick)
2087 {this._panelElement=panelElement;this._getAnchor=getAnchor;this._showPopover=showPopover;this._onHide=onHide;this._disableOnClick=!!disableOnClick;panelElement.addEventListener("mousedown",this._mouseDown.bind(this),false);panelElement.addEventListener("mousemove",this._mouseMove.bind(this),false);panelElement.addEventListener("mouseout",this._mouseOut.bind(this),false);this.setTimeout(1000);}
2088 WebInspector.PopoverHelper.prototype={setTimeout:function(timeout)
2089 {this._timeout=timeout;},_eventInHoverElement:function(event)
2090 {if(!this._hoverElement)
2091 return false;var box=this._hoverElement instanceof AnchorBox?this._hoverElement:this._hoverElement.boxInWindow();return(box.x<=event.clientX&&event.clientX<=box.x+box.width&&box.y<=event.clientY&&event.clientY<=box.y+box.height);},_mouseDown:function(event)
2092 {if(this._disableOnClick||!this._eventInHoverElement(event))
2093 this.hidePopover();else{this._killHidePopoverTimer();this._handleMouseAction(event,true);}},_mouseMove:function(event)
2094 {if(this._eventInHoverElement(event))
2095 return;this._startHidePopoverTimer();this._handleMouseAction(event,false);},_popoverMouseOut:function(event)
2096 {if(!this.isPopoverVisible())
2097 return;if(event.relatedTarget&&!event.relatedTarget.isSelfOrDescendant(this._popover._contentDiv))
2098 this._startHidePopoverTimer();},_mouseOut:function(event)
2099 {if(!this.isPopoverVisible())
2100 return;if(!this._eventInHoverElement(event))
2101 this._startHidePopoverTimer();},_startHidePopoverTimer:function()
2102 {if(!this._popover||this._hidePopoverTimer)
2103 return;function doHide()
2104 {this._hidePopover();delete this._hidePopoverTimer;}
2105 this._hidePopoverTimer=setTimeout(doHide.bind(this),this._timeout/2);},_handleMouseAction:function(event,isMouseDown)
2106 {this._resetHoverTimer();if(event.which&&this._disableOnClick)
2107 return;this._hoverElement=this._getAnchor(event.target,event);if(!this._hoverElement)
2108 return;const toolTipDelay=isMouseDown?0:(this._popup?this._timeout*0.6:this._timeout);this._hoverTimer=setTimeout(this._mouseHover.bind(this,this._hoverElement),toolTipDelay);},_resetHoverTimer:function()
2109 {if(this._hoverTimer){clearTimeout(this._hoverTimer);delete this._hoverTimer;}},isPopoverVisible:function()
2110 {return!!this._popover;},hidePopover:function()
2111 {this._resetHoverTimer();this._hidePopover();},_hidePopover:function()
2112 {if(!this._popover)
2113 return;if(this._onHide)
2114 this._onHide();this._popover.dispose();delete this._popover;this._hoverElement=null;},_mouseHover:function(element)
2115 {delete this._hoverTimer;this._hidePopover();this._popover=new WebInspector.Popover(this);this._showPopover(element,this._popover);},_killHidePopoverTimer:function()
2116 {if(this._hidePopoverTimer){clearTimeout(this._hidePopoverTimer);delete this._hidePopoverTimer;this._resetHoverTimer();}}}
2117 WebInspector.Popover.Orientation={Top:"top",Bottom:"bottom"}
2118 WebInspector.Placard=function(title,subtitle)
2119 {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.title=title;this.subtitle=subtitle;this.selected=false;}
2120 WebInspector.Placard.prototype={get title()
2121 {return this._title;},set title(x)
2122 {if(this._title===x)
2123 return;this._title=x;this.titleElement.textContent=x;},get subtitle()
2124 {return this._subtitle;},set subtitle(x)
2125 {if(this._subtitle===x)
2126 return;this._subtitle=x;this.subtitleElement.textContent=x;},get selected()
2127 {return this._selected;},set selected(x)
2128 {if(x)
2129 this.select();else
2130 this.deselect();},select:function()
2131 {if(this._selected)
2132 return;this._selected=true;this.element.classList.add("selected");},deselect:function()
2133 {if(!this._selected)
2134 return;this._selected=false;this.element.classList.remove("selected");},toggleSelected:function()
2135 {this.selected=!this.selected;},discard:function()
2136 {}}
2137 WebInspector.TabbedPane=function()
2138 {WebInspector.VBox.call(this);this.element.classList.add("tabbed-pane");this._headerElement=this.element.createChild("div","tabbed-pane-header");this._headerContentsElement=this._headerElement.createChild("div","tabbed-pane-header-contents");this._tabsElement=this._headerContentsElement.createChild("div","tabbed-pane-header-tabs");this._contentElement=this.element.createChild("div","tabbed-pane-content scroll-target");this._tabs=[];this._tabsHistory=[];this._tabsById={};this._dropDownButton=this._createDropDownButton();}
2139 WebInspector.TabbedPane.EventTypes={TabSelected:"TabSelected",TabClosed:"TabClosed"}
2140 WebInspector.TabbedPane.prototype={get visibleView()
2141 {return this._currentTab?this._currentTab.view:null;},get selectedTabId()
2142 {return this._currentTab?this._currentTab.id:null;},set shrinkableTabs(shrinkableTabs)
2143 {this._shrinkableTabs=shrinkableTabs;},set verticalTabLayout(verticalTabLayout)
2144 {this._verticalTabLayout=verticalTabLayout;this.invalidateMinimumSize();},set closeableTabs(closeableTabs)
2145 {this._closeableTabs=closeableTabs;},setRetainTabOrder:function(retainTabOrder,tabOrderComparator)
2146 {this._retainTabOrder=retainTabOrder;this._tabOrderComparator=tabOrderComparator;},defaultFocusedElement:function()
2147 {return this.visibleView?this.visibleView.defaultFocusedElement():null;},focus:function()
2148 {if(this.visibleView)
2149 this.visibleView.focus();else
2150 WebInspector.View.prototype.focus.call(this);},headerElement:function()
2151 {return this._headerElement;},isTabCloseable:function(id)
2152 {var tab=this._tabsById[id];return tab?tab.isCloseable():false;},setTabDelegate:function(delegate)
2153 {var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
2154 tabs[i].setDelegate(delegate);this._delegate=delegate;},appendTab:function(id,tabTitle,view,tabTooltip,userGesture,isCloseable)
2155 {isCloseable=typeof isCloseable==="boolean"?isCloseable:this._closeableTabs;var tab=new WebInspector.TabbedPaneTab(this,id,tabTitle,isCloseable,view,tabTooltip);tab.setDelegate(this._delegate);this._tabsById[id]=tab;function comparator(tab1,tab2)
2156 {return this._tabOrderComparator(tab1.id,tab2.id);}
2157 if(this._retainTabOrder&&this._tabOrderComparator)
2158 this._tabs.splice(insertionIndexForObjectInListSortedByFunction(tab,this._tabs,comparator.bind(this)),0,tab);else
2159 this._tabs.push(tab);this._tabsHistory.push(tab);if(this._tabsHistory[0]===tab&&this.isShowing())
2160 this.selectTab(tab.id,userGesture);this._updateTabElements();},closeTab:function(id,userGesture)
2161 {this.closeTabs([id],userGesture);},closeTabs:function(ids,userGesture)
2162 {for(var i=0;i<ids.length;++i)
2163 this._innerCloseTab(ids[i],userGesture);this._updateTabElements();if(this._tabsHistory.length)
2164 this.selectTab(this._tabsHistory[0].id,false);},_innerCloseTab:function(id,userGesture)
2165 {if(!this._tabsById[id])
2166 return;if(userGesture&&!this._tabsById[id]._closeable)
2167 return;if(this._currentTab&&this._currentTab.id===id)
2168 this._hideCurrentTab();var tab=this._tabsById[id];delete this._tabsById[id];this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabs.splice(this._tabs.indexOf(tab),1);if(tab._shown)
2169 this._hideTabElement(tab);var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabClosed,eventData);return true;},hasTab:function(tabId)
2170 {return!!this._tabsById[tabId];},allTabs:function()
2171 {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i)
2172 result.push(tabs[i].id);return result;},otherTabs:function(id)
2173 {var result=[];var tabs=this._tabs.slice();for(var i=0;i<tabs.length;++i){if(tabs[i].id!==id)
2174 result.push(tabs[i].id);}
2175 return result;},selectTab:function(id,userGesture)
2176 {var tab=this._tabsById[id];if(!tab)
2177 return;if(this._currentTab&&this._currentTab.id===id)
2178 return;this._hideCurrentTab();this._showTab(tab);this._currentTab=tab;this._tabsHistory.splice(this._tabsHistory.indexOf(tab),1);this._tabsHistory.splice(0,0,tab);this._updateTabElements();var eventData={tabId:id,view:tab.view,isUserGesture:userGesture};this.dispatchEventToListeners(WebInspector.TabbedPane.EventTypes.TabSelected,eventData);},lastOpenedTabIds:function(tabsCount)
2179 {function tabToTabId(tab){return tab.id;}
2180 return this._tabsHistory.slice(0,tabsCount).map(tabToTabId);},setTabIcon:function(id,iconClass,iconTooltip)
2181 {var tab=this._tabsById[id];if(tab._setIconClass(iconClass,iconTooltip))
2182 this._updateTabElements();},changeTabTitle:function(id,tabTitle)
2183 {var tab=this._tabsById[id];if(tab.title===tabTitle)
2184 return;tab.title=tabTitle;this._updateTabElements();},changeTabView:function(id,view)
2185 {var tab=this._tabsById[id];if(this._currentTab&&this._currentTab.id===tab.id){if(tab.view!==view)
2186 this._hideTab(tab);tab.view=view;this._showTab(tab);}else
2187 tab.view=view;},changeTabTooltip:function(id,tabTooltip)
2188 {var tab=this._tabsById[id];tab.tooltip=tabTooltip;},onResize:function()
2189 {this._updateTabElements();},headerResized:function()
2190 {this._updateTabElements();},wasShown:function()
2191 {var effectiveTab=this._currentTab||this._tabsHistory[0];if(effectiveTab)
2192 this.selectTab(effectiveTab.id);this.invalidateMinimumSize();},calculateMinimumSize:function()
2193 {var size=WebInspector.VBox.prototype.calculateMinimumSize.call(this);if(this._verticalTabLayout)
2194 size.width+=this._headerElement.offsetWidth;else
2195 size.height+=this._headerElement.offsetHeight;return size;},_updateTabElements:function()
2196 {WebInspector.invokeOnceAfterBatchUpdate(this,this._innerUpdateTabElements);},setPlaceholderText:function(text)
2197 {this._noTabsMessage=text;},_innerUpdateTabElements:function()
2198 {if(!this.isShowing())
2199 return;if(!this._tabs.length){this._contentElement.classList.add("has-no-tabs");if(this._noTabsMessage&&!this._noTabsMessageElement){this._noTabsMessageElement=this._contentElement.createChild("div","tabbed-pane-placeholder fill");this._noTabsMessageElement.textContent=this._noTabsMessage;}}else{this._contentElement.classList.remove("has-no-tabs");if(this._noTabsMessageElement){this._noTabsMessageElement.remove();delete this._noTabsMessageElement;}}
2200 if(!this._measuredDropDownButtonWidth)
2201 this._measureDropDownButton();this._updateWidths();this._updateTabsDropDown();},_showTabElement:function(index,tab)
2202 {if(index>=this._tabsElement.children.length)
2203 this._tabsElement.appendChild(tab.tabElement);else
2204 this._tabsElement.insertBefore(tab.tabElement,this._tabsElement.children[index]);tab._shown=true;},_hideTabElement:function(tab)
2205 {this._tabsElement.removeChild(tab.tabElement);tab._shown=false;},_createDropDownButton:function()
2206 {var dropDownContainer=document.createElement("div");dropDownContainer.classList.add("tabbed-pane-header-tabs-drop-down-container");var dropDownButton=dropDownContainer.createChild("div","tabbed-pane-header-tabs-drop-down");dropDownButton.appendChild(document.createTextNode("\u00bb"));this._dropDownMenu=new WebInspector.DropDownMenu();this._dropDownMenu.addEventListener(WebInspector.DropDownMenu.Events.ItemSelected,this._dropDownMenuItemSelected,this);dropDownButton.appendChild(this._dropDownMenu.element);return dropDownContainer;},_dropDownMenuItemSelected:function(event)
2207 {var tabId=(event.data);this.selectTab(tabId,true);},_totalWidth:function()
2208 {return this._headerContentsElement.getBoundingClientRect().width;},_updateTabsDropDown:function()
2209 {var tabsToShowIndexes=this._tabsToShowIndexes(this._tabs,this._tabsHistory,this._totalWidth(),this._measuredDropDownButtonWidth);for(var i=0;i<this._tabs.length;++i){if(this._tabs[i]._shown&&tabsToShowIndexes.indexOf(i)===-1)
2210 this._hideTabElement(this._tabs[i]);}
2211 for(var i=0;i<tabsToShowIndexes.length;++i){var tab=this._tabs[tabsToShowIndexes[i]];if(!tab._shown)
2212 this._showTabElement(i,tab);}
2213 this._populateDropDownFromIndex();},_populateDropDownFromIndex:function()
2214 {if(this._dropDownButton.parentElement)
2215 this._headerContentsElement.removeChild(this._dropDownButton);this._dropDownMenu.clear();var tabsToShow=[];for(var i=0;i<this._tabs.length;++i){if(!this._tabs[i]._shown)
2216 tabsToShow.push(this._tabs[i]);continue;}
2217 function compareFunction(tab1,tab2)
2218 {return tab1.title.localeCompare(tab2.title);}
2219 if(!this._retainTabOrder)
2220 tabsToShow.sort(compareFunction);var selectedId=null;for(var i=0;i<tabsToShow.length;++i){var tab=tabsToShow[i];this._dropDownMenu.addItem(tab.id,tab.title);if(this._tabsHistory[0]===tab)
2221 selectedId=tab.id;}
2222 if(tabsToShow.length){this._headerContentsElement.appendChild(this._dropDownButton);this._dropDownMenu.selectItem(selectedId);}},_measureDropDownButton:function()
2223 {this._dropDownButton.classList.add("measuring");this._headerContentsElement.appendChild(this._dropDownButton);this._measuredDropDownButtonWidth=this._dropDownButton.getBoundingClientRect().width;this._headerContentsElement.removeChild(this._dropDownButton);this._dropDownButton.classList.remove("measuring");},_updateWidths:function()
2224 {var measuredWidths=this._measureWidths();var maxWidth=this._shrinkableTabs?this._calculateMaxWidth(measuredWidths.slice(),this._totalWidth()):Number.MAX_VALUE;var i=0;for(var tabId in this._tabs){var tab=this._tabs[tabId];tab.setWidth(this._verticalTabLayout?-1:Math.min(maxWidth,measuredWidths[i++]));}},_measureWidths:function()
2225 {this._tabsElement.style.setProperty("width","2000px");var measuringTabElements=[];for(var tabId in this._tabs){var tab=this._tabs[tabId];if(typeof tab._measuredWidth==="number")
2226 continue;var measuringTabElement=tab._createTabElement(true);measuringTabElement.__tab=tab;measuringTabElements.push(measuringTabElement);this._tabsElement.appendChild(measuringTabElement);}
2227 for(var i=0;i<measuringTabElements.length;++i)
2228 measuringTabElements[i].__tab._measuredWidth=measuringTabElements[i].getBoundingClientRect().width;for(var i=0;i<measuringTabElements.length;++i)
2229 measuringTabElements[i].remove();var measuredWidths=[];for(var tabId in this._tabs)
2230 measuredWidths.push(this._tabs[tabId]._measuredWidth);this._tabsElement.style.removeProperty("width");return measuredWidths;},_calculateMaxWidth:function(measuredWidths,totalWidth)
2231 {if(!measuredWidths.length)
2232 return 0;measuredWidths.sort(function(x,y){return x-y});var totalMeasuredWidth=0;for(var i=0;i<measuredWidths.length;++i)
2233 totalMeasuredWidth+=measuredWidths[i];if(totalWidth>=totalMeasuredWidth)
2234 return measuredWidths[measuredWidths.length-1];var totalExtraWidth=0;for(var i=measuredWidths.length-1;i>0;--i){var extraWidth=measuredWidths[i]-measuredWidths[i-1];totalExtraWidth+=(measuredWidths.length-i)*extraWidth;if(totalWidth+totalExtraWidth>=totalMeasuredWidth)
2235 return measuredWidths[i-1]+(totalWidth+totalExtraWidth-totalMeasuredWidth)/(measuredWidths.length-i);}
2236 return totalWidth/measuredWidths.length;},_tabsToShowIndexes:function(tabsOrdered,tabsHistory,totalWidth,measuredDropDownButtonWidth)
2237 {var tabsToShowIndexes=[];var totalTabsWidth=0;var tabCount=tabsOrdered.length;for(var i=0;i<tabCount;++i){var tab=this._retainTabOrder?tabsOrdered[i]:tabsHistory[i];totalTabsWidth+=tab.width();var minimalRequiredWidth=totalTabsWidth;if(i!==tabCount-1)
2238 minimalRequiredWidth+=measuredDropDownButtonWidth;if(!this._verticalTabLayout&&minimalRequiredWidth>totalWidth)
2239 break;tabsToShowIndexes.push(tabsOrdered.indexOf(tab));}
2240 tabsToShowIndexes.sort(function(x,y){return x-y});return tabsToShowIndexes;},_hideCurrentTab:function()
2241 {if(!this._currentTab)
2242 return;this._hideTab(this._currentTab);delete this._currentTab;},_showTab:function(tab)
2243 {tab.tabElement.classList.add("selected");tab.view.show(this._contentElement);},_hideTab:function(tab)
2244 {tab.tabElement.classList.remove("selected");tab.view.detach();},elementsToRestoreScrollPositionsFor:function()
2245 {return[this._contentElement];},_insertBefore:function(tab,index)
2246 {this._tabsElement.insertBefore(tab._tabElement,this._tabsElement.childNodes[index]);var oldIndex=this._tabs.indexOf(tab);this._tabs.splice(oldIndex,1);if(oldIndex<index)
2247 --index;this._tabs.splice(index,0,tab);},__proto__:WebInspector.VBox.prototype}
2248 WebInspector.TabbedPaneTab=function(tabbedPane,id,title,closeable,view,tooltip)
2249 {this._closeable=closeable;this._tabbedPane=tabbedPane;this._id=id;this._title=title;this._tooltip=tooltip;this._view=view;this._shown=false;this._measuredWidth;this._tabElement;}
2250 WebInspector.TabbedPaneTab.prototype={get id()
2251 {return this._id;},get title()
2252 {return this._title;},set title(title)
2253 {if(title===this._title)
2254 return;this._title=title;if(this._titleElement)
2255 this._titleElement.textContent=title;delete this._measuredWidth;},iconClass:function()
2256 {return this._iconClass;},isCloseable:function()
2257 {return this._closeable;},_setIconClass:function(iconClass,iconTooltip)
2258 {if(iconClass===this._iconClass&&iconTooltip===this._iconTooltip)
2259 return false;this._iconClass=iconClass;this._iconTooltip=iconTooltip;if(this._iconElement)
2260 this._iconElement.remove();if(this._iconClass&&this._tabElement)
2261 this._iconElement=this._createIconElement(this._tabElement,this._titleElement);delete this._measuredWidth;return true;},get view()
2262 {return this._view;},set view(view)
2263 {this._view=view;},get tooltip()
2264 {return this._tooltip;},set tooltip(tooltip)
2265 {this._tooltip=tooltip;if(this._titleElement)
2266 this._titleElement.title=tooltip||"";},get tabElement()
2267 {if(!this._tabElement)
2268 this._tabElement=this._createTabElement(false);return this._tabElement;},width:function()
2269 {return this._width;},setWidth:function(width)
2270 {this.tabElement.style.width=width===-1?"":(width+"px");this._width=width;},setDelegate:function(delegate)
2271 {this._delegate=delegate;},_createIconElement:function(tabElement,titleElement)
2272 {var iconElement=document.createElement("span");iconElement.className="tabbed-pane-header-tab-icon "+this._iconClass;if(this._iconTooltip)
2273 iconElement.title=this._iconTooltip;tabElement.insertBefore(iconElement,titleElement);return iconElement;},_createTabElement:function(measuring)
2274 {var tabElement=document.createElement("div");tabElement.classList.add("tabbed-pane-header-tab");tabElement.id="tab-"+this._id;tabElement.tabIndex=-1;tabElement.selectTabForTest=this._tabbedPane.selectTab.bind(this._tabbedPane,this.id,true);var titleElement=tabElement.createChild("span","tabbed-pane-header-tab-title");titleElement.textContent=this.title;titleElement.title=this.tooltip||"";if(this._iconClass)
2275 this._createIconElement(tabElement,titleElement);if(!measuring)
2276 this._titleElement=titleElement;if(this._closeable)
2277 tabElement.createChild("div","close-button-gray");if(measuring){tabElement.classList.add("measuring");}else{tabElement.addEventListener("click",this._tabClicked.bind(this),false);tabElement.addEventListener("mousedown",this._tabMouseDown.bind(this),false);tabElement.addEventListener("mouseup",this._tabMouseUp.bind(this),false);if(this._closeable){tabElement.addEventListener("contextmenu",this._tabContextMenu.bind(this),false);WebInspector.installDragHandle(tabElement,this._startTabDragging.bind(this),this._tabDragging.bind(this),this._endTabDragging.bind(this),"pointer");}}
2278 return tabElement;},_tabClicked:function(event)
2279 {var middleButton=event.button===1;var shouldClose=this._closeable&&(middleButton||event.target.classList.contains("close-button-gray"));if(!shouldClose){this._tabbedPane.focus();return;}
2280 this._closeTabs([this.id]);event.consume(true);},_tabMouseDown:function(event)
2281 {if(event.target.classList.contains("close-button-gray")||event.button===1)
2282 return;this._tabbedPane.selectTab(this.id,true);},_tabMouseUp:function(event)
2283 {if(event.button===1)
2284 event.consume(true);},_closeTabs:function(ids)
2285 {if(this._delegate){this._delegate.closeTabs(this._tabbedPane,ids);return;}
2286 this._tabbedPane.closeTabs(ids,true);},_tabContextMenu:function(event)
2287 {function close()
2288 {this._closeTabs([this.id]);}
2289 function closeOthers()
2290 {this._closeTabs(this._tabbedPane.otherTabs(this.id));}
2291 function closeAll()
2292 {this._closeTabs(this._tabbedPane.allTabs());}
2293 var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Close"),close.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Close others":"Close Others"),closeOthers.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Close all":"Close All"),closeAll.bind(this));contextMenu.show();},_startTabDragging:function(event)
2294 {if(event.target.classList.contains("close-button-gray"))
2295 return false;this._dragStartX=event.pageX;return true;},_tabDragging:function(event)
2296 {var tabElements=this._tabbedPane._tabsElement.childNodes;for(var i=0;i<tabElements.length;++i){var tabElement=tabElements[i];if(tabElement===this._tabElement)
2297 continue;var intersects=tabElement.offsetLeft+tabElement.clientWidth>this._tabElement.offsetLeft&&this._tabElement.offsetLeft+this._tabElement.clientWidth>tabElement.offsetLeft;if(!intersects)
2298 continue;if(Math.abs(event.pageX-this._dragStartX)<tabElement.clientWidth/2+5)
2299 break;if(event.pageX-this._dragStartX>0){tabElement=tabElement.nextSibling;++i;}
2300 var oldOffsetLeft=this._tabElement.offsetLeft;this._tabbedPane._insertBefore(this,i);this._dragStartX+=this._tabElement.offsetLeft-oldOffsetLeft;break;}
2301 if(!this._tabElement.previousSibling&&event.pageX-this._dragStartX<0){this._tabElement.style.setProperty("left","0px");return;}
2302 if(!this._tabElement.nextSibling&&event.pageX-this._dragStartX>0){this._tabElement.style.setProperty("left","0px");return;}
2303 this._tabElement.style.setProperty("position","relative");this._tabElement.style.setProperty("left",(event.pageX-this._dragStartX)+"px");},_endTabDragging:function(event)
2304 {this._tabElement.style.removeProperty("position");this._tabElement.style.removeProperty("left");delete this._dragStartX;}}
2305 WebInspector.TabbedPaneTabDelegate=function()
2306 {}
2307 WebInspector.TabbedPaneTabDelegate.prototype={closeTabs:function(tabbedPane,ids){}}
2308 WebInspector.ExtensibleTabbedPaneController=function(tabbedPane,extensionPoint,viewCallback)
2309 {this._tabbedPane=tabbedPane;this._extensionPoint=extensionPoint;this._viewCallback=viewCallback;this._tabbedPane.setRetainTabOrder(true,WebInspector.moduleManager.orderComparator(extensionPoint,"name","order"));this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._views=new StringMap();this._initialize();}
2310 WebInspector.ExtensibleTabbedPaneController.prototype={_initialize:function()
2311 {this._extensions={};var extensions=WebInspector.moduleManager.extensions(this._extensionPoint);for(var i=0;i<extensions.length;++i){var descriptor=extensions[i].descriptor();var id=descriptor["name"];var title=WebInspector.UIString(descriptor["title"]);var settingName=descriptor["setting"];var setting=settingName?(WebInspector.settings[settingName]):null;this._extensions[id]=extensions[i];if(setting){setting.addChangeListener(this._toggleSettingBasedView.bind(this,id,title,setting));if(setting.get())
2312 this._tabbedPane.appendTab(id,title,new WebInspector.View());}else{this._tabbedPane.appendTab(id,title,new WebInspector.View());}}},_toggleSettingBasedView:function(id,title,setting)
2313 {this._tabbedPane.closeTab(id);if(setting.get())
2314 this._tabbedPane.appendTab(id,title,new WebInspector.View());},_tabSelected:function(event)
2315 {var tabId=this._tabbedPane.selectedTabId;var view=this._viewForId(tabId);if(view)
2316 this._tabbedPane.changeTabView(tabId,view);},_viewForId:function(id)
2317 {if(this._views.contains(id))
2318 return(this._views.get(id));var view=this._extensions[id]?(this._extensions[id].instance()):null;this._views.put(id,view);if(this._viewCallback&&view)
2319 this._viewCallback(id,view);return view;}}
2320 WebInspector.ViewportControl=function(provider)
2321 {this.element=document.createElement("div");this.element.className="fill";this.element.style.overflow="auto";this._topGapElement=this.element.createChild("div");this._contentElement=this.element.createChild("div");this._bottomGapElement=this.element.createChild("div");this._provider=provider;this.element.addEventListener("scroll",this._onScroll.bind(this),false);this._firstVisibleIndex=0;this._lastVisibleIndex=-1;}
2322 WebInspector.ViewportControl.Provider=function()
2323 {}
2324 WebInspector.ViewportControl.Provider.prototype={itemCount:function(){return 0;},itemElement:function(index){return null;}}
2325 WebInspector.ViewportControl.prototype={contentElement:function()
2326 {return this._contentElement;},refresh:function()
2327 {if(!this.element.clientHeight)
2328 return;this._contentElement.style.setProperty("height","100000px");this._contentElement.removeChildren();var itemCount=this._provider.itemCount();if(!itemCount){this._firstVisibleIndex=-1;this._lastVisibleIndex=-1;return;}
2329 if(!this._rowHeight){var firstElement=this._provider.itemElement(0);this._rowHeight=firstElement.measurePreferredSize(this._contentElement).height;}
2330 var visibleFrom=this.element.scrollTop;var visibleTo=visibleFrom+this.element.clientHeight;this._firstVisibleIndex=Math.floor(visibleFrom/this._rowHeight);this._lastVisibleIndex=Math.min(Math.ceil(visibleTo/this._rowHeight),itemCount)-1;this._topGapElement.style.height=(this._rowHeight*this._firstVisibleIndex)+"px";this._bottomGapElement.style.height=(this._rowHeight*(itemCount-this._lastVisibleIndex-1))+"px";for(var i=this._firstVisibleIndex;i<=this._lastVisibleIndex;++i)
2331 this._contentElement.appendChild(this._provider.itemElement(i));this._contentElement.style.removeProperty("height");},_onScroll:function(event)
2332 {this.refresh();},rowsPerViewport:function()
2333 {return Math.floor(this.element.clientHeight/this._rowHeight);},firstVisibleIndex:function()
2334 {return this._firstVisibleIndex;},lastVisibleIndex:function()
2335 {return this._lastVisibleIndex;},renderedElementAt:function(index)
2336 {if(index<this._firstVisibleIndex)
2337 return null;if(index>this._lastVisibleIndex)
2338 return null;return this._contentElement.childNodes[index-this._firstVisibleIndex];},scrollItemIntoView:function(index,makeLast)
2339 {if(index>this._firstVisibleIndex&&index<this._lastVisibleIndex)
2340 return;if(makeLast)
2341 this.element.scrollTop=this._rowHeight*(index+1)-this.element.clientHeight;else
2342 this.element.scrollTop=this._rowHeight*index;}}
2343 WebInspector.Drawer=function(splitView)
2344 {WebInspector.VBox.call(this);this.element.id="drawer-contents";this._splitView=splitView;splitView.hideDefaultResizer();this.show(splitView.sidebarElement());this._drawerEditorSplitView=new WebInspector.SplitView(true,true,"editorInDrawerSplitViewState",0.5,0.5);this._drawerEditorSplitView.hideSidebar();this._drawerEditorSplitView.addEventListener(WebInspector.SplitView.Events.ShowModeChanged,this._drawerEditorSplitViewShowModeChanged,this);this._drawerEditorShownSetting=WebInspector.settings.createSetting("drawerEditorShown",true);this._drawerEditorSplitView.show(this.element);this._toggleDrawerButton=new WebInspector.StatusBarButton(WebInspector.UIString("Show drawer."),"console-status-bar-item");this._toggleDrawerButton.addEventListener("click",this.toggle,this);this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.element.id="drawer-tabbed-pane";this._tabbedPane.closeableTabs=false;this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);new WebInspector.ExtensibleTabbedPaneController(this._tabbedPane,"drawer-view");this._toggleDrawerEditorButton=this._drawerEditorSplitView.createShowHideSidebarButton("editor in drawer","drawer-editor-show-hide-button");this._tabbedPane.element.appendChild(this._toggleDrawerEditorButton.element);if(!WebInspector.experimentsSettings.showEditorInDrawer.isEnabled())
2345 this.setDrawerEditorAvailable(false);splitView.installResizer(this._tabbedPane.headerElement());this._lastSelectedViewSetting=WebInspector.settings.createSetting("WebInspector.Drawer.lastSelectedView","console");this._tabbedPane.show(this._drawerEditorSplitView.mainElement());}
2346 WebInspector.Drawer.prototype={toggleButtonElement:function()
2347 {return this._toggleDrawerButton.element;},closeView:function(id)
2348 {this._tabbedPane.closeTab(id);},showView:function(id,immediate)
2349 {if(!this._tabbedPane.hasTab(id)){this._innerShow(immediate);return;}
2350 this._innerShow(immediate);this._tabbedPane.selectTab(id,true);this._lastSelectedViewSetting.set(id);},showCloseableView:function(id,title,view)
2351 {if(!this._tabbedPane.hasTab(id)){this._tabbedPane.appendTab(id,title,view,undefined,false,true);}else{this._tabbedPane.changeTabView(id,view);this._tabbedPane.changeTabTitle(id,title);}
2352 this._innerShow();this._tabbedPane.selectTab(id,true);},showDrawer:function()
2353 {this.showView(this._lastSelectedViewSetting.get());},wasShown:function()
2354 {this.showView(this._lastSelectedViewSetting.get());this._toggleDrawerButton.toggled=true;this._toggleDrawerButton.title=WebInspector.UIString("Hide drawer.");this._ensureDrawerEditorExistsIfNeeded();},willHide:function()
2355 {this._toggleDrawerButton.toggled=false;this._toggleDrawerButton.title=WebInspector.UIString("Show drawer.");},_innerShow:function(immediate)
2356 {if(this.isShowing())
2357 return;this._splitView.showBoth(!immediate);if(this._visibleView())
2358 this._visibleView().focus();},closeDrawer:function()
2359 {if(!this.isShowing())
2360 return;WebInspector.restoreFocusFromElement(this.element);this._splitView.hideSidebar(true);},_visibleView:function()
2361 {return this._tabbedPane.visibleView;},_tabSelected:function(event)
2362 {var tabId=this._tabbedPane.selectedTabId;if(event.data["isUserGesture"]&&!this._tabbedPane.isTabCloseable(tabId))
2363 this._lastSelectedViewSetting.set(tabId);},toggle:function()
2364 {if(this._toggleDrawerButton.toggled)
2365 this.closeDrawer();else
2366 this.showDrawer();},visible:function()
2367 {return this._toggleDrawerButton.toggled;},selectedViewId:function()
2368 {return this._tabbedPane.selectedTabId;},_drawerEditorSplitViewShowModeChanged:function(event)
2369 {var mode=(event.data);var shown=mode===WebInspector.SplitView.ShowMode.Both;if(this._isHidingDrawerEditor)
2370 return;this._drawerEditorShownSetting.set(shown);if(!shown)
2371 return;this._ensureDrawerEditor();this._drawerEditor.view().show(this._drawerEditorSplitView.sidebarElement());},initialPanelShown:function()
2372 {this._initialPanelWasShown=true;this._ensureDrawerEditorExistsIfNeeded();},_ensureDrawerEditorExistsIfNeeded:function()
2373 {if(!this._initialPanelWasShown||!this.isShowing()||!this._drawerEditorShownSetting.get()||!WebInspector.experimentsSettings.showEditorInDrawer.isEnabled())
2374 return;this._ensureDrawerEditor();},_ensureDrawerEditor:function()
2375 {if(this._drawerEditor)
2376 return;this._drawerEditor=WebInspector.moduleManager.instance(WebInspector.DrawerEditor);this._drawerEditor.installedIntoDrawer();},setDrawerEditorAvailable:function(available)
2377 {if(!WebInspector.experimentsSettings.showEditorInDrawer.isEnabled())
2378 available=false;this._toggleDrawerEditorButton.element.classList.toggle("hidden",!available);},showDrawerEditor:function()
2379 {if(!WebInspector.experimentsSettings.showEditorInDrawer.isEnabled())
2380 return;this._splitView.showBoth();this._drawerEditorSplitView.showBoth();},hideDrawerEditor:function()
2381 {this._isHidingDrawerEditor=true;this._drawerEditorSplitView.hideSidebar();this._isHidingDrawerEditor=false;},isDrawerEditorShown:function()
2382 {return this._drawerEditorShownSetting.get();},__proto__:WebInspector.VBox.prototype}
2383 WebInspector.Drawer.ViewFactory=function()
2384 {}
2385 WebInspector.Drawer.ViewFactory.prototype={createView:function(){}}
2386 WebInspector.Drawer.SingletonViewFactory=function(constructor)
2387 {this._constructor=constructor;}
2388 WebInspector.Drawer.SingletonViewFactory.prototype={createView:function()
2389 {if(!this._instance)
2390 this._instance=(new this._constructor());return this._instance;}}
2391 WebInspector.DrawerEditor=function()
2392 {}
2393 WebInspector.DrawerEditor.prototype={view:function(){},installedIntoDrawer:function(){},}
2394 WebInspector.ConsoleModel=function(target)
2395 {this.messages=[];this.warnings=0;this.errors=0;this._target=target;this._consoleAgent=target.consoleAgent();target.registerConsoleDispatcher(new WebInspector.ConsoleDispatcher(this));this._enableAgent();}
2396 WebInspector.ConsoleModel.Events={ConsoleCleared:"ConsoleCleared",MessageAdded:"MessageAdded",CommandEvaluated:"CommandEvaluated",}
2397 WebInspector.ConsoleModel.prototype={_enableAgent:function()
2398 {if(WebInspector.settings.monitoringXHREnabled.get())
2399 this._consoleAgent.setMonitoringXHREnabled(true);this._enablingConsole=true;function callback()
2400 {delete this._enablingConsole;}
2401 this._consoleAgent.enable(callback.bind(this));},enablingConsole:function()
2402 {return!!this._enablingConsole;},addMessage:function(msg,isFromBackend)
2403 {if(isFromBackend&&WebInspector.SourceMap.hasSourceMapRequestHeader(msg.request))
2404 return;msg.index=this.messages.length;this.messages.push(msg);this._incrementErrorWarningCount(msg);this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.MessageAdded,msg);},evaluateCommand:function(text,useCommandLineAPI)
2405 {this.show();var commandMessage=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS,null,text,WebInspector.ConsoleMessage.MessageType.Command);this.addMessage(commandMessage);function printResult(result,wasThrown,valueResult)
2406 {if(!result)
2407 return;this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated,{result:result,wasThrown:wasThrown,text:text,commandMessage:commandMessage});}
2408 this._target.runtimeModel.evaluate(text,"console",useCommandLineAPI,false,false,true,printResult.bind(this));WebInspector.userMetrics.ConsoleEvaluated.record();},show:function()
2409 {WebInspector.Revealer.reveal(this);},evaluate:function(expression)
2410 {this.evaluateCommand(expression,false);},log:function(messageText,messageLevel,showConsole)
2411 {var message=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,messageLevel||WebInspector.ConsoleMessage.MessageLevel.Debug,messageText);this.addMessage(message);if(showConsole)
2412 this.show();},showErrorMessage:function(error)
2413 {this.log(error,WebInspector.ConsoleMessage.MessageLevel.Error,true);},_incrementErrorWarningCount:function(msg)
2414 {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:this.warnings++;break;case WebInspector.ConsoleMessage.MessageLevel.Error:this.errors++;break;}},requestClearMessages:function()
2415 {this._consoleAgent.clearMessages();this.clearMessages();},clearMessages:function()
2416 {this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.ConsoleCleared);this.messages=[];this.errors=0;this.warnings=0;},__proto__:WebInspector.Object.prototype}
2417 WebInspector.ConsoleMessage=function(source,level,messageText,type,url,line,column,requestId,parameters,stackTrace,timestamp,isOutdated)
2418 {this.source=source;this.level=level;this.messageText=messageText;this.type=type||WebInspector.ConsoleMessage.MessageType.Log;this.url=url||null;this.line=line||0;this.column=column||0;this.parameters=parameters;this.stackTrace=stackTrace;this.timestamp=timestamp||Date.now();this.isOutdated=isOutdated;this.request=requestId?WebInspector.networkLog.requestForId(requestId):null;}
2419 WebInspector.ConsoleMessage.prototype={isGroupMessage:function()
2420 {return this.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed||this.type===WebInspector.ConsoleMessage.MessageType.EndGroup;},isErrorOrWarning:function()
2421 {return(this.level===WebInspector.ConsoleMessage.MessageLevel.Warning||this.level===WebInspector.ConsoleMessage.MessageLevel.Error);},clone:function()
2422 {return new WebInspector.ConsoleMessage(this.source,this.level,this.messageText,this.type,this.url,this.line,this.column,this.request?this.request.requestId:undefined,this.parameters,this.stackTrace,this.timestamp,this.isOutdated);},isEqual:function(msg)
2423 {if(!msg||WebInspector.settings.consoleTimestampsEnabled.get())
2424 return false;if(this.stackTrace){if(!msg.stackTrace||this.stackTrace.length!==msg.stackTrace.length)
2425 return false;for(var i=0;i<msg.stackTrace.length;++i){if(this.stackTrace[i].url!==msg.stackTrace[i].url||this.stackTrace[i].functionName!==msg.stackTrace[i].functionName||this.stackTrace[i].lineNumber!==msg.stackTrace[i].lineNumber||this.stackTrace[i].columnNumber!==msg.stackTrace[i].columnNumber)
2426 return false;}}
2427 if(this.parameters){if(!msg.parameters||this.parameters.length!==msg.parameters.length)
2428 return false;for(var i=0;i<msg.parameters.length;++i){if(this.parameters[i].type!==msg.parameters[i].type||msg.parameters[i].type==="object"||this.parameters[i].value!==msg.parameters[i].value)
2429 return false;}}
2430 return(this.source===msg.source)&&(this.type===msg.type)&&(this.level===msg.level)&&(this.line===msg.line)&&(this.url===msg.url)&&(this.messageText===msg.messageText)&&(this.request===msg.request);}}
2431 WebInspector.ConsoleMessage.MessageSource={XML:"xml",JS:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",AppCache:"appcache",Rendering:"rendering",CSS:"css",Security:"security",Other:"other",Deprecation:"deprecation"}
2432 WebInspector.ConsoleMessage.MessageType={Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",Clear:"clear",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Result:"result",Profile:"profile",ProfileEnd:"profileEnd",Command:"command"}
2433 WebInspector.ConsoleMessage.MessageLevel={Log:"log",Info:"info",Warning:"warning",Error:"error",Debug:"debug"}
2434 WebInspector.ConsoleDispatcher=function(console)
2435 {this._console=console;}
2436 WebInspector.ConsoleDispatcher.prototype={messageAdded:function(payload)
2437 {var consoleMessage=new WebInspector.ConsoleMessage(payload.source,payload.level,payload.text,payload.type,payload.url,payload.line,payload.column,payload.networkRequestId,payload.parameters,payload.stackTrace,payload.timestamp*1000,this._console._enablingConsole);this._console.addMessage(consoleMessage,true);},messageRepeatCountUpdated:function(count)
2438 {},messagesCleared:function()
2439 {if(!WebInspector.settings.preserveConsoleLog.get())
2440 this._console.clearMessages();}}
2441 WebInspector.console;WebInspector.Panel=function(name)
2442 {WebInspector.VBox.call(this);WebInspector.panels[name]=this;this.element.classList.add("panel");this.element.classList.add(name);this._panelName=name;this._shortcuts=({});}
2443 WebInspector.Panel.counterRightMargin=25;WebInspector.Panel.prototype={get name()
2444 {return this._panelName;},reset:function()
2445 {},defaultFocusedElement:function()
2446 {return this.element;},searchableView:function()
2447 {return null;},replaceSelectionWith:function(text)
2448 {},replaceAllWith:function(query,text)
2449 {},get statusBarItems()
2450 {},elementsToRestoreScrollPositionsFor:function()
2451 {return[];},handleShortcut:function(event)
2452 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event)){event.handled=true;return;}
2453 var searchableView=this.searchableView();if(!searchableView)
2454 return;function handleSearchShortcuts(shortcuts,handler)
2455 {for(var i=0;i<shortcuts.length;++i){if(shortcuts[i].key!==shortcutKey)
2456 continue;return handler.call(searchableView);}
2457 return false;}
2458 if(handleSearchShortcuts(WebInspector.SearchableView.findShortcuts(),searchableView.handleFindShortcut))
2459 event.handled=true;else if(handleSearchShortcuts(WebInspector.SearchableView.cancelSearchShortcuts(),searchableView.handleCancelSearchShortcut))
2460 event.handled=true;},registerShortcuts:function(keys,handler)
2461 {for(var i=0;i<keys.length;++i)
2462 this._shortcuts[keys[i].key]=handler;},__proto__:WebInspector.VBox.prototype}
2463 WebInspector.PanelWithSidebarTree=function(name,defaultWidth)
2464 {WebInspector.Panel.call(this,name);this._panelSplitView=new WebInspector.SplitView(true,false,this._panelName+"PanelSplitViewState",defaultWidth||200);this._panelSplitView.show(this.element);var sidebarView=new WebInspector.VBox();sidebarView.setMinimumSize(Preferences.minSidebarWidth,25);sidebarView.show(this._panelSplitView.sidebarElement());this._sidebarElement=sidebarView.element;this._sidebarElement.classList.add("sidebar");var sidebarTreeElement=this._sidebarElement.createChild("ol","sidebar-tree");this.sidebarTree=new TreeOutline(sidebarTreeElement);}
2465 WebInspector.PanelWithSidebarTree.prototype={sidebarElement:function()
2466 {return this._sidebarElement;},mainElement:function()
2467 {return this._panelSplitView.mainElement();},defaultFocusedElement:function()
2468 {return this.sidebarTree.element||this.element;},__proto__:WebInspector.Panel.prototype}
2469 WebInspector.PanelDescriptor=function()
2470 {}
2471 WebInspector.PanelDescriptor.prototype={name:function(){},title:function(){},panel:function(){}}
2472 WebInspector.ModuleManagerExtensionPanelDescriptor=function(extension)
2473 {this._name=extension.descriptor()["name"];this._title=WebInspector.UIString(extension.descriptor()["title"]);this._extension=extension;}
2474 WebInspector.ModuleManagerExtensionPanelDescriptor.prototype={name:function()
2475 {return this._name;},title:function()
2476 {return this._title;},panel:function()
2477 {return(this._extension.instance());}}
2478 WebInspector.InspectorView=function()
2479 {WebInspector.VBox.call(this);WebInspector.Dialog.setModalHostView(this);this.setMinimumSize(180,72);this._drawerSplitView=new WebInspector.SplitView(false,true,"Inspector.drawerSplitViewState",200,200);this._drawerSplitView.hideSidebar();this._drawerSplitView.enableShowModeSaving();this._drawerSplitView.show(this.element);this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.setRetainTabOrder(true,WebInspector.moduleManager.orderComparator(WebInspector.Panel,"name","order"));this._tabbedPane.show(this._drawerSplitView.mainElement());this._drawer=new WebInspector.Drawer(this._drawerSplitView);this._toolbarElement=document.createElement("div");this._toolbarElement.className="toolbar toolbar-background";var headerElement=this._tabbedPane.headerElement();headerElement.parentElement.insertBefore(this._toolbarElement,headerElement);this._leftToolbarElement=this._toolbarElement.createChild("div","toolbar-controls-left");this._toolbarElement.appendChild(headerElement);this._rightToolbarElement=this._toolbarElement.createChild("div","toolbar-controls-right");this._errorWarningCountElement=this._rightToolbarElement.createChild("div","hidden");this._errorWarningCountElement.id="error-warning-count";this._closeButtonToolbarItem=document.createElementWithClass("div","toolbar-close-button-item");var closeButtonElement=this._closeButtonToolbarItem.createChild("div","close-button");closeButtonElement.addEventListener("click",InspectorFrontendHost.closeWindow.bind(InspectorFrontendHost),true);this._rightToolbarElement.appendChild(this._closeButtonToolbarItem);this.appendToRightToolbar(this._drawer.toggleButtonElement());this._history=[];this._historyIterator=-1;document.addEventListener("keydown",this._keyDown.bind(this),false);document.addEventListener("keypress",this._keyPress.bind(this),false);this._panelDescriptors={};this._openBracketIdentifiers=["U+005B","U+00DB"].keySet();this._closeBracketIdentifiers=["U+005D","U+00DD"].keySet();this._lastActivePanelSetting=WebInspector.settings.createSetting("lastActivePanel","elements");this._loadPanelDesciptors();};WebInspector.InspectorView.prototype={_loadPanelDesciptors:function()
2480 {WebInspector.startBatchUpdate();WebInspector.moduleManager.extensions(WebInspector.Panel).forEach(processPanelExtensions.bind(this));function processPanelExtensions(extension)
2481 {this.addPanel(new WebInspector.ModuleManagerExtensionPanelDescriptor(extension));}
2482 WebInspector.endBatchUpdate();},appendToLeftToolbar:function(element)
2483 {this._leftToolbarElement.appendChild(element);},appendToRightToolbar:function(element)
2484 {this._rightToolbarElement.insertBefore(element,this._closeButtonToolbarItem);},addPanel:function(panelDescriptor)
2485 {var panelName=panelDescriptor.name();this._panelDescriptors[panelName]=panelDescriptor;this._tabbedPane.appendTab(panelName,panelDescriptor.title(),new WebInspector.View());if(this._lastActivePanelSetting.get()===panelName)
2486 this._tabbedPane.selectTab(panelName);},panel:function(panelName)
2487 {var panelDescriptor=this._panelDescriptors[panelName];var panelOrder=this._tabbedPane.allTabs();if(!panelDescriptor&&panelOrder.length)
2488 panelDescriptor=this._panelDescriptors[panelOrder[0]];return panelDescriptor?panelDescriptor.panel():null;},showPanel:function(panelName)
2489 {var panel=this.panel(panelName);if(panel)
2490 this.setCurrentPanel(panel);return panel;},currentPanel:function()
2491 {return this._currentPanel;},showInitialPanel:function()
2492 {this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);this._tabSelected();this._drawer.initialPanelShown();},showDrawerEditor:function()
2493 {this._drawer.showDrawerEditor();},isDrawerEditorShown:function()
2494 {return this._drawer.isDrawerEditorShown();},hideDrawerEditor:function()
2495 {this._drawer.hideDrawerEditor();},setDrawerEditorAvailable:function(available)
2496 {this._drawer.setDrawerEditorAvailable(available);},_tabSelected:function()
2497 {var panelName=this._tabbedPane.selectedTabId;var panel=this._panelDescriptors[this._tabbedPane.selectedTabId].panel();this._tabbedPane.changeTabView(panelName,panel);this._currentPanel=panel;this._lastActivePanelSetting.set(panel.name);this._pushToHistory(panel.name);WebInspector.userMetrics.panelShown(panel.name);panel.focus();},setCurrentPanel:function(x)
2498 {if(this._currentPanel===x)
2499 return;this._tabbedPane.changeTabView(x.name,x);this._tabbedPane.selectTab(x.name);},closeViewInDrawer:function(id)
2500 {this._drawer.closeView(id);},showCloseableViewInDrawer:function(id,title,view)
2501 {this._drawer.showCloseableView(id,title,view);},showDrawer:function()
2502 {this._drawer.showDrawer();},drawerVisible:function()
2503 {return this._drawer.isShowing();},showViewInDrawer:function(id,immediate)
2504 {this._drawer.showView(id,immediate);},selectedViewInDrawer:function()
2505 {return this._drawer.selectedViewId();},closeDrawer:function()
2506 {this._drawer.closeDrawer();},defaultFocusedElement:function()
2507 {return this._currentPanel?this._currentPanel.defaultFocusedElement():null;},_keyPress:function(event)
2508 {if(event.charCode<32&&WebInspector.isWin())
2509 return;clearTimeout(this._keyDownTimer);delete this._keyDownTimer;},_keyDown:function(event)
2510 {if(!WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event))
2511 return;var keyboardEvent=(event);var panelShortcutEnabled=WebInspector.settings.shortcutPanelSwitch.get();if(panelShortcutEnabled&&!event.shiftKey&&!event.altKey){var panelIndex=-1;if(event.keyCode>0x30&&event.keyCode<0x3A)
2512 panelIndex=event.keyCode-0x31;else if(event.keyCode>0x60&&event.keyCode<0x6A&&keyboardEvent.location===KeyboardEvent.DOM_KEY_LOCATION_NUMPAD)
2513 panelIndex=event.keyCode-0x61;if(panelIndex!==-1){var panelName=this._tabbedPane.allTabs()[panelIndex];if(panelName){if(!WebInspector.Dialog.currentInstance())
2514 this.showPanel(panelName);event.consume(true);}
2515 return;}}
2516 if(!WebInspector.isWin()||(!this._openBracketIdentifiers[event.keyIdentifier]&&!this._closeBracketIdentifiers[event.keyIdentifier])){this._keyDownInternal(event);return;}
2517 this._keyDownTimer=setTimeout(this._keyDownInternal.bind(this,event),0);},_keyDownInternal:function(event)
2518 {var direction=0;if(this._openBracketIdentifiers[event.keyIdentifier])
2519 direction=-1;if(this._closeBracketIdentifiers[event.keyIdentifier])
2520 direction=1;if(!direction)
2521 return;if(!event.shiftKey&&!event.altKey){if(!WebInspector.Dialog.currentInstance())
2522 this._changePanelInDirection(direction);event.consume(true);return;}
2523 if(event.altKey&&this._moveInHistory(direction))
2524 event.consume(true)},_changePanelInDirection:function(direction)
2525 {var panelOrder=this._tabbedPane.allTabs();var index=panelOrder.indexOf(this.currentPanel().name);index=(index+panelOrder.length+direction)%panelOrder.length;this.showPanel(panelOrder[index]);},_moveInHistory:function(move)
2526 {var newIndex=this._historyIterator+move;if(newIndex>=this._history.length||newIndex<0)
2527 return false;this._inHistory=true;this._historyIterator=newIndex;if(!WebInspector.Dialog.currentInstance())
2528 this.setCurrentPanel(WebInspector.panels[this._history[this._historyIterator]]);delete this._inHistory;return true;},_pushToHistory:function(panelName)
2529 {if(this._inHistory)
2530 return;this._history.splice(this._historyIterator+1,this._history.length-this._historyIterator-1);if(!this._history.length||this._history[this._history.length-1]!==panelName)
2531 this._history.push(panelName);this._historyIterator=this._history.length-1;},onResize:function()
2532 {WebInspector.Dialog.modalHostRepositioned();},topResizerElement:function()
2533 {return this._tabbedPane.headerElement();},_createImagedCounterElementIfNeeded:function(count,id,styleName)
2534 {if(!count)
2535 return;var imageElement=this._errorWarningCountElement.createChild("div",styleName);var counterElement=this._errorWarningCountElement.createChild("span");counterElement.id=id;counterElement.textContent=count;},setErrorAndWarningCounts:function(errors,warnings)
2536 {if(this._errors===errors&&this._warnings===warnings)
2537 return;this._errors=errors;this._warnings=warnings;this._errorWarningCountElement.classList.toggle("hidden",!errors&&!warnings);this._errorWarningCountElement.removeChildren();this._createImagedCounterElementIfNeeded(errors,"error-count","error-icon-small");this._createImagedCounterElementIfNeeded(warnings,"warning-count","warning-icon-small");var errorString=errors?WebInspector.UIString("%d error%s",errors,errors>1?"s":""):"";var warningString=warnings?WebInspector.UIString("%d warning%s",warnings,warnings>1?"s":""):"";var commaString=errors&&warnings?", ":"";this._errorWarningCountElement.title=errorString+commaString+warningString;this._tabbedPane.headerResized();},__proto__:WebInspector.VBox.prototype};WebInspector.inspectorView;WebInspector.InspectorView.DrawerToggleActionDelegate=function()
2538 {}
2539 WebInspector.InspectorView.DrawerToggleActionDelegate.prototype={handleAction:function()
2540 {if(WebInspector.inspectorView.drawerVisible()){WebInspector.inspectorView.closeDrawer();return true;}
2541 if(!WebInspector.experimentsSettings.doNotOpenDrawerOnEsc.isEnabled()){WebInspector.inspectorView.showDrawer();return true;}
2542 return false;}}
2543 WebInspector.RootView=function()
2544 {WebInspector.VBox.call(this);this.markAsRoot();this.element.classList.add("root-view");this.element.setAttribute("spellcheck",false);window.addEventListener("resize",this.doResize.bind(this),true);this._onScrollBound=this._onScroll.bind(this);};WebInspector.RootView.prototype={attachToBody:function()
2545 {this.doResize();this.show(document.body);},_onScroll:function()
2546 {if(document.body.scrollTop!==0)
2547 document.body.scrollTop=0;if(document.body.scrollLeft!==0)
2548 document.body.scrollLeft=0;},doResize:function()
2549 {var size=this.minimumSize();var right=Math.min(0,window.innerWidth-size.width);this.element.style.right=right+"px";var bottom=Math.min(0,window.innerHeight-size.height);this.element.style.bottom=bottom+"px";if(window.innerWidth<size.width||window.innerHeight<size.height)
2550 window.addEventListener("scroll",this._onScrollBound,false);else
2551 window.removeEventListener("scroll",this._onScrollBound,false);WebInspector.VBox.prototype.doResize.call(this);this._onScroll();},__proto__:WebInspector.VBox.prototype};WebInspector.InspectedPagePlaceholder=function()
2552 {WebInspector.View.call(this);WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._onZoomChanged,this);this._margins={top:false,right:false,bottom:false,left:false};this.setMinimumSize(WebInspector.InspectedPagePlaceholder.Constraints.Width,WebInspector.InspectedPagePlaceholder.Constraints.Height);};WebInspector.InspectedPagePlaceholder.Constraints={Width:50,Height:50};WebInspector.InspectedPagePlaceholder.MarginValue=3;WebInspector.InspectedPagePlaceholder.prototype={_findMargins:function()
2553 {var margins={top:false,right:false,bottom:false,left:false};var adjacent={top:true,right:true,bottom:true,left:true};var view=this;while(view.parentView()){var parent=view.parentView();if(parent instanceof WebInspector.SplitView){var side=parent.sidebarSide();if(adjacent[side]&&!parent.hasCustomResizer())
2554 margins[side]=true;adjacent[side]=false;}
2555 view=parent;}
2556 if(this._margins.top!==margins.top||this._margins.left!==margins.left||this._margins.right!==margins.right||this._margins.bottom!==margins.bottom){this._margins=margins;this._updateMarginValue();}},_updateMarginValue:function()
2557 {var marginValue=Math.round(WebInspector.InspectedPagePlaceholder.MarginValue/WebInspector.zoomManager.zoomFactor())+"px ";var margins=this._margins.top?marginValue:"0 ";margins+=this._margins.right?marginValue:"0 ";margins+=this._margins.bottom?marginValue:"0 ";margins+=this._margins.left?marginValue:"0 ";this.element.style.margin=margins;},_onZoomChanged:function()
2558 {this._updateMarginValue();this._scheduleUpdate();},onResize:function()
2559 {this._findMargins();this._scheduleUpdate();},_scheduleUpdate:function()
2560 {var dockSide=WebInspector.dockController.dockSide();if(dockSide!==WebInspector.DockController.State.Undocked){if(this._updateId)
2561 window.cancelAnimationFrame(this._updateId);this._updateId=window.requestAnimationFrame(this._update.bind(this));}},_update:function()
2562 {delete this._updateId;var zoomFactor=WebInspector.zoomManager.zoomFactor();var marginValue=WebInspector.InspectedPagePlaceholder.MarginValue;var insets={top:this._margins.top?marginValue:0,left:this._margins.left?marginValue:0,right:this._margins.right?marginValue:0,bottom:this._margins.bottom?marginValue:0};var minSize={width:WebInspector.InspectedPagePlaceholder.Constraints.Width-Math.round(insets.left*zoomFactor)-Math.round(insets.right*zoomFactor),height:WebInspector.InspectedPagePlaceholder.Constraints.Height-Math.round(insets.top*zoomFactor)-Math.round(insets.bottom*zoomFactor)};var view=this;while(view){if((view instanceof WebInspector.SplitView)&&view.sidebarSide())
2563 insets[view.sidebarSide()]+=view.preferredSidebarSize();view=view.parentView();}
2564 var roundedInsets={top:Math.ceil(insets.top),left:Math.ceil(insets.left),right:Math.ceil(insets.right),bottom:Math.ceil(insets.bottom)};InspectorFrontendHost.setContentsResizingStrategy(roundedInsets,minSize);},__proto__:WebInspector.View.prototype};WebInspector.AdvancedSearchController=function()
2565 {this._shortcut=WebInspector.AdvancedSearchController.createShortcut();this._searchId=0;WebInspector.settings.advancedSearchConfig=WebInspector.settings.createSetting("advancedSearchConfig",new WebInspector.SearchConfig("",true,false));WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);}
2566 WebInspector.AdvancedSearchController.createShortcut=function()
2567 {if(WebInspector.isMac())
2568 return WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.Meta|WebInspector.KeyboardShortcut.Modifiers.Alt);else
2569 return WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.Ctrl|WebInspector.KeyboardShortcut.Modifiers.Shift);}
2570 WebInspector.AdvancedSearchController.prototype={handleShortcut:function(event)
2571 {if(WebInspector.KeyboardShortcut.makeKeyFromEvent(event)===this._shortcut.key){if(!this._searchView||!this._searchView.isShowing()||this._searchView._search!==document.activeElement){WebInspector.inspectorView.showPanel("sources");this.show();}else{WebInspector.inspectorView.closeDrawer();}
2572 event.consume(true);return true;}
2573 return false;},_frameNavigated:function()
2574 {this.resetSearch();},show:function()
2575 {var selection=window.getSelection();var queryCandidate;if(selection.rangeCount)
2576 queryCandidate=selection.toString().replace(/\r?\n.*/,"");if(!this._searchView||!this._searchView.isShowing())
2577 WebInspector.inspectorView.showViewInDrawer("search");if(queryCandidate)
2578 this._searchView._search.value=queryCandidate;this._searchView.focus();this.startIndexing();},_onIndexingFinished:function(finished)
2579 {delete this._isIndexing;this._searchView.indexingFinished(finished);if(!finished)
2580 delete this._pendingSearchConfig;if(!this._pendingSearchConfig)
2581 return;var searchConfig=this._pendingSearchConfig
2582 delete this._pendingSearchConfig;this._innerStartSearch(searchConfig);},startIndexing:function()
2583 {this._isIndexing=true;this._currentSearchScope=this._searchScopes()[0];if(this._progressIndicator)
2584 this._progressIndicator.done();this._progressIndicator=new WebInspector.ProgressIndicator();this._searchView.indexingStarted(this._progressIndicator);this._currentSearchScope.performIndexing(this._progressIndicator,this._onIndexingFinished.bind(this));},_onSearchResult:function(searchId,searchResult)
2585 {if(searchId!==this._searchId)
2586 return;this._searchView.addSearchResult(searchResult);if(!searchResult.searchMatches.length)
2587 return;if(!this._searchResultsPane)
2588 this._searchResultsPane=this._currentSearchScope.createSearchResultsPane(this._searchConfig);this._searchView.resultsPane=this._searchResultsPane;this._searchResultsPane.addSearchResult(searchResult);},_onSearchFinished:function(searchId,finished)
2589 {if(searchId!==this._searchId)
2590 return;if(!this._searchResultsPane)
2591 this._searchView.nothingFound();this._searchView.searchFinished(finished);delete this._searchConfig;},startSearch:function(searchConfig)
2592 {this.resetSearch();++this._searchId;if(!this._isIndexing)
2593 this.startIndexing();this._pendingSearchConfig=searchConfig;},_innerStartSearch:function(searchConfig)
2594 {this._searchConfig=searchConfig;this._currentSearchScope=this._searchScopes()[0];if(this._progressIndicator)
2595 this._progressIndicator.done();this._progressIndicator=new WebInspector.ProgressIndicator();this._searchView.searchStarted(this._progressIndicator);this._currentSearchScope.performSearch(searchConfig,this._progressIndicator,this._onSearchResult.bind(this,this._searchId),this._onSearchFinished.bind(this,this._searchId));},resetSearch:function()
2596 {this.stopSearch();if(this._searchResultsPane){this._searchView.resetResults();delete this._searchResultsPane;}},stopSearch:function()
2597 {if(this._progressIndicator)
2598 this._progressIndicator.cancel();if(this._currentSearchScope)
2599 this._currentSearchScope.stopSearch();delete this._searchConfig;},_searchScopes:function()
2600 {return(WebInspector.moduleManager.instances(WebInspector.SearchScope));}}
2601 WebInspector.SearchView=function(controller)
2602 {WebInspector.VBox.call(this);this._controller=WebInspector.advancedSearchController;WebInspector.advancedSearchController._searchView=this;this.element.classList.add("search-view");this._searchPanelElement=this.element.createChild("div","search-drawer-header");this._searchPanelElement.addEventListener("keydown",this._onKeyDown.bind(this),false);this._searchResultsElement=this.element.createChild("div");this._searchResultsElement.className="search-results";this._search=this._searchPanelElement.createChild("input");this._search.placeholder=WebInspector.UIString("Search sources");this._search.setAttribute("type","text");this._search.classList.add("search-config-search");this._search.setAttribute("results","0");this._search.setAttribute("size",30);this._ignoreCaseLabel=this._searchPanelElement.createChild("label");this._ignoreCaseLabel.classList.add("search-config-label");this._ignoreCaseCheckbox=this._ignoreCaseLabel.createChild("input");this._ignoreCaseCheckbox.setAttribute("type","checkbox");this._ignoreCaseCheckbox.classList.add("search-config-checkbox");this._ignoreCaseLabel.appendChild(document.createTextNode(WebInspector.UIString("Ignore case")));this._regexLabel=this._searchPanelElement.createChild("label");this._regexLabel.classList.add("search-config-label");this._regexCheckbox=this._regexLabel.createChild("input");this._regexCheckbox.setAttribute("type","checkbox");this._regexCheckbox.classList.add("search-config-checkbox");this._regexLabel.appendChild(document.createTextNode(WebInspector.UIString("Regular expression")));this._searchStatusBarElement=this.element.createChild("div","search-status-bar-summary");this._searchMessageElement=this._searchStatusBarElement.createChild("span");this._searchResultsMessageElement=document.createElement("span");this._load();}
2603 WebInspector.SearchView.maxQueriesCount=20;WebInspector.SearchView.prototype={get searchConfig()
2604 {return new WebInspector.SearchConfig(this._search.value,this._ignoreCaseCheckbox.checked,this._regexCheckbox.checked);},set resultsPane(resultsPane)
2605 {this.resetResults();this._searchResultsElement.appendChild(resultsPane.element);},searchStarted:function(progressIndicator)
2606 {this.resetResults();this._resetCounters();this._searchMessageElement.textContent=WebInspector.UIString("Searching...");progressIndicator.show(this._searchStatusBarElement);this._updateSearchResultsMessage();if(!this._searchingView)
2607 this._searchingView=new WebInspector.EmptyView(WebInspector.UIString("Searching..."));this._searchingView.show(this._searchResultsElement);},indexingStarted:function(progressIndicator)
2608 {this._searchMessageElement.textContent=WebInspector.UIString("Indexing...");progressIndicator.show(this._searchStatusBarElement);},indexingFinished:function(finished)
2609 {this._searchMessageElement.textContent=finished?"":WebInspector.UIString("Indexing interrupted.");},_updateSearchResultsMessage:function()
2610 {if(this._searchMatchesCount&&this._searchResultsCount)
2611 this._searchResultsMessageElement.textContent=WebInspector.UIString("Found %d matches in %d files.",this._searchMatchesCount,this._nonEmptySearchResultsCount);else
2612 this._searchResultsMessageElement.textContent="";},resetResults:function()
2613 {if(this._searchingView)
2614 this._searchingView.detach();if(this._notFoundView)
2615 this._notFoundView.detach();this._searchResultsElement.removeChildren();},_resetCounters:function()
2616 {this._searchMatchesCount=0;this._searchResultsCount=0;this._nonEmptySearchResultsCount=0;},nothingFound:function()
2617 {this.resetResults();if(!this._notFoundView)
2618 this._notFoundView=new WebInspector.EmptyView(WebInspector.UIString("No matches found."));this._notFoundView.show(this._searchResultsElement);this._searchResultsMessageElement.textContent=WebInspector.UIString("No matches found.");},addSearchResult:function(searchResult)
2619 {this._searchMatchesCount+=searchResult.searchMatches.length;this._searchResultsCount++;if(searchResult.searchMatches.length)
2620 this._nonEmptySearchResultsCount++;this._updateSearchResultsMessage();},searchFinished:function(finished)
2621 {this._searchMessageElement.textContent=finished?WebInspector.UIString("Search finished."):WebInspector.UIString("Search interrupted.");},focus:function()
2622 {WebInspector.setCurrentFocusElement(this._search);this._search.select();},willHide:function()
2623 {this._controller.stopSearch();},_onKeyDown:function(event)
2624 {switch(event.keyCode){case WebInspector.KeyboardShortcut.Keys.Enter.code:this._onAction();break;}},_save:function()
2625 {WebInspector.settings.advancedSearchConfig.set(this.searchConfig);},_load:function()
2626 {var searchConfig=WebInspector.settings.advancedSearchConfig.get();this._search.value=searchConfig.query;this._ignoreCaseCheckbox.checked=searchConfig.ignoreCase;this._regexCheckbox.checked=searchConfig.isRegex;},_onAction:function()
2627 {var searchConfig=this.searchConfig;if(!searchConfig.query||!searchConfig.query.length)
2628 return;this._save();this._controller.startSearch(searchConfig);},__proto__:WebInspector.VBox.prototype}
2629 WebInspector.SearchConfig=function(query,ignoreCase,isRegex)
2630 {this.query=query;this.ignoreCase=ignoreCase;this.isRegex=isRegex;this._parse();}
2631 WebInspector.SearchConfig.prototype={_parse:function()
2632 {var filePattern="file:(([^\\\\ ]|\\\\.)+)";var quotedPattern="\"(([^\\\\\"]|\\\\.)+)\"";var unquotedPattern="(([^\\\\ ]|\\\\.)+)";var pattern="("+filePattern+")|("+quotedPattern+")|("+unquotedPattern+")";var regexp=new RegExp(pattern,"g");var queryParts=this.query.match(regexp)||[];this._fileQueries=[];this._queries=[];for(var i=0;i<queryParts.length;++i){var queryPart=queryParts[i];if(!queryPart)
2633 continue;if(queryPart.startsWith("file:")){this._fileQueries.push(this._parseFileQuery(queryPart));continue;}
2634 if(queryPart.startsWith("\"")){if(!queryPart.endsWith("\""))
2635 continue;this._queries.push(this._parseQuotedQuery(queryPart));continue;}
2636 this._queries.push(this._parseUnquotedQuery(queryPart));}},fileQueries:function()
2637 {return this._fileQueries;},queries:function()
2638 {return this._queries;},_parseUnquotedQuery:function(query)
2639 {return query.replace(/\\(.)/g,"$1");},_parseQuotedQuery:function(query)
2640 {return query.substring(1,query.length-1).replace(/\\(.)/g,"$1");},_parseFileQuery:function(query)
2641 {query=query.substr("file:".length);var result="";for(var i=0;i<query.length;++i){var char=query[i];if(char==="*"){result+=".*";}else if(char==="\\"){++i;var nextChar=query[i];if(nextChar===" ")
2642 result+=" ";}else{if(String.regexSpecialCharacters().indexOf(query.charAt(i))!==-1)
2643 result+="\\";result+=query.charAt(i);}}
2644 return result;}}
2645 WebInspector.SearchScope=function()
2646 {}
2647 WebInspector.SearchScope.prototype={performSearch:function(searchConfig,progress,searchResultCallback,searchFinishedCallback){},performIndexing:function(progressIndicator,callback){},stopSearch:function(){},createSearchResultsPane:function(searchConfig){}}
2648 WebInspector.SearchResultsPane=function(searchConfig)
2649 {this._searchConfig=searchConfig;this.element=document.createElement("div");}
2650 WebInspector.SearchResultsPane.prototype={get searchConfig()
2651 {return this._searchConfig;},addSearchResult:function(searchResult){}}
2652 WebInspector.FileBasedSearchResultsPane=function(searchConfig)
2653 {WebInspector.SearchResultsPane.call(this,searchConfig);this._searchResults=[];this.element.id="search-results-pane-file-based";this._treeOutlineElement=document.createElement("ol");this._treeOutlineElement.className="search-results-outline-disclosure";this.element.appendChild(this._treeOutlineElement);this._treeOutline=new TreeOutline(this._treeOutlineElement);this._matchesExpandedCount=0;}
2654 WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount=20;WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce=20;WebInspector.FileBasedSearchResultsPane.prototype={_createAnchor:function(uiSourceCode,lineNumber,columnNumber)
2655 {return WebInspector.Linkifier.linkifyUsingRevealer(new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber),"",uiSourceCode.url,lineNumber);},addSearchResult:function(searchResult)
2656 {this._searchResults.push(searchResult);var uiSourceCode=searchResult.uiSourceCode;if(!uiSourceCode)
2657 return;var searchMatches=searchResult.searchMatches;var fileTreeElement=this._addFileTreeElement(uiSourceCode.fullDisplayName(),searchMatches.length,this._searchResults.length-1);},_fileTreeElementExpanded:function(searchResult,fileTreeElement)
2658 {if(fileTreeElement._initialized)
2659 return;var toIndex=Math.min(searchResult.searchMatches.length,WebInspector.FileBasedSearchResultsPane.fileMatchesShownAtOnce);if(toIndex<searchResult.searchMatches.length){this._appendSearchMatches(fileTreeElement,searchResult,0,toIndex-1);this._appendShowMoreMatchesElement(fileTreeElement,searchResult,toIndex-1);}else
2660 this._appendSearchMatches(fileTreeElement,searchResult,0,toIndex);fileTreeElement._initialized=true;},_appendSearchMatches:function(fileTreeElement,searchResult,fromIndex,toIndex)
2661 {var uiSourceCode=searchResult.uiSourceCode;var searchMatches=searchResult.searchMatches;var queries=this._searchConfig.queries();var regexes=[];for(var i=0;i<queries.length;++i)
2662 regexes.push(createSearchRegex(queries[i],!this._searchConfig.ignoreCase,this._searchConfig.isRegex));for(var i=fromIndex;i<toIndex;++i){var lineNumber=searchMatches[i].lineNumber;var lineContent=searchMatches[i].lineContent;var matchRanges=[];for(var j=0;j<regexes.length;++j)
2663 matchRanges=matchRanges.concat(this._regexMatchRanges(lineContent,regexes[j]));var anchor=this._createAnchor(uiSourceCode,lineNumber,matchRanges[0].offset);var numberString=numberToStringWithSpacesPadding(lineNumber+1,4);var lineNumberSpan=document.createElement("span");lineNumberSpan.classList.add("search-match-line-number");lineNumberSpan.textContent=numberString;anchor.appendChild(lineNumberSpan);var contentSpan=this._createContentSpan(lineContent,matchRanges);anchor.appendChild(contentSpan);var searchMatchElement=new TreeElement("");searchMatchElement.selectable=false;fileTreeElement.appendChild(searchMatchElement);searchMatchElement.listItemElement.className="search-match source-code";searchMatchElement.listItemElement.appendChild(anchor);}},_appendShowMoreMatchesElement:function(fileTreeElement,searchResult,startMatchIndex)
2664 {var matchesLeftCount=searchResult.searchMatches.length-startMatchIndex;var showMoreMatchesText=WebInspector.UIString("Show all matches (%d more).",matchesLeftCount);var showMoreMatchesElement=new TreeElement(showMoreMatchesText);fileTreeElement.appendChild(showMoreMatchesElement);showMoreMatchesElement.listItemElement.classList.add("show-more-matches");showMoreMatchesElement.onselect=this._showMoreMatchesElementSelected.bind(this,searchResult,startMatchIndex,showMoreMatchesElement);},_showMoreMatchesElementSelected:function(searchResult,startMatchIndex,showMoreMatchesElement)
2665 {var fileTreeElement=showMoreMatchesElement.parent;fileTreeElement.removeChild(showMoreMatchesElement);this._appendSearchMatches(fileTreeElement,searchResult,startMatchIndex,searchResult.searchMatches.length);return false;},_addFileTreeElement:function(fileName,searchMatchesCount,searchResultIndex)
2666 {var fileTreeElement=new TreeElement("",null,true);fileTreeElement.toggleOnClick=true;fileTreeElement.selectable=false;this._treeOutline.appendChild(fileTreeElement);fileTreeElement.listItemElement.classList.add("search-result");var fileNameSpan=document.createElement("span");fileNameSpan.className="search-result-file-name";fileNameSpan.textContent=fileName;fileTreeElement.listItemElement.appendChild(fileNameSpan);var matchesCountSpan=document.createElement("span");matchesCountSpan.className="search-result-matches-count";if(searchMatchesCount===1)
2667 matchesCountSpan.textContent=WebInspector.UIString("(%d match)",searchMatchesCount);else
2668 matchesCountSpan.textContent=WebInspector.UIString("(%d matches)",searchMatchesCount);fileTreeElement.listItemElement.appendChild(matchesCountSpan);var searchResult=this._searchResults[searchResultIndex];fileTreeElement.onexpand=this._fileTreeElementExpanded.bind(this,searchResult,fileTreeElement);if(this._matchesExpandedCount<WebInspector.FileBasedSearchResultsPane.matchesExpandedByDefaultCount)
2669 fileTreeElement.expand();this._matchesExpandedCount+=searchResult.searchMatches.length;return fileTreeElement;},_regexMatchRanges:function(lineContent,regex)
2670 {regex.lastIndex=0;var match;var offset=0;var matchRanges=[];while((regex.lastIndex<lineContent.length)&&(match=regex.exec(lineContent)))
2671 matchRanges.push(new WebInspector.SourceRange(match.index,match[0].length));return matchRanges;},_createContentSpan:function(lineContent,matchRanges)
2672 {var contentSpan=document.createElement("span");contentSpan.className="search-match-content";contentSpan.textContent=lineContent;WebInspector.highlightRangesWithStyleClass(contentSpan,matchRanges,"highlighted-match");return contentSpan;},__proto__:WebInspector.SearchResultsPane.prototype}
2673 WebInspector.FileBasedSearchResultsPane.SearchResult=function(uiSourceCode,searchMatches){this.uiSourceCode=uiSourceCode;this.searchMatches=searchMatches;}
2674 WebInspector.advancedSearchController;WebInspector.TimelineGrid=function()
2675 {this.element=document.createElement("div");this._dividersElement=this.element.createChild("div","resources-dividers");this._gridHeaderElement=document.createElement("div");this._gridHeaderElement.id="timeline-grid-header";this._eventDividersElement=this._gridHeaderElement.createChild("div","resources-event-dividers");this._dividersLabelBarElement=this._gridHeaderElement.createChild("div","resources-dividers-label-bar");this.element.appendChild(this._gridHeaderElement);this._leftCurtainElement=this.element.createChild("div","timeline-cpu-curtain-left");this._rightCurtainElement=this.element.createChild("div","timeline-cpu-curtain-right");}
2676 WebInspector.TimelineGrid.calculateDividerOffsets=function(calculator,clientWidth)
2677 {const minGridSlicePx=64;const gridFreeZoneAtLeftPx=50;var dividersCount=clientWidth/minGridSlicePx;var gridSliceTime=calculator.boundarySpan()/dividersCount;var pixelsPerTime=clientWidth/calculator.boundarySpan();var logGridSliceTime=Math.ceil(Math.log(gridSliceTime)/Math.LN10);gridSliceTime=Math.pow(10,logGridSliceTime);if(gridSliceTime*pixelsPerTime>=5*minGridSlicePx)
2678 gridSliceTime=gridSliceTime/5;if(gridSliceTime*pixelsPerTime>=2*minGridSlicePx)
2679 gridSliceTime=gridSliceTime/2;var firstDividerTime=Math.ceil((calculator.minimumBoundary()-calculator.zeroTime())/gridSliceTime)*gridSliceTime+calculator.zeroTime();var lastDividerTime=calculator.maximumBoundary();if(calculator.paddingLeft()>0)
2680 lastDividerTime=lastDividerTime+minGridSlicePx/pixelsPerTime;dividersCount=Math.ceil((lastDividerTime-firstDividerTime)/gridSliceTime);var skipLeftmostDividers=calculator.paddingLeft()===0;if(!gridSliceTime)
2681 dividersCount=0;var offsets=[];for(var i=0;i<dividersCount;++i){var left=calculator.computePosition(firstDividerTime+gridSliceTime*i);if(skipLeftmostDividers&&left<gridFreeZoneAtLeftPx)
2682 continue;offsets.push(firstDividerTime+gridSliceTime*i);}
2683 return{offsets:offsets,precision:Math.max(0,-Math.floor(Math.log(gridSliceTime*1.01)/Math.LN10))};}
2684 WebInspector.TimelineGrid.drawCanvasGrid=function(canvas,calculator,dividerOffsets)
2685 {var context=canvas.getContext("2d");context.save();var ratio=window.devicePixelRatio;context.scale(ratio,ratio);context.translate(0.5,0.5);var printDeltas=!!dividerOffsets;var width=canvas.width/window.devicePixelRatio;var height=canvas.height/window.devicePixelRatio;var precision=0;if(!dividerOffsets){var dividersData=WebInspector.TimelineGrid.calculateDividerOffsets(calculator,width);dividerOffsets=dividersData.offsets;precision=dividersData.precision;}
2686 context.fillStyle="#333";context.strokeStyle="rgba(0, 0, 0, 0.1)";context.textBaseline="hanging";context.font=(printDeltas?"italic bold 11px ":" 11px ")+WebInspector.fontFamily();context.lineWidth=1;const minWidthForTitle=60;var lastPosition=0;var time=0;var lastTime=0;var paddingRight=4;var paddingTop=3;for(var i=0;i<dividerOffsets.length;++i){time=dividerOffsets[i];var position=calculator.computePosition(time);context.beginPath();if(position-lastPosition>minWidthForTitle){if(!printDeltas||i!==0){var text=printDeltas?calculator.formatTime(calculator.zeroTime()+time-lastTime):calculator.formatTime(time,precision);var textWidth=context.measureText(text).width;var textPosition=printDeltas?(position+lastPosition-textWidth)/2:position-textWidth-paddingRight;context.fillText(text,textPosition,paddingTop);}}
2687 context.moveTo(position,0);context.lineTo(position,height);context.stroke();lastTime=time;lastPosition=position;}
2688 context.restore();},WebInspector.TimelineGrid.prototype={get dividersElement()
2689 {return this._dividersElement;},get dividersLabelBarElement()
2690 {return this._dividersLabelBarElement;},removeDividers:function()
2691 {this._dividersElement.removeChildren();this._dividersLabelBarElement.removeChildren();},updateDividers:function(calculator,dividerOffsets,printDeltas)
2692 {var precision=0;if(!dividerOffsets){var dividersData=WebInspector.TimelineGrid.calculateDividerOffsets(calculator,this._dividersElement.clientWidth);dividerOffsets=dividersData.offsets;precision=dividersData.precision;printDeltas=false;}
2693 var dividersElementClientWidth=this._dividersElement.clientWidth;var divider=this._dividersElement.firstChild;var dividerLabelBar=this._dividersLabelBarElement.firstChild;const minWidthForTitle=60;var lastPosition=0;var lastTime=0;for(var i=0;i<dividerOffsets.length;++i){if(!divider){divider=document.createElement("div");divider.className="resources-divider";this._dividersElement.appendChild(divider);dividerLabelBar=document.createElement("div");dividerLabelBar.className="resources-divider";var label=document.createElement("div");label.className="resources-divider-label";dividerLabelBar._labelElement=label;dividerLabelBar.appendChild(label);this._dividersLabelBarElement.appendChild(dividerLabelBar);}
2694 var time=dividerOffsets[i];var position=calculator.computePosition(time);if(position-lastPosition>minWidthForTitle)
2695 dividerLabelBar._labelElement.textContent=printDeltas?calculator.formatTime(time-lastTime):calculator.formatTime(time,precision);else
2696 dividerLabelBar._labelElement.textContent="";if(printDeltas)
2697 dividerLabelBar._labelElement.style.width=Math.ceil(position-lastPosition)+"px";else
2698 dividerLabelBar._labelElement.style.removeProperty("width");lastPosition=position;lastTime=time;var percentLeft=100*position/dividersElementClientWidth;divider.style.left=percentLeft+"%";dividerLabelBar.style.left=percentLeft+"%";divider=divider.nextSibling;dividerLabelBar=dividerLabelBar.nextSibling;}
2699 while(divider){var nextDivider=divider.nextSibling;this._dividersElement.removeChild(divider);divider=nextDivider;}
2700 while(dividerLabelBar){var nextDivider=dividerLabelBar.nextSibling;this._dividersLabelBarElement.removeChild(dividerLabelBar);dividerLabelBar=nextDivider;}
2701 return true;},addEventDivider:function(divider)
2702 {this._eventDividersElement.appendChild(divider);},addEventDividers:function(dividers)
2703 {this._gridHeaderElement.removeChild(this._eventDividersElement);for(var i=0;i<dividers.length;++i){if(dividers[i])
2704 this._eventDividersElement.appendChild(dividers[i]);}
2705 this._gridHeaderElement.appendChild(this._eventDividersElement);},removeEventDividers:function()
2706 {this._eventDividersElement.removeChildren();},hideEventDividers:function()
2707 {this._eventDividersElement.classList.add("hidden");},showEventDividers:function()
2708 {this._eventDividersElement.classList.remove("hidden");},hideDividers:function()
2709 {this._dividersElement.classList.add("hidden");},showDividers:function()
2710 {this._dividersElement.classList.remove("hidden");},hideCurtains:function()
2711 {this._leftCurtainElement.classList.add("hidden");this._rightCurtainElement.classList.add("hidden");},showCurtains:function(gapOffset,gapWidth)
2712 {this._leftCurtainElement.style.width=gapOffset+"px";this._leftCurtainElement.classList.remove("hidden");this._rightCurtainElement.style.left=(gapOffset+gapWidth)+"px";this._rightCurtainElement.classList.remove("hidden");},setScrollAndDividerTop:function(scrollTop,dividersTop)
2713 {this._dividersLabelBarElement.style.top=scrollTop+"px";this._eventDividersElement.style.top=scrollTop+"px";this._leftCurtainElement.style.top=scrollTop+"px";this._rightCurtainElement.style.top=scrollTop+"px";}}
2714 WebInspector.TimelineGrid.Calculator=function(){}
2715 WebInspector.TimelineGrid.Calculator.prototype={paddingLeft:function(){},computePosition:function(time){},formatTime:function(time,precision){},minimumBoundary:function(){},zeroTime:function(){},maximumBoundary:function(){},boundarySpan:function(){}}
2716 WebInspector.OverviewGrid=function(prefix)
2717 {this.element=document.createElement("div");this.element.id=prefix+"-overview-container";this._grid=new WebInspector.TimelineGrid();this._grid.element.id=prefix+"-overview-grid";this._grid.setScrollAndDividerTop(0,0);this.element.appendChild(this._grid.element);this._window=new WebInspector.OverviewGrid.Window(this.element,this._grid.dividersLabelBarElement);}
2718 WebInspector.OverviewGrid.prototype={clientWidth:function()
2719 {return this.element.clientWidth;},updateDividers:function(calculator)
2720 {this._grid.updateDividers(calculator);},addEventDividers:function(dividers)
2721 {this._grid.addEventDividers(dividers);},removeEventDividers:function()
2722 {this._grid.removeEventDividers();},setWindowPosition:function(start,end)
2723 {this._window._setWindowPosition(start,end);},reset:function()
2724 {this._window.reset();},windowLeft:function()
2725 {return this._window.windowLeft;},windowRight:function()
2726 {return this._window.windowRight;},setWindow:function(left,right)
2727 {this._window._setWindow(left,right);},addEventListener:function(eventType,listener,thisObject)
2728 {this._window.addEventListener(eventType,listener,thisObject);},zoom:function(zoomFactor,referencePoint)
2729 {this._window._zoom(zoomFactor,referencePoint);},setResizeEnabled:function(enabled)
2730 {this._window._setEnabled(!!enabled);}}
2731 WebInspector.OverviewGrid.MinSelectableSize=14;WebInspector.OverviewGrid.WindowScrollSpeedFactor=.3;WebInspector.OverviewGrid.ResizerOffset=3.5;WebInspector.OverviewGrid.Window=function(parentElement,dividersLabelBarElement)
2732 {this._parentElement=parentElement;this._dividersLabelBarElement=dividersLabelBarElement;WebInspector.installDragHandle(this._parentElement,this._startWindowSelectorDragging.bind(this),this._windowSelectorDragging.bind(this),this._endWindowSelectorDragging.bind(this),"ew-resize",null);WebInspector.installDragHandle(this._dividersLabelBarElement,this._startWindowDragging.bind(this),this._windowDragging.bind(this),null,"move");this.windowLeft=0.0;this.windowRight=1.0;this._parentElement.addEventListener("mousewheel",this._onMouseWheel.bind(this),true);this._parentElement.addEventListener("dblclick",this._resizeWindowMaximum.bind(this),true);this._overviewWindowElement=parentElement.createChild("div","overview-grid-window");this._overviewWindowBordersElement=parentElement.createChild("div","overview-grid-window-rulers");parentElement.createChild("div","overview-grid-dividers-background");this._leftResizeElement=parentElement.createChild("div","overview-grid-window-resizer");this._leftResizeElement.style.left=0;WebInspector.installDragHandle(this._leftResizeElement,this._resizerElementStartDragging.bind(this),this._leftResizeElementDragging.bind(this),null,"ew-resize");this._rightResizeElement=parentElement.createChild("div","overview-grid-window-resizer overview-grid-window-resizer-right");this._rightResizeElement.style.right=0;WebInspector.installDragHandle(this._rightResizeElement,this._resizerElementStartDragging.bind(this),this._rightResizeElementDragging.bind(this),null,"ew-resize");this._setEnabled(true);}
2733 WebInspector.OverviewGrid.Events={WindowChanged:"WindowChanged"}
2734 WebInspector.OverviewGrid.Window.prototype={reset:function()
2735 {this.windowLeft=0.0;this.windowRight=1.0;this._overviewWindowElement.style.left="0%";this._overviewWindowElement.style.width="100%";this._overviewWindowBordersElement.style.left="0%";this._overviewWindowBordersElement.style.right="0%";this._leftResizeElement.style.left="0%";this._rightResizeElement.style.left="100%";this._setEnabled(true);},_setEnabled:function(enabled)
2736 {enabled=!!enabled;if(this._enabled===enabled)
2737 return;this._enabled=enabled;},_resizerElementStartDragging:function(event)
2738 {if(!this._enabled)
2739 return false;this._resizerParentOffsetLeft=event.pageX-event.offsetX-event.target.offsetLeft;event.preventDefault();return true;},_leftResizeElementDragging:function(event)
2740 {this._resizeWindowLeft(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_rightResizeElementDragging:function(event)
2741 {this._resizeWindowRight(event.pageX-this._resizerParentOffsetLeft);event.preventDefault();},_startWindowSelectorDragging:function(event)
2742 {if(!this._enabled)
2743 return false;this._offsetLeft=this._parentElement.totalOffsetLeft();var position=event.x-this._offsetLeft;this._overviewWindowSelector=new WebInspector.OverviewGrid.WindowSelector(this._parentElement,position);return true;},_windowSelectorDragging:function(event)
2744 {this._overviewWindowSelector._updatePosition(event.x-this._offsetLeft);event.preventDefault();},_endWindowSelectorDragging:function(event)
2745 {var window=this._overviewWindowSelector._close(event.x-this._offsetLeft);delete this._overviewWindowSelector;if(window.end===window.start){var middle=window.end;window.start=Math.max(0,middle-WebInspector.OverviewGrid.MinSelectableSize/2);window.end=Math.min(this._parentElement.clientWidth,middle+WebInspector.OverviewGrid.MinSelectableSize/2);}else if(window.end-window.start<WebInspector.OverviewGrid.MinSelectableSize){if(this._parentElement.clientWidth-window.end>WebInspector.OverviewGrid.MinSelectableSize)
2746 window.end=window.start+WebInspector.OverviewGrid.MinSelectableSize;else
2747 window.start=window.end-WebInspector.OverviewGrid.MinSelectableSize;}
2748 this._setWindowPosition(window.start,window.end);},_startWindowDragging:function(event)
2749 {this._dragStartPoint=event.pageX;this._dragStartLeft=this.windowLeft;this._dragStartRight=this.windowRight;return true;},_windowDragging:function(event)
2750 {event.preventDefault();var delta=(event.pageX-this._dragStartPoint)/this._parentElement.clientWidth;if(this._dragStartLeft+delta<0)
2751 delta=-this._dragStartLeft;if(this._dragStartRight+delta>1)
2752 delta=1-this._dragStartRight;this._setWindow(this._dragStartLeft+delta,this._dragStartRight+delta);},_resizeWindowLeft:function(start)
2753 {if(start<10)
2754 start=0;else if(start>this._rightResizeElement.offsetLeft-4)
2755 start=this._rightResizeElement.offsetLeft-4;this._setWindowPosition(start,null);},_resizeWindowRight:function(end)
2756 {if(end>this._parentElement.clientWidth-10)
2757 end=this._parentElement.clientWidth;else if(end<this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize)
2758 end=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.MinSelectableSize;this._setWindowPosition(null,end);},_resizeWindowMaximum:function()
2759 {this._setWindowPosition(0,this._parentElement.clientWidth);},_setWindow:function(windowLeft,windowRight)
2760 {var left=windowLeft;var right=windowRight;var width=windowRight-windowLeft;var widthInPixels=width*this._parentElement.clientWidth;var minWidthInPixels=WebInspector.OverviewGrid.MinSelectableSize/2;if(widthInPixels<minWidthInPixels){var factor=minWidthInPixels/widthInPixels;left=((windowRight+windowLeft)-width*factor)/2;right=((windowRight+windowLeft)+width*factor)/2;}
2761 this.windowLeft=windowLeft;this._leftResizeElement.style.left=left*100+"%";this.windowRight=windowRight;this._rightResizeElement.style.left=right*100+"%";this._overviewWindowElement.style.left=left*100+"%";this._overviewWindowBordersElement.style.left=left*100+"%";this._overviewWindowElement.style.width=(right-left)*100+"%";this._overviewWindowBordersElement.style.right=(1-right)*100+"%";this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged);},_setWindowPosition:function(start,end)
2762 {var clientWidth=this._parentElement.clientWidth;var windowLeft=typeof start==="number"?start/clientWidth:this.windowLeft;var windowRight=typeof end==="number"?end/clientWidth:this.windowRight;this._setWindow(windowLeft,windowRight);},_onMouseWheel:function(event)
2763 {if(typeof event.wheelDeltaY==="number"&&event.wheelDeltaY){const zoomFactor=1.1;const mouseWheelZoomSpeed=1/120;var reference=event.offsetX/event.target.clientWidth;this._zoom(Math.pow(zoomFactor,-event.wheelDeltaY*mouseWheelZoomSpeed),reference);}
2764 if(typeof event.wheelDeltaX==="number"&&event.wheelDeltaX){var offset=Math.round(event.wheelDeltaX*WebInspector.OverviewGrid.WindowScrollSpeedFactor);var windowLeft=this._leftResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;var windowRight=this._rightResizeElement.offsetLeft+WebInspector.OverviewGrid.ResizerOffset;if(windowLeft-offset<0)
2765 offset=windowLeft;if(windowRight-offset>this._parentElement.clientWidth)
2766 offset=windowRight-this._parentElement.clientWidth;this._setWindowPosition(windowLeft-offset,windowRight-offset);event.preventDefault();}},_zoom:function(factor,reference)
2767 {var left=this.windowLeft;var right=this.windowRight;var windowSize=right-left;var newWindowSize=factor*windowSize;if(newWindowSize>1){newWindowSize=1;factor=newWindowSize/windowSize;}
2768 left=reference+(left-reference)*factor;left=Number.constrain(left,0,1-newWindowSize);right=reference+(right-reference)*factor;right=Number.constrain(right,newWindowSize,1);this._setWindow(left,right);},__proto__:WebInspector.Object.prototype}
2769 WebInspector.OverviewGrid.WindowSelector=function(parent,position)
2770 {this._startPosition=position;this._width=parent.offsetWidth;this._windowSelector=document.createElement("div");this._windowSelector.className="overview-grid-window-selector";this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";parent.appendChild(this._windowSelector);}
2771 WebInspector.OverviewGrid.WindowSelector.prototype={_close:function(position)
2772 {position=Math.max(0,Math.min(position,this._width));this._windowSelector.remove();return this._startPosition<position?{start:this._startPosition,end:position}:{start:position,end:this._startPosition};},_updatePosition:function(position)
2773 {position=Math.max(0,Math.min(position,this._width));if(position<this._startPosition){this._windowSelector.style.left=position+"px";this._windowSelector.style.right=this._width-this._startPosition+"px";}else{this._windowSelector.style.left=this._startPosition+"px";this._windowSelector.style.right=this._width-position+"px";}}}
2774 WebInspector.ContentProvider=function(){}
2775 WebInspector.ContentProvider.prototype={contentURL:function(){},contentType:function(){},requestContent:function(callback){},searchInContent:function(query,caseSensitive,isRegex,callback){}}
2776 WebInspector.ContentProvider.SearchMatch=function(lineNumber,lineContent){this.lineNumber=lineNumber;this.lineContent=lineContent;}
2777 WebInspector.ContentProvider.performSearchInContent=function(content,query,caseSensitive,isRegex)
2778 {var regex=createSearchRegex(query,caseSensitive,isRegex);var contentString=new String(content);var result=[];for(var i=0;i<contentString.lineCount();++i){var lineContent=contentString.lineAt(i);regex.lastIndex=0;if(regex.exec(lineContent))
2779 result.push(new WebInspector.ContentProvider.SearchMatch(i,lineContent));}
2780 return result;}
2781 WebInspector.Resource=function(request,url,documentURL,frameId,loaderId,type,mimeType,isHidden)
2782 {this._request=request;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._type=type||WebInspector.resourceTypes.Other;this._mimeType=mimeType;this._isHidden=isHidden;this._content;this._contentEncoded;this._pendingContentCallbacks=[];if(this._request&&!this._request.finished)
2783 this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);}
2784 WebInspector.Resource.Events={MessageAdded:"message-added",MessagesCleared:"messages-cleared",}
2785 WebInspector.Resource.prototype={get request()
2786 {return this._request;},get url()
2787 {return this._url;},set url(x)
2788 {this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);},get parsedURL()
2789 {return this._parsedURL;},get documentURL()
2790 {return this._documentURL;},get frameId()
2791 {return this._frameId;},get loaderId()
2792 {return this._loaderId;},get displayName()
2793 {return this._parsedURL.displayName;},get type()
2794 {return this._request?this._request.type:this._type;},get mimeType()
2795 {return this._request?this._request.mimeType:this._mimeType;},get messages()
2796 {return this._messages||[];},addMessage:function(msg)
2797 {if(!msg.isErrorOrWarning()||!msg.messageText)
2798 return;if(!this._messages)
2799 this._messages=[];this._messages.push(msg);this.dispatchEventToListeners(WebInspector.Resource.Events.MessageAdded,msg);},get errors()
2800 {return this._errors||0;},set errors(x)
2801 {this._errors=x;},get warnings()
2802 {return this._warnings||0;},set warnings(x)
2803 {this._warnings=x;},clearErrorsAndWarnings:function()
2804 {this._messages=[];this._warnings=0;this._errors=0;this.dispatchEventToListeners(WebInspector.Resource.Events.MessagesCleared);},get content()
2805 {return this._content;},get contentEncoded()
2806 {return this._contentEncoded;},contentURL:function()
2807 {return this._url;},contentType:function()
2808 {return this.type;},requestContent:function(callback)
2809 {if(typeof this._content!=="undefined"){callback(this._content);return;}
2810 this._pendingContentCallbacks.push(callback);if(!this._request||this._request.finished)
2811 this._innerRequestContent();},canonicalMimeType:function()
2812 {return this.type.canonicalMimeType()||this.mimeType;},searchInContent:function(query,caseSensitive,isRegex,callback)
2813 {function callbackWrapper(error,searchMatches)
2814 {callback(searchMatches||[]);}
2815 if(this.type===WebInspector.resourceTypes.Document){callback([]);return;}
2816 if(this.frameId)
2817 PageAgent.searchInResource(this.frameId,this.url,query,caseSensitive,isRegex,callbackWrapper);else
2818 callback([]);},populateImageSource:function(image)
2819 {function onResourceContent(content)
2820 {var imageSrc=WebInspector.contentAsDataURL(this._content,this.mimeType,this._contentEncoded);if(imageSrc===null)
2821 imageSrc=this.url;image.src=imageSrc;}
2822 this.requestContent(onResourceContent.bind(this));},_requestFinished:function()
2823 {this._request.removeEventListener(WebInspector.NetworkRequest.Events.FinishedLoading,this._requestFinished,this);if(this._pendingContentCallbacks.length)
2824 this._innerRequestContent();},_innerRequestContent:function()
2825 {if(this._contentRequested)
2826 return;this._contentRequested=true;function contentLoaded(error,content,contentEncoded)
2827 {if(error||content===null){replyWithContent.call(this,null,false);return;}
2828 replyWithContent.call(this,content,contentEncoded);}
2829 function replyWithContent(content,contentEncoded)
2830 {this._content=content;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
2831 callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
2832 function resourceContentLoaded(error,content,contentEncoded)
2833 {contentLoaded.call(this,error,content,contentEncoded);}
2834 if(this.request){this.request.requestContent(requestContentLoaded.bind(this));return;}
2835 function requestContentLoaded(content)
2836 {contentLoaded.call(this,null,content,this.request.contentEncoded);}
2837 PageAgent.getResourceContent(this.frameId,this.url,resourceContentLoaded.bind(this));},isHidden:function()
2838 {return!!this._isHidden;},__proto__:WebInspector.Object.prototype}
2839 WebInspector.NetworkRequest=function(requestId,url,documentURL,frameId,loaderId)
2840 {this._requestId=requestId;this.url=url;this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._startTime=-1;this._endTime=-1;this.statusCode=0;this.statusText="";this.requestMethod="";this.requestTime=0;this._type=WebInspector.resourceTypes.Other;this._contentEncoded=false;this._pendingContentCallbacks=[];this._frames=[];this._responseHeaderValues={};this._remoteAddress="";}
2841 WebInspector.NetworkRequest.Events={FinishedLoading:"FinishedLoading",TimingChanged:"TimingChanged",RemoteAddressChanged:"RemoteAddressChanged",RequestHeadersChanged:"RequestHeadersChanged",ResponseHeadersChanged:"ResponseHeadersChanged",}
2842 WebInspector.NetworkRequest.InitiatorType={Other:"other",Parser:"parser",Redirect:"redirect",Script:"script"}
2843 WebInspector.NetworkRequest.NameValue;WebInspector.NetworkRequest.prototype={get requestId()
2844 {return this._requestId;},set requestId(requestId)
2845 {this._requestId=requestId;},get url()
2846 {return this._url;},set url(x)
2847 {if(this._url===x)
2848 return;this._url=x;this._parsedURL=new WebInspector.ParsedURL(x);delete this._queryString;delete this._parsedQueryParameters;delete this._name;delete this._path;},get documentURL()
2849 {return this._documentURL;},get parsedURL()
2850 {return this._parsedURL;},get frameId()
2851 {return this._frameId;},get loaderId()
2852 {return this._loaderId;},setRemoteAddress:function(ip,port)
2853 {this._remoteAddress=ip+":"+port;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RemoteAddressChanged,this);},remoteAddress:function()
2854 {return this._remoteAddress;},get startTime()
2855 {return this._startTime||-1;},set startTime(x)
2856 {this._startTime=x;},get responseReceivedTime()
2857 {return this._responseReceivedTime||-1;},set responseReceivedTime(x)
2858 {this._responseReceivedTime=x;},get endTime()
2859 {return this._endTime||-1;},set endTime(x)
2860 {if(this.timing&&this.timing.requestTime){this._endTime=Math.max(x,this.responseReceivedTime);}else{this._endTime=x;if(this._responseReceivedTime>x)
2861 this._responseReceivedTime=x;}
2862 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.TimingChanged,this);},get duration()
2863 {if(this._endTime===-1||this._startTime===-1)
2864 return-1;return this._endTime-this._startTime;},get latency()
2865 {if(this._responseReceivedTime===-1||this._startTime===-1)
2866 return-1;return this._responseReceivedTime-this._startTime;},get resourceSize()
2867 {return this._resourceSize||0;},set resourceSize(x)
2868 {this._resourceSize=x;},get transferSize()
2869 {return this._transferSize||0;},increaseTransferSize:function(x)
2870 {this._transferSize=(this._transferSize||0)+x;},setTransferSize:function(x)
2871 {this._transferSize=x;},get finished()
2872 {return this._finished;},set finished(x)
2873 {if(this._finished===x)
2874 return;this._finished=x;if(x){this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.FinishedLoading,this);if(this._pendingContentCallbacks.length)
2875 this._innerRequestContent();}},get failed()
2876 {return this._failed;},set failed(x)
2877 {this._failed=x;},get canceled()
2878 {return this._canceled;},set canceled(x)
2879 {this._canceled=x;},get cached()
2880 {return!!this._cached&&!this._transferSize;},set cached(x)
2881 {this._cached=x;if(x)
2882 delete this._timing;},get timing()
2883 {return this._timing;},set timing(x)
2884 {if(x&&!this._cached){this._startTime=x.requestTime;this._responseReceivedTime=x.requestTime+x.receiveHeadersEnd/1000.0;this._timing=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.TimingChanged,this);}},get mimeType()
2885 {return this._mimeType;},set mimeType(x)
2886 {this._mimeType=x;},get displayName()
2887 {return this._parsedURL.displayName;},name:function()
2888 {if(this._name)
2889 return this._name;this._parseNameAndPathFromURL();return this._name;},path:function()
2890 {if(this._path)
2891 return this._path;this._parseNameAndPathFromURL();return this._path;},_parseNameAndPathFromURL:function()
2892 {if(this._parsedURL.isDataURL()){this._name=this._parsedURL.dataURLDisplayName();this._path="";}else if(this._parsedURL.isAboutBlank()){this._name=this._parsedURL.url;this._path="";}else{this._path=this._parsedURL.host+this._parsedURL.folderPathComponents;this._path=this._path.trimURL(WebInspector.resourceTreeModel.inspectedPageDomain());if(this._parsedURL.lastPathComponent||this._parsedURL.queryParams)
2893 this._name=this._parsedURL.lastPathComponent+(this._parsedURL.queryParams?"?"+this._parsedURL.queryParams:"");else if(this._parsedURL.folderPathComponents){this._name=this._parsedURL.folderPathComponents.substring(this._parsedURL.folderPathComponents.lastIndexOf("/")+1)+"/";this._path=this._path.substring(0,this._path.lastIndexOf("/"));}else{this._name=this._parsedURL.host;this._path="";}}},get folder()
2894 {var path=this._parsedURL.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1)
2895 path=path.substring(0,indexOfQuery);var lastSlashIndex=path.lastIndexOf("/");return lastSlashIndex!==-1?path.substring(0,lastSlashIndex):"";},get type()
2896 {return this._type;},set type(x)
2897 {this._type=x;},get domain()
2898 {return this._parsedURL.host;},get scheme()
2899 {return this._parsedURL.scheme;},get redirectSource()
2900 {if(this.redirects&&this.redirects.length>0)
2901 return this.redirects[this.redirects.length-1];return this._redirectSource;},set redirectSource(x)
2902 {this._redirectSource=x;delete this._initiatorInfo;},requestHeaders:function()
2903 {return this._requestHeaders||[];},setRequestHeaders:function(headers)
2904 {this._requestHeaders=headers;delete this._requestCookies;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeadersText:function()
2905 {return this._requestHeadersText;},setRequestHeadersText:function(text)
2906 {this._requestHeadersText=text;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RequestHeadersChanged);},requestHeaderValue:function(headerName)
2907 {return this._headerValue(this.requestHeaders(),headerName);},get requestCookies()
2908 {if(!this._requestCookies)
2909 this._requestCookies=WebInspector.CookieParser.parseCookie(this.requestHeaderValue("Cookie"));return this._requestCookies;},get requestFormData()
2910 {return this._requestFormData;},set requestFormData(x)
2911 {this._requestFormData=x;delete this._parsedFormParameters;},requestHttpVersion:function()
2912 {var headersText=this.requestHeadersText();if(!headersText){return this.requestHeaderValue(":version");}
2913 var firstLine=headersText.split(/\r\n/)[0];var match=firstLine.match(/(HTTP\/\d+\.\d+)$/);return match?match[1]:undefined;},get responseHeaders()
2914 {return this._responseHeaders||[];},set responseHeaders(x)
2915 {this._responseHeaders=x;delete this._sortedResponseHeaders;delete this._responseCookies;this._responseHeaderValues={};this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get responseHeadersText()
2916 {return this._responseHeadersText;},set responseHeadersText(x)
2917 {this._responseHeadersText=x;this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.ResponseHeadersChanged);},get sortedResponseHeaders()
2918 {if(this._sortedResponseHeaders!==undefined)
2919 return this._sortedResponseHeaders;this._sortedResponseHeaders=this.responseHeaders.slice();this._sortedResponseHeaders.sort(function(a,b){return a.name.toLowerCase().compareTo(b.name.toLowerCase());});return this._sortedResponseHeaders;},responseHeaderValue:function(headerName)
2920 {var value=this._responseHeaderValues[headerName];if(value===undefined){value=this._headerValue(this.responseHeaders,headerName);this._responseHeaderValues[headerName]=(value!==undefined)?value:null;}
2921 return(value!==null)?value:undefined;},get responseCookies()
2922 {if(!this._responseCookies)
2923 this._responseCookies=WebInspector.CookieParser.parseSetCookie(this.responseHeaderValue("Set-Cookie"));return this._responseCookies;},queryString:function()
2924 {if(this._queryString!==undefined)
2925 return this._queryString;var queryString=null;var url=this.url;var questionMarkPosition=url.indexOf("?");if(questionMarkPosition!==-1){queryString=url.substring(questionMarkPosition+1);var hashSignPosition=queryString.indexOf("#");if(hashSignPosition!==-1)
2926 queryString=queryString.substring(0,hashSignPosition);}
2927 this._queryString=queryString;return this._queryString;},get queryParameters()
2928 {if(this._parsedQueryParameters)
2929 return this._parsedQueryParameters;var queryString=this.queryString();if(!queryString)
2930 return null;this._parsedQueryParameters=this._parseParameters(queryString);return this._parsedQueryParameters;},get formParameters()
2931 {if(this._parsedFormParameters)
2932 return this._parsedFormParameters;if(!this.requestFormData)
2933 return null;var requestContentType=this.requestContentType();if(!requestContentType||!requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
2934 return null;this._parsedFormParameters=this._parseParameters(this.requestFormData);return this._parsedFormParameters;},get responseHttpVersion()
2935 {var headersText=this._responseHeadersText;if(!headersText){return this.responseHeaderValue(":version");}
2936 var match=headersText.match(/^(HTTP\/\d+\.\d+)/);return match?match[1]:undefined;},_parseParameters:function(queryString)
2937 {function parseNameValue(pair)
2938 {var splitPair=pair.split("=",2);return{name:splitPair[0],value:splitPair[1]||""};}
2939 return queryString.split("&").map(parseNameValue);},_headerValue:function(headers,headerName)
2940 {headerName=headerName.toLowerCase();var values=[];for(var i=0;i<headers.length;++i){if(headers[i].name.toLowerCase()===headerName)
2941 values.push(headers[i].value);}
2942 if(!values.length)
2943 return undefined;if(headerName==="set-cookie")
2944 return values.join("\n");return values.join(", ");},get content()
2945 {return this._content;},contentError:function()
2946 {return this._contentError;},get contentEncoded()
2947 {return this._contentEncoded;},contentURL:function()
2948 {return this._url;},contentType:function()
2949 {return this._type;},requestContent:function(callback)
2950 {if(this.type===WebInspector.resourceTypes.WebSocket){callback(null);return;}
2951 if(typeof this._content!=="undefined"){callback(this.content||null);return;}
2952 this._pendingContentCallbacks.push(callback);if(this.finished)
2953 this._innerRequestContent();},searchInContent:function(query,caseSensitive,isRegex,callback)
2954 {callback([]);},isHttpFamily:function()
2955 {return!!this.url.match(/^https?:/i);},requestContentType:function()
2956 {return this.requestHeaderValue("Content-Type");},isPingRequest:function()
2957 {return"text/ping"===this.requestContentType();},hasErrorStatusCode:function()
2958 {return this.statusCode>=400;},populateImageSource:function(image)
2959 {function onResourceContent(content)
2960 {var imageSrc=this.asDataURL();if(imageSrc===null)
2961 imageSrc=this.url;image.src=imageSrc;}
2962 this.requestContent(onResourceContent.bind(this));},asDataURL:function()
2963 {return WebInspector.contentAsDataURL(this._content,this.mimeType,this._contentEncoded);},_innerRequestContent:function()
2964 {if(this._contentRequested)
2965 return;this._contentRequested=true;function onResourceContent(error,content,contentEncoded)
2966 {this._content=error?null:content;this._contentError=error;this._contentEncoded=contentEncoded;var callbacks=this._pendingContentCallbacks.slice();for(var i=0;i<callbacks.length;++i)
2967 callbacks[i](this._content);this._pendingContentCallbacks.length=0;delete this._contentRequested;}
2968 NetworkAgent.getResponseBody(this._requestId,onResourceContent.bind(this));},initiatorInfo:function()
2969 {if(this._initiatorInfo)
2970 return this._initiatorInfo;var type=WebInspector.NetworkRequest.InitiatorType.Other;var url="";var lineNumber=-Infinity;var columnNumber=-Infinity;if(this.redirectSource){type=WebInspector.NetworkRequest.InitiatorType.Redirect;url=this.redirectSource.url;}else if(this.initiator){if(this.initiator.type===NetworkAgent.InitiatorType.Parser){type=WebInspector.NetworkRequest.InitiatorType.Parser;url=this.initiator.url;lineNumber=this.initiator.lineNumber;}else if(this.initiator.type===NetworkAgent.InitiatorType.Script){var topFrame=this.initiator.stackTrace[0];if(topFrame.url){type=WebInspector.NetworkRequest.InitiatorType.Script;url=topFrame.url;lineNumber=topFrame.lineNumber;columnNumber=topFrame.columnNumber;}}}
2971 this._initiatorInfo={type:type,url:url,source:WebInspector.displayNameForURL(url),lineNumber:lineNumber,columnNumber:columnNumber};return this._initiatorInfo;},frames:function()
2972 {return this._frames;},frame:function(position)
2973 {return this._frames[position];},addFrameError:function(errorMessage,time)
2974 {this._pushFrame({errorMessage:errorMessage,time:time});},addFrame:function(response,time,sent)
2975 {response.time=time;if(sent)
2976 response.sent=sent;this._pushFrame(response);},_pushFrame:function(frameOrError)
2977 {if(this._frames.length>=100)
2978 this._frames.splice(0,10);this._frames.push(frameOrError);},__proto__:WebInspector.Object.prototype}
2979 WebInspector.UISourceCode=function(project,parentPath,name,originURL,url,contentType,isEditable)
2980 {this._project=project;this._parentPath=parentPath;this._name=name;this._originURL=originURL;this._url=url;this._contentType=contentType;this._isEditable=isEditable;this._requestContentCallbacks=[];this._consoleMessages=[];this.history=[];if(this.isEditable()&&this._url)
2981 this._restoreRevisionHistory();}
2982 WebInspector.UISourceCode.Events={WorkingCopyChanged:"WorkingCopyChanged",WorkingCopyCommitted:"WorkingCopyCommitted",TitleChanged:"TitleChanged",SavedStateUpdated:"SavedStateUpdated",ConsoleMessageAdded:"ConsoleMessageAdded",ConsoleMessageRemoved:"ConsoleMessageRemoved",ConsoleMessagesCleared:"ConsoleMessagesCleared",SourceMappingChanged:"SourceMappingChanged",}
2983 WebInspector.UISourceCode.prototype={get url()
2984 {return this._url;},name:function()
2985 {return this._name;},parentPath:function()
2986 {return this._parentPath;},path:function()
2987 {return this._parentPath?this._parentPath+"/"+this._name:this._name;},fullDisplayName:function()
2988 {return this._project.displayName()+"/"+(this._parentPath?this._parentPath+"/":"")+this.displayName(true);},displayName:function(skipTrim)
2989 {var displayName=this.name()||WebInspector.UIString("(index)");return skipTrim?displayName:displayName.trimEnd(100);},uri:function()
2990 {var path=this.path();if(!this._project.id())
2991 return path;if(!path)
2992 return this._project.id();return this._project.id()+"/"+path;},originURL:function()
2993 {return this._originURL;},canRename:function()
2994 {return this._project.canRename();},rename:function(newName,callback)
2995 {this._project.rename(this,newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
2996 {if(success)
2997 this._updateName((newName),(newURL),(newOriginURL),(newContentType));callback(success);}},remove:function()
2998 {this._project.deleteFile(this.path());},_updateName:function(name,url,originURL,contentType)
2999 {var oldURI=this.uri();this._name=name;if(url)
3000 this._url=url;if(originURL)
3001 this._originURL=originURL;if(contentType)
3002 this._contentType=contentType;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.TitleChanged,oldURI);},contentURL:function()
3003 {return this.originURL();},contentType:function()
3004 {return this._contentType;},scriptFile:function()
3005 {return this._scriptFile;},setScriptFile:function(scriptFile)
3006 {this._scriptFile=scriptFile;},project:function()
3007 {return this._project;},requestMetadata:function(callback)
3008 {this._project.requestMetadata(this,callback);},requestContent:function(callback)
3009 {if(this._content||this._contentLoaded){callback(this._content);return;}
3010 this._requestContentCallbacks.push(callback);if(this._requestContentCallbacks.length===1)
3011 this._project.requestFileContent(this,this._fireContentAvailable.bind(this));},checkContentUpdated:function(callback)
3012 {if(!this._project.canSetFileContent())
3013 return;if(this._checkingContent)
3014 return;this._checkingContent=true;this._project.requestFileContent(this,contentLoaded.bind(this));function contentLoaded(updatedContent)
3015 {if(updatedContent===null){var workingCopy=this.workingCopy();this._commitContent("",false);this.setWorkingCopy(workingCopy);delete this._checkingContent;if(callback)
3016 callback();return;}
3017 if(typeof this._lastAcceptedContent==="string"&&this._lastAcceptedContent===updatedContent){delete this._checkingContent;if(callback)
3018 callback();return;}
3019 if(this._content===updatedContent){delete this._lastAcceptedContent;delete this._checkingContent;if(callback)
3020 callback();return;}
3021 if(!this.isDirty()){this._commitContent(updatedContent,false);delete this._checkingContent;if(callback)
3022 callback();return;}
3023 var shouldUpdate=window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));if(shouldUpdate)
3024 this._commitContent(updatedContent,false);else
3025 this._lastAcceptedContent=updatedContent;delete this._checkingContent;if(callback)
3026 callback();}},requestOriginalContent:function(callback)
3027 {this._project.requestFileContent(this,callback);},_commitContent:function(content,shouldSetContentInProject)
3028 {delete this._lastAcceptedContent;this._content=content;this._contentLoaded=true;var lastRevision=this.history.length?this.history[this.history.length-1]:null;if(!lastRevision||lastRevision._content!==this._content){var revision=new WebInspector.Revision(this,this._content,new Date());this.history.push(revision);revision._persist();}
3029 this._innerResetWorkingCopy();this._hasCommittedChanges=true;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted);if(this._url&&WebInspector.fileManager.isURLSaved(this._url))
3030 this._saveURLWithFileManager(false,this._content);if(shouldSetContentInProject)
3031 this._project.setFileContent(this,this._content,function(){});},_saveURLWithFileManager:function(forceSaveAs,content)
3032 {WebInspector.fileManager.save(this._url,(content),forceSaveAs,callback.bind(this));WebInspector.fileManager.close(this._url);function callback(accepted)
3033 {if(!accepted)
3034 return;this._savedWithFileManager=true;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SavedStateUpdated);}},saveToFileSystem:function(forceSaveAs)
3035 {if(this.isDirty()){this._saveURLWithFileManager(forceSaveAs,this.workingCopy());this.commitWorkingCopy(function(){});return;}
3036 this.requestContent(this._saveURLWithFileManager.bind(this,forceSaveAs));},hasUnsavedCommittedChanges:function()
3037 {if(this._savedWithFileManager||this.project().canSetFileContent()||!this._isEditable)
3038 return false;if(this._project.workspace().hasResourceContentTrackingExtensions())
3039 return false;return!!this._hasCommittedChanges;},addRevision:function(content)
3040 {this._commitContent(content,true);},_restoreRevisionHistory:function()
3041 {if(!window.localStorage)
3042 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[this.url];if(!historyItems)
3043 return;function filterOutStale(historyItem)
3044 {if(!WebInspector.resourceTreeModel.mainFrame)
3045 return false;return historyItem.loaderId===WebInspector.resourceTreeModel.mainFrame.loaderId;}
3046 historyItems=historyItems.filter(filterOutStale);if(!historyItems.length)
3047 return;for(var i=0;i<historyItems.length;++i){var content=window.localStorage[historyItems[i].key];var timestamp=new Date(historyItems[i].timestamp);var revision=new WebInspector.Revision(this,content,timestamp);this.history.push(revision);}
3048 this._content=this.history[this.history.length-1].content;this._hasCommittedChanges=true;this._contentLoaded=true;},_clearRevisionHistory:function()
3049 {if(!window.localStorage)
3050 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[this.url];for(var i=0;historyItems&&i<historyItems.length;++i)
3051 delete window.localStorage[historyItems[i].key];delete registry[this.url];window.localStorage["revision-history"]=JSON.stringify(registry);},revertToOriginal:function()
3052 {function callback(content)
3053 {if(typeof content!=="string")
3054 return;this.addRevision(content);}
3055 this.requestOriginalContent(callback.bind(this));WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.ApplyOriginalContent,url:this.url});},revertAndClearHistory:function(callback)
3056 {function revert(content)
3057 {if(typeof content!=="string")
3058 return;this.addRevision(content);this._clearRevisionHistory();this.history=[];callback(this);}
3059 this.requestOriginalContent(revert.bind(this));WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.RevertRevision,url:this.url});},isEditable:function()
3060 {return this._isEditable;},workingCopy:function()
3061 {if(this._workingCopyGetter){this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;}
3062 if(this.isDirty())
3063 return this._workingCopy;return this._content;},resetWorkingCopy:function()
3064 {this._innerResetWorkingCopy();this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},_innerResetWorkingCopy:function()
3065 {delete this._workingCopy;delete this._workingCopyGetter;},setWorkingCopy:function(newWorkingCopy)
3066 {this._workingCopy=newWorkingCopy;delete this._workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},setWorkingCopyGetter:function(workingCopyGetter)
3067 {this._workingCopyGetter=workingCopyGetter;this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged);},removeWorkingCopyGetter:function()
3068 {if(!this._workingCopyGetter)
3069 return;this._workingCopy=this._workingCopyGetter();delete this._workingCopyGetter;},commitWorkingCopy:function(callback)
3070 {if(!this.isDirty()){callback(null);return;}
3071 this._commitContent(this.workingCopy(),true);callback(null);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.FileSaved,url:this.url});},isDirty:function()
3072 {return typeof this._workingCopy!=="undefined"||typeof this._workingCopyGetter!=="undefined";},highlighterType:function()
3073 {var lastIndexOfDot=this._name.lastIndexOf(".");var extension=lastIndexOfDot!==-1?this._name.substr(lastIndexOfDot+1):"";var indexOfQuestionMark=extension.indexOf("?");if(indexOfQuestionMark!==-1)
3074 extension=extension.substr(0,indexOfQuestionMark);var mimeType=WebInspector.ResourceType.mimeTypesForExtensions[extension.toLowerCase()];return mimeType||this.contentType().canonicalMimeType();},content:function()
3075 {return this._content;},searchInContent:function(query,caseSensitive,isRegex,callback)
3076 {var content=this.content();if(content){var provider=new WebInspector.StaticContentProvider(this.contentType(),content);provider.searchInContent(query,caseSensitive,isRegex,callback);return;}
3077 this._project.searchInFileContent(this,query,caseSensitive,isRegex,callback);},_fireContentAvailable:function(content)
3078 {this._contentLoaded=true;this._content=content;var callbacks=this._requestContentCallbacks.slice();this._requestContentCallbacks=[];for(var i=0;i<callbacks.length;++i)
3079 callbacks[i](content);},contentLoaded:function()
3080 {return this._contentLoaded;},uiLocationToRawLocation:function(lineNumber,columnNumber)
3081 {if(!this._sourceMapping)
3082 return null;return this._sourceMapping.uiLocationToRawLocation(this,lineNumber,columnNumber);},consoleMessages:function()
3083 {return this._consoleMessages;},consoleMessageAdded:function(message)
3084 {this._consoleMessages.push(message);this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessageAdded,message);},consoleMessageRemoved:function(message)
3085 {this._consoleMessages.remove(message);this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessageRemoved,message);},consoleMessagesCleared:function()
3086 {this._consoleMessages=[];this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ConsoleMessagesCleared);},hasSourceMapping:function()
3087 {return!!this._sourceMapping;},setSourceMapping:function(sourceMapping)
3088 {if(this._sourceMapping===sourceMapping)
3089 return;this._sourceMapping=sourceMapping;var data={};data.isIdentity=this._sourceMapping&&this._sourceMapping.isIdentity();this.dispatchEventToListeners(WebInspector.UISourceCode.Events.SourceMappingChanged,data);},__proto__:WebInspector.Object.prototype}
3090 WebInspector.UILocation=function(uiSourceCode,lineNumber,columnNumber)
3091 {this.uiSourceCode=uiSourceCode;this.lineNumber=lineNumber;this.columnNumber=columnNumber;}
3092 WebInspector.UILocation.prototype={uiLocationToRawLocation:function()
3093 {return this.uiSourceCode.uiLocationToRawLocation(this.lineNumber,this.columnNumber);},url:function()
3094 {return this.uiSourceCode.contentURL();},linkText:function()
3095 {var linkText=this.uiSourceCode.displayName();if(typeof this.lineNumber==="number")
3096 linkText+=":"+(this.lineNumber+1);return linkText;}}
3097 WebInspector.RawLocation=function()
3098 {}
3099 WebInspector.LiveLocation=function(rawLocation,updateDelegate)
3100 {this._rawLocation=rawLocation;this._updateDelegate=updateDelegate;}
3101 WebInspector.LiveLocation.prototype={update:function()
3102 {var uiLocation=this.uiLocation();if(!uiLocation)
3103 return;if(this._updateDelegate(uiLocation))
3104 this.dispose();},rawLocation:function()
3105 {return this._rawLocation;},uiLocation:function()
3106 {throw"Not implemented";},dispose:function()
3107 {}}
3108 WebInspector.Revision=function(uiSourceCode,content,timestamp)
3109 {this._uiSourceCode=uiSourceCode;this._content=content;this._timestamp=timestamp;}
3110 WebInspector.Revision._revisionHistoryRegistry=function()
3111 {if(!WebInspector.Revision._revisionHistoryRegistryObject){if(window.localStorage){var revisionHistory=window.localStorage["revision-history"];try{WebInspector.Revision._revisionHistoryRegistryObject=revisionHistory?JSON.parse(revisionHistory):{};}catch(e){WebInspector.Revision._revisionHistoryRegistryObject={};}}else
3112 WebInspector.Revision._revisionHistoryRegistryObject={};}
3113 return WebInspector.Revision._revisionHistoryRegistryObject;}
3114 WebInspector.Revision.filterOutStaleRevisions=function()
3115 {if(!window.localStorage)
3116 return;var registry=WebInspector.Revision._revisionHistoryRegistry();var filteredRegistry={};for(var url in registry){var historyItems=registry[url];var filteredHistoryItems=[];for(var i=0;historyItems&&i<historyItems.length;++i){var historyItem=historyItems[i];if(historyItem.loaderId===WebInspector.resourceTreeModel.mainFrame.loaderId){filteredHistoryItems.push(historyItem);filteredRegistry[url]=filteredHistoryItems;}else
3117 delete window.localStorage[historyItem.key];}}
3118 WebInspector.Revision._revisionHistoryRegistryObject=filteredRegistry;function persist()
3119 {window.localStorage["revision-history"]=JSON.stringify(filteredRegistry);}
3120 setTimeout(persist,0);}
3121 WebInspector.Revision.prototype={get uiSourceCode()
3122 {return this._uiSourceCode;},get timestamp()
3123 {return this._timestamp;},get content()
3124 {return this._content||null;},revertToThis:function()
3125 {function revert(content)
3126 {if(this._uiSourceCode._content!==content)
3127 this._uiSourceCode.addRevision(content);}
3128 this.requestContent(revert.bind(this));},contentURL:function()
3129 {return this._uiSourceCode.originURL();},contentType:function()
3130 {return this._uiSourceCode.contentType();},requestContent:function(callback)
3131 {callback(this._content||"");},searchInContent:function(query,caseSensitive,isRegex,callback)
3132 {callback([]);},_persist:function()
3133 {if(this._uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem)
3134 return;if(!window.localStorage)
3135 return;var url=this.contentURL();if(!url||url.startsWith("inspector://"))
3136 return;var loaderId=WebInspector.resourceTreeModel.mainFrame.loaderId;var timestamp=this.timestamp.getTime();var key="revision-history|"+url+"|"+loaderId+"|"+timestamp;var registry=WebInspector.Revision._revisionHistoryRegistry();var historyItems=registry[url];if(!historyItems){historyItems=[];registry[url]=historyItems;}
3137 historyItems.push({url:url,loaderId:loaderId,timestamp:timestamp,key:key});function persist()
3138 {window.localStorage[key]=this._content;window.localStorage["revision-history"]=JSON.stringify(registry);}
3139 setTimeout(persist.bind(this),0);}}
3140 WebInspector.CSSStyleModel=function(workspace)
3141 {this._workspace=workspace;this._pendingCommandsMajorState=[];this._styleLoader=new WebInspector.CSSStyleModel.ComputedStyleLoader(this);WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoRequested,this._undoRedoRequested,this);WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.UndoRedoCompleted,this._undoRedoCompleted,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,this._mainFrameCreatedOrNavigated,this);InspectorBackend.registerCSSDispatcher(new WebInspector.CSSDispatcher(this));CSSAgent.enable(this._wasEnabled.bind(this));this._resetStyleSheets();}
3142 WebInspector.CSSStyleModel.parseRuleMatchArrayPayload=function(matchArray)
3143 {if(!matchArray)
3144 return[];var result=[];for(var i=0;i<matchArray.length;++i)
3145 result.push(WebInspector.CSSRule.parsePayload(matchArray[i].rule,matchArray[i].matchingSelectors));return result;}
3146 WebInspector.CSSStyleModel.Events={ModelWasEnabled:"ModelWasEnabled",StyleSheetAdded:"StyleSheetAdded",StyleSheetChanged:"StyleSheetChanged",StyleSheetRemoved:"StyleSheetRemoved",MediaQueryResultChanged:"MediaQueryResultChanged",}
3147 WebInspector.CSSStyleModel.MediaTypes=["all","braille","embossed","handheld","print","projection","screen","speech","tty","tv"];WebInspector.CSSStyleModel.prototype={isEnabled:function()
3148 {return this._isEnabled;},_wasEnabled:function()
3149 {this._isEnabled=true;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.ModelWasEnabled);},getMatchedStylesAsync:function(nodeId,needPseudo,needInherited,userCallback)
3150 {function callback(userCallback,error,matchedPayload,pseudoPayload,inheritedPayload)
3151 {if(error){if(userCallback)
3152 userCallback(null);return;}
3153 var result={};result.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(matchedPayload);result.pseudoElements=[];if(pseudoPayload){for(var i=0;i<pseudoPayload.length;++i){var entryPayload=pseudoPayload[i];result.pseudoElements.push({pseudoId:entryPayload.pseudoId,rules:WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matches)});}}
3154 result.inherited=[];if(inheritedPayload){for(var i=0;i<inheritedPayload.length;++i){var entryPayload=inheritedPayload[i];var entry={};if(entryPayload.inlineStyle)
3155 entry.inlineStyle=WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);if(entryPayload.matchedCSSRules)
3156 entry.matchedCSSRules=WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matchedCSSRules);result.inherited.push(entry);}}
3157 if(userCallback)
3158 userCallback(result);}
3159 CSSAgent.getMatchedStylesForNode(nodeId,needPseudo,needInherited,callback.bind(null,userCallback));},getComputedStyleAsync:function(nodeId,userCallback)
3160 {this._styleLoader.getComputedStyle(nodeId,userCallback);},getPlatformFontsForNode:function(nodeId,callback)
3161 {function platformFontsCallback(error,cssFamilyName,fonts)
3162 {if(error)
3163 callback(null,null);else
3164 callback(cssFamilyName,fonts);}
3165 CSSAgent.getPlatformFontsForNode(nodeId,platformFontsCallback);},allStyleSheets:function()
3166 {var values=Object.values(this._styleSheetIdToHeader);function styleSheetComparator(a,b)
3167 {if(a.sourceURL<b.sourceURL)
3168 return-1;else if(a.sourceURL>b.sourceURL)
3169 return 1;return a.startLine-b.startLine||a.startColumn-b.startColumn;}
3170 values.sort(styleSheetComparator);return values;},getInlineStylesAsync:function(nodeId,userCallback)
3171 {function callback(userCallback,error,inlinePayload,attributesStylePayload)
3172 {if(error||!inlinePayload)
3173 userCallback(null,null);else
3174 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload),attributesStylePayload?WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload):null);}
3175 CSSAgent.getInlineStylesForNode(nodeId,callback.bind(null,userCallback));},forcePseudoState:function(nodeId,forcedPseudoClasses,userCallback)
3176 {CSSAgent.forcePseudoState(nodeId,forcedPseudoClasses||[],userCallback);},setRuleSelector:function(ruleId,nodeId,newSelector,successCallback,failureCallback)
3177 {function callback(nodeId,successCallback,failureCallback,newSelector,error,rulePayload)
3178 {this._pendingCommandsMajorState.pop();if(error){failureCallback();return;}
3179 WebInspector.domModel.markUndoableState();this._computeMatchingSelectors(rulePayload,nodeId,successCallback,failureCallback);}
3180 this._pendingCommandsMajorState.push(true);CSSAgent.setRuleSelector(ruleId,newSelector,callback.bind(this,nodeId,successCallback,failureCallback,newSelector));},_computeMatchingSelectors:function(rulePayload,nodeId,successCallback,failureCallback)
3181 {var ownerDocumentId=this._ownerDocumentId(nodeId);if(!ownerDocumentId){failureCallback();return;}
3182 var rule=WebInspector.CSSRule.parsePayload(rulePayload);var matchingSelectors=[];var allSelectorsBarrier=new CallbackBarrier();for(var i=0;i<rule.selectors.length;++i){var selector=rule.selectors[i];var boundCallback=allSelectorsBarrier.createCallback(selectorQueried.bind(null,i,nodeId,matchingSelectors));WebInspector.domModel.querySelectorAll(ownerDocumentId,selector.value,boundCallback);}
3183 allSelectorsBarrier.callWhenDone(function(){rule.matchingSelectors=matchingSelectors;successCallback(rule);});function selectorQueried(index,nodeId,matchingSelectors,matchingNodeIds)
3184 {if(!matchingNodeIds)
3185 return;if(matchingNodeIds.indexOf(nodeId)!==-1)
3186 matchingSelectors.push(index);}},addRule:function(styleSheetId,node,selector,successCallback,failureCallback)
3187 {this._pendingCommandsMajorState.push(true);CSSAgent.addRule(styleSheetId,selector,callback.bind(this));function callback(error,rulePayload)
3188 {this._pendingCommandsMajorState.pop();if(error){failureCallback();}else{WebInspector.domModel.markUndoableState();this._computeMatchingSelectors(rulePayload,node.id,successCallback,failureCallback);}}},requestViaInspectorStylesheet:function(node,callback)
3189 {var frameId=node.frameId()||WebInspector.resourceTreeModel.mainFrame.id;for(var styleSheetId in this._styleSheetIdToHeader){var styleSheetHeader=this._styleSheetIdToHeader[styleSheetId];if(styleSheetHeader.frameId===frameId&&styleSheetHeader.isViaInspector()){callback(styleSheetHeader);return;}}
3190 function innerCallback(error,styleSheetId)
3191 {if(error){console.error(error);callback(null);}
3192 callback(this._styleSheetIdToHeader[styleSheetId]);}
3193 CSSAgent.createStyleSheet(frameId,innerCallback.bind(this));},mediaQueryResultChanged:function()
3194 {this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.MediaQueryResultChanged);},styleSheetHeaderForId:function(id)
3195 {return this._styleSheetIdToHeader[id];},styleSheetHeaders:function()
3196 {return Object.values(this._styleSheetIdToHeader);},_ownerDocumentId:function(nodeId)
3197 {var node=WebInspector.domModel.nodeForId(nodeId);if(!node)
3198 return null;return node.ownerDocument?node.ownerDocument.id:null;},_fireStyleSheetChanged:function(styleSheetId)
3199 {if(!this._pendingCommandsMajorState.length)
3200 return;var majorChange=this._pendingCommandsMajorState[this._pendingCommandsMajorState.length-1];if(!styleSheetId||!this.hasEventListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged))
3201 return;this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetChanged,{styleSheetId:styleSheetId,majorChange:majorChange});},_styleSheetAdded:function(header)
3202 {console.assert(!this._styleSheetIdToHeader[header.styleSheetId]);var styleSheetHeader=new WebInspector.CSSStyleSheetHeader(header);this._styleSheetIdToHeader[header.styleSheetId]=styleSheetHeader;var url=styleSheetHeader.resourceURL();if(!this._styleSheetIdsForURL[url])
3203 this._styleSheetIdsForURL[url]={};var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];var styleSheetIds=frameIdToStyleSheetIds[styleSheetHeader.frameId];if(!styleSheetIds){styleSheetIds=[];frameIdToStyleSheetIds[styleSheetHeader.frameId]=styleSheetIds;}
3204 styleSheetIds.push(styleSheetHeader.id);this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetAdded,styleSheetHeader);},_styleSheetRemoved:function(id)
3205 {var header=this._styleSheetIdToHeader[id];console.assert(header);if(!header)
3206 return;delete this._styleSheetIdToHeader[id];var url=header.resourceURL();var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];frameIdToStyleSheetIds[header.frameId].remove(id);if(!frameIdToStyleSheetIds[header.frameId].length){delete frameIdToStyleSheetIds[header.frameId];if(!Object.keys(this._styleSheetIdsForURL[url]).length)
3207 delete this._styleSheetIdsForURL[url];}
3208 this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,header);},styleSheetIdsForURL:function(url)
3209 {var frameIdToStyleSheetIds=this._styleSheetIdsForURL[url];if(!frameIdToStyleSheetIds)
3210 return[];var result=[];for(var frameId in frameIdToStyleSheetIds)
3211 result=result.concat(frameIdToStyleSheetIds[frameId]);return result;},styleSheetIdsByFrameIdForURL:function(url)
3212 {var styleSheetIdsForFrame=this._styleSheetIdsForURL[url];if(!styleSheetIdsForFrame)
3213 return{};return styleSheetIdsForFrame;},setStyleSheetText:function(styleSheetId,newText,majorChange,userCallback)
3214 {var header=this._styleSheetIdToHeader[styleSheetId];console.assert(header);this._pendingCommandsMajorState.push(majorChange);header.setContent(newText,callback.bind(this));function callback(error)
3215 {this._pendingCommandsMajorState.pop();if(!error&&majorChange)
3216 WebInspector.domModel.markUndoableState();if(!error&&userCallback)
3217 userCallback(error);}},_undoRedoRequested:function()
3218 {this._pendingCommandsMajorState.push(true);},_undoRedoCompleted:function()
3219 {this._pendingCommandsMajorState.pop();},_mainFrameCreatedOrNavigated:function()
3220 {this._resetStyleSheets();},_resetStyleSheets:function()
3221 {this._styleSheetIdsForURL={};this._styleSheetIdToHeader={};},updateLocations:function()
3222 {var headers=Object.values(this._styleSheetIdToHeader);for(var i=0;i<headers.length;++i)
3223 headers[i].updateLocations();},createLiveLocation:function(styleSheetId,rawLocation,updateDelegate)
3224 {if(!rawLocation)
3225 return null;var header=styleSheetId?this.styleSheetHeaderForId(styleSheetId):null;return new WebInspector.CSSStyleModel.LiveLocation(this,header,rawLocation,updateDelegate);},rawLocationToUILocation:function(rawLocation)
3226 {var frameIdToSheetIds=this._styleSheetIdsForURL[rawLocation.url];if(!frameIdToSheetIds)
3227 return null;var styleSheetIds=[];for(var frameId in frameIdToSheetIds)
3228 styleSheetIds=styleSheetIds.concat(frameIdToSheetIds[frameId]);var uiLocation;for(var i=0;!uiLocation&&i<styleSheetIds.length;++i){var header=this.styleSheetHeaderForId(styleSheetIds[i]);console.assert(header);uiLocation=header.rawLocationToUILocation(rawLocation.lineNumber,rawLocation.columnNumber);}
3229 return uiLocation||null;},__proto__:WebInspector.Object.prototype}
3230 WebInspector.CSSStyleModel.LiveLocation=function(model,header,rawLocation,updateDelegate)
3231 {WebInspector.LiveLocation.call(this,rawLocation,updateDelegate);this._model=model;if(!header)
3232 this._clearStyleSheet();else
3233 this._setStyleSheet(header);}
3234 WebInspector.CSSStyleModel.LiveLocation.prototype={_styleSheetAdded:function(event)
3235 {console.assert(!this._header);var header=(event.data);if(header.sourceURL&&header.sourceURL===this.rawLocation().url)
3236 this._setStyleSheet(header);},_styleSheetRemoved:function(event)
3237 {console.assert(this._header);var header=(event.data);if(this._header!==header)
3238 return;this._header._removeLocation(this);this._clearStyleSheet();},_setStyleSheet:function(header)
3239 {this._header=header;this._header.addLiveLocation(this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},_clearStyleSheet:function()
3240 {delete this._header;this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);this._model.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);},uiLocation:function()
3241 {var cssLocation=(this.rawLocation());if(this._header)
3242 return this._header.rawLocationToUILocation(cssLocation.lineNumber,cssLocation.columnNumber);var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(cssLocation.url);if(!uiSourceCode)
3243 return null;return new WebInspector.UILocation(uiSourceCode,cssLocation.lineNumber,cssLocation.columnNumber);},dispose:function()
3244 {WebInspector.LiveLocation.prototype.dispose.call(this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._model.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);},__proto__:WebInspector.LiveLocation.prototype}
3245 WebInspector.CSSLocation=function(url,lineNumber,columnNumber)
3246 {this.url=url;this.lineNumber=lineNumber;this.columnNumber=columnNumber||0;}
3247 WebInspector.CSSStyleDeclaration=function(payload)
3248 {this.id=payload.styleId;this.width=payload.width;this.height=payload.height;this.range=payload.range;this._shorthandValues=WebInspector.CSSStyleDeclaration.buildShorthandValueMap(payload.shorthandEntries);this._livePropertyMap={};this._allProperties=[];this.__disabledProperties={};var payloadPropertyCount=payload.cssProperties.length;for(var i=0;i<payloadPropertyCount;++i){var property=WebInspector.CSSProperty.parsePayload(this,i,payload.cssProperties[i]);this._allProperties.push(property);}
3249 this._computeActiveProperties();var propertyIndex=0;for(var i=0;i<this._allProperties.length;++i){var property=this._allProperties[i];if(property.disabled)
3250 this.__disabledProperties[i]=property;if(!property.active&&!property.styleBased)
3251 continue;var name=property.name;this[propertyIndex]=name;this._livePropertyMap[name]=property;++propertyIndex;}
3252 this.length=propertyIndex;if("cssText"in payload)
3253 this.cssText=payload.cssText;}
3254 WebInspector.CSSStyleDeclaration.buildShorthandValueMap=function(shorthandEntries)
3255 {var result={};for(var i=0;i<shorthandEntries.length;++i)
3256 result[shorthandEntries[i].name]=shorthandEntries[i].value;return result;}
3257 WebInspector.CSSStyleDeclaration.parsePayload=function(payload)
3258 {return new WebInspector.CSSStyleDeclaration(payload);}
3259 WebInspector.CSSStyleDeclaration.parseComputedStylePayload=function(payload)
3260 {var newPayload=({cssProperties:[],shorthandEntries:[],width:"",height:""});if(payload)
3261 newPayload.cssProperties=(payload);return new WebInspector.CSSStyleDeclaration(newPayload);}
3262 WebInspector.CSSStyleDeclaration.prototype={_computeActiveProperties:function()
3263 {var activeProperties={};for(var i=this._allProperties.length-1;i>=0;--i){var property=this._allProperties[i];if(property.styleBased||property.disabled)
3264 continue;property._setActive(false);if(!property.parsedOk)
3265 continue;var canonicalName=WebInspector.CSSMetadata.canonicalPropertyName(property.name);var activeProperty=activeProperties[canonicalName];if(!activeProperty||(!activeProperty.important&&property.important))
3266 activeProperties[canonicalName]=property;}
3267 for(var propertyName in activeProperties){var property=activeProperties[propertyName];property._setActive(true);}},get allProperties()
3268 {return this._allProperties;},getLiveProperty:function(name)
3269 {return this._livePropertyMap[name]||null;},getPropertyValue:function(name)
3270 {var property=this._livePropertyMap[name];return property?property.value:"";},isPropertyImplicit:function(name)
3271 {var property=this._livePropertyMap[name];return property?property.implicit:"";},longhandProperties:function(name)
3272 {var longhands=WebInspector.CSSMetadata.cssPropertiesMetainfo.longhands(name);var result=[];for(var i=0;longhands&&i<longhands.length;++i){var property=this._livePropertyMap[longhands[i]];if(property)
3273 result.push(property);}
3274 return result;},shorthandValue:function(shorthandProperty)
3275 {return this._shorthandValues[shorthandProperty];},propertyAt:function(index)
3276 {return(index<this.allProperties.length)?this.allProperties[index]:null;},pastLastSourcePropertyIndex:function()
3277 {for(var i=this.allProperties.length-1;i>=0;--i){if(this.allProperties[i].range)
3278 return i+1;}
3279 return 0;},newBlankProperty:function(index)
3280 {index=(typeof index==="undefined")?this.pastLastSourcePropertyIndex():index;var property=new WebInspector.CSSProperty(this,index,"","",false,false,true,false,"");property._setActive(true);return property;},insertPropertyAt:function(index,name,value,userCallback)
3281 {function callback(error,payload)
3282 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(!userCallback)
3283 return;if(error){console.error(error);userCallback(null);}else
3284 userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));}
3285 if(!this.id)
3286 throw"No style id";WebInspector.cssModel._pendingCommandsMajorState.push(true);CSSAgent.setPropertyText(this.id,index,name+": "+value+";",false,callback);},appendProperty:function(name,value,userCallback)
3287 {this.insertPropertyAt(this.allProperties.length,name,value,userCallback);},}
3288 WebInspector.CSSRule=function(payload,matchingSelectors)
3289 {this.id=payload.ruleId;if(matchingSelectors)
3290 this.matchingSelectors=matchingSelectors;this.selectors=payload.selectorList.selectors;this.selectorText=this.selectors.select("value").join(", ");var firstRange=this.selectors[0].range;if(firstRange){var lastRange=this.selectors.peekLast().range;this.selectorRange=new WebInspector.TextRange(firstRange.startLine,firstRange.startColumn,lastRange.endLine,lastRange.endColumn);}
3291 this.sourceURL=payload.sourceURL;this.origin=payload.origin;this.style=WebInspector.CSSStyleDeclaration.parsePayload(payload.style);this.style.parentRule=this;if(payload.media)
3292 this.media=WebInspector.CSSMedia.parseMediaArrayPayload(payload.media);this._setRawLocationAndFrameId();}
3293 WebInspector.CSSRule.parsePayload=function(payload,matchingIndices)
3294 {return new WebInspector.CSSRule(payload,matchingIndices);}
3295 WebInspector.CSSRule.prototype={_setRawLocationAndFrameId:function()
3296 {if(!this.id)
3297 return;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);this.frameId=styleSheetHeader.frameId;var url=styleSheetHeader.resourceURL();if(!url)
3298 return;this.rawLocation=new WebInspector.CSSLocation(url,this.lineNumberInSource(0),this.columnNumberInSource(0));},resourceURL:function()
3299 {if(!this.id)
3300 return"";var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);return styleSheetHeader.resourceURL();},lineNumberInSource:function(selectorIndex)
3301 {var selector=this.selectors[selectorIndex];if(!selector||!selector.range)
3302 return 0;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);return styleSheetHeader.lineNumberInSource(selector.range.startLine);},columnNumberInSource:function(selectorIndex)
3303 {var selector=this.selectors[selectorIndex];if(!selector||!selector.range)
3304 return undefined;var styleSheetHeader=WebInspector.cssModel.styleSheetHeaderForId(this.id.styleSheetId);console.assert(styleSheetHeader);return styleSheetHeader.columnNumberInSource(selector.range.startLine,selector.range.startColumn);},get isUserAgent()
3305 {return this.origin==="user-agent";},get isUser()
3306 {return this.origin==="user";},get isViaInspector()
3307 {return this.origin==="inspector";},get isRegular()
3308 {return this.origin==="regular";}}
3309 WebInspector.CSSProperty=function(ownerStyle,index,name,value,important,disabled,parsedOk,implicit,text,range)
3310 {this.ownerStyle=ownerStyle;this.index=index;this.name=name;this.value=value;this.important=important;this.disabled=disabled;this.parsedOk=parsedOk;this.implicit=implicit;this.text=text;this.range=range;}
3311 WebInspector.CSSProperty.parsePayload=function(ownerStyle,index,payload)
3312 {var result=new WebInspector.CSSProperty(ownerStyle,index,payload.name,payload.value,payload.important||false,payload.disabled||false,("parsedOk"in payload)?!!payload.parsedOk:true,!!payload.implicit,payload.text,payload.range);return result;}
3313 WebInspector.CSSProperty.prototype={_setActive:function(active)
3314 {this._active=active;},get propertyText()
3315 {if(this.text!==undefined)
3316 return this.text;if(this.name==="")
3317 return"";return this.name+": "+this.value+(this.important?" !important":"")+";";},get isLive()
3318 {return this.active||this.styleBased;},get active()
3319 {return typeof this._active==="boolean"&&this._active;},get styleBased()
3320 {return!this.range;},get inactive()
3321 {return typeof this._active==="boolean"&&!this._active;},setText:function(propertyText,majorChange,overwrite,userCallback)
3322 {function enabledCallback(style)
3323 {if(userCallback)
3324 userCallback(style);}
3325 function callback(error,stylePayload)
3326 {WebInspector.cssModel._pendingCommandsMajorState.pop();if(!error){if(majorChange)
3327 WebInspector.domModel.markUndoableState();var style=WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);var newProperty=style.allProperties[this.index];if(newProperty&&this.disabled&&!propertyText.match(/^\s*$/)){newProperty.setDisabled(false,enabledCallback);return;}
3328 if(userCallback)
3329 userCallback(style);}else{if(userCallback)
3330 userCallback(null);}}
3331 if(!this.ownerStyle)
3332 throw"No ownerStyle for property";if(!this.ownerStyle.id)
3333 throw"No owner style id";WebInspector.cssModel._pendingCommandsMajorState.push(majorChange);CSSAgent.setPropertyText(this.ownerStyle.id,this.index,propertyText,overwrite,callback.bind(this));},setValue:function(newValue,majorChange,overwrite,userCallback)
3334 {var text=this.name+": "+newValue+(this.important?" !important":"")+";"
3335 this.setText(text,majorChange,overwrite,userCallback);},setDisabled:function(disabled,userCallback)
3336 {if(!this.ownerStyle&&userCallback)
3337 userCallback(null);if(disabled===this.disabled){if(userCallback)
3338 userCallback(this.ownerStyle);return;}
3339 if(disabled)
3340 this.setText("/* "+this.text+" */",true,true,userCallback);else
3341 this.setText(this.text.substring(2,this.text.length-2).trim(),true,true,userCallback);},uiLocation:function(forName)
3342 {if(!this.range||!this.ownerStyle||!this.ownerStyle.parentRule)
3343 return null;var url=this.ownerStyle.parentRule.resourceURL();if(!url)
3344 return null;var range=this.range;var line=forName?range.startLine:range.endLine;var column=forName?range.startColumn:range.endColumn-(this.text&&this.text.endsWith(";")?2:1);var rawLocation=new WebInspector.CSSLocation(url,line,column);return WebInspector.cssModel.rawLocationToUILocation(rawLocation);}}
3345 WebInspector.CSSMedia=function(payload)
3346 {this.text=payload.text;this.source=payload.source;this.sourceURL=payload.sourceURL||"";this.range=payload.range?WebInspector.TextRange.fromObject(payload.range):null;this.parentStyleSheetId=payload.parentStyleSheetId;}
3347 WebInspector.CSSMedia.Source={LINKED_SHEET:"linkedSheet",INLINE_SHEET:"inlineSheet",MEDIA_RULE:"mediaRule",IMPORT_RULE:"importRule"};WebInspector.CSSMedia.parsePayload=function(payload)
3348 {return new WebInspector.CSSMedia(payload);}
3349 WebInspector.CSSMedia.parseMediaArrayPayload=function(payload)
3350 {var result=[];for(var i=0;i<payload.length;++i)
3351 result.push(WebInspector.CSSMedia.parsePayload(payload[i]));return result;}
3352 WebInspector.CSSMedia.prototype={lineNumberInSource:function()
3353 {if(!this.range)
3354 return undefined;var header=this.header();if(!header)
3355 return undefined;return header.lineNumberInSource(this.range.startLine);},columnNumberInSource:function()
3356 {if(!this.range)
3357 return undefined;var header=this.header();if(!header)
3358 return undefined;return header.columnNumberInSource(this.range.startLine,this.range.startColumn);},header:function()
3359 {return this.parentStyleSheetId?WebInspector.cssModel.styleSheetHeaderForId(this.parentStyleSheetId):null;}}
3360 WebInspector.CSSStyleSheetHeader=function(payload)
3361 {this.id=payload.styleSheetId;this.frameId=payload.frameId;this.sourceURL=payload.sourceURL;this.hasSourceURL=!!payload.hasSourceURL;this.sourceMapURL=payload.sourceMapURL;this.origin=payload.origin;this.title=payload.title;this.disabled=payload.disabled;this.isInline=payload.isInline;this.startLine=payload.startLine;this.startColumn=payload.startColumn;this._locations=new Set();this._sourceMappings=[];}
3362 WebInspector.CSSStyleSheetHeader.prototype={resourceURL:function()
3363 {return this.isViaInspector()?this._viaInspectorResourceURL():this.sourceURL;},addLiveLocation:function(location)
3364 {this._locations.add(location);location.update();},updateLocations:function()
3365 {var items=this._locations.items();for(var i=0;i<items.length;++i)
3366 items[i].update();},_removeLocation:function(location)
3367 {this._locations.remove(location);},rawLocationToUILocation:function(lineNumber,columnNumber)
3368 {var uiLocation=null;var rawLocation=new WebInspector.CSSLocation(this.resourceURL(),lineNumber,columnNumber);for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
3369 uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);return uiLocation;},pushSourceMapping:function(sourceMapping)
3370 {this._sourceMappings.push(sourceMapping);this.updateLocations();},_viaInspectorResourceURL:function()
3371 {var frame=WebInspector.resourceTreeModel.frameForId(this.frameId);console.assert(frame);var parsedURL=new WebInspector.ParsedURL(frame.url);var fakeURL="inspector://"+parsedURL.host+parsedURL.folderPathComponents;if(!fakeURL.endsWith("/"))
3372 fakeURL+="/";fakeURL+="inspector-stylesheet";return fakeURL;},lineNumberInSource:function(lineNumberInStyleSheet)
3373 {return this.startLine+lineNumberInStyleSheet;},columnNumberInSource:function(lineNumberInStyleSheet,columnNumberInStyleSheet)
3374 {return(lineNumberInStyleSheet?0:this.startColumn)+columnNumberInStyleSheet;},contentURL:function()
3375 {return this.resourceURL();},contentType:function()
3376 {return WebInspector.resourceTypes.Stylesheet;},_trimSourceURL:function(text)
3377 {var sourceURLRegex=/\n[\040\t]*\/\*[#@][\040\t]sourceURL=[\040\t]*([^\s]*)[\040\t]*\*\/[\040\t]*$/mg;return text.replace(sourceURLRegex,"");},requestContent:function(callback)
3378 {CSSAgent.getStyleSheetText(this.id,textCallback.bind(this));function textCallback(error,text)
3379 {if(error){WebInspector.console.log("Failed to get text for stylesheet "+this.id+": "+error);text="";}
3380 text=this._trimSourceURL(text);callback(text);}},searchInContent:function(query,caseSensitive,isRegex,callback)
3381 {function performSearch(content)
3382 {callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}
3383 this.requestContent(performSearch);},setContent:function(newText,callback)
3384 {newText=this._trimSourceURL(newText);if(this.hasSourceURL)
3385 newText+="\n/*# sourceURL="+this.sourceURL+" */";CSSAgent.setStyleSheetText(this.id,newText,callback);},isViaInspector:function()
3386 {return this.origin==="inspector";},}
3387 WebInspector.CSSDispatcher=function(cssModel)
3388 {this._cssModel=cssModel;}
3389 WebInspector.CSSDispatcher.prototype={mediaQueryResultChanged:function()
3390 {this._cssModel.mediaQueryResultChanged();},styleSheetChanged:function(styleSheetId)
3391 {this._cssModel._fireStyleSheetChanged(styleSheetId);},styleSheetAdded:function(header)
3392 {this._cssModel._styleSheetAdded(header);},styleSheetRemoved:function(id)
3393 {this._cssModel._styleSheetRemoved(id);},}
3394 WebInspector.CSSStyleModel.ComputedStyleLoader=function(cssModel)
3395 {this._cssModel=cssModel;this._nodeIdToCallbackData={};}
3396 WebInspector.CSSStyleModel.ComputedStyleLoader.prototype={getComputedStyle:function(nodeId,userCallback)
3397 {if(this._nodeIdToCallbackData[nodeId]){this._nodeIdToCallbackData[nodeId].push(userCallback);return;}
3398 this._nodeIdToCallbackData[nodeId]=[userCallback];CSSAgent.getComputedStyleForNode(nodeId,resultCallback.bind(this,nodeId));function resultCallback(nodeId,error,computedPayload)
3399 {var computedStyle=(error||!computedPayload)?null:WebInspector.CSSStyleDeclaration.parseComputedStylePayload(computedPayload);var callbacks=this._nodeIdToCallbackData[nodeId];if(!callbacks)
3400 return;delete this._nodeIdToCallbackData[nodeId];for(var i=0;i<callbacks.length;++i)
3401 callbacks[i](computedStyle);}}}
3402 WebInspector.cssModel;WebInspector.CSSParser=function()
3403 {this._worker=new Worker("ScriptFormatterWorker.js");this._worker.onmessage=this._onRuleChunk.bind(this);this._rules=[];}
3404 WebInspector.CSSParser.Events={RulesParsed:"RulesParsed"}
3405 WebInspector.CSSParser.prototype={fetchAndParse:function(styleSheetHeader,callback)
3406 {this._lock();this._finishedCallback=callback;styleSheetHeader.requestContent(this._innerParse.bind(this));},parse:function(text,callback)
3407 {this._lock();this._finishedCallback=callback;this._innerParse(text);},dispose:function()
3408 {if(this._worker){this._worker.terminate();delete this._worker;}},rules:function()
3409 {return this._rules;},_lock:function()
3410 {console.assert(!this._parsingStyleSheet,"Received request to parse stylesheet before previous was completed.");this._parsingStyleSheet=true;},_unlock:function()
3411 {delete this._parsingStyleSheet;},_innerParse:function(text)
3412 {this._rules=[];this._worker.postMessage({method:"parseCSS",params:{content:text}});},_onRuleChunk:function(event)
3413 {var data=(event.data);var chunk=data.chunk;for(var i=0;i<chunk.length;++i)
3414 this._rules.push(chunk[i]);if(data.isLastChunk)
3415 this._onFinishedParsing();this.dispatchEventToListeners(WebInspector.CSSParser.Events.RulesParsed);},_onFinishedParsing:function()
3416 {this._unlock();if(this._finishedCallback)
3417 this._finishedCallback(this._rules);},__proto__:WebInspector.Object.prototype,}
3418 WebInspector.CSSParser.DataChunk;WebInspector.CSSParser.StyleRule;WebInspector.CSSParser.AtRule;WebInspector.CSSParser.Rule;WebInspector.CSSParser.Property;WebInspector.NetworkManager=function(target)
3419 {WebInspector.Object.call(this);this._dispatcher=new WebInspector.NetworkDispatcher(this);this._target=target;this._networkAgent=target.networkAgent();target.registerNetworkDispatcher(this._dispatcher);if(WebInspector.settings.cacheDisabled.get())
3420 this._networkAgent.setCacheDisabled(true);this._networkAgent.enable();WebInspector.settings.cacheDisabled.addChangeListener(this._cacheDisabledSettingChanged,this);}
3421 WebInspector.NetworkManager.EventTypes={RequestStarted:"RequestStarted",RequestUpdated:"RequestUpdated",RequestFinished:"RequestFinished",RequestUpdateDropped:"RequestUpdateDropped"}
3422 WebInspector.NetworkManager._MIMETypes={"text/html":{"document":true},"text/xml":{"document":true},"text/plain":{"document":true},"application/xhtml+xml":{"document":true},"text/css":{"stylesheet":true},"text/xsl":{"stylesheet":true},"image/jpg":{"image":true},"image/jpeg":{"image":true},"image/pjpeg":{"image":true},"image/png":{"image":true},"image/gif":{"image":true},"image/bmp":{"image":true},"image/svg+xml":{"image":true,"font":true,"document":true},"image/vnd.microsoft.icon":{"image":true},"image/webp":{"image":true},"image/x-icon":{"image":true},"image/x-xbitmap":{"image":true},"font/ttf":{"font":true},"font/otf":{"font":true},"font/woff":{"font":true},"font/woff2":{"font":true},"font/truetype":{"font":true},"font/opentype":{"font":true},"application/octet-stream":{"font":true,"image":true},"application/font-woff":{"font":true},"application/x-font-woff":{"font":true},"application/x-font-type1":{"font":true},"application/x-font-ttf":{"font":true},"application/x-truetype-font":{"font":true},"text/javascript":{"script":true},"text/ecmascript":{"script":true},"application/javascript":{"script":true},"application/ecmascript":{"script":true},"application/x-javascript":{"script":true},"application/json":{"script":true},"text/javascript1.1":{"script":true},"text/javascript1.2":{"script":true},"text/javascript1.3":{"script":true},"text/jscript":{"script":true},"text/livescript":{"script":true},}
3423 WebInspector.NetworkManager.prototype={inflightRequestForURL:function(url)
3424 {return this._dispatcher._inflightRequestsByURL[url];},_cacheDisabledSettingChanged:function(event)
3425 {var enabled=(event.data);this._networkAgent.setCacheDisabled(enabled);},__proto__:WebInspector.Object.prototype}
3426 WebInspector.NetworkDispatcher=function(manager)
3427 {this._manager=manager;this._inflightRequestsById={};this._inflightRequestsByURL={};}
3428 WebInspector.NetworkDispatcher.prototype={_headersMapToHeadersArray:function(headersMap)
3429 {var result=[];for(var name in headersMap){var values=headersMap[name].split("\n");for(var i=0;i<values.length;++i)
3430 result.push({name:name,value:values[i]});}
3431 return result;},_updateNetworkRequestWithRequest:function(networkRequest,request)
3432 {networkRequest.requestMethod=request.method;networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.requestFormData=request.postData;},_updateNetworkRequestWithResponse:function(networkRequest,response)
3433 {if(!response)
3434 return;if(response.url&&networkRequest.url!==response.url)
3435 networkRequest.url=response.url;networkRequest.mimeType=response.mimeType;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);if(response.encodedDataLength>=0)
3436 networkRequest.setTransferSize(response.encodedDataLength);if(response.headersText)
3437 networkRequest.responseHeadersText=response.headersText;if(response.requestHeaders){networkRequest.setRequestHeaders(this._headersMapToHeadersArray(response.requestHeaders));networkRequest.setRequestHeadersText(response.requestHeadersText||"");}
3438 networkRequest.connectionReused=response.connectionReused;networkRequest.connectionId=response.connectionId;if(response.remoteIPAddress)
3439 networkRequest.setRemoteAddress(response.remoteIPAddress,response.remotePort||-1);if(response.fromDiskCache)
3440 networkRequest.cached=true;else
3441 networkRequest.timing=response.timing;if(!this._mimeTypeIsConsistentWithType(networkRequest)){this._manager._target.consoleModel.addMessage(new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Network,WebInspector.ConsoleMessage.MessageLevel.Log,WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s: \"%s\".",networkRequest.type.title(),networkRequest.mimeType,networkRequest.url),WebInspector.ConsoleMessage.MessageType.Log,"",0,0,networkRequest.requestId));}},_mimeTypeIsConsistentWithType:function(networkRequest)
3442 {if(networkRequest.hasErrorStatusCode()||networkRequest.statusCode===304||networkRequest.statusCode===204)
3443 return true;if(typeof networkRequest.type==="undefined"||networkRequest.type===WebInspector.resourceTypes.Other||networkRequest.type===WebInspector.resourceTypes.XHR||networkRequest.type===WebInspector.resourceTypes.WebSocket)
3444 return true;if(!networkRequest.mimeType)
3445 return true;if(networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes)
3446 return networkRequest.type.name()in WebInspector.NetworkManager._MIMETypes[networkRequest.mimeType];return false;},_isNull:function(response)
3447 {if(!response)
3448 return true;return!response.status&&!response.mimeType&&(!response.headers||!Object.keys(response.headers).length);},requestWillBeSent:function(requestId,frameId,loaderId,documentURL,request,time,initiator,redirectResponse)
3449 {var networkRequest=this._inflightRequestsById[requestId];if(networkRequest){if(!redirectResponse)
3450 return;this.responseReceived(requestId,frameId,loaderId,time,PageAgent.ResourceType.Other,redirectResponse);networkRequest=this._appendRedirect(requestId,time,request.url);}else
3451 networkRequest=this._createNetworkRequest(requestId,frameId,loaderId,request.url,documentURL,initiator);networkRequest.hasNetworkData=true;this._updateNetworkRequestWithRequest(networkRequest,request);networkRequest.startTime=time;this._startNetworkRequest(networkRequest);},requestServedFromCache:function(requestId)
3452 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3453 return;networkRequest.cached=true;},responseReceived:function(requestId,frameId,loaderId,time,resourceType,response)
3454 {if(this._isNull(response))
3455 return;var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest){var eventData={};eventData.url=response.url;eventData.frameId=frameId;eventData.loaderId=loaderId;eventData.resourceType=resourceType;eventData.mimeType=response.mimeType;this._manager.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,eventData);return;}
3456 networkRequest.responseReceivedTime=time;networkRequest.type=WebInspector.resourceTypes[resourceType];this._updateNetworkRequestWithResponse(networkRequest,response);this._updateNetworkRequest(networkRequest);},dataReceived:function(requestId,time,dataLength,encodedDataLength)
3457 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3458 return;networkRequest.resourceSize+=dataLength;if(encodedDataLength!=-1)
3459 networkRequest.increaseTransferSize(encodedDataLength);networkRequest.endTime=time;this._updateNetworkRequest(networkRequest);},loadingFinished:function(requestId,finishTime,encodedDataLength)
3460 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3461 return;this._finishNetworkRequest(networkRequest,finishTime,encodedDataLength);},loadingFailed:function(requestId,time,localizedDescription,canceled)
3462 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3463 return;networkRequest.failed=true;networkRequest.canceled=canceled;networkRequest.localizedFailDescription=localizedDescription;this._finishNetworkRequest(networkRequest,time,-1);},webSocketCreated:function(requestId,requestURL)
3464 {var networkRequest=new WebInspector.NetworkRequest(requestId,requestURL,"","","");networkRequest.type=WebInspector.resourceTypes.WebSocket;this._startNetworkRequest(networkRequest);},webSocketWillSendHandshakeRequest:function(requestId,time,request)
3465 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3466 return;networkRequest.requestMethod="GET";networkRequest.setRequestHeaders(this._headersMapToHeadersArray(request.headers));networkRequest.startTime=time;this._updateNetworkRequest(networkRequest);},webSocketHandshakeResponseReceived:function(requestId,time,response)
3467 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3468 return;networkRequest.statusCode=response.status;networkRequest.statusText=response.statusText;networkRequest.responseHeaders=this._headersMapToHeadersArray(response.headers);networkRequest.responseHeadersText=response.headersText;if(response.requestHeaders)
3469 networkRequest.setRequestHeaders(this._headersMapToHeadersArray(response.requestHeaders));if(response.requestHeadersText)
3470 networkRequest.setRequestHeadersText(response.requestHeadersText);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameReceived:function(requestId,time,response)
3471 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3472 return;networkRequest.addFrame(response,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameSent:function(requestId,time,response)
3473 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3474 return;networkRequest.addFrame(response,time,true);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketFrameError:function(requestId,time,errorMessage)
3475 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3476 return;networkRequest.addFrameError(errorMessage,time);networkRequest.responseReceivedTime=time;this._updateNetworkRequest(networkRequest);},webSocketClosed:function(requestId,time)
3477 {var networkRequest=this._inflightRequestsById[requestId];if(!networkRequest)
3478 return;this._finishNetworkRequest(networkRequest,time,-1);},_appendRedirect:function(requestId,time,redirectURL)
3479 {var originalNetworkRequest=this._inflightRequestsById[requestId];var previousRedirects=originalNetworkRequest.redirects||[];originalNetworkRequest.requestId="redirected:"+requestId+"."+previousRedirects.length;delete originalNetworkRequest.redirects;if(previousRedirects.length>0)
3480 originalNetworkRequest.redirectSource=previousRedirects[previousRedirects.length-1];this._finishNetworkRequest(originalNetworkRequest,time,-1);var newNetworkRequest=this._createNetworkRequest(requestId,originalNetworkRequest.frameId,originalNetworkRequest.loaderId,redirectURL,originalNetworkRequest.documentURL,originalNetworkRequest.initiator);newNetworkRequest.redirects=previousRedirects.concat(originalNetworkRequest);return newNetworkRequest;},_startNetworkRequest:function(networkRequest)
3481 {this._inflightRequestsById[networkRequest.requestId]=networkRequest;this._inflightRequestsByURL[networkRequest.url]=networkRequest;this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestStarted,networkRequest);},_updateNetworkRequest:function(networkRequest)
3482 {this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestUpdated,networkRequest);},_finishNetworkRequest:function(networkRequest,finishTime,encodedDataLength)
3483 {networkRequest.endTime=finishTime;networkRequest.finished=true;if(encodedDataLength>=0)
3484 networkRequest.setTransferSize(encodedDataLength);this._dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.RequestFinished,networkRequest);delete this._inflightRequestsById[networkRequest.requestId];delete this._inflightRequestsByURL[networkRequest.url];},_dispatchEventToListeners:function(eventType,networkRequest)
3485 {this._manager.dispatchEventToListeners(eventType,networkRequest);},_createNetworkRequest:function(requestId,frameId,loaderId,url,documentURL,initiator)
3486 {var networkRequest=new WebInspector.NetworkRequest(requestId,url,documentURL,frameId,loaderId);networkRequest.initiator=initiator;return networkRequest;}}
3487 WebInspector.networkManager;WebInspector.NetworkLog=function()
3488 {this._requests=[];this._requestForId={};WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._onLoad,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,this._onDOMContentLoaded,this);}
3489 WebInspector.NetworkLog.prototype={get requests()
3490 {return this._requests;},requestForURL:function(url)
3491 {for(var i=0;i<this._requests.length;++i){if(this._requests[i].url===url)
3492 return this._requests[i];}
3493 return null;},pageLoadForRequest:function(request)
3494 {return request.__page;},_onMainFrameNavigated:function(event)
3495 {var mainFrame=event.data;this._currentPageLoad=null;var oldRequests=this._requests.splice(0,this._requests.length);this._requestForId={};for(var i=0;i<oldRequests.length;++i){var request=oldRequests[i];if(request.loaderId===mainFrame.loaderId){if(!this._currentPageLoad)
3496 this._currentPageLoad=new WebInspector.PageLoad(request);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;}}},_onRequestStarted:function(event)
3497 {var request=(event.data);this._requests.push(request);this._requestForId[request.requestId]=request;request.__page=this._currentPageLoad;},_onDOMContentLoaded:function(event)
3498 {if(this._currentPageLoad)
3499 this._currentPageLoad.contentLoadTime=event.data;},_onLoad:function(event)
3500 {if(this._currentPageLoad)
3501 this._currentPageLoad.loadTime=event.data;},requestForId:function(requestId)
3502 {return this._requestForId[requestId];}}
3503 WebInspector.networkLog;WebInspector.PageLoad=function(mainRequest)
3504 {this.id=++WebInspector.PageLoad._lastIdentifier;this.url=mainRequest.url;this.startTime=mainRequest.startTime;}
3505 WebInspector.PageLoad._lastIdentifier=0;WebInspector.ResourceTreeModel=function(target)
3506 {target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestFinished,this);target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdateDropped,this._onRequestUpdateDropped,this);target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);this._agent=target.pageAgent();this._agent.enable();this._fetchResourceTree();target.registerPageDispatcher(new WebInspector.PageDispatcher(this));this._pendingConsoleMessages={};this._securityOriginFrameCount={};this._inspectedPageURL="";}
3507 WebInspector.ResourceTreeModel.EventTypes={FrameAdded:"FrameAdded",FrameNavigated:"FrameNavigated",FrameDetached:"FrameDetached",FrameResized:"FrameResized",MainFrameNavigated:"MainFrameNavigated",MainFrameCreatedOrNavigated:"MainFrameCreatedOrNavigated",ResourceAdded:"ResourceAdded",WillLoadCachedResources:"WillLoadCachedResources",CachedResourcesLoaded:"CachedResourcesLoaded",DOMContentLoaded:"DOMContentLoaded",Load:"Load",WillReloadPage:"WillReloadPage",InspectedURLChanged:"InspectedURLChanged",SecurityOriginAdded:"SecurityOriginAdded",SecurityOriginRemoved:"SecurityOriginRemoved",ScreencastFrame:"ScreencastFrame",ScreencastVisibilityChanged:"ScreencastVisibilityChanged"}
3508 WebInspector.ResourceTreeModel.prototype={_fetchResourceTree:function()
3509 {this._frames={};delete this._cachedResourcesProcessed;this._agent.getResourceTree(this._processCachedResources.bind(this));},_processCachedResources:function(error,mainFramePayload)
3510 {if(error){console.error(JSON.stringify(error));return;}
3511 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources);this._inspectedPageURL=mainFramePayload.frame.url;this._addFramesRecursively(null,mainFramePayload);this._dispatchInspectedURLChanged();this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded);this._cachedResourcesProcessed=true;},inspectedPageURL:function()
3512 {return this._inspectedPageURL;},inspectedPageDomain:function()
3513 {var parsedURL=this._inspectedPageURL?this._inspectedPageURL.asParsedURL():null;return parsedURL?parsedURL.host:"";},cachedResourcesLoaded:function()
3514 {return this._cachedResourcesProcessed;},_dispatchInspectedURLChanged:function()
3515 {InspectorFrontendHost.inspectedURLChanged(this._inspectedPageURL);this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedPageURL);},_addFrame:function(frame,aboutToNavigate)
3516 {this._frames[frame.id]=frame;if(frame.isMainFrame())
3517 this.mainFrame=frame;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,frame);if(!aboutToNavigate)
3518 this._addSecurityOrigin(frame.securityOrigin);if(frame.isMainFrame())
3519 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,frame);},_addSecurityOrigin:function(securityOrigin)
3520 {if(!this._securityOriginFrameCount[securityOrigin]){this._securityOriginFrameCount[securityOrigin]=1;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,securityOrigin);return;}
3521 this._securityOriginFrameCount[securityOrigin]+=1;},_removeSecurityOrigin:function(securityOrigin)
3522 {if(typeof securityOrigin==="undefined")
3523 return;if(this._securityOriginFrameCount[securityOrigin]===1){delete this._securityOriginFrameCount[securityOrigin];this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,securityOrigin);return;}
3524 this._securityOriginFrameCount[securityOrigin]-=1;},securityOrigins:function()
3525 {return Object.keys(this._securityOriginFrameCount);},_handleMainFrameDetached:function(mainFrame)
3526 {function removeOriginForFrame(frame)
3527 {for(var i=0;i<frame.childFrames.length;++i)
3528 removeOriginForFrame.call(this,frame.childFrames[i]);if(!frame.isMainFrame())
3529 this._removeSecurityOrigin(frame.securityOrigin);}
3530 removeOriginForFrame.call(this,WebInspector.resourceTreeModel.mainFrame);},_frameAttached:function(frameId,parentFrameId)
3531 {if(!this._cachedResourcesProcessed)
3532 return null;if(this._frames[frameId])
3533 return null;var parentFrame=parentFrameId?this._frames[parentFrameId]:null;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,frameId);if(frame.isMainFrame()&&this.mainFrame){this._handleMainFrameDetached(this.mainFrame);this._frameDetached(this.mainFrame.id);}
3534 this._addFrame(frame,true);return frame;},_frameNavigated:function(framePayload)
3535 {if(!this._cachedResourcesProcessed)
3536 return;var frame=this._frames[framePayload.id];if(!frame){console.assert(!framePayload.parentId,"Main frame shouldn't have parent frame id.");frame=this._frameAttached(framePayload.id,framePayload.parentId||"");console.assert(frame);}
3537 this._removeSecurityOrigin(frame.securityOrigin);frame._navigate(framePayload);var addedOrigin=frame.securityOrigin;if(frame.isMainFrame())
3538 this._inspectedPageURL=frame.url;this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,frame);if(frame.isMainFrame()){this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,frame);this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,frame);}
3539 if(addedOrigin)
3540 this._addSecurityOrigin(addedOrigin);var resources=frame.resources();for(var i=0;i<resources.length;++i)
3541 this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resources[i]);if(frame.isMainFrame())
3542 this._dispatchInspectedURLChanged();},_frameDetached:function(frameId)
3543 {if(!this._cachedResourcesProcessed)
3544 return;var frame=this._frames[frameId];if(!frame)
3545 return;this._removeSecurityOrigin(frame.securityOrigin);if(frame.parentFrame)
3546 frame.parentFrame._removeChildFrame(frame);else
3547 frame._remove();},_onRequestFinished:function(event)
3548 {if(!this._cachedResourcesProcessed)
3549 return;var request=(event.data);if(request.failed||request.type===WebInspector.resourceTypes.XHR)
3550 return;var frame=this._frames[request.frameId];if(frame){var resource=frame._addRequest(request);this._addPendingConsoleMessagesToResource(resource);}},_onRequestUpdateDropped:function(event)
3551 {if(!this._cachedResourcesProcessed)
3552 return;var frameId=event.data.frameId;var frame=this._frames[frameId];if(!frame)
3553 return;var url=event.data.url;if(frame._resourcesMap[url])
3554 return;var resource=new WebInspector.Resource(null,url,frame.url,frameId,event.data.loaderId,WebInspector.resourceTypes[event.data.resourceType],event.data.mimeType);frame.addResource(resource);},frameForId:function(frameId)
3555 {return this._frames[frameId];},forAllResources:function(callback)
3556 {if(this.mainFrame)
3557 return this.mainFrame._callForFrameResources(callback);return false;},frames:function()
3558 {return Object.values(this._frames);},_consoleMessageAdded:function(event)
3559 {var msg=(event.data);var resource=msg.url?this.resourceForURL(msg.url):null;if(resource)
3560 this._addConsoleMessageToResource(msg,resource);else
3561 this._addPendingConsoleMessage(msg);},_addPendingConsoleMessage:function(msg)
3562 {if(!msg.url)
3563 return;if(!this._pendingConsoleMessages[msg.url])
3564 this._pendingConsoleMessages[msg.url]=[];this._pendingConsoleMessages[msg.url].push(msg);},_addPendingConsoleMessagesToResource:function(resource)
3565 {var messages=this._pendingConsoleMessages[resource.url];if(messages){for(var i=0;i<messages.length;i++)
3566 this._addConsoleMessageToResource(messages[i],resource);delete this._pendingConsoleMessages[resource.url];}},_addConsoleMessageToResource:function(msg,resource)
3567 {switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Warning:resource.warnings++;break;case WebInspector.ConsoleMessage.MessageLevel.Error:resource.errors++;break;}
3568 resource.addMessage(msg);},_consoleCleared:function()
3569 {function callback(resource)
3570 {resource.clearErrorsAndWarnings();}
3571 this._pendingConsoleMessages={};this.forAllResources(callback);},resourceForURL:function(url)
3572 {return this.mainFrame?this.mainFrame.resourceForURL(url):null;},_addFramesRecursively:function(parentFrame,frameTreePayload)
3573 {var framePayload=frameTreePayload.frame;var frame=new WebInspector.ResourceTreeFrame(this,parentFrame,framePayload.id,framePayload);this._addFrame(frame);var frameResource=this._createResourceFromFramePayload(framePayload,framePayload.url,WebInspector.resourceTypes.Document,framePayload.mimeType);if(frame.isMainFrame())
3574 this._inspectedPageURL=frameResource.url;frame.addResource(frameResource);for(var i=0;frameTreePayload.childFrames&&i<frameTreePayload.childFrames.length;++i)
3575 this._addFramesRecursively(frame,frameTreePayload.childFrames[i]);for(var i=0;i<frameTreePayload.resources.length;++i){var subresource=frameTreePayload.resources[i];var resource=this._createResourceFromFramePayload(framePayload,subresource.url,WebInspector.resourceTypes[subresource.type],subresource.mimeType);frame.addResource(resource);}},_createResourceFromFramePayload:function(frame,url,type,mimeType)
3576 {return new WebInspector.Resource(null,url,frame.url,frame.id,frame.loaderId,type,mimeType);},reloadPage:function(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor)
3577 {this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage);this._agent.reload(ignoreCache,scriptToEvaluateOnLoad,scriptPreprocessor);},__proto__:WebInspector.Object.prototype}
3578 WebInspector.ResourceTreeFrame=function(model,parentFrame,frameId,payload)
3579 {this._model=model;this._parentFrame=parentFrame;this._id=frameId;this._url="";if(payload){this._loaderId=payload.loaderId;this._name=payload.name;this._url=payload.url;this._securityOrigin=payload.securityOrigin;this._mimeType=payload.mimeType;}
3580 this._childFrames=[];this._resourcesMap={};if(this._parentFrame)
3581 this._parentFrame._childFrames.push(this);}
3582 WebInspector.ResourceTreeFrame.prototype={get id()
3583 {return this._id;},get name()
3584 {return this._name||"";},get url()
3585 {return this._url;},get securityOrigin()
3586 {return this._securityOrigin;},get loaderId()
3587 {return this._loaderId;},get parentFrame()
3588 {return this._parentFrame;},get childFrames()
3589 {return this._childFrames;},isMainFrame:function()
3590 {return!this._parentFrame;},_navigate:function(framePayload)
3591 {this._loaderId=framePayload.loaderId;this._name=framePayload.name;this._url=framePayload.url;this._securityOrigin=framePayload.securityOrigin;this._mimeType=framePayload.mimeType;var mainResource=this._resourcesMap[this._url];this._resourcesMap={};this._removeChildFrames();if(mainResource&&mainResource.loaderId===this._loaderId)
3592 this.addResource(mainResource);},get mainResource()
3593 {return this._resourcesMap[this._url];},_removeChildFrame:function(frame)
3594 {this._childFrames.remove(frame);frame._remove();},_removeChildFrames:function()
3595 {var frames=this._childFrames;this._childFrames=[];for(var i=0;i<frames.length;++i)
3596 frames[i]._remove();},_remove:function()
3597 {this._removeChildFrames();delete this._model._frames[this.id];this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this);},addResource:function(resource)
3598 {if(this._resourcesMap[resource.url]===resource){return;}
3599 this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);},_addRequest:function(request)
3600 {var resource=this._resourcesMap[request.url];if(resource&&resource.request===request){return resource;}
3601 resource=new WebInspector.Resource(request,request.url,request.documentURL,request.frameId,request.loaderId,request.type,request.mimeType);this._resourcesMap[resource.url]=resource;this._model.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,resource);return resource;},resources:function()
3602 {var result=[];for(var url in this._resourcesMap)
3603 result.push(this._resourcesMap[url]);return result;},resourceForURL:function(url)
3604 {var result;function filter(resource)
3605 {if(resource.url===url){result=resource;return true;}}
3606 this._callForFrameResources(filter);return result||null;},_callForFrameResources:function(callback)
3607 {for(var url in this._resourcesMap){if(callback(this._resourcesMap[url]))
3608 return true;}
3609 for(var i=0;i<this._childFrames.length;++i){if(this._childFrames[i]._callForFrameResources(callback))
3610 return true;}
3611 return false;},displayName:function()
3612 {if(!this._parentFrame)
3613 return WebInspector.UIString("<top frame>");var subtitle=new WebInspector.ParsedURL(this._url).displayName;if(subtitle){if(!this._name)
3614 return subtitle;return this._name+"( "+subtitle+" )";}
3615 return WebInspector.UIString("<iframe>");}}
3616 WebInspector.PageDispatcher=function(resourceTreeModel)
3617 {this._resourceTreeModel=resourceTreeModel;}
3618 WebInspector.PageDispatcher.prototype={domContentEventFired:function(time)
3619 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,time);},loadEventFired:function(time)
3620 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.Load,time);},frameAttached:function(frameId,parentFrameId)
3621 {this._resourceTreeModel._frameAttached(frameId,parentFrameId);},frameNavigated:function(frame)
3622 {this._resourceTreeModel._frameNavigated(frame);},frameDetached:function(frameId)
3623 {this._resourceTreeModel._frameDetached(frameId);},frameStartedLoading:function(frameId)
3624 {},frameStoppedLoading:function(frameId)
3625 {},frameScheduledNavigation:function(frameId,delay)
3626 {},frameClearedScheduledNavigation:function(frameId)
3627 {},frameResized:function()
3628 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.FrameResized,null);},javascriptDialogOpening:function(message)
3629 {},javascriptDialogClosed:function()
3630 {},scriptsEnabled:function(isEnabled)
3631 {WebInspector.settings.javaScriptDisabled.set(!isEnabled);},screencastFrame:function(data,metadata)
3632 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame,{data:data,metadata:metadata});},screencastVisibilityChanged:function(visible)
3633 {this._resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged,{visible:visible});}}
3634 WebInspector.resourceTreeModel;WebInspector.ParsedURL=function(url)
3635 {this.isValid=false;this.url=url;this.scheme="";this.host="";this.port="";this.path="";this.queryParams="";this.fragment="";this.folderPathComponents="";this.lastPathComponent="";var match=url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);if(match){this.isValid=true;this.scheme=match[1].toLowerCase();this.host=match[2];this.port=match[3];this.path=match[4]||"/";this.fragment=match[5];}else{if(this.url.startsWith("data:")){this.scheme="data";return;}
3636 if(this.url==="about:blank"){this.scheme="about";return;}
3637 this.path=this.url;}
3638 var path=this.path;var indexOfQuery=path.indexOf("?");if(indexOfQuery!==-1){this.queryParams=path.substring(indexOfQuery+1)
3639 path=path.substring(0,indexOfQuery);}
3640 var lastSlashIndex=path.lastIndexOf("/");if(lastSlashIndex!==-1){this.folderPathComponents=path.substring(0,lastSlashIndex);this.lastPathComponent=path.substring(lastSlashIndex+1);}else
3641 this.lastPathComponent=path;}
3642 WebInspector.ParsedURL.splitURL=function(url)
3643 {var parsedURL=new WebInspector.ParsedURL(url);var origin;var folderPath;var name;if(parsedURL.isValid){origin=parsedURL.scheme+"://"+parsedURL.host;if(parsedURL.port)
3644 origin+=":"+parsedURL.port;folderPath=parsedURL.folderPathComponents;name=parsedURL.lastPathComponent;if(parsedURL.queryParams)
3645 name+="?"+parsedURL.queryParams;}else{origin="";folderPath="";name=url;}
3646 var result=[origin];var splittedPath=folderPath.split("/");for(var i=1;i<splittedPath.length;++i)
3647 result.push(splittedPath[i]);result.push(name);return result;}
3648 WebInspector.ParsedURL.normalizePath=function(path)
3649 {if(path.indexOf("..")===-1&&path.indexOf('.')===-1)
3650 return path;var normalizedSegments=[];var segments=path.split("/");for(var i=0;i<segments.length;i++){var segment=segments[i];if(segment===".")
3651 continue;else if(segment==="..")
3652 normalizedSegments.pop();else if(segment)
3653 normalizedSegments.push(segment);}
3654 var normalizedPath=normalizedSegments.join("/");if(normalizedPath[normalizedPath.length-1]==="/")
3655 return normalizedPath;if(path[0]==="/"&&normalizedPath)
3656 normalizedPath="/"+normalizedPath;if((path[path.length-1]==="/")||(segments[segments.length-1]===".")||(segments[segments.length-1]===".."))
3657 normalizedPath=normalizedPath+"/";return normalizedPath;}
3658 WebInspector.ParsedURL.completeURL=function(baseURL,href)
3659 {if(href){var trimmedHref=href.trim();if(trimmedHref.startsWith("data:")||trimmedHref.startsWith("blob:")||trimmedHref.startsWith("javascript:"))
3660 return href;var parsedHref=trimmedHref.asParsedURL();if(parsedHref&&parsedHref.scheme)
3661 return trimmedHref;}else{return baseURL;}
3662 var parsedURL=baseURL.asParsedURL();if(parsedURL){if(parsedURL.isDataURL())
3663 return href;var path=href;var query=path.indexOf("?");var postfix="";if(query!==-1){postfix=path.substring(query);path=path.substring(0,query);}else{var fragment=path.indexOf("#");if(fragment!==-1){postfix=path.substring(fragment);path=path.substring(0,fragment);}}
3664 if(!path){var basePath=parsedURL.path;if(postfix.charAt(0)==="?"){var baseQuery=parsedURL.path.indexOf("?");if(baseQuery!==-1)
3665 basePath=basePath.substring(0,baseQuery);}
3666 return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+basePath+postfix;}else if(path.charAt(0)!=="/"){var prefix=parsedURL.path;var prefixQuery=prefix.indexOf("?");if(prefixQuery!==-1)
3667 prefix=prefix.substring(0,prefixQuery);prefix=prefix.substring(0,prefix.lastIndexOf("/"))+"/";path=prefix+path;}else if(path.length>1&&path.charAt(1)==="/"){return parsedURL.scheme+":"+path+postfix;}
3668 return parsedURL.scheme+"://"+parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"")+WebInspector.ParsedURL.normalizePath(path)+postfix;}
3669 return null;}
3670 WebInspector.ParsedURL.prototype={get displayName()
3671 {if(this._displayName)
3672 return this._displayName;if(this.isDataURL())
3673 return this.dataURLDisplayName();if(this.isAboutBlank())
3674 return this.url;this._displayName=this.lastPathComponent;if(!this._displayName)
3675 this._displayName=(this.host||"")+"/";if(this._displayName==="/")
3676 this._displayName=this.url;return this._displayName;},dataURLDisplayName:function()
3677 {if(this._dataURLDisplayName)
3678 return this._dataURLDisplayName;if(!this.isDataURL())
3679 return"";this._dataURLDisplayName=this.url.trimEnd(20);return this._dataURLDisplayName;},isAboutBlank:function()
3680 {return this.url==="about:blank";},isDataURL:function()
3681 {return this.scheme==="data";}}
3682 String.prototype.asParsedURL=function()
3683 {var parsedURL=new WebInspector.ParsedURL(this.toString());if(parsedURL.isValid)
3684 return parsedURL;return null;}
3685 WebInspector.resourceForURL=function(url)
3686 {return WebInspector.resourceTreeModel.resourceForURL(url);}
3687 WebInspector.forAllResources=function(callback)
3688 {WebInspector.resourceTreeModel.forAllResources(callback);}
3689 WebInspector.displayNameForURL=function(url)
3690 {if(!url)
3691 return"";var resource=WebInspector.resourceForURL(url);if(resource)
3692 return resource.displayName;var uiSourceCode=WebInspector.workspace.uiSourceCodeForURL(url);if(uiSourceCode)
3693 return uiSourceCode.displayName();if(!WebInspector.resourceTreeModel.inspectedPageURL())
3694 return url.trimURL("");var parsedURL=WebInspector.resourceTreeModel.inspectedPageURL().asParsedURL();var lastPathComponent=parsedURL?parsedURL.lastPathComponent:parsedURL;var index=WebInspector.resourceTreeModel.inspectedPageURL().indexOf(lastPathComponent);if(index!==-1&&index+lastPathComponent.length===WebInspector.resourceTreeModel.inspectedPageURL().length){var baseURL=WebInspector.resourceTreeModel.inspectedPageURL().substring(0,index);if(url.startsWith(baseURL))
3695 return url.substring(index);}
3696 if(!parsedURL)
3697 return url;var displayName=url.trimURL(parsedURL.host);return displayName==="/"?parsedURL.host+"/":displayName;}
3698 WebInspector.linkifyStringAsFragmentWithCustomLinkifier=function(string,linkifier)
3699 {var container=document.createDocumentFragment();var linkStringRegEx=/(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/;var lineColumnRegEx=/:(\d+)(:(\d+))?$/;while(string){var linkString=linkStringRegEx.exec(string);if(!linkString)
3700 break;linkString=linkString[0];var linkIndex=string.indexOf(linkString);var nonLink=string.substring(0,linkIndex);container.appendChild(document.createTextNode(nonLink));var title=linkString;var realURL=(linkString.startsWith("www.")?"http://"+linkString:linkString);var lineColumnMatch=lineColumnRegEx.exec(realURL);var lineNumber;var columnNumber;if(lineColumnMatch){realURL=realURL.substring(0,realURL.length-lineColumnMatch[0].length);lineNumber=parseInt(lineColumnMatch[1],10);lineNumber=isNaN(lineNumber)?undefined:lineNumber-1;if(typeof(lineColumnMatch[3])==="string"){columnNumber=parseInt(lineColumnMatch[3],10);columnNumber=isNaN(columnNumber)?undefined:columnNumber-1;}}
3701 var linkNode=linkifier(title,realURL,lineNumber,columnNumber);container.appendChild(linkNode);string=string.substring(linkIndex+linkString.length,string.length);}
3702 if(string)
3703 container.appendChild(document.createTextNode(string));return container;}
3704 WebInspector.linkifyStringAsFragment=function(string)
3705 {function linkifier(title,url,lineNumber,columnNumber)
3706 {var isExternal=!WebInspector.resourceForURL(url)&&!WebInspector.workspace.uiSourceCodeForURL(url);var urlNode=WebInspector.linkifyURLAsNode(url,title,undefined,isExternal);if(typeof lineNumber!=="undefined"){urlNode.lineNumber=lineNumber;if(typeof columnNumber!=="undefined")
3707 urlNode.columnNumber=columnNumber;}
3708 return urlNode;}
3709 return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string,linkifier);}
3710 WebInspector.linkifyURLAsNode=function(url,linkText,classes,isExternal,tooltipText)
3711 {if(!linkText)
3712 linkText=url;classes=(classes?classes+" ":"");classes+=isExternal?"webkit-html-external-link":"webkit-html-resource-link";var a=document.createElement("a");var href=sanitizeHref(url);if(href!==null)
3713 a.href=href;a.className=classes;if(typeof tooltipText==="undefined")
3714 a.title=url;else if(typeof tooltipText!=="string"||tooltipText.length)
3715 a.title=tooltipText;a.textContent=linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);if(isExternal)
3716 a.setAttribute("target","_blank");return a;}
3717 WebInspector.formatLinkText=function(url,lineNumber)
3718 {var text=url?WebInspector.displayNameForURL(url):WebInspector.UIString("(program)");if(typeof lineNumber==="number")
3719 text+=":"+(lineNumber+1);return text;}
3720 WebInspector.linkifyResourceAsNode=function(url,lineNumber,classes,tooltipText)
3721 {var linkText=WebInspector.formatLinkText(url,lineNumber);var anchor=WebInspector.linkifyURLAsNode(url,linkText,classes,false,tooltipText);anchor.lineNumber=lineNumber;return anchor;}
3722 WebInspector.linkifyRequestAsNode=function(request)
3723 {var anchor=WebInspector.linkifyURLAsNode(request.url);anchor.requestId=request.requestId;return anchor;}
3724 WebInspector.contentAsDataURL=function(content,mimeType,contentEncoded)
3725 {const maxDataUrlSize=1024*1024;if(content===null||content.length>maxDataUrlSize)
3726 return null;return"data:"+mimeType+(contentEncoded?";base64,":",")+content;}
3727 WebInspector.ResourceType=function(name,title,categoryTitle,color,isTextType)
3728 {this._name=name;this._title=title;this._categoryTitle=categoryTitle;this._color=color;this._isTextType=isTextType;}
3729 WebInspector.ResourceType.prototype={name:function()
3730 {return this._name;},title:function()
3731 {return this._title;},categoryTitle:function()
3732 {return this._categoryTitle;},color:function()
3733 {return this._color;},isTextType:function()
3734 {return this._isTextType;},toString:function()
3735 {return this._name;},canonicalMimeType:function()
3736 {if(this===WebInspector.resourceTypes.Document)
3737 return"text/html";if(this===WebInspector.resourceTypes.Script)
3738 return"text/javascript";if(this===WebInspector.resourceTypes.Stylesheet)
3739 return"text/css";return"";}}
3740 WebInspector.resourceTypes={Document:new WebInspector.ResourceType("document","Document","Documents","rgb(47,102,236)",true),Stylesheet:new WebInspector.ResourceType("stylesheet","Stylesheet","Stylesheets","rgb(157,231,119)",true),Image:new WebInspector.ResourceType("image","Image","Images","rgb(164,60,255)",false),Script:new WebInspector.ResourceType("script","Script","Scripts","rgb(255,121,0)",true),XHR:new WebInspector.ResourceType("xhr","XHR","XHR","rgb(231,231,10)",true),Font:new WebInspector.ResourceType("font","Font","Fonts","rgb(255,82,62)",false),WebSocket:new WebInspector.ResourceType("websocket","WebSocket","WebSockets","rgb(186,186,186)",false),Other:new WebInspector.ResourceType("other","Other","Other","rgb(186,186,186)",false)}
3741 WebInspector.ResourceType.mimeTypesForExtensions={"js":"text/javascript","css":"text/css","html":"text/html","htm":"text/html","xml":"application/xml","xsl":"application/xml","asp":"application/x-aspx","aspx":"application/x-aspx","jsp":"application/x-jsp","c":"text/x-c++src","cc":"text/x-c++src","cpp":"text/x-c++src","h":"text/x-c++src","m":"text/x-c++src","mm":"text/x-c++src","coffee":"text/x-coffeescript","dart":"text/javascript","ts":"text/typescript","json":"application/json","gyp":"application/json","gypi":"application/json","cs":"text/x-csharp","java":"text/x-java","php":"text/x-php","phtml":"application/x-httpd-php","py":"text/x-python","sh":"text/x-sh","scss":"text/x-scss"}
3742 WebInspector.TimelineManager=function()
3743 {WebInspector.Object.call(this);this._dispatcher=new WebInspector.TimelineDispatcher(this);this._enablementCount=0;TimelineAgent.enable();}
3744 WebInspector.TimelineManager.EventTypes={TimelineStarted:"TimelineStarted",TimelineStopped:"TimelineStopped",TimelineEventRecorded:"TimelineEventRecorded",TimelineProgress:"TimelineProgress"}
3745 WebInspector.TimelineManager.prototype={isStarted:function()
3746 {return this._dispatcher.isStarted();},start:function(maxCallStackDepth,bufferEvents,liveEvents,includeCounters,includeGPUEvents,callback)
3747 {this._enablementCount++;if(this._enablementCount===1)
3748 TimelineAgent.start(maxCallStackDepth,bufferEvents,liveEvents,includeCounters,includeGPUEvents,callback);else if(callback)
3749 callback(null);},stop:function(callback)
3750 {this._enablementCount--;if(this._enablementCount<0){console.error("WebInspector.TimelineManager start/stop calls are unbalanced "+new Error().stack);return;}
3751 if(!this._enablementCount)
3752 TimelineAgent.stop(callback);else if(callback)
3753 callback(null);},__proto__:WebInspector.Object.prototype}
3754 WebInspector.TimelineDispatcher=function(manager)
3755 {this._manager=manager;InspectorBackend.registerTimelineDispatcher(this);}
3756 WebInspector.TimelineDispatcher.prototype={eventRecorded:function(record)
3757 {this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,record);},isStarted:function()
3758 {return!!this._started;},started:function(consoleTimeline)
3759 {if(consoleTimeline){WebInspector.moduleManager.loadModule("timeline");}
3760 this._started=true;this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStarted,consoleTimeline);},stopped:function(consoleTimeline)
3761 {this._started=false;this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped,consoleTimeline);},progress:function(count)
3762 {this._manager.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineProgress,count);}}
3763 WebInspector.timelineManager;WebInspector.PowerProfiler=function()
3764 {WebInspector.Object.call(this);this._dispatcher=new WebInspector.PowerDispatcher(this);}
3765 WebInspector.PowerProfiler.EventTypes={PowerEventRecorded:"PowerEventRecorded"}
3766 WebInspector.PowerProfiler.prototype={startProfile:function()
3767 {PowerAgent.start();},stopProfile:function()
3768 {PowerAgent.end();},__proto__:WebInspector.Object.prototype}
3769 WebInspector.PowerDispatcher=function(profiler)
3770 {this._profiler=profiler;InspectorBackend.registerPowerDispatcher(this);}
3771 WebInspector.PowerDispatcher.prototype={dataAvailable:function(events)
3772 {for(var i=0;i<events.length;++i)
3773 this._profiler.dispatchEventToListeners(WebInspector.PowerProfiler.EventTypes.PowerEventRecorded,events[i]);}}
3774 WebInspector.powerProfiler;WebInspector.OverridesSupport=function()
3775 {WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated.bind(this),this);this._deviceMetricsOverrideEnabled=false;this._emulateViewportEnabled=false;this._userAgent="";this.maybeHasActiveOverridesChanged();WebInspector.settings.overrideUserAgent.addChangeListener(this._userAgentChanged,this);WebInspector.settings.userAgent.addChangeListener(this._userAgentChanged,this);WebInspector.settings.overrideDeviceMetrics.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.emulateViewport.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged,this);WebInspector.settings.overrideGeolocation.addChangeListener(this._geolocationPositionChanged,this);WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged,this);WebInspector.settings.overrideDeviceOrientation.addChangeListener(this._deviceOrientationChanged,this);WebInspector.settings.deviceOrientationOverride.addChangeListener(this._deviceOrientationChanged,this);WebInspector.settings.emulateTouchEvents.addChangeListener(this._emulateTouchEventsChanged,this);WebInspector.settings.overrideCSSMedia.addChangeListener(this._cssMediaChanged,this);WebInspector.settings.emulatedCSSMedia.addChangeListener(this._cssMediaChanged,this);}
3776 WebInspector.OverridesSupport.isInspectingDevice=function()
3777 {return!!WebInspector.queryParam("remoteFrontend");}
3778 WebInspector.OverridesSupport.Events={OverridesWarningUpdated:"OverridesWarningUpdated",HasActiveOverridesChanged:"HasActiveOverridesChanged",}
3779 WebInspector.OverridesSupport.DeviceMetrics=function(width,height,deviceScaleFactor,textAutosizing)
3780 {this.width=width;this.height=height;this.deviceScaleFactor=deviceScaleFactor;this.textAutosizing=textAutosizing;}
3781 WebInspector.OverridesSupport.DeviceMetrics.parseSetting=function(value)
3782 {var width=0;var height=0;var deviceScaleFactor=1;var textAutosizing=true;if(value){var splitMetrics=value.split("x");if(splitMetrics.length>=3){width=parseInt(splitMetrics[0],10);height=parseInt(splitMetrics[1],10);deviceScaleFactor=parseFloat(splitMetrics[2]);if(splitMetrics.length==4)
3783 textAutosizing=splitMetrics[3]==1;}}
3784 return new WebInspector.OverridesSupport.DeviceMetrics(width,height,deviceScaleFactor,textAutosizing);}
3785 WebInspector.OverridesSupport.DeviceMetrics.parseUserInput=function(widthString,heightString,deviceScaleFactorString,textAutosizing)
3786 {function isUserInputValid(value,isInteger)
3787 {if(!value)
3788 return true;return isInteger?/^[0]*[1-9][\d]*$/.test(value):/^[0]*([1-9][\d]*(\.\d+)?|\.\d+)$/.test(value);}
3789 if(!widthString^!heightString)
3790 return null;var isWidthValid=isUserInputValid(widthString,true);var isHeightValid=isUserInputValid(heightString,true);var isDeviceScaleFactorValid=isUserInputValid(deviceScaleFactorString,false);if(!isWidthValid&&!isHeightValid&&!isDeviceScaleFactorValid)
3791 return null;var width=isWidthValid?parseInt(widthString||"0",10):-1;var height=isHeightValid?parseInt(heightString||"0",10):-1;var deviceScaleFactor=isDeviceScaleFactorValid?parseFloat(deviceScaleFactorString):-1;return new WebInspector.OverridesSupport.DeviceMetrics(width,height,deviceScaleFactor,textAutosizing);}
3792 WebInspector.OverridesSupport.DeviceMetrics.prototype={isValid:function()
3793 {return this.isWidthValid()&&this.isHeightValid()&&this.isDeviceScaleFactorValid();},isWidthValid:function()
3794 {return this.width>=0;},isHeightValid:function()
3795 {return this.height>=0;},isDeviceScaleFactorValid:function()
3796 {return this.deviceScaleFactor>0;},toSetting:function()
3797 {if(!this.isValid())
3798 return"";return this.width&&this.height?this.width+"x"+this.height+"x"+this.deviceScaleFactor+"x"+(this.textAutosizing?"1":"0"):"";},widthToInput:function()
3799 {return this.isWidthValid()&&this.width?String(this.width):"";},heightToInput:function()
3800 {return this.isHeightValid()&&this.height?String(this.height):"";},deviceScaleFactorToInput:function()
3801 {return this.isDeviceScaleFactorValid()&&this.deviceScaleFactor?String(this.deviceScaleFactor):"";},fontScaleFactor:function()
3802 {if(this.isValid()){var minWidth=Math.min(this.width,this.height)/this.deviceScaleFactor;var kMinFSM=1.05;var kWidthForMinFSM=320;var kMaxFSM=1.3;var kWidthForMaxFSM=800;if(minWidth<=kWidthForMinFSM)
3803 return kMinFSM;if(minWidth>=kWidthForMaxFSM)
3804 return kMaxFSM;var ratio=(minWidth-kWidthForMinFSM)/(kWidthForMaxFSM-kWidthForMinFSM);return ratio*(kMaxFSM-kMinFSM)+kMinFSM;}
3805 return 1;}}
3806 WebInspector.OverridesSupport.GeolocationPosition=function(latitude,longitude,error)
3807 {this.latitude=latitude;this.longitude=longitude;this.error=error;}
3808 WebInspector.OverridesSupport.GeolocationPosition.prototype={toSetting:function()
3809 {return(typeof this.latitude==="number"&&typeof this.longitude==="number"&&typeof this.error==="string")?this.latitude+"@"+this.longitude+":"+this.error:"";}}
3810 WebInspector.OverridesSupport.GeolocationPosition.parseSetting=function(value)
3811 {if(value){var splitError=value.split(":");if(splitError.length===2){var splitPosition=splitError[0].split("@")
3812 if(splitPosition.length===2)
3813 return new WebInspector.OverridesSupport.GeolocationPosition(parseFloat(splitPosition[0]),parseFloat(splitPosition[1]),splitError[1]);}}
3814 return new WebInspector.OverridesSupport.GeolocationPosition(0,0,"");}
3815 WebInspector.OverridesSupport.GeolocationPosition.parseUserInput=function(latitudeString,longitudeString,errorStatus)
3816 {function isUserInputValid(value)
3817 {if(!value)
3818 return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
3819 if(!latitudeString^!latitudeString)
3820 return null;var isLatitudeValid=isUserInputValid(latitudeString);var isLongitudeValid=isUserInputValid(longitudeString);if(!isLatitudeValid&&!isLongitudeValid)
3821 return null;var latitude=isLatitudeValid?parseFloat(latitudeString):-1;var longitude=isLongitudeValid?parseFloat(longitudeString):-1;return new WebInspector.OverridesSupport.GeolocationPosition(latitude,longitude,errorStatus?"PositionUnavailable":"");}
3822 WebInspector.OverridesSupport.GeolocationPosition.clearGeolocationOverride=function()
3823 {GeolocationAgent.clearGeolocationOverride();}
3824 WebInspector.OverridesSupport.DeviceOrientation=function(alpha,beta,gamma)
3825 {this.alpha=alpha;this.beta=beta;this.gamma=gamma;}
3826 WebInspector.OverridesSupport.DeviceOrientation.prototype={toSetting:function()
3827 {return JSON.stringify(this);}}
3828 WebInspector.OverridesSupport.DeviceOrientation.parseSetting=function(value)
3829 {if(value){var jsonObject=JSON.parse(value);return new WebInspector.OverridesSupport.DeviceOrientation(jsonObject.alpha,jsonObject.beta,jsonObject.gamma);}
3830 return new WebInspector.OverridesSupport.DeviceOrientation(0,0,0);}
3831 WebInspector.OverridesSupport.DeviceOrientation.parseUserInput=function(alphaString,betaString,gammaString)
3832 {function isUserInputValid(value)
3833 {if(!value)
3834 return true;return/^[-]?[0-9]*[.]?[0-9]*$/.test(value);}
3835 if(!alphaString^!betaString^!gammaString)
3836 return null;var isAlphaValid=isUserInputValid(alphaString);var isBetaValid=isUserInputValid(betaString);var isGammaValid=isUserInputValid(gammaString);if(!isAlphaValid&&!isBetaValid&&!isGammaValid)
3837 return null;var alpha=isAlphaValid?parseFloat(alphaString):-1;var beta=isBetaValid?parseFloat(betaString):-1;var gamma=isGammaValid?parseFloat(gammaString):-1;return new WebInspector.OverridesSupport.DeviceOrientation(alpha,beta,gamma);}
3838 WebInspector.OverridesSupport.DeviceOrientation.clearDeviceOrientationOverride=function()
3839 {PageAgent.clearDeviceOrientationOverride();}
3840 WebInspector.OverridesSupport.prototype={emulateDevice:function(deviceMetrics,userAgent)
3841 {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;WebInspector.settings.deviceMetrics.set(deviceMetrics);WebInspector.settings.userAgent.set(userAgent);WebInspector.settings.overrideDeviceMetrics.set(true);WebInspector.settings.overrideUserAgent.set(true);WebInspector.settings.emulateTouchEvents.set(true);WebInspector.settings.emulateViewport.set(true);delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;this._deviceMetricsChanged();this._userAgentChanged();},reset:function()
3842 {this._deviceMetricsChangedListenerMuted=true;this._userAgentChangedListenerMuted=true;WebInspector.settings.overrideDeviceMetrics.set(false);WebInspector.settings.overrideUserAgent.set(false);WebInspector.settings.emulateTouchEvents.set(false);WebInspector.settings.overrideDeviceOrientation.set(false);WebInspector.settings.overrideGeolocation.set(false);WebInspector.settings.overrideCSSMedia.set(false);WebInspector.settings.emulateViewport.set(false);WebInspector.settings.deviceMetrics.set("");delete this._deviceMetricsChangedListenerMuted;delete this._userAgentChangedListenerMuted;this._deviceMetricsChanged();this._userAgentChanged();},applyInitialOverrides:function()
3843 {if(WebInspector.settings.overrideDeviceOrientation.get())
3844 this._deviceOrientationChanged();if(WebInspector.settings.overrideGeolocation.get())
3845 this._geolocationPositionChanged();if(WebInspector.settings.emulateTouchEvents.get())
3846 this._emulateTouchEventsChanged();if(WebInspector.settings.overrideCSSMedia.get())
3847 this._cssMediaChanged();if(WebInspector.settings.overrideDeviceMetrics.get())
3848 this._deviceMetricsChanged();if(WebInspector.settings.overrideUserAgent.get())
3849 this._userAgentChanged();},_userAgentChanged:function()
3850 {if(WebInspector.OverridesSupport.isInspectingDevice()||this._userAgentChangedListenerMuted)
3851 return;var userAgent=WebInspector.settings.overrideUserAgent.get()?WebInspector.settings.userAgent.get():"";NetworkAgent.setUserAgentOverride(userAgent);this._updateUserAgentWarningMessage(this._userAgent!==userAgent?WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."):"");this._userAgent=userAgent;this.maybeHasActiveOverridesChanged();},_deviceMetricsChanged:function()
3852 {if(this._deviceMetricsChangedListenerMuted)
3853 return;var metrics=WebInspector.OverridesSupport.DeviceMetrics.parseSetting(WebInspector.settings.overrideDeviceMetrics.get()?WebInspector.settings.deviceMetrics.get():"");if(!metrics.isValid())
3854 return;var dipWidth=Math.round(metrics.width/metrics.deviceScaleFactor);var dipHeight=Math.round(metrics.height/metrics.deviceScaleFactor);var metricsOverrideEnabled=!!(dipWidth&&dipHeight);if(metricsOverrideEnabled&&WebInspector.OverridesSupport.isInspectingDevice()){this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Screen emulation on the device is not available."));return;}
3855 PageAgent.setDeviceMetricsOverride(dipWidth,dipHeight,metricsOverrideEnabled?metrics.deviceScaleFactor:0,WebInspector.settings.emulateViewport.get(),WebInspector.settings.deviceFitWindow.get(),metrics.textAutosizing,metrics.fontScaleFactor(),apiCallback.bind(this));this.maybeHasActiveOverridesChanged();function apiCallback(error)
3856 {if(error){this._updateDeviceMetricsWarningMessage(WebInspector.UIString("Screen emulation is not available on this page."));return;}
3857 var viewportEnabled=WebInspector.settings.emulateViewport.get();this._updateDeviceMetricsWarningMessage(this._deviceMetricsOverrideEnabled!==metricsOverrideEnabled||(metricsOverrideEnabled&&this._emulateViewportEnabled!=viewportEnabled)?WebInspector.UIString("You might need to reload the page for proper user agent spoofing and viewport rendering."):"");this._deviceMetricsOverrideEnabled=metricsOverrideEnabled;this._emulateViewportEnabled=viewportEnabled;this._deviceMetricsOverrideAppliedForTest();}},_deviceMetricsOverrideAppliedForTest:function()
3858 {},_geolocationPositionChanged:function()
3859 {if(!WebInspector.settings.overrideGeolocation.get()){GeolocationAgent.clearGeolocationOverride();return;}
3860 var geolocation=WebInspector.OverridesSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get());if(geolocation.error)
3861 GeolocationAgent.setGeolocationOverride();else
3862 GeolocationAgent.setGeolocationOverride(geolocation.latitude,geolocation.longitude,150);this.maybeHasActiveOverridesChanged();},_deviceOrientationChanged:function()
3863 {if(!WebInspector.settings.overrideDeviceOrientation.get()){PageAgent.clearDeviceOrientationOverride();return;}
3864 var deviceOrientation=WebInspector.OverridesSupport.DeviceOrientation.parseSetting(WebInspector.settings.deviceOrientationOverride.get());PageAgent.setDeviceOrientationOverride(deviceOrientation.alpha,deviceOrientation.beta,deviceOrientation.gamma);this.maybeHasActiveOverridesChanged();},_emulateTouchEventsChanged:function()
3865 {if(WebInspector.OverridesSupport.isInspectingDevice()&&WebInspector.settings.emulateTouchEvents.get())
3866 return;WebInspector.domModel.emulateTouchEventObjects(WebInspector.settings.emulateTouchEvents.get());this.maybeHasActiveOverridesChanged();},_cssMediaChanged:function()
3867 {PageAgent.setEmulatedMedia(WebInspector.settings.overrideCSSMedia.get()?WebInspector.settings.emulatedCSSMedia.get():"");WebInspector.cssModel.mediaQueryResultChanged();this.maybeHasActiveOverridesChanged();},hasActiveOverrides:function()
3868 {return this._hasActiveOverrides;},maybeHasActiveOverridesChanged:function()
3869 {var hasActiveOverrides=WebInspector.settings.overrideUserAgent.get()||WebInspector.settings.overrideDeviceMetrics.get()||WebInspector.settings.overrideGeolocation.get()||WebInspector.settings.overrideDeviceOrientation.get()||WebInspector.settings.emulateTouchEvents.get()||WebInspector.settings.overrideCSSMedia.get();if(this._hasActiveOverrides!==hasActiveOverrides){this._hasActiveOverrides=hasActiveOverrides;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.HasActiveOverridesChanged);}},_onMainFrameNavigated:function()
3870 {this._deviceMetricsChanged();this._updateUserAgentWarningMessage("");},_updateDeviceMetricsWarningMessage:function(warningMessage)
3871 {this._deviceMetricsWarningMessage=warningMessage;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.OverridesWarningUpdated);},_updateUserAgentWarningMessage:function(warningMessage)
3872 {this._userAgentWarningMessage=warningMessage;this.dispatchEventToListeners(WebInspector.OverridesSupport.Events.OverridesWarningUpdated);},warningMessage:function()
3873 {return this._deviceMetricsWarningMessage||this._userAgentWarningMessage||"";},__proto__:WebInspector.Object.prototype}
3874 WebInspector.overridesSupport;WebInspector.Database=function(model,id,domain,name,version)
3875 {this._model=model;this._id=id;this._domain=domain;this._name=name;this._version=version;}
3876 WebInspector.Database.prototype={get id()
3877 {return this._id;},get name()
3878 {return this._name;},set name(x)
3879 {this._name=x;},get version()
3880 {return this._version;},set version(x)
3881 {this._version=x;},get domain()
3882 {return this._domain;},set domain(x)
3883 {this._domain=x;},getTableNames:function(callback)
3884 {function sortingCallback(error,names)
3885 {if(!error)
3886 callback(names.sort());}
3887 DatabaseAgent.getDatabaseTableNames(this._id,sortingCallback);},executeSql:function(query,onSuccess,onError)
3888 {function callback(error,columnNames,values,errorObj)
3889 {if(error){onError(error);return;}
3890 if(errorObj){var message;if(errorObj.message)
3891 message=errorObj.message;else if(errorObj.code==2)
3892 message=WebInspector.UIString("Database no longer has expected version.");else
3893 message=WebInspector.UIString("An unexpected error %s occurred.",errorObj.code);onError(message);return;}
3894 onSuccess(columnNames,values);}
3895 DatabaseAgent.executeSQL(this._id,query,callback);}}
3896 WebInspector.DatabaseModel=function()
3897 {this._databases=[];InspectorBackend.registerDatabaseDispatcher(new WebInspector.DatabaseDispatcher(this));DatabaseAgent.enable();}
3898 WebInspector.DatabaseModel.Events={DatabaseAdded:"DatabaseAdded"}
3899 WebInspector.DatabaseModel.prototype={databases:function()
3900 {var result=[];for(var databaseId in this._databases)
3901 result.push(this._databases[databaseId]);return result;},databaseForId:function(databaseId)
3902 {return this._databases[databaseId];},_addDatabase:function(database)
3903 {this._databases.push(database);this.dispatchEventToListeners(WebInspector.DatabaseModel.Events.DatabaseAdded,database);},__proto__:WebInspector.Object.prototype}
3904 WebInspector.DatabaseDispatcher=function(model)
3905 {this._model=model;}
3906 WebInspector.DatabaseDispatcher.prototype={addDatabase:function(payload)
3907 {this._model._addDatabase(new WebInspector.Database(this._model,payload.id,payload.domain,payload.name,payload.version));}}
3908 WebInspector.databaseModel;WebInspector.DOMStorage=function(securityOrigin,isLocalStorage)
3909 {this._securityOrigin=securityOrigin;this._isLocalStorage=isLocalStorage;}
3910 WebInspector.DOMStorage.storageId=function(securityOrigin,isLocalStorage)
3911 {return{securityOrigin:securityOrigin,isLocalStorage:isLocalStorage};}
3912 WebInspector.DOMStorage.Events={DOMStorageItemsCleared:"DOMStorageItemsCleared",DOMStorageItemRemoved:"DOMStorageItemRemoved",DOMStorageItemAdded:"DOMStorageItemAdded",DOMStorageItemUpdated:"DOMStorageItemUpdated"}
3913 WebInspector.DOMStorage.prototype={get id()
3914 {return WebInspector.DOMStorage.storageId(this._securityOrigin,this._isLocalStorage);},get securityOrigin()
3915 {return this._securityOrigin;},get isLocalStorage()
3916 {return this._isLocalStorage;},getItems:function(callback)
3917 {DOMStorageAgent.getDOMStorageItems(this.id,callback);},setItem:function(key,value)
3918 {DOMStorageAgent.setDOMStorageItem(this.id,key,value);},removeItem:function(key)
3919 {DOMStorageAgent.removeDOMStorageItem(this.id,key);},__proto__:WebInspector.Object.prototype}
3920 WebInspector.DOMStorageModel=function()
3921 {this._storages={};InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this));DOMStorageAgent.enable();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);}
3922 WebInspector.DOMStorageModel.Events={DOMStorageAdded:"DOMStorageAdded",DOMStorageRemoved:"DOMStorageRemoved"}
3923 WebInspector.DOMStorageModel.prototype={_securityOriginAdded:function(event)
3924 {var securityOrigin=(event.data);var localStorageKey=this._storageKey(securityOrigin,true);console.assert(!this._storages[localStorageKey]);var localStorage=new WebInspector.DOMStorage(securityOrigin,true);this._storages[localStorageKey]=localStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);console.assert(!this._storages[sessionStorageKey]);var sessionStorage=new WebInspector.DOMStorage(securityOrigin,false);this._storages[sessionStorageKey]=sessionStorage;this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded,sessionStorage);},_securityOriginRemoved:function(event)
3925 {var securityOrigin=(event.data);var localStorageKey=this._storageKey(securityOrigin,true);var localStorage=this._storages[localStorageKey];console.assert(localStorage);delete this._storages[localStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,localStorage);var sessionStorageKey=this._storageKey(securityOrigin,false);var sessionStorage=this._storages[sessionStorageKey];console.assert(sessionStorage);delete this._storages[sessionStorageKey];this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved,sessionStorage);},_storageKey:function(securityOrigin,isLocalStorage)
3926 {return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin,isLocalStorage));},_domStorageItemsCleared:function(storageId)
3927 {var domStorage=this.storageForId(storageId);if(!domStorage)
3928 return;var eventData={};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemsCleared,eventData);},_domStorageItemRemoved:function(storageId,key)
3929 {var domStorage=this.storageForId(storageId);if(!domStorage)
3930 return;var eventData={key:key};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemRemoved,eventData);},_domStorageItemAdded:function(storageId,key,value)
3931 {var domStorage=this.storageForId(storageId);if(!domStorage)
3932 return;var eventData={key:key,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemAdded,eventData);},_domStorageItemUpdated:function(storageId,key,oldValue,value)
3933 {var domStorage=this.storageForId(storageId);if(!domStorage)
3934 return;var eventData={key:key,oldValue:oldValue,value:value};domStorage.dispatchEventToListeners(WebInspector.DOMStorage.Events.DOMStorageItemUpdated,eventData);},storageForId:function(storageId)
3935 {return this._storages[JSON.stringify(storageId)];},storages:function()
3936 {var result=[];for(var id in this._storages)
3937 result.push(this._storages[id]);return result;},__proto__:WebInspector.Object.prototype}
3938 WebInspector.DOMStorageDispatcher=function(model)
3939 {this._model=model;}
3940 WebInspector.DOMStorageDispatcher.prototype={domStorageItemsCleared:function(storageId)
3941 {this._model._domStorageItemsCleared(storageId);},domStorageItemRemoved:function(storageId,key)
3942 {this._model._domStorageItemRemoved(storageId,key);},domStorageItemAdded:function(storageId,key,value)
3943 {this._model._domStorageItemAdded(storageId,key,value);},domStorageItemUpdated:function(storageId,key,oldValue,value)
3944 {this._model._domStorageItemUpdated(storageId,key,oldValue,value);},}
3945 WebInspector.domStorageModel;WebInspector.DataGrid=function(columnsArray,editCallback,deleteCallback,refreshCallback,contextMenuCallback)
3946 {WebInspector.View.call(this);this.registerRequiredCSS("dataGrid.css");this.element.className="data-grid";this.element.tabIndex=0;this.element.addEventListener("keydown",this._keyDown.bind(this),false);this._headerTable=document.createElement("table");this._headerTable.className="header";this._headerTableHeaders={};this._dataTable=document.createElement("table");this._dataTable.className="data";this._dataTable.addEventListener("mousedown",this._mouseDownInDataTable.bind(this),true);this._dataTable.addEventListener("click",this._clickInDataTable.bind(this),true);this._dataTable.addEventListener("contextmenu",this._contextMenuInDataTable.bind(this),true);if(editCallback)
3947 this._dataTable.addEventListener("dblclick",this._ondblclick.bind(this),false);this._editCallback=editCallback;this._deleteCallback=deleteCallback;this._refreshCallback=refreshCallback;this._contextMenuCallback=contextMenuCallback;this._scrollContainer=document.createElement("div");this._scrollContainer.className="data-container";this._scrollContainer.appendChild(this._dataTable);this.element.appendChild(this._headerTable);this.element.appendChild(this._scrollContainer);var headerRow=document.createElement("tr");var columnGroup=document.createElement("colgroup");columnGroup.span=columnsArray.length;var fillerRow=document.createElement("tr");fillerRow.className="filler";this._columnsArray=columnsArray;this.columns={};for(var i=0;i<columnsArray.length;++i){var column=columnsArray[i];column.ordinal=i;var columnIdentifier=column.identifier=column.id||i;this.columns[columnIdentifier]=column;if(column.disclosure)
3948 this.disclosureColumnIdentifier=columnIdentifier;var col=document.createElement("col");if(column.width)
3949 col.style.width=column.width;column.element=col;columnGroup.appendChild(col);var cell=document.createElement("th");cell.className=columnIdentifier+"-column";cell.columnIdentifier=columnIdentifier;this._headerTableHeaders[columnIdentifier]=cell;var div=document.createElement("div");if(column.titleDOMFragment)
3950 div.appendChild(column.titleDOMFragment);else
3951 div.textContent=column.title;cell.appendChild(div);if(column.sort){cell.classList.add("sort-"+column.sort);this._sortColumnCell=cell;}
3952 if(column.sortable){cell.addEventListener("click",this._clickInHeaderCell.bind(this),false);cell.classList.add("sortable");}
3953 headerRow.appendChild(cell);fillerRow.createChild("td",columnIdentifier+"-column");}
3954 headerRow.createChild("th","corner");fillerRow.createChild("td","corner");columnGroup.createChild("col","corner");this._headerTableColumnGroup=columnGroup;this._headerTable.appendChild(this._headerTableColumnGroup);this.headerTableBody.appendChild(headerRow);this._dataTableColumnGroup=columnGroup.cloneNode(true);this._dataTable.appendChild(this._dataTableColumnGroup);this.dataTableBody.appendChild(fillerRow);this.selectedNode=null;this.expandNodesWhenArrowing=false;this.setRootNode(new WebInspector.DataGridNode());this.indentWidth=15;this.resizers=[];this._columnWidthsInitialized=false;}
3955 WebInspector.DataGrid.ColumnDescriptor;WebInspector.DataGrid.Events={SelectedNode:"SelectedNode",DeselectedNode:"DeselectedNode",SortingChanged:"SortingChanged",ColumnsResized:"ColumnsResized"}
3956 WebInspector.DataGrid.Order={Ascending:"ascending",Descending:"descending"}
3957 WebInspector.DataGrid.Align={Center:"center",Right:"right"}
3958 WebInspector.DataGrid.createSortableDataGrid=function(columnNames,values)
3959 {var numColumns=columnNames.length;if(!numColumns)
3960 return null;var columns=[];for(var i=0;i<columnNames.length;++i)
3961 columns.push({title:columnNames[i],width:columnNames[i].length,sortable:true});var nodes=[];for(var i=0;i<values.length/numColumns;++i){var data={};for(var j=0;j<columnNames.length;++j)
3962 data[j]=values[numColumns*i+j];var node=new WebInspector.DataGridNode(data,false);node.selectable=false;nodes.push(node);}
3963 var dataGrid=new WebInspector.DataGrid(columns);var length=nodes.length;for(var i=0;i<length;++i)
3964 dataGrid.rootNode().appendChild(nodes[i]);dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,sortDataGrid);function sortDataGrid()
3965 {var nodes=dataGrid._rootNode.children.slice();var sortColumnIdentifier=dataGrid.sortColumnIdentifier();var sortDirection=dataGrid.isSortOrderAscending()?1:-1;var columnIsNumeric=true;for(var i=0;i<nodes.length;i++){var value=nodes[i].data[sortColumnIdentifier];value=value instanceof Node?Number(value.textContent):Number(value);if(isNaN(value)){columnIsNumeric=false;break;}}
3966 function comparator(dataGridNode1,dataGridNode2)
3967 {var item1=dataGridNode1.data[sortColumnIdentifier];var item2=dataGridNode2.data[sortColumnIdentifier];item1=item1 instanceof Node?item1.textContent:String(item1);item2=item2 instanceof Node?item2.textContent:String(item2);var comparison;if(columnIsNumeric){var number1=parseFloat(item1);var number2=parseFloat(item2);comparison=number1<number2?-1:(number1>number2?1:0);}else
3968 comparison=item1<item2?-1:(item1>item2?1:0);return sortDirection*comparison;}
3969 nodes.sort(comparator);dataGrid.rootNode().removeChildren();for(var i=0;i<nodes.length;i++)
3970 dataGrid._rootNode.appendChild(nodes[i]);}
3971 return dataGrid;}
3972 WebInspector.DataGrid.prototype={setRootNode:function(rootNode)
3973 {if(this._rootNode){this._rootNode.removeChildren();this._rootNode.dataGrid=null;this._rootNode._isRoot=false;}
3974 this._rootNode=rootNode;rootNode._isRoot=true;rootNode.hasChildren=false;rootNode._expanded=true;rootNode._revealed=true;rootNode.dataGrid=this;},rootNode:function()
3975 {return this._rootNode;},_ondblclick:function(event)
3976 {if(this._editing||this._editingNode)
3977 return;var columnIdentifier=this.columnIdentifierFromNode(event.target);if(!columnIdentifier||!this.columns[columnIdentifier].editable)
3978 return;this._startEditing(event.target);},_startEditingColumnOfDataGridNode:function(node,columnOrdinal)
3979 {this._editing=true;this._editingNode=node;this._editingNode.select();var element=this._editingNode._element.children[columnOrdinal];WebInspector.InplaceEditor.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);},_startEditing:function(target)
3980 {var element=target.enclosingNodeOrSelfWithNodeName("td");if(!element)
3981 return;this._editingNode=this.dataGridNodeFromNode(target);if(!this._editingNode){if(!this.creationNode)
3982 return;this._editingNode=this.creationNode;}
3983 if(this._editingNode.isCreationNode)
3984 return this._startEditingColumnOfDataGridNode(this._editingNode,this._nextEditableColumn(-1));this._editing=true;WebInspector.InplaceEditor.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);},renderInline:function()
3985 {this.element.classList.add("inline");},_startEditingConfig:function(element)
3986 {return new WebInspector.InplaceEditor.Config(this._editingCommitted.bind(this),this._editingCancelled.bind(this),element.textContent);},_editingCommitted:function(element,newText,oldText,context,moveDirection)
3987 {var columnIdentifier=this.columnIdentifierFromNode(element);if(!columnIdentifier){this._editingCancelled(element);return;}
3988 var columnOrdinal=this.columns[columnIdentifier].ordinal;var textBeforeEditing=this._editingNode.data[columnIdentifier];var currentEditingNode=this._editingNode;function moveToNextIfNeeded(wasChange){if(!moveDirection)
3989 return;if(moveDirection==="forward"){var firstEditableColumn=this._nextEditableColumn(-1);if(currentEditingNode.isCreationNode&&columnOrdinal===firstEditableColumn&&!wasChange)
3990 return;var nextEditableColumn=this._nextEditableColumn(columnOrdinal);if(nextEditableColumn!==-1)
3991 return this._startEditingColumnOfDataGridNode(currentEditingNode,nextEditableColumn);var nextDataGridNode=currentEditingNode.traverseNextNode(true,null,true);if(nextDataGridNode)
3992 return this._startEditingColumnOfDataGridNode(nextDataGridNode,firstEditableColumn);if(currentEditingNode.isCreationNode&&wasChange){this.addCreationNode(false);return this._startEditingColumnOfDataGridNode(this.creationNode,firstEditableColumn);}
3993 return;}
3994 if(moveDirection==="backward"){var prevEditableColumn=this._nextEditableColumn(columnOrdinal,true);if(prevEditableColumn!==-1)
3995 return this._startEditingColumnOfDataGridNode(currentEditingNode,prevEditableColumn);var lastEditableColumn=this._nextEditableColumn(this._columnsArray.length,true);var nextDataGridNode=currentEditingNode.traversePreviousNode(true,true);if(nextDataGridNode)
3996 return this._startEditingColumnOfDataGridNode(nextDataGridNode,lastEditableColumn);return;}}
3997 if(textBeforeEditing==newText){this._editingCancelled(element);moveToNextIfNeeded.call(this,false);return;}
3998 this._editingNode.data[columnIdentifier]=newText;this._editCallback(this._editingNode,columnIdentifier,textBeforeEditing,newText);if(this._editingNode.isCreationNode)
3999 this.addCreationNode(false);this._editingCancelled(element);moveToNextIfNeeded.call(this,true);},_editingCancelled:function(element)
4000 {delete this._editing;this._editingNode=null;},_nextEditableColumn:function(columnOrdinal,moveBackward)
4001 {var increment=moveBackward?-1:1;var columns=this._columnsArray;for(var i=columnOrdinal+increment;(i>=0)&&(i<columns.length);i+=increment){if(columns[i].editable)
4002 return i;}
4003 return-1;},sortColumnIdentifier:function()
4004 {if(!this._sortColumnCell)
4005 return null;return this._sortColumnCell.columnIdentifier;},sortOrder:function()
4006 {if(!this._sortColumnCell||this._sortColumnCell.classList.contains("sort-ascending"))
4007 return WebInspector.DataGrid.Order.Ascending;if(this._sortColumnCell.classList.contains("sort-descending"))
4008 return WebInspector.DataGrid.Order.Descending;return null;},isSortOrderAscending:function()
4009 {return!this._sortColumnCell||this._sortColumnCell.classList.contains("sort-ascending");},get headerTableBody()
4010 {if("_headerTableBody"in this)
4011 return this._headerTableBody;this._headerTableBody=this._headerTable.getElementsByTagName("tbody")[0];if(!this._headerTableBody){this._headerTableBody=this.element.ownerDocument.createElement("tbody");this._headerTable.insertBefore(this._headerTableBody,this._headerTable.tFoot);}
4012 return this._headerTableBody;},get dataTableBody()
4013 {if("_dataTableBody"in this)
4014 return this._dataTableBody;this._dataTableBody=this._dataTable.getElementsByTagName("tbody")[0];if(!this._dataTableBody){this._dataTableBody=this.element.ownerDocument.createElement("tbody");this._dataTable.insertBefore(this._dataTableBody,this._dataTable.tFoot);}
4015 return this._dataTableBody;},_autoSizeWidths:function(widths,minPercent,maxPercent)
4016 {if(minPercent)
4017 minPercent=Math.min(minPercent,Math.floor(100/widths.length));var totalWidth=0;for(var i=0;i<widths.length;++i)
4018 totalWidth+=widths[i];var totalPercentWidth=0;for(var i=0;i<widths.length;++i){var width=Math.round(100*widths[i]/totalWidth);if(minPercent&&width<minPercent)
4019 width=minPercent;else if(maxPercent&&width>maxPercent)
4020 width=maxPercent;totalPercentWidth+=width;widths[i]=width;}
4021 var recoupPercent=totalPercentWidth-100;while(minPercent&&recoupPercent>0){for(var i=0;i<widths.length;++i){if(widths[i]>minPercent){--widths[i];--recoupPercent;if(!recoupPercent)
4022 break;}}}
4023 while(maxPercent&&recoupPercent<0){for(var i=0;i<widths.length;++i){if(widths[i]<maxPercent){++widths[i];++recoupPercent;if(!recoupPercent)
4024 break;}}}
4025 return widths;},autoSizeColumns:function(minPercent,maxPercent,maxDescentLevel)
4026 {var widths=[];for(var i=0;i<this._columnsArray.length;++i)
4027 widths.push((this._columnsArray[i].title||"").length);maxDescentLevel=maxDescentLevel||0;var children=this._enumerateChildren(this._rootNode,[],maxDescentLevel+1);for(var i=0;i<children.length;++i){var node=children[i];for(var j=0;j<this._columnsArray.length;++j){var text=node.data[this._columnsArray[j].identifier]||"";if(text.length>widths[j])
4028 widths[j]=text.length;}}
4029 widths=this._autoSizeWidths(widths,minPercent,maxPercent);for(var i=0;i<this._columnsArray.length;++i)
4030 this._columnsArray[i].element.style.width=widths[i]+"%";this._columnWidthsInitialized=false;this.updateWidths();},_enumerateChildren:function(rootNode,result,maxLevel)
4031 {if(!rootNode._isRoot)
4032 result.push(rootNode);if(!maxLevel)
4033 return;for(var i=0;i<rootNode.children.length;++i)
4034 this._enumerateChildren(rootNode.children[i],result,maxLevel-1);return result;},onResize:function()
4035 {this.updateWidths();},updateWidths:function()
4036 {var headerTableColumns=this._headerTableColumnGroup.children;var tableWidth=this._dataTable.offsetWidth;var numColumns=headerTableColumns.length-1;if(!this._columnWidthsInitialized&&this.element.offsetWidth){for(var i=0;i<numColumns;i++){var columnWidth=this.headerTableBody.rows[0].cells[i].offsetWidth;var percentWidth=(100*columnWidth/tableWidth)+"%";this._headerTableColumnGroup.children[i].style.width=percentWidth;this._dataTableColumnGroup.children[i].style.width=percentWidth;}
4037 this._columnWidthsInitialized=true;}
4038 this._positionResizers();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},setName:function(name)
4039 {this._columnWeightsSetting=WebInspector.settings.createSetting("dataGrid-"+name+"-columnWeights",{});this._loadColumnWeights();},_loadColumnWeights:function()
4040 {if(!this._columnWeightsSetting)
4041 return;var weights=this._columnWeightsSetting.get();for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];var weight=weights[column.identifier];if(weight)
4042 column.weight=weight;}
4043 this.applyColumnWeights();},_saveColumnWeights:function()
4044 {if(!this._columnWeightsSetting)
4045 return;var weights={};for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];weights[column.identifier]=column.weight;}
4046 this._columnWeightsSetting.set(weights);},wasShown:function()
4047 {this._loadColumnWeights();},applyColumnWeights:function()
4048 {var sumOfWeights=0.0;for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];if(this.isColumnVisible(column))
4049 sumOfWeights+=column.weight;}
4050 for(var i=0;i<this._columnsArray.length;++i){var column=this._columnsArray[i];var width=this.isColumnVisible(column)?(100*column.weight/sumOfWeights)+"%":"0%";this._headerTableColumnGroup.children[i].style.width=width;this._dataTableColumnGroup.children[i].style.width=width;}
4051 this._positionResizers();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},isColumnVisible:function(column)
4052 {return!column.hidden;},setColumnVisible:function(columnIdentifier,visible)
4053 {if(visible===!this.columns[columnIdentifier].hidden)
4054 return;this.columns[columnIdentifier].hidden=!visible;this.element.classList.toggle("hide-"+columnIdentifier+"-column",!visible);},get scrollContainer()
4055 {return this._scrollContainer;},isScrolledToLastRow:function()
4056 {return this._scrollContainer.isScrolledToBottom();},scrollToLastRow:function()
4057 {this._scrollContainer.scrollTop=this._scrollContainer.scrollHeight-this._scrollContainer.offsetHeight;},_positionResizers:function()
4058 {var headerTableColumns=this._headerTableColumnGroup.children;var numColumns=headerTableColumns.length-1;var left=[];var previousResizer=null;for(var i=0;i<numColumns-1;i++){left[i]=(left[i-1]||0)+this.headerTableBody.rows[0].cells[i].offsetWidth;}
4059 for(var i=0;i<numColumns-1;i++){var resizer=this.resizers[i];if(!resizer){resizer=document.createElement("div");resizer.classList.add("data-grid-resizer");WebInspector.installDragHandle(resizer,this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),"col-resize");this.element.appendChild(resizer);this.resizers[i]=resizer;}
4060 if(!this._columnsArray[i].hidden){resizer.style.removeProperty("display");if(resizer._position!==left[i]){resizer._position=left[i];resizer.style.left=left[i]+"px";}
4061 resizer.leftNeighboringColumnIndex=i;if(previousResizer)
4062 previousResizer.rightNeighboringColumnIndex=i;previousResizer=resizer;}else{if(previousResizer&&previousResizer._position!==left[i]){previousResizer._position=left[i];previousResizer.style.left=left[i]+"px";}
4063 if(resizer.style.getPropertyValue("display")!=="none")
4064 resizer.style.setProperty("display","none");resizer.leftNeighboringColumnIndex=0;resizer.rightNeighboringColumnIndex=0;}}
4065 if(previousResizer)
4066 previousResizer.rightNeighboringColumnIndex=numColumns-1;},addCreationNode:function(hasChildren)
4067 {if(this.creationNode)
4068 this.creationNode.makeNormal();var emptyData={};for(var column in this.columns)
4069 emptyData[column]=null;this.creationNode=new WebInspector.CreationDataGridNode(emptyData,hasChildren);this.rootNode().appendChild(this.creationNode);},sortNodes:function(comparator,reverseMode)
4070 {function comparatorWrapper(a,b)
4071 {if(a._dataGridNode._data.summaryRow)
4072 return 1;if(b._dataGridNode._data.summaryRow)
4073 return-1;var aDataGirdNode=a._dataGridNode;var bDataGirdNode=b._dataGridNode;return reverseMode?comparator(bDataGirdNode,aDataGirdNode):comparator(aDataGirdNode,bDataGirdNode);}
4074 var tbody=this.dataTableBody;var tbodyParent=tbody.parentElement;tbodyParent.removeChild(tbody);var childNodes=tbody.childNodes;var fillerRow=childNodes[childNodes.length-1];var sortedRows=Array.prototype.slice.call(childNodes,0,childNodes.length-1);sortedRows.sort(comparatorWrapper);var sortedRowsLength=sortedRows.length;tbody.removeChildren();var previousSiblingNode=null;for(var i=0;i<sortedRowsLength;++i){var row=sortedRows[i];var node=row._dataGridNode;node.previousSibling=previousSiblingNode;if(previousSiblingNode)
4075 previousSiblingNode.nextSibling=node;tbody.appendChild(row);previousSiblingNode=node;}
4076 if(previousSiblingNode)
4077 previousSiblingNode.nextSibling=null;tbody.appendChild(fillerRow);tbodyParent.appendChild(tbody);},_keyDown:function(event)
4078 {if(!this.selectedNode||event.shiftKey||event.metaKey||event.ctrlKey||this._editing)
4079 return;var handled=false;var nextSelectedNode;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4080 nextSelectedNode=nextSelectedNode.traversePreviousNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4081 nextSelectedNode=nextSelectedNode.traverseNextNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Left"){if(this.selectedNode.expanded){if(event.altKey)
4082 this.selectedNode.collapseRecursively();else
4083 this.selectedNode.collapse();handled=true;}else if(this.selectedNode.parent&&!this.selectedNode.parent._isRoot){handled=true;if(this.selectedNode.parent.selectable){nextSelectedNode=this.selectedNode.parent;handled=nextSelectedNode?true:false;}else if(this.selectedNode.parent)
4084 this.selectedNode.parent.collapse();}}else if(event.keyIdentifier==="Right"){if(!this.selectedNode.revealed){this.selectedNode.reveal();handled=true;}else if(this.selectedNode.hasChildren){handled=true;if(this.selectedNode.expanded){nextSelectedNode=this.selectedNode.children[0];handled=nextSelectedNode?true:false;}else{if(event.altKey)
4085 this.selectedNode.expandRecursively();else
4086 this.selectedNode.expand();}}}else if(event.keyCode===8||event.keyCode===46){if(this._deleteCallback){handled=true;this._deleteCallback(this.selectedNode);this.changeNodeAfterDeletion();}}else if(isEnterKey(event)){if(this._editCallback){handled=true;this._startEditing(this.selectedNode._element.children[this._nextEditableColumn(-1)]);}}
4087 if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}
4088 if(handled)
4089 event.consume(true);},changeNodeAfterDeletion:function()
4090 {var nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4091 nextSelectedNode=nextSelectedNode.traverseNextNode(true);if(!nextSelectedNode||nextSelectedNode.isCreationNode){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
4092 nextSelectedNode=nextSelectedNode.traversePreviousNode(true);}
4093 if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}},dataGridNodeFromNode:function(target)
4094 {var rowElement=target.enclosingNodeOrSelfWithNodeName("tr");return rowElement&&rowElement._dataGridNode;},columnIdentifierFromNode:function(target)
4095 {var cellElement=target.enclosingNodeOrSelfWithNodeName("td");return cellElement&&cellElement.columnIdentifier_;},_clickInHeaderCell:function(event)
4096 {var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||(typeof cell.columnIdentifier==="undefined")||!cell.classList.contains("sortable"))
4097 return;var sortOrder=WebInspector.DataGrid.Order.Ascending;if((cell===this._sortColumnCell)&&this.isSortOrderAscending())
4098 sortOrder=WebInspector.DataGrid.Order.Descending;if(this._sortColumnCell)
4099 this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");this._sortColumnCell=cell;cell.classList.add("sort-"+sortOrder);this.dispatchEventToListeners(WebInspector.DataGrid.Events.SortingChanged);},markColumnAsSortedBy:function(columnIdentifier,sortOrder)
4100 {if(this._sortColumnCell)
4101 this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");this._sortColumnCell=this._headerTableHeaders[columnIdentifier];this._sortColumnCell.classList.add("sort-"+sortOrder);},headerTableHeader:function(columnIdentifier)
4102 {return this._headerTableHeaders[columnIdentifier];},_mouseDownInDataTable:function(event)
4103 {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.selectable)
4104 return;if(gridNode.isEventWithinDisclosureTriangle(event))
4105 return;if(event.metaKey){if(gridNode.selected)
4106 gridNode.deselect();else
4107 gridNode.select();}else
4108 gridNode.select();},_contextMenuInDataTable:function(event)
4109 {var contextMenu=new WebInspector.ContextMenu(event);var gridNode=this.dataGridNodeFromNode(event.target);if(this._refreshCallback&&(!gridNode||gridNode!==this.creationNode))
4110 contextMenu.appendItem(WebInspector.UIString("Refresh"),this._refreshCallback.bind(this));if(gridNode&&gridNode.selectable&&!gridNode.isEventWithinDisclosureTriangle(event)){if(this._editCallback){if(gridNode===this.creationNode)
4111 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Add new":"Add New"),this._startEditing.bind(this,event.target));else{var columnIdentifier=this.columnIdentifierFromNode(event.target);if(columnIdentifier&&this.columns[columnIdentifier].editable)
4112 contextMenu.appendItem(WebInspector.UIString("Edit \"%s\"",this.columns[columnIdentifier].title),this._startEditing.bind(this,event.target));}}
4113 if(this._deleteCallback&&gridNode!==this.creationNode)
4114 contextMenu.appendItem(WebInspector.UIString("Delete"),this._deleteCallback.bind(this,gridNode));if(this._contextMenuCallback)
4115 this._contextMenuCallback(contextMenu,gridNode);}
4116 contextMenu.show();},_clickInDataTable:function(event)
4117 {var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.hasChildren)
4118 return;if(!gridNode.isEventWithinDisclosureTriangle(event))
4119 return;if(gridNode.expanded){if(event.altKey)
4120 gridNode.collapseRecursively();else
4121 gridNode.collapse();}else{if(event.altKey)
4122 gridNode.expandRecursively();else
4123 gridNode.expand();}},get resizeMethod()
4124 {if(typeof this._resizeMethod==="undefined")
4125 return WebInspector.DataGrid.ResizeMethod.Nearest;return this._resizeMethod;},set resizeMethod(method)
4126 {this._resizeMethod=method;},_startResizerDragging:function(event)
4127 {this._currentResizer=event.target;return!!this._currentResizer.rightNeighboringColumnIndex;},_resizerDragging:function(event)
4128 {var resizer=this._currentResizer;if(!resizer)
4129 return;var tableWidth=this._dataTable.offsetWidth;var dragPoint=event.clientX-this.element.totalOffsetLeft();var leftCellIndex=resizer.leftNeighboringColumnIndex;var rightCellIndex=resizer.rightNeighboringColumnIndex;var firstRowCells=this.headerTableBody.rows[0].cells;var leftEdgeOfPreviousColumn=0;for(var i=0;i<leftCellIndex;i++)
4130 leftEdgeOfPreviousColumn+=firstRowCells[i].offsetWidth;if(this.resizeMethod==WebInspector.DataGrid.ResizeMethod.Last){rightCellIndex=this.resizers.length;}else if(this.resizeMethod==WebInspector.DataGrid.ResizeMethod.First){leftEdgeOfPreviousColumn+=firstRowCells[leftCellIndex].offsetWidth-firstRowCells[0].offsetWidth;leftCellIndex=0;}
4131 var rightEdgeOfNextColumn=leftEdgeOfPreviousColumn+firstRowCells[leftCellIndex].offsetWidth+firstRowCells[rightCellIndex].offsetWidth;var leftMinimum=leftEdgeOfPreviousColumn+this.ColumnResizePadding;var rightMaximum=rightEdgeOfNextColumn-this.ColumnResizePadding;if(leftMinimum>rightMaximum)
4132 return;dragPoint=Number.constrain(dragPoint,leftMinimum,rightMaximum);resizer.style.left=(dragPoint-this.CenterResizerOverBorderAdjustment)+"px";var percentLeftColumn=(100*(dragPoint-leftEdgeOfPreviousColumn)/tableWidth)+"%";this._headerTableColumnGroup.children[leftCellIndex].style.width=percentLeftColumn;this._dataTableColumnGroup.children[leftCellIndex].style.width=percentLeftColumn;var percentRightColumn=(100*(rightEdgeOfNextColumn-dragPoint)/tableWidth)+"%";this._headerTableColumnGroup.children[rightCellIndex].style.width=percentRightColumn;this._dataTableColumnGroup.children[rightCellIndex].style.width=percentRightColumn;var leftColumn=this._columnsArray[leftCellIndex];var rightColumn=this._columnsArray[rightCellIndex];if(leftColumn.weight||rightColumn.weight){var sumOfWeights=leftColumn.weight+rightColumn.weight;var delta=rightEdgeOfNextColumn-leftEdgeOfPreviousColumn;leftColumn.weight=(dragPoint-leftEdgeOfPreviousColumn)*sumOfWeights/delta;rightColumn.weight=(rightEdgeOfNextColumn-dragPoint)*sumOfWeights/delta;}
4133 this._positionResizers();event.preventDefault();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},_endResizerDragging:function(event)
4134 {this._currentResizer=null;this._saveColumnWeights();this.dispatchEventToListeners(WebInspector.DataGrid.Events.ColumnsResized);},defaultAttachLocation:function()
4135 {return this.dataTableBody.firstChild;},ColumnResizePadding:24,CenterResizerOverBorderAdjustment:3,__proto__:WebInspector.View.prototype}
4136 WebInspector.DataGrid.ResizeMethod={Nearest:"nearest",First:"first",Last:"last"}
4137 WebInspector.DataGridNode=function(data,hasChildren)
4138 {this._expanded=false;this._selected=false;this._shouldRefreshChildren=true;this._data=data||{};this.hasChildren=hasChildren||false;this.children=[];this.dataGrid=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this.disclosureToggleWidth=10;}
4139 WebInspector.DataGridNode.prototype={selectable:true,_isRoot:false,get element()
4140 {if(this._element)
4141 return this._element;if(!this.dataGrid)
4142 return null;this._element=document.createElement("tr");this._element._dataGridNode=this;if(this.hasChildren)
4143 this._element.classList.add("parent");if(this.expanded)
4144 this._element.classList.add("expanded");if(this.selected)
4145 this._element.classList.add("selected");if(this.revealed)
4146 this._element.classList.add("revealed");this.createCells();this._element.createChild("td","corner");return this._element;},createCells:function()
4147 {var columnsArray=this.dataGrid._columnsArray;for(var i=0;i<columnsArray.length;++i){var cell=this.createCell(columnsArray[i].identifier);this._element.appendChild(cell);}},get data()
4148 {return this._data;},set data(x)
4149 {this._data=x||{};this.refresh();},get revealed()
4150 {if("_revealed"in this)
4151 return this._revealed;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded){this._revealed=false;return false;}
4152 currentAncestor=currentAncestor.parent;}
4153 this._revealed=true;return true;},set hasChildren(x)
4154 {if(this._hasChildren===x)
4155 return;this._hasChildren=x;if(!this._element)
4156 return;this._element.classList.toggle("parent",this._hasChildren);this._element.classList.toggle("expanded",this._hasChildren&&this.expanded);},get hasChildren()
4157 {return this._hasChildren;},set revealed(x)
4158 {if(this._revealed===x)
4159 return;this._revealed=x;if(this._element)
4160 this._element.classList.toggle("revealed",this._revealed);for(var i=0;i<this.children.length;++i)
4161 this.children[i].revealed=x&&this.expanded;},get depth()
4162 {if("_depth"in this)
4163 return this._depth;if(this.parent&&!this.parent._isRoot)
4164 this._depth=this.parent.depth+1;else
4165 this._depth=0;return this._depth;},get leftPadding()
4166 {if(typeof this._leftPadding==="number")
4167 return this._leftPadding;this._leftPadding=this.depth*this.dataGrid.indentWidth;return this._leftPadding;},get shouldRefreshChildren()
4168 {return this._shouldRefreshChildren;},set shouldRefreshChildren(x)
4169 {this._shouldRefreshChildren=x;if(x&&this.expanded)
4170 this.expand();},get selected()
4171 {return this._selected;},set selected(x)
4172 {if(x)
4173 this.select();else
4174 this.deselect();},get expanded()
4175 {return this._expanded;},set expanded(x)
4176 {if(x)
4177 this.expand();else
4178 this.collapse();},refresh:function()
4179 {if(!this._element||!this.dataGrid)
4180 return;this._element.removeChildren();this.createCells();this._element.createChild("td","corner");},createTD:function(columnIdentifier)
4181 {var cell=document.createElement("td");cell.className=columnIdentifier+"-column";cell.columnIdentifier_=columnIdentifier;var alignment=this.dataGrid.columns[columnIdentifier].align;if(alignment)
4182 cell.classList.add(alignment);return cell;},createCell:function(columnIdentifier)
4183 {var cell=this.createTD(columnIdentifier);var data=this.data[columnIdentifier];var div=document.createElement("div");if(data instanceof Node)
4184 div.appendChild(data);else{div.textContent=data;if(this.dataGrid.columns[columnIdentifier].longText)
4185 div.title=data;}
4186 cell.appendChild(div);if(columnIdentifier===this.dataGrid.disclosureColumnIdentifier){cell.classList.add("disclosure");if(this.leftPadding)
4187 cell.style.setProperty("padding-left",this.leftPadding+"px");}
4188 return cell;},nodeSelfHeight:function()
4189 {return 16;},appendChild:function(child)
4190 {this.insertChild(child,this.children.length);},insertChild:function(child,index)
4191 {if(!child)
4192 throw("insertChild: Node can't be undefined or null.");if(child.parent===this)
4193 throw("insertChild: Node is already a child of this node.");if(child.parent)
4194 child.parent.removeChild(child);this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.dataGrid=this.dataGrid;child._recalculateSiblings(index);delete child._depth;delete child._revealed;delete child._attached;child._shouldRefreshChildren=true;var current=child.children[0];while(current){current.dataGrid=this.dataGrid;delete current._depth;delete current._revealed;delete current._attached;current._shouldRefreshChildren=true;current=current.traverseNextNode(false,child,true);}
4195 if(this.expanded)
4196 child._attach();if(!this.revealed)
4197 child.revealed=false;},removeChild:function(child)
4198 {if(!child)
4199 throw("removeChild: Node can't be undefined or null.");if(child.parent!==this)
4200 throw("removeChild: Node is not a child of this node.");child.deselect();child._detach();this.children.remove(child,true);if(child.previousSibling)
4201 child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
4202 child.nextSibling.previousSibling=child.previousSibling;child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(this.children.length<=0)
4203 this.hasChildren=false;},removeChildren:function()
4204 {for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();child._detach();child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
4205 this.children=[];this.hasChildren=false;},_recalculateSiblings:function(myIndex)
4206 {if(!this.parent)
4207 return;var previousChild=(myIndex>0?this.parent.children[myIndex-1]:null);if(previousChild){previousChild.nextSibling=this;this.previousSibling=previousChild;}else
4208 this.previousSibling=null;var nextChild=this.parent.children[myIndex+1];if(nextChild){nextChild.previousSibling=this;this.nextSibling=nextChild;}else
4209 this.nextSibling=null;},collapse:function()
4210 {if(this._isRoot)
4211 return;if(this._element)
4212 this._element.classList.remove("expanded");this._expanded=false;for(var i=0;i<this.children.length;++i)
4213 this.children[i].revealed=false;},collapseRecursively:function()
4214 {var item=this;while(item){if(item.expanded)
4215 item.collapse();item=item.traverseNextNode(false,this,true);}},populate:function(){},expand:function()
4216 {if(!this.hasChildren||this.expanded)
4217 return;if(this._isRoot)
4218 return;if(this.revealed&&!this._shouldRefreshChildren)
4219 for(var i=0;i<this.children.length;++i)
4220 this.children[i].revealed=true;if(this._shouldRefreshChildren){for(var i=0;i<this.children.length;++i)
4221 this.children[i]._detach();this.populate();if(this._attached){for(var i=0;i<this.children.length;++i){var child=this.children[i];if(this.revealed)
4222 child.revealed=true;child._attach();}}
4223 delete this._shouldRefreshChildren;}
4224 if(this._element)
4225 this._element.classList.add("expanded");this._expanded=true;},expandRecursively:function()
4226 {var item=this;while(item){item.expand();item=item.traverseNextNode(false,this);}},reveal:function()
4227 {if(this._isRoot)
4228 return;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor._isRoot){if(!currentAncestor.expanded)
4229 currentAncestor.expand();currentAncestor=currentAncestor.parent;}
4230 this.element.scrollIntoViewIfNeeded(false);},select:function(supressSelectedEvent)
4231 {if(!this.dataGrid||!this.selectable||this.selected)
4232 return;if(this.dataGrid.selectedNode)
4233 this.dataGrid.selectedNode.deselect();this._selected=true;this.dataGrid.selectedNode=this;if(this._element)
4234 this._element.classList.add("selected");if(!supressSelectedEvent)
4235 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.SelectedNode);},revealAndSelect:function()
4236 {if(this._isRoot)
4237 return;this.reveal();this.select();},deselect:function(supressDeselectedEvent)
4238 {if(!this.dataGrid||this.dataGrid.selectedNode!==this||!this.selected)
4239 return;this._selected=false;this.dataGrid.selectedNode=null;if(this._element)
4240 this._element.classList.remove("selected");if(!supressDeselectedEvent)
4241 this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Events.DeselectedNode);},traverseNextNode:function(skipHidden,stayWithin,dontPopulate,info)
4242 {if(!dontPopulate&&this.hasChildren)
4243 this.populate();if(info)
4244 info.depthChange=0;var node=(!skipHidden||this.revealed)?this.children[0]:null;if(node&&(!skipHidden||this.expanded)){if(info)
4245 info.depthChange=1;return node;}
4246 if(this===stayWithin)
4247 return null;node=(!skipHidden||this.revealed)?this.nextSibling:null;if(node)
4248 return node;node=this;while(node&&!node._isRoot&&!((!skipHidden||node.revealed)?node.nextSibling:null)&&node.parent!==stayWithin){if(info)
4249 info.depthChange-=1;node=node.parent;}
4250 if(!node)
4251 return null;return(!skipHidden||node.revealed)?node.nextSibling:null;},traversePreviousNode:function(skipHidden,dontPopulate)
4252 {var node=(!skipHidden||this.revealed)?this.previousSibling:null;if(!dontPopulate&&node&&node.hasChildren)
4253 node.populate();while(node&&((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null)){if(!dontPopulate&&node.hasChildren)
4254 node.populate();node=((!skipHidden||(node.revealed&&node.expanded))?node.children[node.children.length-1]:null);}
4255 if(node)
4256 return node;if(!this.parent||this.parent._isRoot)
4257 return null;return this.parent;},isEventWithinDisclosureTriangle:function(event)
4258 {if(!this.hasChildren)
4259 return false;var cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell.classList.contains("disclosure"))
4260 return false;var left=cell.totalOffsetLeft()+this.leftPadding;return event.pageX>=left&&event.pageX<=left+this.disclosureToggleWidth;},_attach:function()
4261 {if(!this.dataGrid||this._attached)
4262 return;this._attached=true;var nextNode=null;var previousNode=this.traversePreviousNode(true,true);if(previousNode&&previousNode.element.parentNode&&previousNode.element.nextSibling)
4263 nextNode=previousNode.element.nextSibling;if(!nextNode)
4264 nextNode=this.dataGrid.defaultAttachLocation();this.dataGrid.dataTableBody.insertBefore(this.element,nextNode);if(this.expanded)
4265 for(var i=0;i<this.children.length;++i)
4266 this.children[i]._attach();},_detach:function()
4267 {if(!this._attached)
4268 return;this._attached=false;if(this._element)
4269 this._element.remove();for(var i=0;i<this.children.length;++i)
4270 this.children[i]._detach();this.wasDetached();},wasDetached:function()
4271 {},savePosition:function()
4272 {if(this._savedPosition)
4273 return;if(!this.parent)
4274 throw("savePosition: Node must have a parent.");this._savedPosition={parent:this.parent,index:this.parent.children.indexOf(this)};},restorePosition:function()
4275 {if(!this._savedPosition)
4276 return;if(this.parent!==this._savedPosition.parent)
4277 this._savedPosition.parent.insertChild(this,this._savedPosition.index);delete this._savedPosition;},__proto__:WebInspector.Object.prototype}
4278 WebInspector.CreationDataGridNode=function(data,hasChildren)
4279 {WebInspector.DataGridNode.call(this,data,hasChildren);this.isCreationNode=true;}
4280 WebInspector.CreationDataGridNode.prototype={makeNormal:function()
4281 {delete this.isCreationNode;delete this.makeNormal;},__proto__:WebInspector.DataGridNode.prototype}
4282 WebInspector.ShowMoreDataGridNode=function(callback,startPosition,endPosition,chunkSize)
4283 {WebInspector.DataGridNode.call(this,{summaryRow:true},false);this._callback=callback;this._startPosition=startPosition;this._endPosition=endPosition;this._chunkSize=chunkSize;this.showNext=document.createElement("button");this.showNext.setAttribute("type","button");this.showNext.addEventListener("click",this._showNextChunk.bind(this),false);this.showNext.textContent=WebInspector.UIString("Show %d before",this._chunkSize);this.showAll=document.createElement("button");this.showAll.setAttribute("type","button");this.showAll.addEventListener("click",this._showAll.bind(this),false);this.showLast=document.createElement("button");this.showLast.setAttribute("type","button");this.showLast.addEventListener("click",this._showLastChunk.bind(this),false);this.showLast.textContent=WebInspector.UIString("Show %d after",this._chunkSize);this._updateLabels();this.selectable=false;}
4284 WebInspector.ShowMoreDataGridNode.prototype={_showNextChunk:function()
4285 {this._callback(this._startPosition,this._startPosition+this._chunkSize);},_showAll:function()
4286 {this._callback(this._startPosition,this._endPosition);},_showLastChunk:function()
4287 {this._callback(this._endPosition-this._chunkSize,this._endPosition);},_updateLabels:function()
4288 {var totalSize=this._endPosition-this._startPosition;if(totalSize>this._chunkSize){this.showNext.classList.remove("hidden");this.showLast.classList.remove("hidden");}else{this.showNext.classList.add("hidden");this.showLast.classList.add("hidden");}
4289 this.showAll.textContent=WebInspector.UIString("Show all %d",totalSize);},createCells:function()
4290 {var cell=document.createElement("td");if(this.depth)
4291 cell.style.setProperty("padding-left",(this.depth*this.dataGrid.indentWidth)+"px");cell.appendChild(this.showNext);cell.appendChild(this.showAll);cell.appendChild(this.showLast);this._element.appendChild(cell);var columns=this.dataGrid.columns;var count=0;for(var c in columns)
4292 ++count;while(--count>0){cell=document.createElement("td");this._element.appendChild(cell);}},setStartPosition:function(from)
4293 {this._startPosition=from;this._updateLabels();},setEndPosition:function(to)
4294 {this._endPosition=to;this._updateLabels();},nodeSelfHeight:function()
4295 {return 32;},dispose:function()
4296 {},__proto__:WebInspector.DataGridNode.prototype}
4297 WebInspector.CookiesTable=function(expandable,refreshCallback,selectedCallback)
4298 {WebInspector.VBox.call(this);var readOnly=expandable;this._refreshCallback=refreshCallback;var columns=[{id:"name",title:WebInspector.UIString("Name"),sortable:true,disclosure:expandable,sort:WebInspector.DataGrid.Order.Ascending,longText:true,weight:24},{id:"value",title:WebInspector.UIString("Value"),sortable:true,longText:true,weight:34},{id:"domain",title:WebInspector.UIString("Domain"),sortable:true,weight:7},{id:"path",title:WebInspector.UIString("Path"),sortable:true,weight:7},{id:"expires",title:WebInspector.UIString("Expires / Max-Age"),sortable:true,weight:7},{id:"size",title:WebInspector.UIString("Size"),sortable:true,align:WebInspector.DataGrid.Align.Right,weight:7},{id:"httpOnly",title:WebInspector.UIString("HTTP"),sortable:true,align:WebInspector.DataGrid.Align.Center,weight:7},{id:"secure",title:WebInspector.UIString("Secure"),sortable:true,align:WebInspector.DataGrid.Align.Center,weight:7}];if(readOnly)
4299 this._dataGrid=new WebInspector.DataGrid(columns);else
4300 this._dataGrid=new WebInspector.DataGrid(columns,undefined,this._onDeleteCookie.bind(this),refreshCallback,this._onContextMenu.bind(this));this._dataGrid.setName("cookiesTable");this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,this._rebuildTable,this);if(selectedCallback)
4301 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode,selectedCallback,this);this._nextSelectedCookie=(null);this._dataGrid.show(this.element);this._data=[];}
4302 WebInspector.CookiesTable.prototype={_clearAndRefresh:function(domain)
4303 {this.clear(domain);this._refresh();},_onContextMenu:function(contextMenu,node)
4304 {if(node===this._dataGrid.creationNode)
4305 return;var cookie=node.cookie;var domain=cookie.domain();if(domain)
4306 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear all from \"%s\"":"Clear All from \"%s\"",domain),this._clearAndRefresh.bind(this,domain));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear all":"Clear All"),this._clearAndRefresh.bind(this,null));},setCookies:function(cookies)
4307 {this.setCookieFolders([{cookies:cookies}]);},setCookieFolders:function(cookieFolders)
4308 {this._data=cookieFolders;this._rebuildTable();},selectedCookie:function()
4309 {var node=this._dataGrid.selectedNode;return node?node.cookie:null;},clear:function(domain)
4310 {for(var i=0,length=this._data.length;i<length;++i){var cookies=this._data[i].cookies;for(var j=0,cookieCount=cookies.length;j<cookieCount;++j){if(!domain||cookies[j].domain()===domain)
4311 cookies[j].remove();}}},_rebuildTable:function()
4312 {var selectedCookie=this._nextSelectedCookie||this.selectedCookie();this._nextSelectedCookie=null;this._dataGrid.rootNode().removeChildren();for(var i=0;i<this._data.length;++i){var item=this._data[i];if(item.folderName){var groupData={name:item.folderName,value:"",domain:"",path:"",expires:"",size:this._totalSize(item.cookies),httpOnly:"",secure:""};var groupNode=new WebInspector.DataGridNode(groupData);groupNode.selectable=true;this._dataGrid.rootNode().appendChild(groupNode);groupNode.element.classList.add("row-group");this._populateNode(groupNode,item.cookies,selectedCookie);groupNode.expand();}else
4313 this._populateNode(this._dataGrid.rootNode(),item.cookies,selectedCookie);}},_populateNode:function(parentNode,cookies,selectedCookie)
4314 {parentNode.removeChildren();if(!cookies)
4315 return;this._sortCookies(cookies);for(var i=0;i<cookies.length;++i){var cookie=cookies[i];var cookieNode=this._createGridNode(cookie);parentNode.appendChild(cookieNode);if(selectedCookie&&selectedCookie.name()===cookie.name()&&selectedCookie.domain()===cookie.domain()&&selectedCookie.path()===cookie.path())
4316 cookieNode.select();}},_totalSize:function(cookies)
4317 {var totalSize=0;for(var i=0;cookies&&i<cookies.length;++i)
4318 totalSize+=cookies[i].size();return totalSize;},_sortCookies:function(cookies)
4319 {var sortDirection=this._dataGrid.isSortOrderAscending()?1:-1;function compareTo(getter,cookie1,cookie2)
4320 {return sortDirection*(getter.apply(cookie1)+"").compareTo(getter.apply(cookie2)+"")}
4321 function numberCompare(getter,cookie1,cookie2)
4322 {return sortDirection*(getter.apply(cookie1)-getter.apply(cookie2));}
4323 function expiresCompare(cookie1,cookie2)
4324 {if(cookie1.session()!==cookie2.session())
4325 return sortDirection*(cookie1.session()?1:-1);if(cookie1.session())
4326 return 0;if(cookie1.maxAge()&&cookie2.maxAge())
4327 return sortDirection*(cookie1.maxAge()-cookie2.maxAge());if(cookie1.expires()&&cookie2.expires())
4328 return sortDirection*(cookie1.expires()-cookie2.expires());return sortDirection*(cookie1.expires()?1:-1);}
4329 var comparator;switch(this._dataGrid.sortColumnIdentifier()){case"name":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.name);break;case"value":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.value);break;case"domain":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.domain);break;case"path":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.path);break;case"expires":comparator=expiresCompare;break;case"size":comparator=numberCompare.bind(null,WebInspector.Cookie.prototype.size);break;case"httpOnly":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.httpOnly);break;case"secure":comparator=compareTo.bind(null,WebInspector.Cookie.prototype.secure);break;default:compareTo.bind(null,WebInspector.Cookie.prototype.name);}
4330 cookies.sort(comparator);},_createGridNode:function(cookie)
4331 {var data={};data.name=cookie.name();data.value=cookie.value();if(cookie.type()===WebInspector.Cookie.Type.Request){data.domain=WebInspector.UIString("N/A");data.path=WebInspector.UIString("N/A");data.expires=WebInspector.UIString("N/A");}else{data.domain=cookie.domain()||"";data.path=cookie.path()||"";if(cookie.maxAge())
4332 data.expires=Number.secondsToString(parseInt(cookie.maxAge(),10));else if(cookie.expires())
4333 data.expires=new Date(cookie.expires()).toGMTString();else
4334 data.expires=WebInspector.UIString("Session");}
4335 data.size=cookie.size();const checkmark="\u2713";data.httpOnly=(cookie.httpOnly()?checkmark:"");data.secure=(cookie.secure()?checkmark:"");var node=new WebInspector.DataGridNode(data);node.cookie=cookie;node.selectable=true;return node;},_onDeleteCookie:function(node)
4336 {var cookie=node.cookie;var neighbour=node.traverseNextNode()||node.traversePreviousNode();if(neighbour)
4337 this._nextSelectedCookie=neighbour.cookie;cookie.remove();this._refresh();},_refresh:function()
4338 {if(this._refreshCallback)
4339 this._refreshCallback();},__proto__:WebInspector.VBox.prototype}
4340 WebInspector.CookieItemsView=function(treeElement,cookieDomain)
4341 {WebInspector.VBox.call(this);this.element.classList.add("storage-view");this._deleteButton=new WebInspector.StatusBarButton(WebInspector.UIString("Delete"),"delete-storage-status-bar-item");this._deleteButton.visible=false;this._deleteButton.addEventListener("click",this._deleteButtonClicked,this);this._clearButton=new WebInspector.StatusBarButton(WebInspector.UIString("Clear"),"clear-storage-status-bar-item");this._clearButton.visible=false;this._clearButton.addEventListener("click",this._clearButtonClicked,this);this._refreshButton=new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"),"refresh-storage-status-bar-item");this._refreshButton.addEventListener("click",this._refreshButtonClicked,this);this._treeElement=treeElement;this._cookieDomain=cookieDomain;this._emptyView=new WebInspector.EmptyView(WebInspector.UIString("This site has no cookies."));this._emptyView.show(this.element);this.element.addEventListener("contextmenu",this._contextMenu.bind(this),true);}
4342 WebInspector.CookieItemsView.prototype={get statusBarItems()
4343 {return[this._refreshButton.element,this._clearButton.element,this._deleteButton.element];},wasShown:function()
4344 {this._update();},willHide:function()
4345 {this._deleteButton.visible=false;},_update:function()
4346 {WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));},_updateWithCookies:function(allCookies)
4347 {this._cookies=this._filterCookiesForDomain(allCookies);if(!this._cookies.length){this._emptyView.show(this.element);this._clearButton.visible=false;this._deleteButton.visible=false;if(this._cookiesTable)
4348 this._cookiesTable.detach();return;}
4349 if(!this._cookiesTable)
4350 this._cookiesTable=new WebInspector.CookiesTable(false,this._update.bind(this),this._showDeleteButton.bind(this));this._cookiesTable.setCookies(this._cookies);this._emptyView.detach();this._cookiesTable.show(this.element);this._treeElement.subtitle=String.sprintf(WebInspector.UIString("%d cookies (%s)"),this._cookies.length,Number.bytesToString(this._totalSize));this._clearButton.visible=true;this._deleteButton.visible=!!this._cookiesTable.selectedCookie();},_filterCookiesForDomain:function(allCookies)
4351 {var cookies=[];var resourceURLsForDocumentURL=[];this._totalSize=0;function populateResourcesForDocuments(resource)
4352 {var url=resource.documentURL.asParsedURL();if(url&&url.host==this._cookieDomain)
4353 resourceURLsForDocumentURL.push(resource.url);}
4354 WebInspector.forAllResources(populateResourcesForDocuments.bind(this));for(var i=0;i<allCookies.length;++i){var pushed=false;var size=allCookies[i].size();for(var j=0;j<resourceURLsForDocumentURL.length;++j){var resourceURL=resourceURLsForDocumentURL[j];if(WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i],resourceURL)){this._totalSize+=size;if(!pushed){pushed=true;cookies.push(allCookies[i]);}}}}
4355 return cookies;},clear:function()
4356 {this._cookiesTable.clear();this._update();},_clearButtonClicked:function()
4357 {this.clear();},_showDeleteButton:function()
4358 {this._deleteButton.visible=true;},_deleteButtonClicked:function()
4359 {var selectedCookie=this._cookiesTable.selectedCookie();if(selectedCookie){selectedCookie.remove();this._update();}},_refreshButtonClicked:function(event)
4360 {this._update();},_contextMenu:function(event)
4361 {if(!this._cookies.length){var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString("Refresh"),this._update.bind(this));contextMenu.show();}},__proto__:WebInspector.VBox.prototype}
4362 WebInspector.ApplicationCacheModel=function()
4363 {ApplicationCacheAgent.enable();InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameDetached,this);this._statuses={};this._manifestURLsByFrame={};this._mainFrameNavigated();this._onLine=true;}
4364 WebInspector.ApplicationCacheModel.EventTypes={FrameManifestStatusUpdated:"FrameManifestStatusUpdated",FrameManifestAdded:"FrameManifestAdded",FrameManifestRemoved:"FrameManifestRemoved",NetworkStateChanged:"NetworkStateChanged"}
4365 WebInspector.ApplicationCacheModel.prototype={_frameNavigated:function(event)
4366 {var frame=(event.data);if(frame.isMainFrame()){this._mainFrameNavigated();return;}
4367 ApplicationCacheAgent.getManifestForFrame(frame.id,this._manifestForFrameLoaded.bind(this,frame.id));},_frameDetached:function(event)
4368 {var frame=(event.data);this._frameManifestRemoved(frame.id);},_mainFrameNavigated:function()
4369 {ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));},_manifestForFrameLoaded:function(frameId,error,manifestURL)
4370 {if(error){console.error(error);return;}
4371 if(!manifestURL)
4372 this._frameManifestRemoved(frameId);},_framesWithManifestsLoaded:function(error,framesWithManifests)
4373 {if(error){console.error(error);return;}
4374 for(var i=0;i<framesWithManifests.length;++i)
4375 this._frameManifestUpdated(framesWithManifests[i].frameId,framesWithManifests[i].manifestURL,framesWithManifests[i].status);},_frameManifestUpdated:function(frameId,manifestURL,status)
4376 {if(status===applicationCache.UNCACHED){this._frameManifestRemoved(frameId);return;}
4377 if(!manifestURL)
4378 return;if(this._manifestURLsByFrame[frameId]&&manifestURL!==this._manifestURLsByFrame[frameId])
4379 this._frameManifestRemoved(frameId);var statusChanged=this._statuses[frameId]!==status;this._statuses[frameId]=status;if(!this._manifestURLsByFrame[frameId]){this._manifestURLsByFrame[frameId]=manifestURL;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded,frameId);}
4380 if(statusChanged)
4381 this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated,frameId);},_frameManifestRemoved:function(frameId)
4382 {if(!this._manifestURLsByFrame[frameId])
4383 return;var manifestURL=this._manifestURLsByFrame[frameId];delete this._manifestURLsByFrame[frameId];delete this._statuses[frameId];this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved,frameId);},frameManifestURL:function(frameId)
4384 {return this._manifestURLsByFrame[frameId]||"";},frameManifestStatus:function(frameId)
4385 {return this._statuses[frameId]||applicationCache.UNCACHED;},get onLine()
4386 {return this._onLine;},_statusUpdated:function(frameId,manifestURL,status)
4387 {this._frameManifestUpdated(frameId,manifestURL,status);},requestApplicationCache:function(frameId,callback)
4388 {function callbackWrapper(error,applicationCache)
4389 {if(error){console.error(error);callback(null);return;}
4390 callback(applicationCache);}
4391 ApplicationCacheAgent.getApplicationCacheForFrame(frameId,callbackWrapper);},_networkStateUpdated:function(isNowOnline)
4392 {this._onLine=isNowOnline;this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged,isNowOnline);},__proto__:WebInspector.Object.prototype}
4393 WebInspector.ApplicationCacheDispatcher=function(applicationCacheModel)
4394 {this._applicationCacheModel=applicationCacheModel;}
4395 WebInspector.ApplicationCacheDispatcher.prototype={applicationCacheStatusUpdated:function(frameId,manifestURL,status)
4396 {this._applicationCacheModel._statusUpdated(frameId,manifestURL,status);},networkStateUpdated:function(isNowOnline)
4397 {this._applicationCacheModel._networkStateUpdated(isNowOnline);}}
4398 WebInspector.IndexedDBModel=function()
4399 {IndexedDBAgent.enable();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);this._databases=new Map();this._databaseNamesBySecurityOrigin={};this._reset();}
4400 WebInspector.IndexedDBModel.KeyTypes={NumberType:"number",StringType:"string",DateType:"date",ArrayType:"array"};WebInspector.IndexedDBModel.KeyPathTypes={NullType:"null",StringType:"string",ArrayType:"array"};WebInspector.IndexedDBModel.keyFromIDBKey=function(idbKey)
4401 {if(typeof(idbKey)==="undefined"||idbKey===null)
4402 return null;var key={};switch(typeof(idbKey)){case"number":key.number=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.NumberType;break;case"string":key.string=idbKey;key.type=WebInspector.IndexedDBModel.KeyTypes.StringType;break;case"object":if(idbKey instanceof Date){key.date=idbKey.getTime();key.type=WebInspector.IndexedDBModel.KeyTypes.DateType;}else if(idbKey instanceof Array){key.array=[];for(var i=0;i<idbKey.length;++i)
4403 key.array.push(WebInspector.IndexedDBModel.keyFromIDBKey(idbKey[i]));key.type=WebInspector.IndexedDBModel.KeyTypes.ArrayType;}
4404 break;default:return null;}
4405 return key;}
4406 WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange=function(idbKeyRange)
4407 {var IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange;if(typeof(idbKeyRange)==="undefined"||idbKeyRange===null)
4408 return null;var keyRange={};keyRange.lower=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.lower);keyRange.upper=WebInspector.IndexedDBModel.keyFromIDBKey(idbKeyRange.upper);keyRange.lowerOpen=idbKeyRange.lowerOpen;keyRange.upperOpen=idbKeyRange.upperOpen;return keyRange;}
4409 WebInspector.IndexedDBModel.idbKeyPathFromKeyPath=function(keyPath)
4410 {var idbKeyPath;switch(keyPath.type){case WebInspector.IndexedDBModel.KeyPathTypes.NullType:idbKeyPath=null;break;case WebInspector.IndexedDBModel.KeyPathTypes.StringType:idbKeyPath=keyPath.string;break;case WebInspector.IndexedDBModel.KeyPathTypes.ArrayType:idbKeyPath=keyPath.array;break;}
4411 return idbKeyPath;}
4412 WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath=function(idbKeyPath)
4413 {if(typeof idbKeyPath==="string")
4414 return"\""+idbKeyPath+"\"";if(idbKeyPath instanceof Array)
4415 return"[\""+idbKeyPath.join("\", \"")+"\"]";return null;}
4416 WebInspector.IndexedDBModel.EventTypes={DatabaseAdded:"DatabaseAdded",DatabaseRemoved:"DatabaseRemoved",DatabaseLoaded:"DatabaseLoaded"}
4417 WebInspector.IndexedDBModel.prototype={_reset:function()
4418 {for(var securityOrigin in this._databaseNamesBySecurityOrigin)
4419 this._removeOrigin(securityOrigin);var securityOrigins=WebInspector.resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
4420 this._addOrigin(securityOrigins[i]);},refreshDatabaseNames:function()
4421 {for(var securityOrigin in this._databaseNamesBySecurityOrigin)
4422 this._loadDatabaseNames(securityOrigin);},refreshDatabase:function(databaseId)
4423 {this._loadDatabase(databaseId);},clearObjectStore:function(databaseId,objectStoreName,callback)
4424 {IndexedDBAgent.clearObjectStore(databaseId.securityOrigin,databaseId.name,objectStoreName,callback);},_securityOriginAdded:function(event)
4425 {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
4426 {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
4427 {console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);this._databaseNamesBySecurityOrigin[securityOrigin]=[];this._loadDatabaseNames(securityOrigin);},_removeOrigin:function(securityOrigin)
4428 {console.assert(this._databaseNamesBySecurityOrigin[securityOrigin]);for(var i=0;i<this._databaseNamesBySecurityOrigin[securityOrigin].length;++i)
4429 this._databaseRemoved(securityOrigin,this._databaseNamesBySecurityOrigin[securityOrigin][i]);delete this._databaseNamesBySecurityOrigin[securityOrigin];},_updateOriginDatabaseNames:function(securityOrigin,databaseNames)
4430 {var newDatabaseNames={};for(var i=0;i<databaseNames.length;++i)
4431 newDatabaseNames[databaseNames[i]]=true;var oldDatabaseNames={};for(var i=0;i<this._databaseNamesBySecurityOrigin[securityOrigin].length;++i)
4432 oldDatabaseNames[this._databaseNamesBySecurityOrigin[securityOrigin][i]]=true;this._databaseNamesBySecurityOrigin[securityOrigin]=databaseNames;for(var databaseName in oldDatabaseNames){if(!newDatabaseNames[databaseName])
4433 this._databaseRemoved(securityOrigin,databaseName);}
4434 for(var databaseName in newDatabaseNames){if(!oldDatabaseNames[databaseName])
4435 this._databaseAdded(securityOrigin,databaseName);}},_databaseAdded:function(securityOrigin,databaseName)
4436 {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseAdded,databaseId);},_databaseRemoved:function(securityOrigin,databaseName)
4437 {var databaseId=new WebInspector.IndexedDBModel.DatabaseId(securityOrigin,databaseName);this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseRemoved,databaseId);},_loadDatabaseNames:function(securityOrigin)
4438 {function callback(error,databaseNames)
4439 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4440 if(!this._databaseNamesBySecurityOrigin[securityOrigin])
4441 return;this._updateOriginDatabaseNames(securityOrigin,databaseNames);}
4442 IndexedDBAgent.requestDatabaseNames(securityOrigin,callback.bind(this));},_loadDatabase:function(databaseId)
4443 {function callback(error,databaseWithObjectStores)
4444 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4445 if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
4446 return;var databaseModel=new WebInspector.IndexedDBModel.Database(databaseId,databaseWithObjectStores.version,databaseWithObjectStores.intVersion);this._databases.put(databaseId,databaseModel);for(var i=0;i<databaseWithObjectStores.objectStores.length;++i){var objectStore=databaseWithObjectStores.objectStores[i];var objectStoreIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);var objectStoreModel=new WebInspector.IndexedDBModel.ObjectStore(objectStore.name,objectStoreIDBKeyPath,objectStore.autoIncrement);for(var j=0;j<objectStore.indexes.length;++j){var index=objectStore.indexes[j];var indexIDBKeyPath=WebInspector.IndexedDBModel.idbKeyPathFromKeyPath(index.keyPath);var indexModel=new WebInspector.IndexedDBModel.Index(index.name,indexIDBKeyPath,index.unique,index.multiEntry);objectStoreModel.indexes[indexModel.name]=indexModel;}
4447 databaseModel.objectStores[objectStoreModel.name]=objectStoreModel;}
4448 this.dispatchEventToListeners(WebInspector.IndexedDBModel.EventTypes.DatabaseLoaded,databaseModel);}
4449 IndexedDBAgent.requestDatabase(databaseId.securityOrigin,databaseId.name,callback.bind(this));},loadObjectStoreData:function(databaseId,objectStoreName,idbKeyRange,skipCount,pageSize,callback)
4450 {this._requestData(databaseId,databaseId.name,objectStoreName,"",idbKeyRange,skipCount,pageSize,callback);},loadIndexData:function(databaseId,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
4451 {this._requestData(databaseId,databaseId.name,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback);},_requestData:function(databaseId,databaseName,objectStoreName,indexName,idbKeyRange,skipCount,pageSize,callback)
4452 {function innerCallback(error,dataEntries,hasMore)
4453 {if(error){console.error("IndexedDBAgent error: "+error);return;}
4454 if(!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin])
4455 return;var entries=[];for(var i=0;i<dataEntries.length;++i){var key=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].key));var primaryKey=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].primaryKey));var value=WebInspector.RemoteObject.fromLocalObject(JSON.parse(dataEntries[i].value));entries.push(new WebInspector.IndexedDBModel.Entry(key,primaryKey,value));}
4456 callback(entries,hasMore);}
4457 var keyRange=WebInspector.IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);IndexedDBAgent.requestData(databaseId.securityOrigin,databaseName,objectStoreName,indexName,skipCount,pageSize,keyRange?keyRange:undefined,innerCallback.bind(this));},__proto__:WebInspector.Object.prototype}
4458 WebInspector.IndexedDBModel.Entry=function(key,primaryKey,value)
4459 {this.key=key;this.primaryKey=primaryKey;this.value=value;}
4460 WebInspector.IndexedDBModel.DatabaseId=function(securityOrigin,name)
4461 {this.securityOrigin=securityOrigin;this.name=name;}
4462 WebInspector.IndexedDBModel.DatabaseId.prototype={equals:function(databaseId)
4463 {return this.name===databaseId.name&&this.securityOrigin===databaseId.securityOrigin;},}
4464 WebInspector.IndexedDBModel.Database=function(databaseId,version,intVersion)
4465 {this.databaseId=databaseId;this.version=version;this.intVersion=intVersion;this.objectStores={};}
4466 WebInspector.IndexedDBModel.ObjectStore=function(name,keyPath,autoIncrement)
4467 {this.name=name;this.keyPath=keyPath;this.autoIncrement=autoIncrement;this.indexes={};}
4468 WebInspector.IndexedDBModel.ObjectStore.prototype={get keyPathString()
4469 {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}}
4470 WebInspector.IndexedDBModel.Index=function(name,keyPath,unique,multiEntry)
4471 {this.name=name;this.keyPath=keyPath;this.unique=unique;this.multiEntry=multiEntry;}
4472 WebInspector.IndexedDBModel.Index.prototype={get keyPathString()
4473 {return WebInspector.IndexedDBModel.keyPathStringFromIDBKeyPath(this.keyPath);}}
4474 WebInspector.Spectrum=function()
4475 {WebInspector.VBox.call(this);this.registerRequiredCSS("spectrum.css");this.element.classList.add("spectrum-container");this.element.tabIndex=0;var topElement=this.element.createChild("div","spectrum-top");topElement.createChild("div","spectrum-fill");var topInnerElement=topElement.createChild("div","spectrum-top-inner fill");this._draggerElement=topInnerElement.createChild("div","spectrum-color");this._dragHelperElement=this._draggerElement.createChild("div","spectrum-sat fill").createChild("div","spectrum-val fill").createChild("div","spectrum-dragger");this._sliderElement=topInnerElement.createChild("div","spectrum-hue");this.slideHelper=this._sliderElement.createChild("div","spectrum-slider");var rangeContainer=this.element.createChild("div","spectrum-range-container");var alphaLabel=rangeContainer.createChild("label");alphaLabel.textContent=WebInspector.UIString("\u03B1:");this._alphaElement=rangeContainer.createChild("input","spectrum-range");this._alphaElement.setAttribute("type","range");this._alphaElement.setAttribute("min","0");this._alphaElement.setAttribute("max","100");this._alphaElement.addEventListener("input",alphaDrag.bind(this),false);this._alphaElement.addEventListener("change",alphaDrag.bind(this),false);var swatchElement=document.createElement("span");swatchElement.className="swatch";this._swatchInnerElement=swatchElement.createChild("span","swatch-inner");var displayContainer=this.element.createChild("div");displayContainer.appendChild(swatchElement);this._displayElement=displayContainer.createChild("span","source-code spectrum-display-value");WebInspector.Spectrum.draggable(this._sliderElement,hueDrag.bind(this));WebInspector.Spectrum.draggable(this._draggerElement,colorDrag.bind(this),colorDragStart.bind(this));function hueDrag(element,dragX,dragY)
4476 {this._hsv[0]=(this.slideHeight-dragY)/this.slideHeight;this._onchange();}
4477 var initialHelperOffset;function colorDragStart()
4478 {initialHelperOffset={x:this._dragHelperElement.offsetLeft,y:this._dragHelperElement.offsetTop};}
4479 function colorDrag(element,dragX,dragY,event)
4480 {if(event.shiftKey){if(Math.abs(dragX-initialHelperOffset.x)>=Math.abs(dragY-initialHelperOffset.y))
4481 dragY=initialHelperOffset.y;else
4482 dragX=initialHelperOffset.x;}
4483 this._hsv[1]=dragX/this.dragWidth;this._hsv[2]=(this.dragHeight-dragY)/this.dragHeight;this._onchange();}
4484 function alphaDrag()
4485 {this._hsv[3]=this._alphaElement.value/100;this._onchange();}};WebInspector.Spectrum.Events={ColorChanged:"ColorChanged"};WebInspector.Spectrum.draggable=function(element,onmove,onstart,onstop){var doc=document;var dragging;var offset;var scrollOffset;var maxHeight;var maxWidth;function consume(e)
4486 {e.consume(true);}
4487 function move(e)
4488 {if(dragging){var dragX=Math.max(0,Math.min(e.pageX-offset.left+scrollOffset.left,maxWidth));var dragY=Math.max(0,Math.min(e.pageY-offset.top+scrollOffset.top,maxHeight));if(onmove)
4489 onmove(element,dragX,dragY,(e));}}
4490 function start(e)
4491 {var mouseEvent=(e);var rightClick=mouseEvent.which?(mouseEvent.which===3):(mouseEvent.button===2);if(!rightClick&&!dragging){if(onstart)
4492 onstart(element,mouseEvent);dragging=true;maxHeight=element.clientHeight;maxWidth=element.clientWidth;scrollOffset=element.scrollOffset();offset=element.totalOffset();doc.addEventListener("selectstart",consume,false);doc.addEventListener("dragstart",consume,false);doc.addEventListener("mousemove",move,false);doc.addEventListener("mouseup",stop,false);move(mouseEvent);consume(mouseEvent);}}
4493 function stop(e)
4494 {if(dragging){doc.removeEventListener("selectstart",consume,false);doc.removeEventListener("dragstart",consume,false);doc.removeEventListener("mousemove",move,false);doc.removeEventListener("mouseup",stop,false);if(onstop)
4495 onstop(element,(e));}
4496 dragging=false;}
4497 element.addEventListener("mousedown",start,false);};WebInspector.Spectrum.prototype={setColor:function(color)
4498 {this._hsv=color.hsva();},color:function()
4499 {return WebInspector.Color.fromHSVA(this._hsv);},_colorString:function()
4500 {var cf=WebInspector.Color.Format;var format=this._originalFormat;var color=this.color();var originalFormatString=color.toString(this._originalFormat);if(originalFormatString)
4501 return originalFormatString;if(color.hasAlpha()){if(format===cf.HSLA||format===cf.HSL)
4502 return color.toString(cf.HSLA);else
4503 return color.toString(cf.RGBA);}
4504 if(format===cf.ShortHEX)
4505 return color.toString(cf.HEX);console.assert(format===cf.Nickname);return color.toString(cf.RGB);},set displayText(text)
4506 {this._displayElement.textContent=text;},_onchange:function()
4507 {this._updateUI();this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged,this._colorString());},_updateHelperLocations:function()
4508 {var h=this._hsv[0];var s=this._hsv[1];var v=this._hsv[2];var dragX=s*this.dragWidth;var dragY=this.dragHeight-(v*this.dragHeight);dragX=Math.max(-this._dragHelperElementHeight,Math.min(this.dragWidth-this._dragHelperElementHeight,dragX-this._dragHelperElementHeight));dragY=Math.max(-this._dragHelperElementHeight,Math.min(this.dragHeight-this._dragHelperElementHeight,dragY-this._dragHelperElementHeight));this._dragHelperElement.positionAt(dragX,dragY);var slideY=this.slideHeight-((h*this.slideHeight)+this.slideHelperHeight);this.slideHelper.style.top=slideY+"px";this._alphaElement.value=this._hsv[3]*100;},_updateUI:function()
4509 {this._updateHelperLocations();this._draggerElement.style.backgroundColor=WebInspector.Color.fromHSVA([this._hsv[0],1,1,1]).toString(WebInspector.Color.Format.RGB);this._swatchInnerElement.style.backgroundColor=this.color().toString(WebInspector.Color.Format.RGBA);this._alphaElement.value=this._hsv[3]*100;},wasShown:function()
4510 {this.slideHeight=this._sliderElement.offsetHeight;this.dragWidth=this._draggerElement.offsetWidth;this.dragHeight=this._draggerElement.offsetHeight;this._dragHelperElementHeight=this._dragHelperElement.offsetHeight/2;this.slideHelperHeight=this.slideHelper.offsetHeight/2;this._updateUI();},__proto__:WebInspector.VBox.prototype}
4511 WebInspector.SpectrumPopupHelper=function()
4512 {this._spectrum=new WebInspector.Spectrum();this._spectrum.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._popover=new WebInspector.Popover();this._popover.setCanShrink(false);this._popover.element.addEventListener("mousedown",consumeEvent,false);this._hideProxy=this.hide.bind(this,true);}
4513 WebInspector.SpectrumPopupHelper.Events={Hidden:"Hidden"};WebInspector.SpectrumPopupHelper.prototype={spectrum:function()
4514 {return this._spectrum;},toggle:function(element,color,format)
4515 {if(this._popover.isShowing())
4516 this.hide(true);else
4517 this.show(element,color,format);return this._popover.isShowing();},show:function(element,color,format)
4518 {if(this._popover.isShowing()){if(this._anchorElement===element)
4519 return false;this.hide(true);}
4520 this._anchorElement=element;this._spectrum.setColor(color);this._spectrum._originalFormat=format!==WebInspector.Color.Format.Original?format:color.format();this.reposition(element);document.addEventListener("mousedown",this._hideProxy,false);window.addEventListener("blur",this._hideProxy,false);return true;},reposition:function(element)
4521 {if(!this._previousFocusElement)
4522 this._previousFocusElement=WebInspector.currentFocusElement();this._popover.showView(this._spectrum,element);WebInspector.setCurrentFocusElement(this._spectrum.element);},hide:function(commitEdit)
4523 {if(!this._popover.isShowing())
4524 return;this._popover.hide();document.removeEventListener("mousedown",this._hideProxy,false);window.removeEventListener("blur",this._hideProxy,false);this.dispatchEventToListeners(WebInspector.SpectrumPopupHelper.Events.Hidden,!!commitEdit);WebInspector.setCurrentFocusElement(this._previousFocusElement);delete this._previousFocusElement;delete this._anchorElement;},_onKeyDown:function(event)
4525 {if(event.keyIdentifier==="Enter"){this.hide(true);event.consume(true);return;}
4526 if(event.keyIdentifier==="U+001B"){this.hide(false);event.consume(true);}},__proto__:WebInspector.Object.prototype}
4527 WebInspector.ColorSwatch=function(readOnly)
4528 {this.element=document.createElement("span");this._swatchInnerElement=this.element.createChild("span","swatch-inner");var shiftClickMessage=WebInspector.UIString("Shift-click to change color format.");this.element.title=readOnly?shiftClickMessage:String.sprintf("%s\n%s",WebInspector.UIString("Click to open a colorpicker."),shiftClickMessage);this.element.className="swatch";this.element.addEventListener("mousedown",consumeEvent,false);this.element.addEventListener("dblclick",consumeEvent,false);}
4529 WebInspector.ColorSwatch.prototype={setColorString:function(colorString)
4530 {this._swatchInnerElement.style.backgroundColor=colorString;}}
4531 WebInspector.SidebarPane=function(title)
4532 {WebInspector.View.call(this);this.setMinimumSize(25,0);this.element.className="sidebar-pane";this.titleElement=document.createElement("div");this.titleElement.className="sidebar-pane-toolbar";this.bodyElement=this.element.createChild("div","body");this._title=title;this._expandCallback=null;}
4533 WebInspector.SidebarPane.EventTypes={wasShown:"wasShown"}
4534 WebInspector.SidebarPane.prototype={title:function()
4535 {return this._title;},prepareContent:function(callback)
4536 {if(callback)
4537 callback();},expand:function()
4538 {this.prepareContent(this.onContentReady.bind(this));},onContentReady:function()
4539 {if(this._expandCallback)
4540 this._expandCallback();else
4541 this._expandPending=true;},setExpandCallback:function(callback)
4542 {this._expandCallback=callback;if(this._expandPending){delete this._expandPending;this._expandCallback();}},wasShown:function()
4543 {WebInspector.View.prototype.wasShown.call(this);this.dispatchEventToListeners(WebInspector.SidebarPane.EventTypes.wasShown);},__proto__:WebInspector.View.prototype}
4544 WebInspector.SidebarPaneTitle=function(container,pane)
4545 {this._pane=pane;this.element=container.createChild("div","sidebar-pane-title");this.element.textContent=pane.title();this.element.tabIndex=0;this.element.addEventListener("click",this._toggleExpanded.bind(this),false);this.element.addEventListener("keydown",this._onTitleKeyDown.bind(this),false);this.element.appendChild(this._pane.titleElement);this._pane.setExpandCallback(this._expand.bind(this));}
4546 WebInspector.SidebarPaneTitle.prototype={_expand:function()
4547 {this.element.classList.add("expanded");this._pane.show(this.element.parentNode,this.element.nextSibling);},_collapse:function()
4548 {this.element.classList.remove("expanded");if(this._pane.element.parentNode==this.element.parentNode)
4549 this._pane.detach();},_toggleExpanded:function()
4550 {if(this.element.classList.contains("expanded"))
4551 this._collapse();else
4552 this._pane.expand();},_onTitleKeyDown:function(event)
4553 {if(isEnterKey(event)||event.keyCode===WebInspector.KeyboardShortcut.Keys.Space.code)
4554 this._toggleExpanded();}}
4555 WebInspector.SidebarPaneStack=function()
4556 {WebInspector.View.call(this);this.setMinimumSize(25,0);this.element.className="sidebar-pane-stack";this.registerRequiredCSS("sidebarPane.css");}
4557 WebInspector.SidebarPaneStack.prototype={addPane:function(pane)
4558 {new WebInspector.SidebarPaneTitle(this.element,pane);},__proto__:WebInspector.View.prototype}
4559 WebInspector.SidebarTabbedPane=function()
4560 {WebInspector.TabbedPane.call(this);this.setRetainTabOrder(true);this.element.classList.add("sidebar-tabbed-pane");this.registerRequiredCSS("sidebarPane.css");}
4561 WebInspector.SidebarTabbedPane.prototype={addPane:function(pane)
4562 {var title=pane.title();this.appendTab(title,title,pane);pane.element.appendChild(pane.titleElement);pane.setExpandCallback(this.selectTab.bind(this,title));},__proto__:WebInspector.TabbedPane.prototype}
4563 WebInspector.DOMPresentationUtils={}
4564 WebInspector.DOMPresentationUtils.decorateNodeLabel=function(node,parentElement)
4565 {var title=node.nodeNameInCorrectCase();var nameElement=document.createElement("span");nameElement.textContent=title;parentElement.appendChild(nameElement);var idAttribute=node.getAttribute("id");if(idAttribute){var idElement=document.createElement("span");parentElement.appendChild(idElement);var part="#"+idAttribute;title+=part;idElement.appendChild(document.createTextNode(part));nameElement.className="extra";}
4566 var classAttribute=node.getAttribute("class");if(classAttribute){var classes=classAttribute.split(/\s+/);var foundClasses={};if(classes.length){var classesElement=document.createElement("span");classesElement.className="extra";parentElement.appendChild(classesElement);for(var i=0;i<classes.length;++i){var className=classes[i];if(className&&!(className in foundClasses)){var part="."+className;title+=part;classesElement.appendChild(document.createTextNode(part));foundClasses[className]=true;}}}}
4567 parentElement.title=title;}
4568 WebInspector.DOMPresentationUtils.createSpansForNodeTitle=function(container,nodeTitle)
4569 {var match=nodeTitle.match(/([^#.]+)(#[^.]+)?(\..*)?/);container.createChild("span","webkit-html-tag-name").textContent=match[1];if(match[2])
4570 container.createChild("span","webkit-html-attribute-value").textContent=match[2];if(match[3])
4571 container.createChild("span","webkit-html-attribute-name").textContent=match[3];}
4572 WebInspector.DOMPresentationUtils.linkifyNodeReference=function(node)
4573 {var link=document.createElement("span");link.className="node-link";WebInspector.DOMPresentationUtils.decorateNodeLabel(node,link);link.addEventListener("click",WebInspector.domModel.inspectElement.bind(WebInspector.domModel,node.id),false);link.addEventListener("mouseover",WebInspector.domModel.highlightDOMNode.bind(WebInspector.domModel,node.id,"",undefined),false);link.addEventListener("mouseout",WebInspector.domModel.hideDOMNodeHighlight.bind(WebInspector.domModel),false);return link;}
4574 WebInspector.DOMPresentationUtils.linkifyNodeById=function(nodeId)
4575 {var node=WebInspector.domModel.nodeForId(nodeId);if(!node)
4576 return document.createTextNode(WebInspector.UIString("<node>"));return WebInspector.DOMPresentationUtils.linkifyNodeReference(node);}
4577 WebInspector.DOMPresentationUtils.buildImagePreviewContents=function(imageURL,showDimensions,userCallback,precomputedDimensions)
4578 {var resource=WebInspector.resourceTreeModel.resourceForURL(imageURL);if(!resource){userCallback();return;}
4579 var imageElement=document.createElement("img");imageElement.addEventListener("load",buildContent,false);imageElement.addEventListener("error",errorCallback,false);resource.populateImageSource(imageElement);function errorCallback()
4580 {userCallback();}
4581 function buildContent()
4582 {var container=document.createElement("table");container.className="image-preview-container";var naturalWidth=precomputedDimensions?precomputedDimensions.naturalWidth:imageElement.naturalWidth;var naturalHeight=precomputedDimensions?precomputedDimensions.naturalHeight:imageElement.naturalHeight;var offsetWidth=precomputedDimensions?precomputedDimensions.offsetWidth:naturalWidth;var offsetHeight=precomputedDimensions?precomputedDimensions.offsetHeight:naturalHeight;var description;if(showDimensions){if(offsetHeight===naturalHeight&&offsetWidth===naturalWidth)
4583 description=WebInspector.UIString("%d \xd7 %d pixels",offsetWidth,offsetHeight);else
4584 description=WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)",offsetWidth,offsetHeight,naturalWidth,naturalHeight);}
4585 container.createChild("tr").createChild("td","image-container").appendChild(imageElement);if(description)
4586 container.createChild("tr").createChild("td").createChild("span","description").textContent=description;userCallback(container);}}
4587 WebInspector.DOMPresentationUtils.fullQualifiedSelector=function(node,justSelector)
4588 {if(node.nodeType()!==Node.ELEMENT_NODE)
4589 return node.localName()||node.nodeName().toLowerCase();return WebInspector.DOMPresentationUtils.cssPath(node,justSelector);}
4590 WebInspector.DOMPresentationUtils.simpleSelector=function(node)
4591 {var lowerCaseName=node.localName()||node.nodeName().toLowerCase();if(node.nodeType()!==Node.ELEMENT_NODE)
4592 return lowerCaseName;if(lowerCaseName==="input"&&node.getAttribute("type")&&!node.getAttribute("id")&&!node.getAttribute("class"))
4593 return lowerCaseName+"[type=\""+node.getAttribute("type")+"\"]";if(node.getAttribute("id"))
4594 return lowerCaseName+"#"+node.getAttribute("id");if(node.getAttribute("class"))
4595 return lowerCaseName+"."+node.getAttribute("class").trim().replace(/\s+/g,".");return lowerCaseName;}
4596 WebInspector.DOMPresentationUtils.cssPath=function(node,optimized)
4597 {if(node.nodeType()!==Node.ELEMENT_NODE)
4598 return"";var steps=[];var contextNode=node;while(contextNode){var step=WebInspector.DOMPresentationUtils._cssPathStep(contextNode,!!optimized,contextNode===node);if(!step)
4599 break;steps.push(step);if(step.optimized)
4600 break;contextNode=contextNode.parentNode;}
4601 steps.reverse();return steps.join(" > ");}
4602 WebInspector.DOMPresentationUtils._cssPathStep=function(node,optimized,isTargetNode)
4603 {if(node.nodeType()!==Node.ELEMENT_NODE)
4604 return null;var id=node.getAttribute("id");if(optimized){if(id)
4605 return new WebInspector.DOMNodePathStep(idSelector(id),true);var nodeNameLower=node.nodeName().toLowerCase();if(nodeNameLower==="body"||nodeNameLower==="head"||nodeNameLower==="html")
4606 return new WebInspector.DOMNodePathStep(node.nodeNameInCorrectCase(),true);}
4607 var nodeName=node.nodeNameInCorrectCase();if(id)
4608 return new WebInspector.DOMNodePathStep(nodeName+idSelector(id),true);var parent=node.parentNode;if(!parent||parent.nodeType()===Node.DOCUMENT_NODE)
4609 return new WebInspector.DOMNodePathStep(nodeName,true);function prefixedElementClassNames(node)
4610 {var classAttribute=node.getAttribute("class");if(!classAttribute)
4611 return[];return classAttribute.split(/\s+/g).filter(Boolean).map(function(name){return"$"+name;});}
4612 function idSelector(id)
4613 {return"#"+escapeIdentifierIfNeeded(id);}
4614 function escapeIdentifierIfNeeded(ident)
4615 {if(isCSSIdentifier(ident))
4616 return ident;var shouldEscapeFirst=/^(?:[0-9]|-[0-9-]?)/.test(ident);var lastIndex=ident.length-1;return ident.replace(/./g,function(c,i){return((shouldEscapeFirst&&i===0)||!isCSSIdentChar(c))?escapeAsciiChar(c,i===lastIndex):c;});}
4617 function escapeAsciiChar(c,isLast)
4618 {return"\\"+toHexByte(c)+(isLast?"":" ");}
4619 function toHexByte(c)
4620 {var hexByte=c.charCodeAt(0).toString(16);if(hexByte.length===1)
4621 hexByte="0"+hexByte;return hexByte;}
4622 function isCSSIdentChar(c)
4623 {if(/[a-zA-Z0-9_-]/.test(c))
4624 return true;return c.charCodeAt(0)>=0xA0;}
4625 function isCSSIdentifier(value)
4626 {return/^-?[a-zA-Z_][a-zA-Z0-9_-]*$/.test(value);}
4627 var prefixedOwnClassNamesArray=prefixedElementClassNames(node);var needsClassNames=false;var needsNthChild=false;var ownIndex=-1;var elementIndex=-1;var siblings=parent.children();for(var i=0;(ownIndex===-1||!needsNthChild)&&i<siblings.length;++i){var sibling=siblings[i];if(sibling.nodeType()!==Node.ELEMENT_NODE)
4628 continue;elementIndex+=1;if(sibling===node){ownIndex=elementIndex;continue;}
4629 if(needsNthChild)
4630 continue;if(sibling.nodeNameInCorrectCase()!==nodeName)
4631 continue;needsClassNames=true;var ownClassNames=prefixedOwnClassNamesArray.keySet();var ownClassNameCount=0;for(var name in ownClassNames)
4632 ++ownClassNameCount;if(ownClassNameCount===0){needsNthChild=true;continue;}
4633 var siblingClassNamesArray=prefixedElementClassNames(sibling);for(var j=0;j<siblingClassNamesArray.length;++j){var siblingClass=siblingClassNamesArray[j];if(!ownClassNames.hasOwnProperty(siblingClass))
4634 continue;delete ownClassNames[siblingClass];if(!--ownClassNameCount){needsNthChild=true;break;}}}
4635 var result=nodeName;if(isTargetNode&&nodeName.toLowerCase()==="input"&&node.getAttribute("type")&&!node.getAttribute("id")&&!node.getAttribute("class"))
4636 result+="[type=\""+node.getAttribute("type")+"\"]";if(needsNthChild){result+=":nth-child("+(ownIndex+1)+")";}else if(needsClassNames){for(var prefixedName in prefixedOwnClassNamesArray.keySet())
4637 result+="."+escapeIdentifierIfNeeded(prefixedName.substr(1));}
4638 return new WebInspector.DOMNodePathStep(result,false);}
4639 WebInspector.DOMPresentationUtils.xPath=function(node,optimized)
4640 {if(node.nodeType()===Node.DOCUMENT_NODE)
4641 return"/";var steps=[];var contextNode=node;while(contextNode){var step=WebInspector.DOMPresentationUtils._xPathValue(contextNode,optimized);if(!step)
4642 break;steps.push(step);if(step.optimized)
4643 break;contextNode=contextNode.parentNode;}
4644 steps.reverse();return(steps.length&&steps[0].optimized?"":"/")+steps.join("/");}
4645 WebInspector.DOMPresentationUtils._xPathValue=function(node,optimized)
4646 {var ownValue;var ownIndex=WebInspector.DOMPresentationUtils._xPathIndex(node);if(ownIndex===-1)
4647 return null;switch(node.nodeType()){case Node.ELEMENT_NODE:if(optimized&&node.getAttribute("id"))
4648 return new WebInspector.DOMNodePathStep("//*[@id=\""+node.getAttribute("id")+"\"]",true);ownValue=node.localName();break;case Node.ATTRIBUTE_NODE:ownValue="@"+node.nodeName();break;case Node.TEXT_NODE:case Node.CDATA_SECTION_NODE:ownValue="text()";break;case Node.PROCESSING_INSTRUCTION_NODE:ownValue="processing-instruction()";break;case Node.COMMENT_NODE:ownValue="comment()";break;case Node.DOCUMENT_NODE:ownValue="";break;default:ownValue="";break;}
4649 if(ownIndex>0)
4650 ownValue+="["+ownIndex+"]";return new WebInspector.DOMNodePathStep(ownValue,node.nodeType()===Node.DOCUMENT_NODE);},WebInspector.DOMPresentationUtils._xPathIndex=function(node)
4651 {function areNodesSimilar(left,right)
4652 {if(left===right)
4653 return true;if(left.nodeType()===Node.ELEMENT_NODE&&right.nodeType()===Node.ELEMENT_NODE)
4654 return left.localName()===right.localName();if(left.nodeType()===right.nodeType())
4655 return true;var leftType=left.nodeType()===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:left.nodeType();var rightType=right.nodeType()===Node.CDATA_SECTION_NODE?Node.TEXT_NODE:right.nodeType();return leftType===rightType;}
4656 var siblings=node.parentNode?node.parentNode.children():null;if(!siblings)
4657 return 0;var hasSameNamedElements;for(var i=0;i<siblings.length;++i){if(areNodesSimilar(node,siblings[i])&&siblings[i]!==node){hasSameNamedElements=true;break;}}
4658 if(!hasSameNamedElements)
4659 return 0;var ownIndex=1;for(var i=0;i<siblings.length;++i){if(areNodesSimilar(node,siblings[i])){if(siblings[i]===node)
4660 return ownIndex;++ownIndex;}}
4661 return-1;}
4662 WebInspector.DOMNodePathStep=function(value,optimized)
4663 {this.value=value;this.optimized=optimized||false;}
4664 WebInspector.DOMNodePathStep.prototype={toString:function()
4665 {return this.value;}}
4666 WebInspector.SidebarSectionTreeElement=function(title,representedObject,hasChildren)
4667 {TreeElement.call(this,title.escapeHTML(),representedObject||{},hasChildren);this.expand();}
4668 WebInspector.SidebarSectionTreeElement.prototype={selectable:false,collapse:function()
4669 {},get smallChildren()
4670 {return this._smallChildren;},set smallChildren(x)
4671 {if(this._smallChildren===x)
4672 return;this._smallChildren=x;this._childrenListNode.classList.toggle("small",this._smallChildren);},onattach:function()
4673 {this._listItemNode.classList.add("sidebar-tree-section");},onreveal:function()
4674 {if(this.listItemElement)
4675 this.listItemElement.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype}
4676 WebInspector.SidebarTreeElement=function(className,title,subtitle,representedObject,hasChildren)
4677 {TreeElement.call(this,"",representedObject,hasChildren);if(hasChildren){this.disclosureButton=document.createElement("button");this.disclosureButton.className="disclosure-button";}
4678 this.iconElement=document.createElementWithClass("div","icon");this.statusElement=document.createElementWithClass("div","status");this.titlesElement=document.createElementWithClass("div","titles");this.titleContainer=this.titlesElement.createChild("span","title-container");this.titleElement=this.titleContainer.createChild("span","title");this.subtitleElement=this.titlesElement.createChild("span","subtitle");this.className=className;this.mainTitle=title;this.subtitle=subtitle;}
4679 WebInspector.SidebarTreeElement.prototype={get small()
4680 {return this._small;},set small(x)
4681 {this._small=x;if(this._listItemNode)
4682 this._listItemNode.classList.toggle("small",this._small);},get mainTitle()
4683 {return this._mainTitle;},set mainTitle(x)
4684 {this._mainTitle=x;this.refreshTitles();},get subtitle()
4685 {return this._subtitle;},set subtitle(x)
4686 {this._subtitle=x;this.refreshTitles();},set wait(x)
4687 {this._listItemNode.classList.toggle("wait",x);},refreshTitles:function()
4688 {var mainTitle=this.mainTitle;if(this.titleElement.textContent!==mainTitle)
4689 this.titleElement.textContent=mainTitle;var subtitle=this.subtitle;if(subtitle){if(this.subtitleElement.textContent!==subtitle)
4690 this.subtitleElement.textContent=subtitle;this.titlesElement.classList.remove("no-subtitle");}else{this.subtitleElement.textContent="";this.titlesElement.classList.add("no-subtitle");}},isEventWithinDisclosureTriangle:function(event)
4691 {return event.target===this.disclosureButton;},onattach:function()
4692 {this._listItemNode.classList.add("sidebar-tree-item");if(this.className)
4693 this._listItemNode.classList.add(this.className);if(this.small)
4694 this._listItemNode.classList.add("small");if(this.hasChildren&&this.disclosureButton)
4695 this._listItemNode.appendChild(this.disclosureButton);this._listItemNode.appendChild(this.iconElement);this._listItemNode.appendChild(this.statusElement);this._listItemNode.appendChild(this.titlesElement);},onreveal:function()
4696 {if(this._listItemNode)
4697 this._listItemNode.scrollIntoViewIfNeeded(false);},__proto__:TreeElement.prototype}
4698 WebInspector.Section=function(title,subtitle)
4699 {this.element=document.createElement("div");this.element.className="section";this.element._section=this;this.headerElement=document.createElement("div");this.headerElement.className="header";this.titleElement=document.createElement("div");this.titleElement.className="title";this.subtitleElement=document.createElement("div");this.subtitleElement.className="subtitle";this.headerElement.appendChild(this.subtitleElement);this.headerElement.appendChild(this.titleElement);this.headerElement.addEventListener("click",this.handleClick.bind(this),false);this.element.appendChild(this.headerElement);this.title=title;this.subtitle=subtitle;this._expanded=false;}
4700 WebInspector.Section.prototype={get title()
4701 {return this._title;},set title(x)
4702 {if(this._title===x)
4703 return;this._title=x;if(x instanceof Node){this.titleElement.removeChildren();this.titleElement.appendChild(x);}else
4704 this.titleElement.textContent=x;},get subtitle()
4705 {return this._subtitle;},set subtitle(x)
4706 {if(this._subtitle===x)
4707 return;this._subtitle=x;this.subtitleElement.textContent=x;},get subtitleAsTextForTest()
4708 {var result=this.subtitleElement.textContent;var child=this.subtitleElement.querySelector("[data-uncopyable]");if(child){var linkData=child.getAttribute("data-uncopyable");if(linkData)
4709 result+=linkData;}
4710 return result;},get expanded()
4711 {return this._expanded;},set expanded(x)
4712 {if(x)
4713 this.expand();else
4714 this.collapse();},get populated()
4715 {return this._populated;},set populated(x)
4716 {this._populated=x;if(!x&&this._expanded){this.onpopulate();this._populated=true;}},onpopulate:function()
4717 {},get firstSibling()
4718 {var parent=this.element.parentElement;if(!parent)
4719 return null;var childElement=parent.firstChild;while(childElement){if(childElement._section)
4720 return childElement._section;childElement=childElement.nextSibling;}
4721 return null;},get lastSibling()
4722 {var parent=this.element.parentElement;if(!parent)
4723 return null;var childElement=parent.lastChild;while(childElement){if(childElement._section)
4724 return childElement._section;childElement=childElement.previousSibling;}
4725 return null;},get nextSibling()
4726 {var curElement=this.element;do{curElement=curElement.nextSibling;}while(curElement&&!curElement._section);return curElement?curElement._section:null;},get previousSibling()
4727 {var curElement=this.element;do{curElement=curElement.previousSibling;}while(curElement&&!curElement._section);return curElement?curElement._section:null;},expand:function()
4728 {if(this._expanded)
4729 return;this._expanded=true;this.element.classList.add("expanded");if(!this._populated){this.onpopulate();this._populated=true;}},collapse:function()
4730 {if(!this._expanded)
4731 return;this._expanded=false;this.element.classList.remove("expanded");},toggleExpanded:function()
4732 {this.expanded=!this.expanded;},handleClick:function(event)
4733 {this.toggleExpanded();event.consume();}}
4734 WebInspector.PropertiesSection=function(title,subtitle)
4735 {WebInspector.Section.call(this,title,subtitle);this.headerElement.classList.add("monospace");this.propertiesElement=document.createElement("ol");this.propertiesElement.className="properties properties-tree monospace";this.propertiesTreeOutline=new TreeOutline(this.propertiesElement,true);this.propertiesTreeOutline.setFocusable(false);this.propertiesTreeOutline.section=this;this.element.appendChild(this.propertiesElement);}
4736 WebInspector.PropertiesSection.prototype={__proto__:WebInspector.Section.prototype}
4737 WebInspector.RemoteObject=function(){}
4738 WebInspector.RemoteObject.prototype={get type()
4739 {throw"Not implemented";},get subtype()
4740 {throw"Not implemented";},get description()
4741 {throw"Not implemented";},get hasChildren()
4742 {throw"Not implemented";},arrayLength:function()
4743 {throw"Not implemented";},getOwnProperties:function(callback)
4744 {throw"Not implemented";},getAllProperties:function(accessorPropertiesOnly,callback)
4745 {throw"Not implemented";},callFunction:function(functionDeclaration,args,callback)
4746 {throw"Not implemented";},callFunctionJSON:function(functionDeclaration,args,callback)
4747 {throw"Not implemented";},target:function()
4748 {throw"Not implemented";}}
4749 WebInspector.RemoteObject.fromPrimitiveValue=function(value,target)
4750 {if(!target)
4751 target=WebInspector.targetManager.mainTarget();return new WebInspector.RemoteObjectImpl(target,undefined,typeof value,undefined,value);}
4752 WebInspector.RemoteObject.fromLocalObject=function(value)
4753 {return new WebInspector.LocalJSONObject(value);}
4754 WebInspector.RemoteObject.resolveNode=function(node,objectGroup,callback)
4755 {function mycallback(error,object)
4756 {if(!callback)
4757 return;if(error||!object)
4758 callback(null);else
4759 callback(WebInspector.RemoteObject.fromPayload(object));}
4760 DOMAgent.resolveNode(node.id,objectGroup,mycallback);}
4761 WebInspector.RemoteObject.fromPayload=function(payload,target)
4762 {if(!target)
4763 target=WebInspector.targetManager.mainTarget();console.assert(typeof payload==="object","Remote object payload should only be an object");return new WebInspector.RemoteObjectImpl(target,payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.preview);}
4764 WebInspector.RemoteObject.type=function(remoteObject)
4765 {if(remoteObject===null)
4766 return"null";var type=typeof remoteObject;if(type!=="object"&&type!=="function")
4767 return type;return remoteObject.type;}
4768 WebInspector.RemoteObject.toCallArgument=function(remoteObject)
4769 {var type=(remoteObject.type);var value=remoteObject.value;if(type==="number"){switch(remoteObject.description){case"NaN":case"Infinity":case"-Infinity":case"-0":value=remoteObject.description;break;}}
4770 return{value:value,objectId:remoteObject.objectId,type:type};}
4771 WebInspector.RemoteObjectImpl=function(target,objectId,type,subtype,value,description,preview)
4772 {WebInspector.RemoteObject.call(this);this._target=target;this._runtimeAgent=target.runtimeAgent();this._domModel=target.domModel;this._type=type;this._subtype=subtype;if(objectId){this._objectId=objectId;this._description=description;this._hasChildren=true;this._preview=preview;}else{console.assert(type!=="object"||value===null);this._description=description||(value+"");this._hasChildren=false;if(type==="number"&&typeof value!=="number")
4773 this.value=Number(value);else
4774 this.value=value;}}
4775 WebInspector.RemoteObjectImpl.prototype={get objectId()
4776 {return this._objectId;},get type()
4777 {return this._type;},get subtype()
4778 {return this._subtype;},get description()
4779 {return this._description;},get hasChildren()
4780 {return this._hasChildren;},get preview()
4781 {return this._preview;},getOwnProperties:function(callback)
4782 {this.doGetProperties(true,false,callback);},getAllProperties:function(accessorPropertiesOnly,callback)
4783 {this.doGetProperties(false,accessorPropertiesOnly,callback);},getProperty:function(propertyPath,callback)
4784 {function remoteFunction(arrayStr)
4785 {var result=this;var properties=JSON.parse(arrayStr);for(var i=0,n=properties.length;i<n;++i)
4786 result=result[properties[i]];return result;}
4787 var args=[{value:JSON.stringify(propertyPath)}];this.callFunction(remoteFunction,args,callback);},doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
4788 {if(!this._objectId){callback(null,null);return;}
4789 function remoteObjectBinder(error,properties,internalProperties)
4790 {if(error){callback(null,null);return;}
4791 var result=[];for(var i=0;properties&&i<properties.length;++i){var property=properties[i];result.push(new WebInspector.RemoteObjectProperty(property.name,null,property));}
4792 var internalPropertiesResult=null;if(internalProperties){internalPropertiesResult=[];for(var i=0;i<internalProperties.length;i++){var property=internalProperties[i];if(!property.value)
4793 continue;internalPropertiesResult.push(new WebInspector.RemoteObjectProperty(property.name,WebInspector.RemoteObject.fromPayload(property.value)));}}
4794 callback(result,internalPropertiesResult);}
4795 this._runtimeAgent.getProperties(this._objectId,ownProperties,accessorPropertiesOnly,remoteObjectBinder);},setPropertyValue:function(name,value,callback)
4796 {if(!this._objectId){callback("Can't set a property of non-object.");return;}
4797 this._runtimeAgent.invoke_evaluate({expression:value,doNotPauseOnExceptionsAndMuteConsole:true},evaluatedCallback.bind(this));function evaluatedCallback(error,result,wasThrown)
4798 {if(error||wasThrown){callback(error||result.description);return;}
4799 this.doSetObjectPropertyValue(result,name,callback);if(result.objectId)
4800 this._runtimeAgent.releaseObject(result.objectId);}},doSetObjectPropertyValue:function(result,name,callback)
4801 {var setPropertyValueFunction="function(a, b) { this[a] = b; }";var argv=[{value:name},WebInspector.RemoteObject.toCallArgument(result)]
4802 this._runtimeAgent.callFunctionOn(this._objectId,setPropertyValueFunction,argv,true,undefined,undefined,propertySetCallback);function propertySetCallback(error,result,wasThrown)
4803 {if(error||wasThrown){callback(error||result.description);return;}
4804 callback();}},pushNodeToFrontend:function(callback)
4805 {if(this._objectId)
4806 this._domModel.pushNodeToFrontend(this._objectId,callback);else
4807 callback(0);},highlightAsDOMNode:function()
4808 {this._domModel.highlightDOMNode(undefined,undefined,this._objectId);},hideDOMNodeHighlight:function()
4809 {this._domModel.hideDOMNodeHighlight();},callFunction:function(functionDeclaration,args,callback)
4810 {function mycallback(error,result,wasThrown)
4811 {if(!callback)
4812 return;if(error)
4813 callback(null,false);else
4814 callback(WebInspector.RemoteObject.fromPayload(result),wasThrown);}
4815 this._runtimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,undefined,undefined,mycallback);},callFunctionJSON:function(functionDeclaration,args,callback)
4816 {function mycallback(error,result,wasThrown)
4817 {callback((error||wasThrown)?null:result.value);}
4818 this._runtimeAgent.callFunctionOn(this._objectId,functionDeclaration.toString(),args,true,true,false,mycallback);},release:function()
4819 {if(!this._objectId)
4820 return;this._runtimeAgent.releaseObject(this._objectId);},arrayLength:function()
4821 {if(this.subtype!=="array")
4822 return 0;var matches=this._description.match(/\[([0-9]+)\]/);if(!matches)
4823 return 0;return parseInt(matches[1],10);},target:function()
4824 {return this._target;},__proto__:WebInspector.RemoteObject.prototype};WebInspector.RemoteObject.loadFromObject=function(object,flattenProtoChain,callback)
4825 {if(flattenProtoChain)
4826 object.getAllProperties(false,callback);else
4827 WebInspector.RemoteObject.loadFromObjectPerProto(object,callback);};WebInspector.RemoteObject.loadFromObjectPerProto=function(object,callback)
4828 {var savedOwnProperties;var savedAccessorProperties;var savedInternalProperties;var resultCounter=2;function processCallback()
4829 {if(--resultCounter)
4830 return;if(savedOwnProperties&&savedAccessorProperties){var combinedList=savedAccessorProperties.slice(0);for(var i=0;i<savedOwnProperties.length;i++){var property=savedOwnProperties[i];if(!property.isAccessorProperty())
4831 combinedList.push(property);}
4832 return callback(combinedList,savedInternalProperties?savedInternalProperties:null);}else{callback(null,null);}}
4833 function allAccessorPropertiesCallback(properties,internalProperties)
4834 {savedAccessorProperties=properties;processCallback();}
4835 function ownPropertiesCallback(properties,internalProperties)
4836 {savedOwnProperties=properties;savedInternalProperties=internalProperties;processCallback();}
4837 object.getAllProperties(true,allAccessorPropertiesCallback);object.getOwnProperties(ownPropertiesCallback);};WebInspector.ScopeRemoteObject=function(target,objectId,scopeRef,type,subtype,value,description,preview)
4838 {WebInspector.RemoteObjectImpl.call(this,target,objectId,type,subtype,value,description,preview);this._scopeRef=scopeRef;this._savedScopeProperties=undefined;this._debuggerAgent=target.debuggerAgent();};WebInspector.ScopeRemoteObject.fromPayload=function(payload,scopeRef,target)
4839 {if(!target)
4840 target=WebInspector.targetManager.mainTarget();if(scopeRef)
4841 return new WebInspector.ScopeRemoteObject(target,payload.objectId,scopeRef,payload.type,payload.subtype,payload.value,payload.description,payload.preview);else
4842 return new WebInspector.RemoteObjectImpl(target,payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.preview);}
4843 WebInspector.ScopeRemoteObject.prototype={doGetProperties:function(ownProperties,accessorPropertiesOnly,callback)
4844 {if(accessorPropertiesOnly){callback([],[]);return;}
4845 if(this._savedScopeProperties){callback(this._savedScopeProperties.slice(),[]);return;}
4846 function wrappedCallback(properties,internalProperties)
4847 {if(this._scopeRef&&properties instanceof Array)
4848 this._savedScopeProperties=properties.slice();callback(properties,internalProperties);}
4849 WebInspector.RemoteObjectImpl.prototype.doGetProperties.call(this,ownProperties,accessorPropertiesOnly,wrappedCallback.bind(this));},doSetObjectPropertyValue:function(result,name,callback)
4850 {this._debuggerAgent.setVariableValue(this._scopeRef.number,name,WebInspector.RemoteObject.toCallArgument(result),this._scopeRef.callFrameId,this._scopeRef.functionId,setVariableValueCallback.bind(this));function setVariableValueCallback(error)
4851 {if(error){callback(error);return;}
4852 if(this._savedScopeProperties){for(var i=0;i<this._savedScopeProperties.length;i++){if(this._savedScopeProperties[i].name===name)
4853 this._savedScopeProperties[i].value=WebInspector.RemoteObject.fromPayload(result);}}
4854 callback();}},__proto__:WebInspector.RemoteObjectImpl.prototype};WebInspector.ScopeRef=function(number,callFrameId,functionId)
4855 {this.number=number;this.callFrameId=callFrameId;this.functionId=functionId;}
4856 WebInspector.RemoteObjectProperty=function(name,value,descriptor)
4857 {this.name=name;this.enumerable=descriptor?!!descriptor.enumerable:true;this.writable=descriptor?!!descriptor.writable:true;if(value===null&&descriptor){if(descriptor.value)
4858 this.value=WebInspector.RemoteObject.fromPayload(descriptor.value)
4859 if(descriptor.get&&descriptor.get.type!=="undefined")
4860 this.getter=WebInspector.RemoteObject.fromPayload(descriptor.get);if(descriptor.set&&descriptor.set.type!=="undefined")
4861 this.setter=WebInspector.RemoteObject.fromPayload(descriptor.set);}else{this.value=value;}
4862 if(descriptor){this.isOwn=descriptor.isOwn;this.wasThrown=!!descriptor.wasThrown;}}
4863 WebInspector.RemoteObjectProperty.prototype={isAccessorProperty:function()
4864 {return!!(this.getter||this.setter);}};WebInspector.RemoteObjectProperty.fromPrimitiveValue=function(name,value)
4865 {return new WebInspector.RemoteObjectProperty(name,WebInspector.RemoteObject.fromPrimitiveValue(value));}
4866 WebInspector.RemoteObjectProperty.fromScopeValue=function(name,value)
4867 {var result=new WebInspector.RemoteObjectProperty(name,value);result.writable=false;return result;}
4868 WebInspector.LocalJSONObject=function(value)
4869 {WebInspector.RemoteObject.call(this);this._value=value;}
4870 WebInspector.LocalJSONObject.prototype={get description()
4871 {if(this._cachedDescription)
4872 return this._cachedDescription;function formatArrayItem(property)
4873 {return property.value.description;}
4874 function formatObjectItem(property)
4875 {return property.name+":"+property.value.description;}
4876 if(this.type==="object"){switch(this.subtype){case"array":this._cachedDescription=this._concatenate("[","]",formatArrayItem);break;case"date":this._cachedDescription=""+this._value;break;case"null":this._cachedDescription="null";break;default:this._cachedDescription=this._concatenate("{","}",formatObjectItem);}}else
4877 this._cachedDescription=String(this._value);return this._cachedDescription;},_concatenate:function(prefix,suffix,formatProperty)
4878 {const previewChars=100;var buffer=prefix;var children=this._children();for(var i=0;i<children.length;++i){var itemDescription=formatProperty(children[i]);if(buffer.length+itemDescription.length>previewChars){buffer+=",\u2026";break;}
4879 if(i)
4880 buffer+=", ";buffer+=itemDescription;}
4881 buffer+=suffix;return buffer;},get type()
4882 {return typeof this._value;},get subtype()
4883 {if(this._value===null)
4884 return"null";if(this._value instanceof Array)
4885 return"array";if(this._value instanceof Date)
4886 return"date";return undefined;},get hasChildren()
4887 {if((typeof this._value!=="object")||(this._value===null))
4888 return false;return!!Object.keys((this._value)).length;},getOwnProperties:function(callback)
4889 {callback(this._children());},getAllProperties:function(accessorPropertiesOnly,callback)
4890 {if(accessorPropertiesOnly)
4891 callback([],null);else
4892 callback(this._children(),null);},_children:function()
4893 {if(!this.hasChildren)
4894 return[];var value=(this._value);function buildProperty(propName)
4895 {return new WebInspector.RemoteObjectProperty(propName,new WebInspector.LocalJSONObject(this._value[propName]));}
4896 if(!this._cachedChildren)
4897 this._cachedChildren=Object.keys(value).map(buildProperty.bind(this));return this._cachedChildren;},isError:function()
4898 {return false;},arrayLength:function()
4899 {return this._value instanceof Array?this._value.length:0;},callFunction:function(functionDeclaration,args,callback)
4900 {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;var wasThrown=false;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){wasThrown=true;}
4901 if(!callback)
4902 return;callback(WebInspector.RemoteObject.fromLocalObject(result),wasThrown);},callFunctionJSON:function(functionDeclaration,args,callback)
4903 {var target=(this._value);var rawArgs=args?args.map(function(arg){return arg.value;}):[];var result;try{result=functionDeclaration.apply(target,rawArgs);}catch(e){result=null;}
4904 callback(result);},__proto__:WebInspector.RemoteObject.prototype}
4905 WebInspector.ObjectPropertiesSection=function(object,title,subtitle,emptyPlaceholder,ignoreHasOwnProperty,extraProperties,treeElementConstructor)
4906 {this.emptyPlaceholder=(emptyPlaceholder||WebInspector.UIString("No Properties"));this.object=object;this.ignoreHasOwnProperty=ignoreHasOwnProperty;this.extraProperties=extraProperties;this.treeElementConstructor=treeElementConstructor||WebInspector.ObjectPropertyTreeElement;this.editable=true;this.skipProto=false;WebInspector.PropertiesSection.call(this,title||"",subtitle);}
4907 WebInspector.ObjectPropertiesSection._arrayLoadThreshold=100;WebInspector.ObjectPropertiesSection.prototype={enableContextMenu:function()
4908 {this.element.addEventListener("contextmenu",this._contextMenuEventFired.bind(this),false);},_contextMenuEventFired:function(event)
4909 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendApplicableItems(this.object);contextMenu.show();},onpopulate:function()
4910 {this.update();},update:function()
4911 {if(this.object.arrayLength()>WebInspector.ObjectPropertiesSection._arrayLoadThreshold){this.propertiesTreeOutline.removeChildren();WebInspector.ArrayGroupingTreeElement._populateArray(this.propertiesTreeOutline,this.object,0,this.object.arrayLength()-1);return;}
4912 function callback(properties,internalProperties)
4913 {if(!properties)
4914 return;this.updateProperties(properties,internalProperties);}
4915 WebInspector.RemoteObject.loadFromObject(this.object,!!this.ignoreHasOwnProperty,callback.bind(this));},updateProperties:function(properties,internalProperties,rootTreeElementConstructor,rootPropertyComparer)
4916 {if(!rootTreeElementConstructor)
4917 rootTreeElementConstructor=this.treeElementConstructor;if(!rootPropertyComparer)
4918 rootPropertyComparer=WebInspector.ObjectPropertiesSection.CompareProperties;if(this.extraProperties){for(var i=0;i<this.extraProperties.length;++i)
4919 properties.push(this.extraProperties[i]);}
4920 this.propertiesTreeOutline.removeChildren();WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.propertiesTreeOutline,properties,internalProperties,rootTreeElementConstructor,rootPropertyComparer,this.skipProto,this.object);this.propertiesForTest=properties;if(!this.propertiesTreeOutline.children.length){var title=document.createElement("div");title.className="info";title.textContent=this.emptyPlaceholder;var infoElement=new TreeElement(title,null,false);this.propertiesTreeOutline.appendChild(infoElement);}},__proto__:WebInspector.PropertiesSection.prototype}
4921 WebInspector.ObjectPropertiesSection.CompareProperties=function(propertyA,propertyB)
4922 {var a=propertyA.name;var b=propertyB.name;if(a==="__proto__")
4923 return 1;if(b==="__proto__")
4924 return-1;return String.naturalOrderComparator(a,b);}
4925 WebInspector.ObjectPropertyTreeElement=function(property)
4926 {this.property=property;TreeElement.call(this,"",null,false);this.toggleOnClick=true;this.selectable=false;}
4927 WebInspector.ObjectPropertyTreeElement.prototype={onpopulate:function()
4928 {var propertyValue=(this.property.value);console.assert(propertyValue);WebInspector.ObjectPropertyTreeElement.populate(this,propertyValue);},ondblclick:function(event)
4929 {if(this.property.writable||this.property.setter)
4930 this.startEditing(event);return false;},onattach:function()
4931 {this.update();},update:function()
4932 {this.nameElement=document.createElement("span");this.nameElement.className="name";var name=this.property.name;if(/^\s|\s$|^$|\n/.test(name))
4933 name="\""+name.replace(/\n/g,"\u21B5")+"\"";this.nameElement.textContent=name;if(!this.property.enumerable)
4934 this.nameElement.classList.add("dimmed");if(this.property.isAccessorProperty())
4935 this.nameElement.classList.add("properties-accessor-property-name");var separatorElement=document.createElement("span");separatorElement.className="separator";separatorElement.textContent=": ";if(this.property.value){this.valueElement=document.createElement("span");this.valueElement.className="value";var description=this.property.value.description;var valueText;if(this.property.wasThrown){valueText="[Exception: "+description+"]";}else if(this.property.value.type==="string"&&typeof description==="string"){valueText="\""+description.replace(/\n/g,"\u21B5")+"\"";this.valueElement._originalTextContent="\""+description+"\"";}else if(this.property.value.type==="function"&&typeof description==="string"){valueText=/.*/.exec(description)[0].replace(/ +$/g,"");this.valueElement._originalTextContent=description;}else if(this.property.value.type!=="object"||this.property.value.subtype!=="node"){valueText=description;}
4936 this.valueElement.setTextContentTruncatedIfNeeded(valueText||"");if(this.property.wasThrown)
4937 this.valueElement.classList.add("error");if(this.property.value.subtype)
4938 this.valueElement.classList.add("console-formatted-"+this.property.value.subtype);else if(this.property.value.type)
4939 this.valueElement.classList.add("console-formatted-"+this.property.value.type);this.valueElement.addEventListener("contextmenu",this._contextMenuFired.bind(this,this.property.value),false);if(this.property.value.type==="object"&&this.property.value.subtype==="node"&&this.property.value.description){WebInspector.DOMPresentationUtils.createSpansForNodeTitle(this.valueElement,this.property.value.description);this.valueElement.addEventListener("mousemove",this._mouseMove.bind(this,this.property.value),false);this.valueElement.addEventListener("mouseout",this._mouseOut.bind(this,this.property.value),false);}else{this.valueElement.title=description||"";}
4940 this.listItemElement.removeChildren();this.hasChildren=this.property.value.hasChildren&&!this.property.wasThrown;}else{if(this.property.getter){this.valueElement=WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(this.property.parentObject,[this.property.name],this._onInvokeGetterClick.bind(this));}else{this.valueElement=document.createElement("span");this.valueElement.className="console-formatted-undefined";this.valueElement.textContent=WebInspector.UIString("<unreadable>");this.valueElement.title=WebInspector.UIString("No property getter");}}
4941 this.listItemElement.appendChild(this.nameElement);this.listItemElement.appendChild(separatorElement);this.listItemElement.appendChild(this.valueElement);},_contextMenuFired:function(value,event)
4942 {var contextMenu=new WebInspector.ContextMenu(event);this.populateContextMenu(contextMenu);contextMenu.appendApplicableItems(value);contextMenu.show();},populateContextMenu:function(contextMenu)
4943 {},_mouseMove:function(event)
4944 {this.property.value.highlightAsDOMNode();},_mouseOut:function(event)
4945 {this.property.value.hideDOMNodeHighlight();},updateSiblings:function()
4946 {if(this.parent.root)
4947 this.treeOutline.section.update();else
4948 this.parent.shouldRefreshChildren=true;},renderPromptAsBlock:function()
4949 {return false;},elementAndValueToEdit:function(event)
4950 {return[this.valueElement,(typeof this.valueElement._originalTextContent==="string")?this.valueElement._originalTextContent:undefined];},startEditing:function(event)
4951 {var elementAndValueToEdit=this.elementAndValueToEdit(event);var elementToEdit=elementAndValueToEdit[0];var valueToEdit=elementAndValueToEdit[1];if(WebInspector.isBeingEdited(elementToEdit)||!this.treeOutline.section.editable||this._readOnly)
4952 return;if(typeof valueToEdit!=="undefined")
4953 elementToEdit.setTextContentTruncatedIfNeeded(valueToEdit,WebInspector.UIString("<string is too large to edit>"));var context={expanded:this.expanded,elementToEdit:elementToEdit,previousContent:elementToEdit.textContent};this.hasChildren=false;this.listItemElement.classList.add("editing-sub-part");this._prompt=new WebInspector.ObjectPropertyPrompt(this.editingCommitted.bind(this,null,elementToEdit.textContent,context.previousContent,context),this.editingCancelled.bind(this,null,context),this.renderPromptAsBlock());function blurListener()
4954 {this.editingCommitted(null,elementToEdit.textContent,context.previousContent,context);}
4955 var proxyElement=this._prompt.attachAndStartEditing(elementToEdit,blurListener.bind(this));window.getSelection().setBaseAndExtent(elementToEdit,0,elementToEdit,1);proxyElement.addEventListener("keydown",this._promptKeyDown.bind(this,context),false);},isEditing:function()
4956 {return!!this._prompt;},editingEnded:function(context)
4957 {this._prompt.detach();delete this._prompt;this.listItemElement.scrollLeft=0;this.listItemElement.classList.remove("editing-sub-part");if(context.expanded)
4958 this.expand();},editingCancelled:function(element,context)
4959 {this.editingEnded(context);this.update();},editingCommitted:function(element,userInput,previousContent,context)
4960 {if(userInput===previousContent){this.editingCancelled(element,context);return;}
4961 this.editingEnded(context);this.applyExpression(userInput,true);},_promptKeyDown:function(context,event)
4962 {if(isEnterKey(event)){event.consume(true);this.editingCommitted(null,context.elementToEdit.textContent,context.previousContent,context);return;}
4963 if(event.keyIdentifier==="U+001B"){event.consume();this.editingCancelled(null,context);return;}},applyExpression:function(expression,updateInterface)
4964 {expression=expression.trim();var expressionLength=expression.length;function callback(error)
4965 {if(!updateInterface)
4966 return;if(error)
4967 this.update();if(!expressionLength){this.parent.removeChild(this);}else{this.updateSiblings();}};this.property.parentObject.setPropertyValue(this.property.name,expression.trim(),callback.bind(this));},propertyPath:function()
4968 {if("_cachedPropertyPath"in this)
4969 return this._cachedPropertyPath;var current=this;var result;do{if(current.property){if(result)
4970 result=current.property.name+"."+result;else
4971 result=current.property.name;}
4972 current=current.parent;}while(current&&!current.root);this._cachedPropertyPath=result;return result;},_onInvokeGetterClick:function(result,wasThrown)
4973 {if(!result)
4974 return;this.property.value=result;this.property.wasThrown=wasThrown;this.update();this.shouldRefreshChildren=true;},__proto__:TreeElement.prototype}
4975 WebInspector.ObjectPropertyTreeElement.populate=function(treeElement,value){if(treeElement.children.length&&!treeElement.shouldRefreshChildren)
4976 return;if(value.arrayLength()>WebInspector.ObjectPropertiesSection._arrayLoadThreshold){treeElement.removeChildren();WebInspector.ArrayGroupingTreeElement._populateArray(treeElement,value,0,value.arrayLength()-1);return;}
4977 function callback(properties,internalProperties)
4978 {treeElement.removeChildren();if(!properties)
4979 return;if(!internalProperties)
4980 internalProperties=[];WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement,properties,internalProperties,treeElement.treeOutline.section.treeElementConstructor,WebInspector.ObjectPropertiesSection.CompareProperties,treeElement.treeOutline.section.skipProto,value);}
4981 WebInspector.RemoteObject.loadFromObjectPerProto(value,callback);}
4982 WebInspector.ObjectPropertyTreeElement.populateWithProperties=function(treeElement,properties,internalProperties,treeElementConstructor,comparator,skipProto,value){properties.sort(comparator);for(var i=0;i<properties.length;++i){var property=properties[i];if(skipProto&&property.name==="__proto__")
4983 continue;if(property.isAccessorProperty()){if(property.name!=="__proto__"&&property.getter){property.parentObject=value;treeElement.appendChild(new treeElementConstructor(property));}
4984 if(property.isOwn){if(property.getter){var getterProperty=new WebInspector.RemoteObjectProperty("get "+property.name,property.getter);getterProperty.parentObject=value;treeElement.appendChild(new treeElementConstructor(getterProperty));}
4985 if(property.setter){var setterProperty=new WebInspector.RemoteObjectProperty("set "+property.name,property.setter);setterProperty.parentObject=value;treeElement.appendChild(new treeElementConstructor(setterProperty));}}}else{property.parentObject=value;treeElement.appendChild(new treeElementConstructor(property));}}
4986 if(value&&value.type==="function"){var hasTargetFunction=false;if(internalProperties){for(var i=0;i<internalProperties.length;i++){if(internalProperties[i].name=="[[TargetFunction]]"){hasTargetFunction=true;break;}}}
4987 if(!hasTargetFunction)
4988 treeElement.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));}
4989 if(internalProperties){for(var i=0;i<internalProperties.length;i++){internalProperties[i].parentObject=value;treeElement.appendChild(new treeElementConstructor(internalProperties[i]));}}}
4990 WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan=function(object,propertyPath,callback)
4991 {var rootElement=document.createElement("span");var element=rootElement.createChild("span","properties-calculate-value-button");element.textContent=WebInspector.UIString("(...)");element.title=WebInspector.UIString("Invoke property getter");element.addEventListener("click",onInvokeGetterClick,false);function onInvokeGetterClick(event)
4992 {event.consume();object.getProperty(propertyPath,callback);}
4993 return rootElement;}
4994 WebInspector.FunctionScopeMainTreeElement=function(remoteObject)
4995 {TreeElement.call(this,"<function scope>",null,false);this.toggleOnClick=true;this.selectable=false;this._remoteObject=remoteObject;this.hasChildren=true;}
4996 WebInspector.FunctionScopeMainTreeElement.prototype={onpopulate:function()
4997 {if(this.children.length&&!this.shouldRefreshChildren)
4998 return;function didGetDetails(error,response)
4999 {if(error){console.error(error);return;}
5000 this.removeChildren();var scopeChain=response.scopeChain;if(!scopeChain)
5001 return;for(var i=0;i<scopeChain.length;++i){var scope=scopeChain[i];var title=null;var isTrueObject;switch(scope.type){case DebuggerAgent.ScopeType.Local:title=WebInspector.UIString("Local");isTrueObject=false;break;case DebuggerAgent.ScopeType.Closure:title=WebInspector.UIString("Closure");isTrueObject=false;break;case DebuggerAgent.ScopeType.Catch:title=WebInspector.UIString("Catch");isTrueObject=false;break;case DebuggerAgent.ScopeType.With:title=WebInspector.UIString("With Block");isTrueObject=true;break;case DebuggerAgent.ScopeType.Global:title=WebInspector.UIString("Global");isTrueObject=true;break;default:console.error("Unknown scope type: "+scope.type);continue;}
5002 var scopeRef=isTrueObject?undefined:new WebInspector.ScopeRef(i,undefined,this._remoteObject.objectId);var remoteObject=WebInspector.ScopeRemoteObject.fromPayload(scope.object,scopeRef);if(isTrueObject){var property=WebInspector.RemoteObjectProperty.fromScopeValue(title,remoteObject);property.parentObject=null;this.appendChild(new this.treeOutline.section.treeElementConstructor(property));}else{var scopeTreeElement=new WebInspector.ScopeTreeElement(title,null,remoteObject);this.appendChild(scopeTreeElement);}}}
5003 DebuggerAgent.getFunctionDetails(this._remoteObject.objectId,didGetDetails.bind(this));},__proto__:TreeElement.prototype}
5004 WebInspector.ScopeTreeElement=function(title,subtitle,remoteObject)
5005 {TreeElement.call(this,title,null,false);this.toggleOnClick=true;this.selectable=false;this._remoteObject=remoteObject;this.hasChildren=true;}
5006 WebInspector.ScopeTreeElement.prototype={onpopulate:function()
5007 {WebInspector.ObjectPropertyTreeElement.populate(this,this._remoteObject);},__proto__:TreeElement.prototype}
5008 WebInspector.ArrayGroupingTreeElement=function(object,fromIndex,toIndex,propertyCount)
5009 {TreeElement.call(this,String.sprintf("[%d \u2026 %d]",fromIndex,toIndex),undefined,true);this._fromIndex=fromIndex;this._toIndex=toIndex;this._object=object;this._readOnly=true;this._propertyCount=propertyCount;this._populated=false;}
5010 WebInspector.ArrayGroupingTreeElement._bucketThreshold=100;WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold=250000;WebInspector.ArrayGroupingTreeElement._populateArray=function(treeElement,object,fromIndex,toIndex)
5011 {WebInspector.ArrayGroupingTreeElement._populateRanges(treeElement,object,fromIndex,toIndex,true);}
5012 WebInspector.ArrayGroupingTreeElement._populateRanges=function(treeElement,object,fromIndex,toIndex,topLevel)
5013 {object.callFunctionJSON(packRanges,[{value:fromIndex},{value:toIndex},{value:WebInspector.ArrayGroupingTreeElement._bucketThreshold},{value:WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}],callback);function packRanges(fromIndex,toIndex,bucketThreshold,sparseIterationThreshold)
5014 {var ownPropertyNames=null;function doLoop(iterationCallback)
5015 {if(toIndex-fromIndex<sparseIterationThreshold){for(var i=fromIndex;i<=toIndex;++i){if(i in this)
5016 iterationCallback(i);}}else{ownPropertyNames=ownPropertyNames||Object.getOwnPropertyNames(this);for(var i=0;i<ownPropertyNames.length;++i){var name=ownPropertyNames[i];var index=name>>>0;if(String(index)===name&&fromIndex<=index&&index<=toIndex)
5017 iterationCallback(index);}}}
5018 var count=0;function countIterationCallback()
5019 {++count;}
5020 doLoop.call(this,countIterationCallback);var bucketSize=count;if(count<=bucketThreshold)
5021 bucketSize=count;else
5022 bucketSize=Math.pow(bucketThreshold,Math.ceil(Math.log(count)/Math.log(bucketThreshold))-1);var ranges=[];count=0;var groupStart=-1;var groupEnd=0;function loopIterationCallback(i)
5023 {if(groupStart===-1)
5024 groupStart=i;groupEnd=i;if(++count===bucketSize){ranges.push([groupStart,groupEnd,count]);count=0;groupStart=-1;}}
5025 doLoop.call(this,loopIterationCallback);if(count>0)
5026 ranges.push([groupStart,groupEnd,count]);return ranges;}
5027 function callback(ranges)
5028 {if(ranges.length==1)
5029 WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeElement,object,ranges[0][0],ranges[0][1]);else{for(var i=0;i<ranges.length;++i){var fromIndex=ranges[i][0];var toIndex=ranges[i][1];var count=ranges[i][2];if(fromIndex==toIndex)
5030 WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeElement,object,fromIndex,toIndex);else
5031 treeElement.appendChild(new WebInspector.ArrayGroupingTreeElement(object,fromIndex,toIndex,count));}}
5032 if(topLevel)
5033 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(treeElement,object);}}
5034 WebInspector.ArrayGroupingTreeElement._populateAsFragment=function(treeElement,object,fromIndex,toIndex)
5035 {object.callFunction(buildArrayFragment,[{value:fromIndex},{value:toIndex},{value:WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}],processArrayFragment.bind(this));function buildArrayFragment(fromIndex,toIndex,sparseIterationThreshold)
5036 {var result=Object.create(null);if(toIndex-fromIndex<sparseIterationThreshold){for(var i=fromIndex;i<=toIndex;++i){if(i in this)
5037 result[i]=this[i];}}else{var ownPropertyNames=Object.getOwnPropertyNames(this);for(var i=0;i<ownPropertyNames.length;++i){var name=ownPropertyNames[i];var index=name>>>0;if(String(index)===name&&fromIndex<=index&&index<=toIndex)
5038 result[index]=this[index];}}
5039 return result;}
5040 function processArrayFragment(arrayFragment,wasThrown)
5041 {if(!arrayFragment||wasThrown)
5042 return;arrayFragment.getAllProperties(false,processProperties.bind(this));}
5043 function processProperties(properties,internalProperties)
5044 {if(!properties)
5045 return;properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);for(var i=0;i<properties.length;++i){properties[i].parentObject=this._object;var childTreeElement=new treeElement.treeOutline.section.treeElementConstructor(properties[i]);childTreeElement._readOnly=true;treeElement.appendChild(childTreeElement);}}}
5046 WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties=function(treeElement,object)
5047 {object.callFunction(buildObjectFragment,undefined,processObjectFragment.bind(this));function buildObjectFragment()
5048 {var result=Object.create(this.__proto__);var names=Object.getOwnPropertyNames(this);for(var i=0;i<names.length;++i){var name=names[i];if(String(name>>>0)===name&&name>>>0!==0xffffffff)
5049 continue;var descriptor=Object.getOwnPropertyDescriptor(this,name);if(descriptor)
5050 Object.defineProperty(result,name,descriptor);}
5051 return result;}
5052 function processObjectFragment(arrayFragment,wasThrown)
5053 {if(!arrayFragment||wasThrown)
5054 return;arrayFragment.getOwnProperties(processProperties.bind(this));}
5055 function processProperties(properties,internalProperties)
5056 {if(!properties)
5057 return;properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);for(var i=0;i<properties.length;++i){properties[i].parentObject=this._object;var childTreeElement=new treeElement.treeOutline.section.treeElementConstructor(properties[i]);childTreeElement._readOnly=true;treeElement.appendChild(childTreeElement);}}}
5058 WebInspector.ArrayGroupingTreeElement.prototype={onpopulate:function()
5059 {if(this._populated)
5060 return;this._populated=true;if(this._propertyCount>=WebInspector.ArrayGroupingTreeElement._bucketThreshold){WebInspector.ArrayGroupingTreeElement._populateRanges(this,this._object,this._fromIndex,this._toIndex,false);return;}
5061 WebInspector.ArrayGroupingTreeElement._populateAsFragment(this,this._object,this._fromIndex,this._toIndex);},onattach:function()
5062 {this.listItemElement.classList.add("name");},__proto__:TreeElement.prototype}
5063 WebInspector.ObjectPropertyPrompt=function(commitHandler,cancelHandler,renderAsBlock)
5064 {WebInspector.TextPrompt.call(this,WebInspector.runtimeModel.completionsForTextPrompt.bind(WebInspector.runtimeModel));this.setSuggestBoxEnabled("generic-suggest");if(renderAsBlock)
5065 this.renderAsBlock();}
5066 WebInspector.ObjectPropertyPrompt.prototype={__proto__:WebInspector.TextPrompt.prototype}
5067 WebInspector.ObjectPopoverHelper=function(panelElement,getAnchor,queryObject,onHide,disableOnClick)
5068 {WebInspector.PopoverHelper.call(this,panelElement,getAnchor,this._showObjectPopover.bind(this),this._onHideObjectPopover.bind(this),disableOnClick);this._queryObject=queryObject;this._onHideCallback=onHide;this._popoverObjectGroup="popover";panelElement.addEventListener("scroll",this.hidePopover.bind(this),true);};WebInspector.ObjectPopoverHelper.prototype={setRemoteObjectFormatter:function(formatter)
5069 {this._remoteObjectFormatter=formatter;},_showObjectPopover:function(element,popover)
5070 {function didGetDetails(anchorElement,popoverContentElement,error,response)
5071 {if(error){console.error(error);return;}
5072 var container=document.createElement("div");container.className="inline-block";var title=container.createChild("div","function-popover-title source-code");var functionName=title.createChild("span","function-name");functionName.textContent=response.functionName||WebInspector.UIString("(anonymous function)");this._linkifier=new WebInspector.Linkifier();var rawLocation=(response.location);var link=this._linkifier.linkifyRawLocation(rawLocation,"function-location-link");if(link)
5073 title.appendChild(link);container.appendChild(popoverContentElement);popover.show(container,anchorElement);}
5074 function showObjectPopover(result,wasThrown,anchorOverride)
5075 {if(popover.disposed)
5076 return;if(wasThrown){this.hidePopover();return;}
5077 var anchorElement=anchorOverride||element;var description=(this._remoteObjectFormatter&&this._remoteObjectFormatter(result))||result.description;var popoverContentElement=null;if(result.type!=="object"){popoverContentElement=document.createElement("span");popoverContentElement.className="monospace console-formatted-"+result.type;popoverContentElement.style.whiteSpace="pre";popoverContentElement.textContent=description;if(result.type==="function"){DebuggerAgent.getFunctionDetails(result.objectId,didGetDetails.bind(this,anchorElement,popoverContentElement));return;}
5078 if(result.type==="string")
5079 popoverContentElement.textContent="\""+popoverContentElement.textContent+"\"";popover.show(popoverContentElement,anchorElement);}else{if(result.subtype==="node")
5080 result.highlightAsDOMNode();popoverContentElement=document.createElement("div");this._titleElement=document.createElement("div");this._titleElement.className="source-frame-popover-title monospace";this._titleElement.textContent=description;popoverContentElement.appendChild(this._titleElement);var section=new WebInspector.ObjectPropertiesSection(result);if(description.substr(0,4)==="HTML"){this._sectionUpdateProperties=section.updateProperties.bind(section);section.updateProperties=this._updateHTMLId.bind(this);}
5081 section.expanded=true;section.element.classList.add("source-frame-popover-tree");section.headerElement.classList.add("hidden");popoverContentElement.appendChild(section.element);const popoverWidth=300;const popoverHeight=250;popover.show(popoverContentElement,anchorElement,popoverWidth,popoverHeight);}}
5082 this._queryObject(element,showObjectPopover.bind(this),this._popoverObjectGroup);},_onHideObjectPopover:function()
5083 {WebInspector.domModel.hideDOMNodeHighlight();if(this._linkifier){this._linkifier.reset();delete this._linkifier;}
5084 if(this._onHideCallback)
5085 this._onHideCallback();RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup);},_updateHTMLId:function(properties,rootTreeElementConstructor,rootPropertyComparer)
5086 {for(var i=0;i<properties.length;++i){if(properties[i].name==="id"){if(properties[i].value.description)
5087 this._titleElement.textContent+="#"+properties[i].value.description;break;}}
5088 this._sectionUpdateProperties(properties,rootTreeElementConstructor,rootPropertyComparer);},__proto__:WebInspector.PopoverHelper.prototype}
5089 WebInspector.NativeBreakpointsSidebarPane=function(title)
5090 {WebInspector.SidebarPane.call(this,title);this.registerRequiredCSS("breakpointsList.css");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);}
5091 WebInspector.NativeBreakpointsSidebarPane.prototype={_addListElement:function(element,beforeElement)
5092 {if(beforeElement)
5093 this.listElement.insertBefore(element,beforeElement);else{if(!this.listElement.firstChild){this.bodyElement.removeChild(this.emptyElement);this.bodyElement.appendChild(this.listElement);}
5094 this.listElement.appendChild(element);}},_removeListElement:function(element)
5095 {this.listElement.removeChild(element);if(!this.listElement.firstChild){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}},_reset:function()
5096 {this.listElement.removeChildren();if(this.listElement.parentElement){this.bodyElement.removeChild(this.listElement);this.bodyElement.appendChild(this.emptyElement);}},__proto__:WebInspector.SidebarPane.prototype}
5097 WebInspector.DOMBreakpointsSidebarPane=function()
5098 {WebInspector.NativeBreakpointsSidebarPane.call(this,WebInspector.UIString("DOM Breakpoints"));this._breakpointElements={};this._breakpointTypes={SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed"};this._breakpointTypeLabels={};this._breakpointTypeLabels[this._breakpointTypes.SubtreeModified]=WebInspector.UIString("Subtree Modified");this._breakpointTypeLabels[this._breakpointTypes.AttributeModified]=WebInspector.UIString("Attribute Modified");this._breakpointTypeLabels[this._breakpointTypes.NodeRemoved]=WebInspector.UIString("Node Removed");this._contextMenuLabels={};this._contextMenuLabels[this._breakpointTypes.SubtreeModified]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Subtree modifications":"Subtree Modifications");this._contextMenuLabels[this._breakpointTypes.AttributeModified]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Attributes modifications":"Attributes Modifications");this._contextMenuLabels[this._breakpointTypes.NodeRemoved]=WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Node removal":"Node Removal");WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeRemoved,this._nodeRemoved,this);}
5099 WebInspector.DOMBreakpointsSidebarPane.prototype={_inspectedURLChanged:function(event)
5100 {this._breakpointElements={};this._reset();var url=(event.data);this._inspectedURL=url.removeURLFragment();},populateNodeContextMenu:function(node,contextMenu)
5101 {if(node.pseudoType())
5102 return;var nodeBreakpoints={};for(var id in this._breakpointElements){var element=this._breakpointElements[id];if(element._node===node)
5103 nodeBreakpoints[element._type]=true;}
5104 function toggleBreakpoint(type)
5105 {if(!nodeBreakpoints[type])
5106 this._setBreakpoint(node,type,true);else
5107 this._removeBreakpoint(node,type);this._saveBreakpoints();}
5108 var breakPointSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Break on..."));for(var key in this._breakpointTypes){var type=this._breakpointTypes[key];var label=this._contextMenuLabels[type];breakPointSubMenu.appendCheckboxItem(label,toggleBreakpoint.bind(this,type),nodeBreakpoints[type]);}},createBreakpointHitStatusMessage:function(auxData,callback)
5109 {if(auxData.type===this._breakpointTypes.SubtreeModified){var targetNodeObject=WebInspector.RemoteObject.fromPayload(auxData["targetNode"]);targetNodeObject.pushNodeToFrontend(didPushNodeToFrontend.bind(this));}else
5110 this._doCreateBreakpointHitStatusMessage(auxData,null,callback);function didPushNodeToFrontend(targetNodeId)
5111 {if(targetNodeId)
5112 targetNodeObject.release();this._doCreateBreakpointHitStatusMessage(auxData,targetNodeId,callback);}},_doCreateBreakpointHitStatusMessage:function(auxData,targetNodeId,callback)
5113 {var message;var typeLabel=this._breakpointTypeLabels[auxData.type];var linkifiedNode=WebInspector.DOMPresentationUtils.linkifyNodeById(auxData.nodeId);var substitutions=[typeLabel,linkifiedNode];var targetNode="";if(targetNodeId)
5114 targetNode=WebInspector.DOMPresentationUtils.linkifyNodeById(targetNodeId);if(auxData.type===this._breakpointTypes.SubtreeModified){if(auxData.insertion){if(targetNodeId!==auxData.nodeId){message="Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.";substitutions.push(targetNode);}else
5115 message="Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.";}else{message="Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.";substitutions.push(targetNode);}}else
5116 message="Paused on a \"%s\" breakpoint set on %s.";var element=document.createElement("span");var formatters={s:function(substitution)
5117 {return substitution;}};function append(a,b)
5118 {if(typeof b==="string")
5119 b=document.createTextNode(b);element.appendChild(b);}
5120 WebInspector.formatLocalized(message,substitutions,formatters,"",append);callback(element);},_nodeRemoved:function(event)
5121 {var node=event.data.node;this._removeBreakpointsForNode(event.data.node);var children=node.children();if(!children)
5122 return;for(var i=0;i<children.length;++i)
5123 this._removeBreakpointsForNode(children[i]);this._saveBreakpoints();},_removeBreakpointsForNode:function(node)
5124 {for(var id in this._breakpointElements){var element=this._breakpointElements[id];if(element._node===node)
5125 this._removeBreakpoint(element._node,element._type);}},_setBreakpoint:function(node,type,enabled)
5126 {var breakpointId=this._createBreakpointId(node.id,type);if(breakpointId in this._breakpointElements)
5127 return;var element=document.createElement("li");element._node=node;element._type=type;element.addEventListener("contextmenu",this._contextMenu.bind(this,node,type),true);var checkboxElement=document.createElement("input");checkboxElement.className="checkbox-elem";checkboxElement.type="checkbox";checkboxElement.checked=enabled;checkboxElement.addEventListener("click",this._checkboxClicked.bind(this,node,type),false);element._checkboxElement=checkboxElement;element.appendChild(checkboxElement);var labelElement=document.createElement("span");element.appendChild(labelElement);var linkifiedNode=WebInspector.DOMPresentationUtils.linkifyNodeById(node.id);linkifiedNode.classList.add("monospace");labelElement.appendChild(linkifiedNode);var description=document.createElement("div");description.className="source-text";description.textContent=this._breakpointTypeLabels[type];labelElement.appendChild(description);var currentElement=this.listElement.firstChild;while(currentElement){if(currentElement._type&&currentElement._type<element._type)
5128 break;currentElement=currentElement.nextSibling;}
5129 this._addListElement(element,currentElement);this._breakpointElements[breakpointId]=element;if(enabled)
5130 DOMDebuggerAgent.setDOMBreakpoint(node.id,type);},_removeAllBreakpoints:function()
5131 {for(var id in this._breakpointElements){var element=this._breakpointElements[id];this._removeBreakpoint(element._node,element._type);}
5132 this._saveBreakpoints();},_removeBreakpoint:function(node,type)
5133 {var breakpointId=this._createBreakpointId(node.id,type);var element=this._breakpointElements[breakpointId];if(!element)
5134 return;this._removeListElement(element);delete this._breakpointElements[breakpointId];if(element._checkboxElement.checked)
5135 DOMDebuggerAgent.removeDOMBreakpoint(node.id,type);},_contextMenu:function(node,type,event)
5136 {var contextMenu=new WebInspector.ContextMenu(event);function removeBreakpoint()
5137 {this._removeBreakpoint(node,type);this._saveBreakpoints();}
5138 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove breakpoint":"Remove Breakpoint"),removeBreakpoint.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Remove all DOM breakpoints":"Remove All DOM Breakpoints"),this._removeAllBreakpoints.bind(this));contextMenu.show();},_checkboxClicked:function(node,type,event)
5139 {if(event.target.checked)
5140 DOMDebuggerAgent.setDOMBreakpoint(node.id,type);else
5141 DOMDebuggerAgent.removeDOMBreakpoint(node.id,type);this._saveBreakpoints();},highlightBreakpoint:function(auxData)
5142 {var breakpointId=this._createBreakpointId(auxData.nodeId,auxData.type);var element=this._breakpointElements[breakpointId];if(!element)
5143 return;this.expand();element.classList.add("breakpoint-hit");this._highlightedElement=element;},clearBreakpointHighlight:function()
5144 {if(this._highlightedElement){this._highlightedElement.classList.remove("breakpoint-hit");delete this._highlightedElement;}},_createBreakpointId:function(nodeId,type)
5145 {return nodeId+":"+type;},_saveBreakpoints:function()
5146 {var breakpoints=[];var storedBreakpoints=WebInspector.settings.domBreakpoints.get();for(var i=0;i<storedBreakpoints.length;++i){var breakpoint=storedBreakpoints[i];if(breakpoint.url!==this._inspectedURL)
5147 breakpoints.push(breakpoint);}
5148 for(var id in this._breakpointElements){var element=this._breakpointElements[id];breakpoints.push({url:this._inspectedURL,path:element._node.path(),type:element._type,enabled:element._checkboxElement.checked});}
5149 WebInspector.settings.domBreakpoints.set(breakpoints);},restoreBreakpoints:function()
5150 {var pathToBreakpoints={};function didPushNodeByPathToFrontend(path,nodeId)
5151 {var node=nodeId?WebInspector.domModel.nodeForId(nodeId):null;if(!node)
5152 return;var breakpoints=pathToBreakpoints[path];for(var i=0;i<breakpoints.length;++i)
5153 this._setBreakpoint(node,breakpoints[i].type,breakpoints[i].enabled);}
5154 var breakpoints=WebInspector.settings.domBreakpoints.get();for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(breakpoint.url!==this._inspectedURL)
5155 continue;var path=breakpoint.path;if(!pathToBreakpoints[path]){pathToBreakpoints[path]=[];WebInspector.domModel.pushNodeByPathToFrontend(path,didPushNodeByPathToFrontend.bind(this,path));}
5156 pathToBreakpoints[path].push(breakpoint);}},createProxy:function(panel)
5157 {var proxy=new WebInspector.DOMBreakpointsSidebarPane.Proxy(this,panel);if(!this._proxies)
5158 this._proxies=[];this._proxies.push(proxy);return proxy;},onContentReady:function()
5159 {for(var i=0;i!=this._proxies.length;i++)
5160 this._proxies[i].onContentReady();},__proto__:WebInspector.NativeBreakpointsSidebarPane.prototype}
5161 WebInspector.DOMBreakpointsSidebarPane.Proxy=function(pane,panel)
5162 {WebInspector.View._assert(!pane.titleElement.firstChild,"Cannot create proxy for a sidebar pane with a toolbar");WebInspector.SidebarPane.call(this,pane.title());this.registerRequiredCSS("breakpointsList.css");this._wrappedPane=pane;this._panel=panel;this.bodyElement.remove();this.bodyElement=this._wrappedPane.bodyElement;}
5163 WebInspector.DOMBreakpointsSidebarPane.Proxy.prototype={expand:function()
5164 {this._wrappedPane.expand();},onContentReady:function()
5165 {if(this._panel.isShowing())
5166 this._reattachBody();WebInspector.SidebarPane.prototype.onContentReady.call(this);},wasShown:function()
5167 {WebInspector.SidebarPane.prototype.wasShown.call(this);this._reattachBody();},_reattachBody:function()
5168 {if(this.bodyElement.parentNode!==this.element)
5169 this.element.appendChild(this.bodyElement);},__proto__:WebInspector.SidebarPane.prototype}
5170 WebInspector.domBreakpointsSidebarPane;WebInspector.Color=function(rgba,format,originalText)
5171 {this._rgba=rgba;this._originalText=originalText||null;this._format=format||null;if(typeof this._rgba[3]==="undefined")
5172 this._rgba[3]=1;for(var i=0;i<4;++i){if(this._rgba[i]<0)
5173 this._rgba[i]=0;if(this._rgba[i]>1)
5174 this._rgba[i]=1;}}
5175 WebInspector.Color.parse=function(text)
5176 {var value=text.toLowerCase().replace(/\s+/g,"");var simple=/^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;var match=value.match(simple);if(match){if(match[1]){var hex=match[1].toUpperCase();var format;if(hex.length===3){format=WebInspector.Color.Format.ShortHEX;hex=hex.charAt(0)+hex.charAt(0)+hex.charAt(1)+hex.charAt(1)+hex.charAt(2)+hex.charAt(2);}else
5177 format=WebInspector.Color.Format.HEX;var r=parseInt(hex.substring(0,2),16);var g=parseInt(hex.substring(2,4),16);var b=parseInt(hex.substring(4,6),16);return new WebInspector.Color([r/255,g/255,b/255,1],format,text);}
5178 if(match[2]){var rgbString=match[2].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbString[0]),WebInspector.Color._parseRgbNumeric(rgbString[1]),WebInspector.Color._parseRgbNumeric(rgbString[2]),1];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGB,text);}
5179 if(match[3]){var nickname=match[3].toLowerCase();if(nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];var color=WebInspector.Color.fromRGBA(rgba);color._format=WebInspector.Color.Format.Nickname;color._originalText=nickname;return color;}
5180 return null;}
5181 if(match[4]){var hslString=match[4].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslString[0]),WebInspector.Color._parseSatLightNumeric(hslString[1]),WebInspector.Color._parseSatLightNumeric(hslString[2]),1];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSL,text);}
5182 return null;}
5183 var advanced=/^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;match=value.match(advanced);if(match){if(match[1]){var rgbaString=match[1].split(/\s*,\s*/);var rgba=[WebInspector.Color._parseRgbNumeric(rgbaString[0]),WebInspector.Color._parseRgbNumeric(rgbaString[1]),WebInspector.Color._parseRgbNumeric(rgbaString[2]),WebInspector.Color._parseAlphaNumeric(rgbaString[3])];return new WebInspector.Color(rgba,WebInspector.Color.Format.RGBA,text);}
5184 if(match[2]){var hslaString=match[2].replace(/%/g,"").split(/\s*,\s*/);var hsla=[WebInspector.Color._parseHueNumeric(hslaString[0]),WebInspector.Color._parseSatLightNumeric(hslaString[1]),WebInspector.Color._parseSatLightNumeric(hslaString[2]),WebInspector.Color._parseAlphaNumeric(hslaString[3])];var rgba=WebInspector.Color._hsl2rgb(hsla);return new WebInspector.Color(rgba,WebInspector.Color.Format.HSLA,text);}}
5185 return null;}
5186 WebInspector.Color.fromRGBA=function(rgba)
5187 {return new WebInspector.Color([rgba[0]/255,rgba[1]/255,rgba[2]/255,rgba[3]]);}
5188 WebInspector.Color.fromHSVA=function(hsva)
5189 {var h=hsva[0];var s=hsva[1];var v=hsva[2];var t=(2-s)*v;if(v===0||s===0)
5190 s=0;else
5191 s*=v/(t<1?t:2-t);var hsla=[h,s,t/2,hsva[3]];return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla),WebInspector.Color.Format.HSLA);}
5192 WebInspector.Color.prototype={format:function()
5193 {return this._format;},hsla:function()
5194 {if(this._hsla)
5195 return this._hsla;var r=this._rgba[0];var g=this._rgba[1];var b=this._rgba[2];var max=Math.max(r,g,b);var min=Math.min(r,g,b);var diff=max-min;var add=max+min;if(min===max)
5196 var h=0;else if(r===max)
5197 var h=((1/6*(g-b)/diff)+1)%1;else if(g===max)
5198 var h=(1/6*(b-r)/diff)+1/3;else
5199 var h=(1/6*(r-g)/diff)+2/3;var l=0.5*add;if(l===0)
5200 var s=0;else if(l===1)
5201 var s=1;else if(l<=0.5)
5202 var s=diff/add;else
5203 var s=diff/(2-add);this._hsla=[h,s,l,this._rgba[3]];return this._hsla;},hsva:function()
5204 {var hsla=this.hsla();var h=hsla[0];var s=hsla[1];var l=hsla[2];s*=l<0.5?l:1-l;return[h,s!==0?2*s/(l+s):0,(l+s),hsla[3]];},hasAlpha:function()
5205 {return this._rgba[3]!==1;},canBeShortHex:function()
5206 {if(this.hasAlpha())
5207 return false;for(var i=0;i<3;++i){var c=Math.round(this._rgba[i]*255);if(c%17)
5208 return false;}
5209 return true;},toString:function(format)
5210 {if(!format)
5211 format=this._format;function toRgbValue(value)
5212 {return Math.round(value*255);}
5213 function toHexValue(value)
5214 {var hex=Math.round(value*255).toString(16);return hex.length===1?"0"+hex:hex;}
5215 function toShortHexValue(value)
5216 {return(Math.round(value*255)/17).toString(16);}
5217 switch(format){case WebInspector.Color.Format.Original:return this._originalText;case WebInspector.Color.Format.RGB:if(this.hasAlpha())
5218 return null;return String.sprintf("rgb(%d, %d, %d)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]));case WebInspector.Color.Format.RGBA:return String.sprintf("rgba(%d, %d, %d, %f)",toRgbValue(this._rgba[0]),toRgbValue(this._rgba[1]),toRgbValue(this._rgba[2]),this._rgba[3]);case WebInspector.Color.Format.HSL:if(this.hasAlpha())
5219 return null;var hsl=this.hsla();return String.sprintf("hsl(%d, %d%, %d%)",Math.round(hsl[0]*360),Math.round(hsl[1]*100),Math.round(hsl[2]*100));case WebInspector.Color.Format.HSLA:var hsla=this.hsla();return String.sprintf("hsla(%d, %d%, %d%, %f)",Math.round(hsla[0]*360),Math.round(hsla[1]*100),Math.round(hsla[2]*100),hsla[3]);case WebInspector.Color.Format.HEX:if(this.hasAlpha())
5220 return null;return String.sprintf("#%s%s%s",toHexValue(this._rgba[0]),toHexValue(this._rgba[1]),toHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.ShortHEX:if(!this.canBeShortHex())
5221 return null;return String.sprintf("#%s%s%s",toShortHexValue(this._rgba[0]),toShortHexValue(this._rgba[1]),toShortHexValue(this._rgba[2])).toUpperCase();case WebInspector.Color.Format.Nickname:return this.nickname();}
5222 return this._originalText;},_canonicalRGBA:function()
5223 {var rgba=new Array(3);for(var i=0;i<3;++i)
5224 rgba[i]=Math.round(this._rgba[i]*255);if(this._rgba[3]!==1)
5225 rgba.push(this._rgba[3]);return rgba;},nickname:function()
5226 {if(!WebInspector.Color._rgbaToNickname){WebInspector.Color._rgbaToNickname={};for(var nickname in WebInspector.Color.Nicknames){var rgba=WebInspector.Color.Nicknames[nickname];WebInspector.Color._rgbaToNickname[rgba]=nickname;}}
5227 return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()]||null;},toProtocolRGBA:function()
5228 {var rgba=this._canonicalRGBA();var result={r:rgba[0],g:rgba[1],b:rgba[2]};if(rgba[3]!==1)
5229 result.a=rgba[3];return result;},invert:function()
5230 {var rgba=[];rgba[0]=1-this._rgba[0];rgba[1]=1-this._rgba[1];rgba[2]=1-this._rgba[2];rgba[3]=this._rgba[3];return new WebInspector.Color(rgba);},setAlpha:function(alpha)
5231 {var rgba=this._rgba.slice();rgba[3]=alpha;return new WebInspector.Color(rgba);}}
5232 WebInspector.Color._parseRgbNumeric=function(value)
5233 {var parsed=parseInt(value,10);if(value.indexOf("%")!==-1)
5234 parsed/=100;else
5235 parsed/=255;return parsed;}
5236 WebInspector.Color._parseHueNumeric=function(value)
5237 {return isNaN(value)?0:(parseFloat(value)/360)%1;}
5238 WebInspector.Color._parseSatLightNumeric=function(value)
5239 {return parseFloat(value)/100;}
5240 WebInspector.Color._parseAlphaNumeric=function(value)
5241 {return isNaN(value)?0:parseFloat(value);}
5242 WebInspector.Color._hsl2rgb=function(hsl)
5243 {var h=hsl[0];var s=hsl[1];var l=hsl[2];function hue2rgb(p,q,h)
5244 {if(h<0)
5245 h+=1;else if(h>1)
5246 h-=1;if((h*6)<1)
5247 return p+(q-p)*h*6;else if((h*2)<1)
5248 return q;else if((h*3)<2)
5249 return p+(q-p)*((2/3)-h)*6;else
5250 return p;}
5251 if(s<0)
5252 s=0;if(l<=0.5)
5253 var q=l*(1+s);else
5254 var q=l+s-(l*s);var p=2*l-q;var tr=h+(1/3);var tg=h;var tb=h-(1/3);var r=hue2rgb(p,q,tr);var g=hue2rgb(p,q,tg);var b=hue2rgb(p,q,tb);return[r,g,b,hsl[3]];}
5255 WebInspector.Color.Nicknames={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[237,20,61],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50],"transparent":[0,0,0,0],};WebInspector.Color.PageHighlight={Content:WebInspector.Color.fromRGBA([111,168,220,.66]),ContentLight:WebInspector.Color.fromRGBA([111,168,220,.5]),ContentOutline:WebInspector.Color.fromRGBA([9,83,148]),Padding:WebInspector.Color.fromRGBA([147,196,125,.55]),PaddingLight:WebInspector.Color.fromRGBA([147,196,125,.4]),Border:WebInspector.Color.fromRGBA([255,229,153,.66]),BorderLight:WebInspector.Color.fromRGBA([255,229,153,.5]),Margin:WebInspector.Color.fromRGBA([246,178,107,.66]),MarginLight:WebInspector.Color.fromRGBA([246,178,107,.5]),EventTarget:WebInspector.Color.fromRGBA([255,196,196,.66])}
5256 WebInspector.Color.Format={Original:"original",Nickname:"nickname",HEX:"hex",ShortHEX:"shorthex",RGB:"rgb",RGBA:"rgba",HSL:"hsl",HSLA:"hsla"}
5257 WebInspector.CSSMetadata=function(properties)
5258 {this._values=([]);this._longhands={};this._shorthands={};for(var i=0;i<properties.length;++i){var property=properties[i];if(typeof property==="string"){this._values.push(property);continue;}
5259 var propertyName=property.name;this._values.push(propertyName);var longhands=properties[i].longhands;if(longhands){this._longhands[propertyName]=longhands;for(var j=0;j<longhands.length;++j){var longhandName=longhands[j];var shorthands=this._shorthands[longhandName];if(!shorthands){shorthands=[];this._shorthands[longhandName]=shorthands;}
5260 shorthands.push(propertyName);}}}
5261 this._values.sort();}
5262 WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata([]);WebInspector.CSSMetadata.isColorAwareProperty=function(propertyName)
5263 {return WebInspector.CSSMetadata._colorAwareProperties[propertyName]===true;}
5264 WebInspector.CSSMetadata.colors=function()
5265 {if(!WebInspector.CSSMetadata._colorsKeySet)
5266 WebInspector.CSSMetadata._colorsKeySet=WebInspector.CSSMetadata._colors.keySet();return WebInspector.CSSMetadata._colorsKeySet;}
5267 WebInspector.CSSMetadata.InheritedProperties=["azimuth","border-collapse","border-spacing","caption-side","color","cursor","direction","elevation","empty-cells","font-family","font-size","font-style","font-variant","font-weight","font","letter-spacing","line-height","list-style-image","list-style-position","list-style-type","list-style","orphans","pitch-range","pitch","quotes","resize","richness","speak-header","speak-numeral","speak-punctuation","speak","speech-rate","stress","text-align","text-indent","text-transform","text-shadow","visibility","voice-family","volume","white-space","widows","word-spacing","zoom"].keySet();WebInspector.CSSMetadata.NonStandardInheritedProperties=["-webkit-font-smoothing"].keySet();WebInspector.CSSMetadata.canonicalPropertyName=function(name)
5268 {if(!name||name.length<9||name.charAt(0)!=="-")
5269 return name.toLowerCase();var match=name.match(/(?:-webkit-)(.+)/);var propertiesSet=WebInspector.CSSMetadata.cssPropertiesMetainfoKeySet();var hasSupportedProperties=WebInspector.CSSMetadata.cssPropertiesMetainfo._values.length>0;if(!match||(hasSupportedProperties&&!propertiesSet.hasOwnProperty(match[1].toLowerCase())))
5270 return name.toLowerCase();return match[1].toLowerCase();}
5271 WebInspector.CSSMetadata.isPropertyInherited=function(propertyName)
5272 {return!!(WebInspector.CSSMetadata.InheritedProperties[WebInspector.CSSMetadata.canonicalPropertyName(propertyName)]||WebInspector.CSSMetadata.NonStandardInheritedProperties[propertyName.toLowerCase()]);}
5273 WebInspector.CSSMetadata._colors=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow","transparent","currentcolor","grey","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen"];WebInspector.CSSMetadata._colorAwareProperties=["background","background-color","background-image","border","border-color","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","box-shadow","color","fill","outline","outline-color","stroke","text-line-through-color","text-overline-color","text-shadow","text-underline-color","-webkit-box-shadow","-webkit-column-rule-color","-webkit-text-decoration-color","-webkit-text-emphasis","-webkit-text-emphasis-color"].keySet();WebInspector.CSSMetadata._propertyDataMap={"table-layout":{values:["auto","fixed"]},"visibility":{values:["hidden","visible","collapse"]},"background-repeat":{values:["repeat","repeat-x","repeat-y","no-repeat","space","round"]},"content":{values:["list-item","close-quote","no-close-quote","no-open-quote","open-quote"]},"list-style-image":{values:["none"]},"clear":{values:["none","left","right","both"]},"text-underline-mode":{values:["continuous","skip-white-space"]},"overflow-x":{values:["hidden","auto","visible","overlay","scroll"]},"stroke-linejoin":{values:["round","miter","bevel"]},"baseline-shift":{values:["baseline","sub","super"]},"border-bottom-width":{values:["medium","thick","thin"]},"marquee-speed":{values:["normal","slow","fast"]},"margin-top-collapse":{values:["collapse","separate","discard"]},"max-height":{values:["none"]},"box-orient":{values:["horizontal","vertical","inline-axis","block-axis"],},"font-stretch":{values:["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded"]},"text-underline-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"text-overline-mode":{values:["continuous","skip-white-space"]},"-webkit-background-composite":{values:["highlight","clear","copy","source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","plus-darker","plus-lighter"]},"border-left-width":{values:["medium","thick","thin"]},"box-shadow":{values:["inset","none"]},"-webkit-writing-mode":{values:["lr","rl","tb","lr-tb","rl-tb","tb-rl","horizontal-tb","vertical-rl","vertical-lr","horizontal-bt"]},"text-line-through-mode":{values:["continuous","skip-white-space"]},"border-collapse":{values:["collapse","separate"]},"page-break-inside":{values:["auto","avoid"]},"border-top-width":{values:["medium","thick","thin"]},"outline-color":{values:["invert"]},"text-line-through-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"outline-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"cursor":{values:["none","copy","auto","crosshair","default","pointer","move","vertical-text","cell","context-menu","alias","progress","no-drop","not-allowed","-webkit-zoom-in","-webkit-zoom-out","e-resize","ne-resize","nw-resize","n-resize","se-resize","sw-resize","s-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","text","wait","help","all-scroll","-webkit-grab","-webkit-grabbing"]},"border-width":{values:["medium","thick","thin"]},"border-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"size":{values:["a3","a4","a5","b4","b5","landscape","ledger","legal","letter","portrait"]},"background-size":{values:["contain","cover"]},"direction":{values:["ltr","rtl"]},"marquee-direction":{values:["left","right","auto","reverse","forwards","backwards","ahead","up","down"]},"enable-background":{values:["accumulate","new"]},"float":{values:["none","left","right"]},"overflow-y":{values:["hidden","auto","visible","overlay","scroll"]},"margin-bottom-collapse":{values:["collapse","separate","discard"]},"box-reflect":{values:["left","right","above","below"]},"overflow":{values:["hidden","auto","visible","overlay","scroll"]},"text-rendering":{values:["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"]},"text-align":{values:["-webkit-auto","start","end","left","right","center","justify","-webkit-left","-webkit-right","-webkit-center"]},"list-style-position":{values:["outside","inside","hanging"]},"margin-bottom":{values:["auto"]},"color-interpolation":{values:["linearrgb"]},"background-origin":{values:["border-box","content-box","padding-box"]},"word-wrap":{values:["normal","break-word"]},"font-weight":{values:["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},"margin-before-collapse":{values:["collapse","separate","discard"]},"text-overline-width":{values:["normal","medium","auto","thick","thin"]},"text-transform":{values:["none","capitalize","uppercase","lowercase"]},"border-right-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"border-left-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"-webkit-text-emphasis":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"font-style":{values:["italic","oblique","normal"]},"speak":{values:["none","normal","spell-out","digits","literal-punctuation","no-punctuation"]},"color-rendering":{values:["auto","optimizeSpeed","optimizeQuality"]},"list-style-type":{values:["none","inline","disc","circle","square","decimal","decimal-leading-zero","arabic-indic","binary","bengali","cambodian","khmer","devanagari","gujarati","gurmukhi","kannada","lower-hexadecimal","lao","malayalam","mongolian","myanmar","octal","oriya","persian","urdu","telugu","tibetan","thai","upper-hexadecimal","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","afar","ethiopic-halehame-aa-et","ethiopic-halehame-aa-er","amharic","ethiopic-halehame-am-et","amharic-abegede","ethiopic-abegede-am-et","cjk-earthly-branch","cjk-heavenly-stem","ethiopic","ethiopic-halehame-gez","ethiopic-abegede","ethiopic-abegede-gez","hangul-consonant","hangul","lower-norwegian","oromo","ethiopic-halehame-om-et","sidama","ethiopic-halehame-sid-et","somali","ethiopic-halehame-so-et","tigre","ethiopic-halehame-tig","tigrinya-er","ethiopic-halehame-ti-er","tigrinya-er-abegede","ethiopic-abegede-ti-er","tigrinya-et","ethiopic-halehame-ti-et","tigrinya-et-abegede","ethiopic-abegede-ti-et","upper-greek","upper-norwegian","asterisks","footnotes","hebrew","armenian","lower-armenian","upper-armenian","georgian","cjk-ideographic","hiragana","katakana","hiragana-iroha","katakana-iroha"]},"-webkit-text-combine":{values:["none","horizontal"]},"outline":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font":{values:["caption","icon","menu","message-box","small-caption","-webkit-mini-control","-webkit-small-control","-webkit-control","status-bar","italic","oblique","small-caps","normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger","serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph"]},"dominant-baseline":{values:["middle","auto","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","use-script","no-change","reset-size"]},"display":{values:["none","inline","block","list-item","run-in","compact","inline-block","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","-webkit-box","-webkit-inline-box","flex","inline-flex","grid","inline-grid"]},"-webkit-text-emphasis-position":{values:["over","under"]},"image-rendering":{values:["auto","optimizeSpeed","optimizeQuality"]},"alignment-baseline":{values:["baseline","middle","auto","before-edge","after-edge","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical"]},"outline-width":{values:["medium","thick","thin"]},"text-line-through-width":{values:["normal","medium","auto","thick","thin"]},"box-align":{values:["baseline","center","stretch","start","end"]},"border-right-width":{values:["medium","thick","thin"]},"border-top-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"line-height":{values:["normal"]},"text-overflow":{values:["clip","ellipsis"]},"overflow-wrap":{values:["normal","break-word"]},"box-direction":{values:["normal","reverse"]},"margin-after-collapse":{values:["collapse","separate","discard"]},"page-break-before":{values:["left","right","auto","always","avoid"]},"border-image":{values:["repeat","stretch"]},"text-decoration":{values:["blink","line-through","overline","underline"]},"position":{values:["absolute","fixed","relative","static"]},"font-family":{values:["serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph"]},"text-overflow-mode":{values:["clip","ellipsis"]},"border-bottom-style":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"unicode-bidi":{values:["normal","bidi-override","embed","isolate","isolate-override","plaintext"]},"clip-rule":{values:["nonzero","evenodd"]},"margin-left":{values:["auto"]},"margin-top":{values:["auto"]},"zoom":{values:["normal","document","reset"]},"text-overline-style":{values:["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"]},"max-width":{values:["none"]},"caption-side":{values:["top","bottom"]},"empty-cells":{values:["hide","show"]},"pointer-events":{values:["none","all","auto","visible","visiblepainted","visiblefill","visiblestroke","painted","fill","stroke","bounding-box"]},"letter-spacing":{values:["normal"]},"background-clip":{values:["border-box","content-box","padding-box"]},"-webkit-font-smoothing":{values:["none","auto","antialiased","subpixel-antialiased"]},"border":{values:["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"]},"font-size":{values:["xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger"]},"font-variant":{values:["small-caps","normal"]},"vertical-align":{values:["baseline","middle","sub","super","text-top","text-bottom","top","bottom","-webkit-baseline-middle"]},"marquee-style":{values:["none","scroll","slide","alternate"]},"white-space":{values:["normal","nowrap","pre","pre-line","pre-wrap"]},"text-underline-width":{values:["normal","medium","auto","thick","thin"]},"box-lines":{values:["single","multiple"]},"page-break-after":{values:["left","right","auto","always","avoid"]},"clip-path":{values:["none"]},"margin":{values:["auto"]},"marquee-repetition":{values:["infinite"]},"margin-right":{values:["auto"]},"word-break":{values:["normal","break-all","break-word"]},"word-spacing":{values:["normal"]},"-webkit-text-emphasis-style":{values:["circle","filled","open","dot","double-circle","triangle","sesame"]},"-webkit-transform":{values:["scale","scaleX","scaleY","scale3d","rotate","rotateX","rotateY","rotateZ","rotate3d","skew","skewX","skewY","translate","translateX","translateY","translateZ","translate3d","matrix","matrix3d","perspective"]},"image-resolution":{values:["from-image","snap"]},"box-sizing":{values:["content-box","padding-box","border-box"]},"clip":{values:["auto"]},"resize":{values:["none","both","horizontal","vertical"]},"align-content":{values:["flex-start","flex-end","center","space-between","space-around","stretch"]},"align-items":{values:["flex-start","flex-end","center","baseline","stretch"]},"align-self":{values:["auto","flex-start","flex-end","center","baseline","stretch"]},"flex-direction":{values:["row","row-reverse","column","column-reverse"]},"justify-content":{values:["flex-start","flex-end","center","space-between","space-around"]},"flex-wrap":{values:["nowrap","wrap","wrap-reverse"]},"-webkit-animation-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-animation-direction":{values:["normal","reverse","alternate","alternate-reverse"]},"-webkit-animation-play-state":{values:["running","paused"]},"-webkit-animation-fill-mode":{values:["none","forwards","backwards","both"]},"-webkit-backface-visibility":{values:["visible","hidden"]},"-webkit-box-decoration-break":{values:["slice","clone"]},"-webkit-column-break-after":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-before":{values:["auto","always","avoid","left","right","page","column","avoid-page","avoid-column"]},"-webkit-column-break-inside":{values:["auto","avoid","avoid-page","avoid-column"]},"-webkit-column-span":{values:["none","all"]},"-webkit-column-count":{values:["auto"]},"-webkit-column-gap":{values:["normal"]},"-webkit-line-break":{values:["auto","loose","normal","strict"]},"-webkit-perspective":{values:["none"]},"-webkit-perspective-origin":{values:["left","center","right","top","bottom"]},"text-align-last":{values:["auto","start","end","left","right","center","justify"]},"-webkit-text-decoration-line":{values:["none","underline","overline","line-through","blink"]},"-webkit-text-decoration-style":{values:["solid","double","dotted","dashed","wavy"]},"-webkit-text-decoration-skip":{values:["none","objects","spaces","ink","edges","box-decoration"]},"-webkit-transform-origin":{values:["left","center","right","top","bottom"]},"-webkit-transform-style":{values:["flat","preserve-3d"]},"-webkit-transition-timing-function":{values:["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps","cubic-bezier"]},"-webkit-flex":{m:"flexbox"},"-webkit-flex-basis":{m:"flexbox"},"-webkit-flex-flow":{m:"flexbox"},"-webkit-flex-grow":{m:"flexbox"},"-webkit-flex-shrink":{m:"flexbox"},"-webkit-animation":{m:"animations"},"-webkit-animation-delay":{m:"animations"},"-webkit-animation-duration":{m:"animations"},"-webkit-animation-iteration-count":{m:"animations"},"-webkit-animation-name":{m:"animations"},"-webkit-column-rule":{m:"multicol"},"-webkit-column-rule-color":{m:"multicol",a:"crc"},"-webkit-column-rule-style":{m:"multicol",a:"crs"},"-webkit-column-rule-width":{m:"multicol",a:"crw"},"-webkit-column-width":{m:"multicol",a:"cw"},"-webkit-columns":{m:"multicol"},"-webkit-order":{m:"flexbox"},"-webkit-text-decoration-color":{m:"text-decor"},"-webkit-text-emphasis-color":{m:"text-decor"},"-webkit-transition":{m:"transitions"},"-webkit-transition-delay":{m:"transitions"},"-webkit-transition-duration":{m:"transitions"},"-webkit-transition-property":{m:"transitions"},"background":{m:"background"},"background-attachment":{m:"background"},"background-color":{m:"background"},"background-image":{m:"background"},"background-position":{m:"background"},"background-position-x":{m:"background"},"background-position-y":{m:"background"},"background-repeat-x":{m:"background"},"background-repeat-y":{m:"background"},"border-top":{m:"background"},"border-right":{m:"background"},"border-bottom":{m:"background"},"border-left":{m:"background"},"border-radius":{m:"background"},"bottom":{m:"visuren"},"color":{m:"color",a:"foreground"},"counter-increment":{m:"generate"},"counter-reset":{m:"generate"},"grid-template-columns":{m:"grid"},"grid-template-rows":{m:"grid"},"height":{m:"box"},"image-orientation":{m:"images"},"left":{m:"visuren"},"list-style":{m:"lists"},"min-height":{m:"box"},"min-width":{m:"box"},"opacity":{m:"color",a:"transparency"},"orphans":{m:"page"},"outline-offset":{m:"ui"},"padding":{m:"box",a:"padding1"},"padding-bottom":{m:"box"},"padding-left":{m:"box"},"padding-right":{m:"box"},"padding-top":{m:"box"},"page":{m:"page"},"quotes":{m:"generate"},"right":{m:"visuren"},"tab-size":{m:"text"},"text-indent":{m:"text"},"text-shadow":{m:"text-decor"},"top":{m:"visuren"},"unicode-range":{m:"fonts",a:"descdef-unicode-range"},"widows":{m:"page"},"width":{m:"box"},"z-index":{m:"visuren"}}
5274 WebInspector.CSSMetadata.keywordsForProperty=function(propertyName)
5275 {var acceptedKeywords=["inherit","initial"];var descriptor=WebInspector.CSSMetadata.descriptor(propertyName);if(descriptor&&descriptor.values)
5276 acceptedKeywords.push.apply(acceptedKeywords,descriptor.values);if(propertyName in WebInspector.CSSMetadata._colorAwareProperties)
5277 acceptedKeywords.push.apply(acceptedKeywords,WebInspector.CSSMetadata._colors);return new WebInspector.CSSMetadata(acceptedKeywords);}
5278 WebInspector.CSSMetadata.descriptor=function(propertyName)
5279 {if(!propertyName)
5280 return null;var unprefixedName=propertyName.replace(/^-webkit-/,"");var entry=WebInspector.CSSMetadata._propertyDataMap[propertyName];if(!entry&&unprefixedName!==propertyName)
5281 entry=WebInspector.CSSMetadata._propertyDataMap[unprefixedName];return entry||null;}
5282 WebInspector.CSSMetadata.initializeWithSupportedProperties=function(properties)
5283 {WebInspector.CSSMetadata.cssPropertiesMetainfo=new WebInspector.CSSMetadata(properties);}
5284 WebInspector.CSSMetadata.cssPropertiesMetainfoKeySet=function()
5285 {if(!WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet)
5286 WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet=WebInspector.CSSMetadata.cssPropertiesMetainfo.keySet();return WebInspector.CSSMetadata._cssPropertiesMetainfoKeySet;}
5287 WebInspector.CSSMetadata.Weight={"-webkit-animation":1,"-webkit-animation-duration":1,"-webkit-animation-iteration-count":1,"-webkit-animation-name":1,"-webkit-animation-timing-function":1,"-webkit-appearance":1,"-webkit-background-clip":2,"-webkit-border-horizontal-spacing":1,"-webkit-border-vertical-spacing":1,"-webkit-box-shadow":24,"-webkit-font-smoothing":2,"-webkit-transform":1,"-webkit-transition":8,"-webkit-transition-delay":7,"-webkit-transition-duration":7,"-webkit-transition-property":7,"-webkit-transition-timing-function":6,"-webkit-user-select":1,"background":222,"background-attachment":144,"background-clip":143,"background-color":222,"background-image":201,"background-origin":142,"background-size":25,"border":121,"border-bottom":121,"border-bottom-color":121,"border-bottom-left-radius":50,"border-bottom-right-radius":50,"border-bottom-style":114,"border-bottom-width":120,"border-collapse":3,"border-left":95,"border-left-color":95,"border-left-style":89,"border-left-width":94,"border-radius":50,"border-right":93,"border-right-color":93,"border-right-style":88,"border-right-width":93,"border-top":111,"border-top-color":111,"border-top-left-radius":49,"border-top-right-radius":49,"border-top-style":104,"border-top-width":109,"bottom":16,"box-shadow":25,"box-sizing":2,"clear":23,"color":237,"cursor":34,"direction":4,"display":210,"fill":2,"filter":1,"float":105,"font":174,"font-family":25,"font-size":174,"font-style":9,"font-weight":89,"height":161,"left":54,"letter-spacing":3,"line-height":75,"list-style":17,"list-style-image":8,"list-style-position":8,"list-style-type":17,"margin":241,"margin-bottom":226,"margin-left":225,"margin-right":213,"margin-top":241,"max-height":5,"max-width":11,"min-height":9,"min-width":6,"opacity":24,"outline":10,"outline-color":10,"outline-style":10,"outline-width":10,"overflow":57,"overflow-x":56,"overflow-y":57,"padding":216,"padding-bottom":208,"padding-left":216,"padding-right":206,"padding-top":216,"position":136,"resize":1,"right":29,"stroke":1,"stroke-width":1,"table-layout":1,"text-align":66,"text-decoration":53,"text-indent":9,"text-overflow":8,"text-shadow":19,"text-transform":5,"top":71,"unicode-bidi":1,"vertical-align":37,"visibility":11,"white-space":24,"width":255,"word-wrap":6,"z-index":32,"zoom":10};WebInspector.CSSMetadata.prototype={startsWith:function(prefix)
5288 {var firstIndex=this._firstIndexOfPrefix(prefix);if(firstIndex===-1)
5289 return[];var results=[];while(firstIndex<this._values.length&&this._values[firstIndex].startsWith(prefix))
5290 results.push(this._values[firstIndex++]);return results;},mostUsedOf:function(properties)
5291 {var maxWeight=0;var index=0;for(var i=0;i<properties.length;i++){var weight=WebInspector.CSSMetadata.Weight[properties[i]];if(weight>maxWeight){maxWeight=weight;index=i;}}
5292 return index;},_firstIndexOfPrefix:function(prefix)
5293 {if(!this._values.length)
5294 return-1;if(!prefix)
5295 return 0;var maxIndex=this._values.length-1;var minIndex=0;var foundIndex;do{var middleIndex=(maxIndex+minIndex)>>1;if(this._values[middleIndex].startsWith(prefix)){foundIndex=middleIndex;break;}
5296 if(this._values[middleIndex]<prefix)
5297 minIndex=middleIndex+1;else
5298 maxIndex=middleIndex-1;}while(minIndex<=maxIndex);if(foundIndex===undefined)
5299 return-1;while(foundIndex&&this._values[foundIndex-1].startsWith(prefix))
5300 foundIndex--;return foundIndex;},keySet:function()
5301 {if(!this._keySet)
5302 this._keySet=this._values.keySet();return this._keySet;},next:function(str,prefix)
5303 {return this._closest(str,prefix,1);},previous:function(str,prefix)
5304 {return this._closest(str,prefix,-1);},_closest:function(str,prefix,shift)
5305 {if(!str)
5306 return"";var index=this._values.indexOf(str);if(index===-1)
5307 return"";if(!prefix){index=(index+this._values.length+shift)%this._values.length;return this._values[index];}
5308 var propertiesWithPrefix=this.startsWith(prefix);var j=propertiesWithPrefix.indexOf(str);j=(j+propertiesWithPrefix.length+shift)%propertiesWithPrefix.length;return propertiesWithPrefix[j];},longhands:function(shorthand)
5309 {return this._longhands[shorthand];},shorthands:function(longhand)
5310 {return this._shorthands[longhand];}}
5311 WebInspector.CSSMetadata.initializeWithSupportedProperties([]);WebInspector.CSSMetadata.initializeWithSupportedProperties([{"name":"-webkit-animation-iteration-count"},{"name":"-webkit-logical-height"},{"name":"-webkit-text-emphasis-position"},{"name":"-webkit-text-emphasis-style"},{"name":"text-underline-position"},{"longhands":["-webkit-column-rule-width","-webkit-column-rule-style","-webkit-column-rule-color"],"name":"-webkit-column-rule"},{"name":"buffered-rendering"},{"name":"-webkit-appearance"},{"name":"outline-width"},{"name":"alignment-baseline"},{"name":"glyph-orientation-vertical"},{"name":"text-line-through-color"},{"longhands":["-webkit-border-after-width","-webkit-border-after-style","-webkit-border-after-color"],"name":"-webkit-border-after"},{"name":"-webkit-column-break-inside"},{"name":"-webkit-print-color-adjust"},{"name":"list-style-type"},{"name":"page-break-before"},{"name":"flood-color"},{"name":"text-anchor"},{"name":"-webkit-padding-start"},{"name":"-webkit-column-rule-color"},{"name":"padding-left"},{"name":"shape-outside"},{"name":"-webkit-margin-before"},{"name":"-webkit-background-composite"},{"name":"perspective"},{"name":"-webkit-animation-play-state"},{"name":"border-image-repeat"},{"name":"-webkit-font-size-delta"},{"name":"border-right-style"},{"name":"border-left-style"},{"longhands":["flex-direction","flex-wrap"],"name":"flex-flow"},{"name":"outline-color"},{"name":"flex-grow"},{"name":"max-width"},{"longhands":["grid-column-start","grid-column-end"],"name":"grid-column"},{"name":"animation-duration"},{"longhands":["-webkit-column-width","-webkit-column-count"],"name":"-webkit-columns"},{"name":"-webkit-box-flex-group"},{"name":"-webkit-animation-delay"},{"name":"flex-shrink"},{"name":"text-rendering"},{"name":"align-items"},{"name":"border-collapse"},{"name":"-webkit-mask-position-x"},{"name":"-webkit-mask-position-y"},{"name":"outline-style"},{"name":"-webkit-margin-bottom-collapse"},{"name":"color-interpolation-filters"},{"name":"kerning"},{"name":"font-variant"},{"name":"-webkit-animation-fill-mode"},{"longhands":["border-right-width","border-right-style","border-right-color"],"name":"border-right"},{"name":"touch-action-delay"},{"name":"visibility"},{"name":"-internal-marquee-speed"},{"name":"-webkit-border-before-style"},{"name":"resize"},{"name":"-webkit-rtl-ordering"},{"name":"-webkit-box-ordinal-group"},{"name":"paint-order"},{"name":"stroke-linecap"},{"name":"animation-direction"},{"name":"-internal-marquee-direction"},{"name":"-webkit-background-size"},{"name":"border-top-left-radius"},{"name":"-webkit-column-width"},{"name":"-webkit-box-align"},{"name":"-webkit-padding-after"},{"longhands":["list-style-type","list-style-position","list-style-image"],"name":"list-style"},{"name":"-webkit-mask-repeat-y"},{"name":"-webkit-margin-before-collapse"},{"name":"stroke"},{"name":"text-decoration-line"},{"name":"-webkit-font-feature-settings"},{"name":"-webkit-mask-repeat-x"},{"name":"padding-bottom"},{"name":"font-style"},{"name":"-webkit-transition-delay"},{"longhands":["background-repeat-x","background-repeat-y"],"name":"background-repeat"},{"name":"flex-basis"},{"name":"-webkit-margin-after"},{"longhands":["-webkit-transform-origin-x","-webkit-transform-origin-y","-webkit-transform-origin-z"],"name":"-webkit-transform-origin"},{"name":"border-image-slice"},{"name":"vector-effect"},{"name":"-webkit-animation-timing-function"},{"name":"text-underline-style"},{"name":"-webkit-border-after-style"},{"name":"-webkit-perspective-origin-x"},{"name":"-webkit-perspective-origin-y"},{"longhands":["outline-color","outline-style","outline-width"],"name":"outline"},{"name":"table-layout"},{"longhands":["text-decoration-line","text-decoration-style","text-decoration-color"],"name":"text-decoration"},{"name":"transition-duration"},{"name":"order"},{"name":"-webkit-box-orient"},{"name":"counter-reset"},{"name":"flood-opacity"},{"name":"flex-direction"},{"name":"-webkit-text-stroke-width"},{"name":"min-height"},{"longhands":["-webkit-mask-box-image-source","-webkit-mask-box-image-slice","-webkit-mask-box-image-width","-webkit-mask-box-image-outset","-webkit-mask-box-image-repeat"],"name":"-webkit-mask-box-image"},{"name":"left"},{"longhands":["-webkit-mask-image","-webkit-mask-position-x","-webkit-mask-position-y","-webkit-mask-size","-webkit-mask-repeat-x","-webkit-mask-repeat-y","-webkit-mask-origin","-webkit-mask-clip"],"name":"-webkit-mask"},{"name":"-webkit-border-after-width"},{"name":"stroke-width"},{"name":"-webkit-box-decoration-break"},{"longhands":["-webkit-mask-position-x","-webkit-mask-position-y"],"name":"-webkit-mask-position"},{"name":"background-origin"},{"name":"-webkit-border-start-color"},{"name":"grid-auto-flow"},{"name":"-webkit-background-clip"},{"name":"-webkit-border-horizontal-spacing"},{"longhands":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"name":"border-radius"},{"longhands":["flex-grow","flex-shrink","flex-basis"],"name":"flex"},{"name":"text-indent"},{"name":"text-transform"},{"name":"text-line-through-mode"},{"name":"font-size"},{"name":"-webkit-animation-name"},{"longhands":["-webkit-text-stroke-width","-webkit-text-stroke-color"],"name":"-webkit-text-stroke"},{"name":"padding-top"},{"name":"-webkit-border-end-width"},{"name":"-webkit-text-combine"},{"name":"grid-template-rows"},{"name":"content"},{"name":"padding-right"},{"name":"-webkit-transform"},{"name":"marker-mid"},{"name":"-webkit-min-logical-width"},{"name":"clip-rule"},{"name":"text-overline-width"},{"name":"font-family"},{"longhands":["transition-property","transition-duration","transition-timing-function","transition-delay"],"name":"transition"},{"name":"-webkit-border-fit"},{"name":"filter"},{"name":"border-right-width"},{"name":"-webkit-mask-composite"},{"name":"-webkit-line-box-contain"},{"name":"color-interpolation"},{"name":"border-top-style"},{"name":"fill-opacity"},{"name":"marker-start"},{"name":"border-bottom-width"},{"longhands":["-webkit-text-emphasis-style","-webkit-text-emphasis-color"],"name":"-webkit-text-emphasis"},{"longhands":["grid-row-start","grid-column-start","grid-row-end","grid-column-end"],"name":"grid-area"},{"name":"size"},{"name":"background-clip"},{"name":"-webkit-text-fill-color"},{"name":"top"},{"name":"-webkit-box-reflect"},{"longhands":["border-top-width","border-right-width","border-bottom-width","border-left-width"],"name":"border-width"},{"name":"-webkit-column-rule-style"},{"name":"-webkit-column-count"},{"name":"animation-play-state"},{"longhands":["padding-top","padding-right","padding-bottom","padding-left"],"name":"padding"},{"name":"dominant-baseline"},{"name":"background-attachment"},{"name":"-webkit-box-flex"},{"name":"-webkit-border-start-width"},{"name":"isolation"},{"name":"color-rendering"},{"name":"border-left-width"},{"name":"grid-column-end"},{"name":"background-blend-mode"},{"name":"vertical-align"},{"name":"-webkit-max-logical-height"},{"name":"grid-auto-rows"},{"name":"shape-padding"},{"name":"-internal-marquee-increment"},{"name":"margin-left"},{"name":"animation-name"},{"name":"border-image-source"},{"longhands":["border-top-color","border-top-style","border-top-width","border-right-color","border-right-style","border-right-width","border-bottom-color","border-bottom-style","border-bottom-width","border-left-color","border-left-style","border-left-width"],"name":"border"},{"name":"-webkit-transition-timing-function"},{"name":"-webkit-wrap-flow"},{"name":"margin-bottom"},{"name":"unicode-range"},{"longhands":["animation-name","animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state"],"name":"animation"},{"name":"glyph-orientation-horizontal"},{"name":"font-weight"},{"name":"shape-margin"},{"name":"-webkit-margin-end"},{"name":"object-position"},{"name":"page-break-after"},{"name":"transition-property"},{"name":"white-space"},{"name":"-webkit-border-after-color"},{"name":"-webkit-transform-origin-x"},{"name":"-webkit-max-logical-width"},{"name":"-webkit-border-before-color"},{"name":"font-kerning"},{"name":"clear"},{"name":"animation-timing-function"},{"longhands":["border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius"],"name":"-webkit-border-radius"},{"name":"text-underline-mode"},{"name":"-webkit-text-decorations-in-effect"},{"name":"-webkit-animation-direction"},{"name":"justify-self"},{"name":"transition-timing-function"},{"name":"counter-increment"},{"name":"-webkit-transform-style"},{"name":"grid-auto-columns"},{"longhands":["font-family","font-size","font-style","font-variant","font-weight","line-height"],"name":"font"},{"name":"flex-wrap"},{"name":"grid-row-start"},{"name":"list-style-image"},{"name":"-webkit-tap-highlight-color"},{"name":"-webkit-text-emphasis-color"},{"longhands":["border-left-width","border-left-style","border-left-color"],"name":"border-left"},{"name":"-webkit-border-end-color"},{"name":"-internal-callback"},{"name":"box-shadow"},{"name":"align-self"},{"longhands":["border-bottom-width","border-bottom-style","border-bottom-color"],"name":"border-bottom"},{"longhands":["-webkit-border-horizontal-spacing","-webkit-border-vertical-spacing"],"name":"border-spacing"},{"name":"text-underline-color"},{"name":"text-line-through-style"},{"name":"-webkit-column-span"},{"name":"grid-row-end"},{"longhands":["-webkit-border-end-width","-webkit-border-end-style","-webkit-border-end-color"],"name":"-webkit-border-end"},{"name":"perspective-origin"},{"name":"page-break-inside"},{"name":"orphans"},{"name":"-webkit-border-start-style"},{"name":"scroll-behavior"},{"name":"-webkit-hyphenate-character"},{"name":"column-fill"},{"name":"tab-size"},{"name":"border-bottom-color"},{"name":"border-bottom-right-radius"},{"name":"line-height"},{"name":"stroke-linejoin"},{"name":"text-align-last"},{"name":"text-overline-mode"},{"name":"word-spacing"},{"name":"transform-style"},{"name":"-webkit-app-region"},{"name":"-webkit-border-end-style"},{"name":"-webkit-transform-origin-z"},{"name":"-webkit-aspect-ratio"},{"name":"-webkit-transform-origin-y"},{"name":"background-repeat-x"},{"name":"background-repeat-y"},{"longhands":["grid-row-start","grid-row-end"],"name":"grid-row"},{"name":"-webkit-ruby-position"},{"name":"-webkit-logical-width"},{"longhands":["border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat"],"name":"border-image"},{"name":"caption-side"},{"name":"mask-source-type"},{"name":"-webkit-mask-box-image-slice"},{"name":"-webkit-border-image"},{"name":"-webkit-text-security"},{"name":"-webkit-mask-box-image-repeat"},{"longhands":["-webkit-mask-repeat-x","-webkit-mask-repeat-y"],"name":"-webkit-mask-repeat"},{"name":"baseline-shift"},{"name":"text-justify"},{"name":"text-decoration-color"},{"name":"color"},{"name":"shape-image-threshold"},{"longhands":["min-height","max-height"],"name":"height"},{"name":"margin-right"},{"name":"color-profile"},{"name":"speak"},{"name":"border-bottom-left-radius"},{"name":"-webkit-column-break-after"},{"name":"-webkit-font-smoothing"},{"name":"clip"},{"name":"-webkit-line-break"},{"name":"fill-rule"},{"name":"-webkit-margin-start"},{"name":"min-width"},{"name":"-webkit-column-gap"},{"name":"empty-cells"},{"name":"direction"},{"name":"clip-path"},{"name":"-webkit-wrap-through"},{"name":"justify-content"},{"name":"z-index"},{"name":"background-position-y"},{"name":"text-decoration-style"},{"name":"grid-template-areas"},{"name":"-webkit-min-logical-height"},{"name":"-webkit-user-select"},{"name":"cursor"},{"name":"-webkit-mask-box-image-source"},{"longhands":["margin-top","margin-right","margin-bottom","margin-left"],"name":"margin"},{"longhands":["-webkit-animation-name","-webkit-animation-duration","-webkit-animation-timing-function","-webkit-animation-delay","-webkit-animation-iteration-count","-webkit-animation-direction","-webkit-animation-fill-mode","-webkit-animation-play-state"],"name":"-webkit-animation"},{"name":"letter-spacing"},{"name":"orientation"},{"name":"will-change"},{"name":"mix-blend-mode"},{"name":"text-line-through-width"},{"name":"-webkit-highlight"},{"name":"transform-origin"},{"name":"font-variant-ligatures"},{"name":"-webkit-animation-duration"},{"name":"text-overline-color"},{"name":"-webkit-mask-origin"},{"name":"-webkit-clip-path"},{"name":"word-break"},{"longhands":["-webkit-border-before-width","-webkit-border-before-style","-webkit-border-before-color"],"name":"-webkit-border-before"},{"name":"text-overflow"},{"name":"-webkit-locale"},{"name":"font-stretch"},{"name":"border-top-right-radius"},{"name":"border-image-outset"},{"name":"fill"},{"name":"touch-action"},{"name":"border-right-color"},{"name":"min-zoom"},{"name":"-webkit-border-before-width"},{"name":"backface-visibility"},{"name":"background-image"},{"name":"-webkit-transition-property"},{"name":"writing-mode"},{"name":"stroke-opacity"},{"name":"box-sizing"},{"name":"margin-top"},{"name":"position"},{"name":"enable-background"},{"name":"list-style-position"},{"name":"-webkit-box-pack"},{"name":"quotes"},{"longhands":["border-top-width","border-top-style","border-top-color"],"name":"border-top"},{"longhands":["-webkit-transition-property","-webkit-transition-duration","-webkit-transition-timing-function","-webkit-transition-delay"],"name":"-webkit-transition"},{"name":"-webkit-column-break-before"},{"name":"lighting-color"},{"name":"background-size"},{"name":"-webkit-mask-size"},{"name":"animation-fill-mode"},{"name":"-webkit-filter"},{"name":"word-wrap"},{"name":"max-zoom"},{"name":"text-overline-style"},{"longhands":["background-image","background-position-x","background-position-y","background-size","background-repeat-x","background-repeat-y","background-attachment","background-origin","background-clip","background-color"],"name":"background"},{"name":"-webkit-padding-before"},{"name":"grid-column-start"},{"name":"text-align"},{"name":"marker-end"},{"name":"zoom"},{"longhands":["-webkit-margin-before-collapse","-webkit-margin-after-collapse"],"name":"-webkit-margin-collapse"},{"name":"-webkit-margin-top-collapse"},{"name":"page"},{"name":"right"},{"name":"-webkit-user-modify"},{"longhands":["marker-start","marker-mid","marker-end"],"name":"marker"},{"name":"mask-type"},{"name":"-webkit-transition-duration"},{"name":"-webkit-writing-mode"},{"name":"border-top-width"},{"name":"bottom"},{"name":"-webkit-user-drag"},{"name":"-webkit-border-vertical-spacing"},{"name":"background-color"},{"name":"-webkit-backface-visibility"},{"name":"-webkit-padding-end"},{"longhands":["-webkit-border-start-width","-webkit-border-start-style","-webkit-border-start-color"],"name":"-webkit-border-start"},{"name":"animation-delay"},{"name":"unicode-bidi"},{"name":"text-shadow"},{"name":"-webkit-box-direction"},{"name":"image-rendering"},{"name":"src"},{"name":"-internal-marquee-repetition"},{"name":"pointer-events"},{"name":"border-image-width"},{"name":"-webkit-mask-clip"},{"name":"-webkit-mask-image"},{"name":"float"},{"name":"max-height"},{"name":"outline-offset"},{"name":"-webkit-box-shadow"},{"name":"overflow-wrap"},{"name":"-internal-marquee-style"},{"name":"transform"},{"longhands":["min-width","max-width"],"name":"width"},{"name":"stroke-miterlimit"},{"name":"stop-opacity"},{"name":"border-top-color"},{"longhands":["background-position-x","background-position-y"],"name":"background-position"},{"name":"object-fit"},{"name":"-webkit-mask-box-image-width"},{"name":"-webkit-background-origin"},{"name":"transition-delay"},{"longhands":["border-top-style","border-right-style","border-bottom-style","border-left-style"],"name":"border-style"},{"name":"animation-iteration-count"},{"name":"-webkit-margin-after-collapse"},{"longhands":["overflow-x","overflow-y"],"name":"overflow"},{"name":"user-zoom"},{"name":"grid-template-columns"},{"name":"-webkit-perspective-origin"},{"name":"display"},{"name":"-webkit-column-rule-width"},{"name":"-webkit-box-lines"},{"longhands":["border-top-color","border-right-color","border-bottom-color","border-left-color"],"name":"border-color"},{"name":"stroke-dashoffset"},{"name":"widows"},{"name":"border-left-color"},{"name":"overflow-y"},{"name":"overflow-x"},{"name":"shape-rendering"},{"name":"opacity"},{"name":"-webkit-perspective"},{"name":"text-underline-width"},{"name":"-webkit-text-stroke-color"},{"name":"-webkit-text-orientation"},{"name":"-webkit-mask-box-image-outset"},{"name":"align-content"},{"name":"border-bottom-style"},{"name":"mask"},{"name":"background-position-x"},{"name":"stop-color"},{"name":"stroke-dasharray"},{"name":"-webkit-line-clamp"}]);WebInspector.StatusBarItem=function(elementType)
5312 {this.element=document.createElement(elementType);this._enabled=true;this._visible=true;}
5313 WebInspector.StatusBarItem.prototype={setEnabled:function(value)
5314 {if(this._enabled===value)
5315 return;this._enabled=value;this._applyEnabledState();},_applyEnabledState:function()
5316 {this.element.disabled=!this._enabled;},get visible()
5317 {return this._visible;},set visible(x)
5318 {if(this._visible===x)
5319 return;this.element.classList.toggle("hidden",!x);this._visible=x;},__proto__:WebInspector.Object.prototype}
5320 WebInspector.StatusBarText=function(text,className)
5321 {WebInspector.StatusBarItem.call(this,"span");this.element.className="status-bar-item status-bar-text";if(className)
5322 this.element.classList.add(className);this.element.textContent=text;}
5323 WebInspector.StatusBarText.prototype={setText:function(text)
5324 {this.element.textContent=text;},__proto__:WebInspector.StatusBarItem.prototype}
5325 WebInspector.StatusBarInput=function(placeholder,width)
5326 {WebInspector.StatusBarItem.call(this,"input");this.element.className="status-bar-item";this.element.addEventListener("input",this._onChangeCallback.bind(this),false);if(width)
5327 this.element.style.width=width+"px";if(placeholder)
5328 this.element.setAttribute("placeholder",placeholder);}
5329 WebInspector.StatusBarInput.prototype={setOnChangeHandler:function(handler)
5330 {this._onChangeHandler=handler;},setValue:function(value)
5331 {this.element.value=value;this._onChangeCallback();},_onChangeCallback:function()
5332 {this._onChangeHandler&&this._onChangeHandler(this.element.value);},__proto__:WebInspector.StatusBarItem.prototype}
5333 WebInspector.StatusBarButton=function(title,className,states)
5334 {WebInspector.StatusBarItem.call(this,"button");this.element.className=className+" status-bar-item";this.element.addEventListener("click",this._clicked.bind(this),false);this.glyph=document.createElement("div");this.glyph.className="glyph";this.element.appendChild(this.glyph);this.glyphShadow=document.createElement("div");this.glyphShadow.className="glyph shadow";this.element.appendChild(this.glyphShadow);this.states=states;if(!states)
5335 this.states=2;if(states==2)
5336 this._state=false;else
5337 this._state=0;this.title=title;this.className=className;}
5338 WebInspector.StatusBarButton.prototype={_clicked:function()
5339 {this.dispatchEventToListeners("click");if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}},_applyEnabledState:function()
5340 {this.element.disabled=!this._enabled;if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}},enabled:function()
5341 {return this._enabled;},get title()
5342 {return this._title;},set title(x)
5343 {if(this._title===x)
5344 return;this._title=x;this.element.title=x;},get state()
5345 {return this._state;},set state(x)
5346 {if(this._state===x)
5347 return;if(this.states===2)
5348 this.element.classList.toggle("toggled-on",x);else{this.element.classList.remove("toggled-"+this._state);if(x!==0)
5349 this.element.classList.add("toggled-"+x);}
5350 this._state=x;},get toggled()
5351 {if(this.states!==2)
5352 throw("Only used toggled when there are 2 states, otherwise, use state");return this.state;},set toggled(x)
5353 {if(this.states!==2)
5354 throw("Only used toggled when there are 2 states, otherwise, use state");this.state=x;},makeLongClickEnabled:function()
5355 {var boundMouseDown=mouseDown.bind(this);var boundMouseUp=mouseUp.bind(this);this.element.addEventListener("mousedown",boundMouseDown,false);this.element.addEventListener("mouseout",boundMouseUp,false);this.element.addEventListener("mouseup",boundMouseUp,false);var longClicks=0;this._longClickData={mouseUp:boundMouseUp,mouseDown:boundMouseDown};function mouseDown(e)
5356 {if(e.which!==1)
5357 return;longClicks=0;this._longClickInterval=setInterval(longClicked.bind(this),200);}
5358 function mouseUp(e)
5359 {if(e.which!==1)
5360 return;if(this._longClickInterval){clearInterval(this._longClickInterval);delete this._longClickInterval;}}
5361 function longClicked()
5362 {++longClicks;this.dispatchEventToListeners(longClicks===1?"longClickDown":"longClickPress");}},unmakeLongClickEnabled:function()
5363 {if(!this._longClickData)
5364 return;this.element.removeEventListener("mousedown",this._longClickData.mouseDown,false);this.element.removeEventListener("mouseout",this._longClickData.mouseUp,false);this.element.removeEventListener("mouseup",this._longClickData.mouseUp,false);delete this._longClickData;},setLongClickOptionsEnabled:function(buttonsProvider)
5365 {if(buttonsProvider){if(!this._longClickOptionsData){this.makeLongClickEnabled();this.longClickGlyph=document.createElement("div");this.longClickGlyph.className="fill long-click-glyph";this.element.appendChild(this.longClickGlyph);this.longClickGlyphShadow=document.createElement("div");this.longClickGlyphShadow.className="fill long-click-glyph shadow";this.element.appendChild(this.longClickGlyphShadow);var longClickDownListener=this._showOptions.bind(this);this.addEventListener("longClickDown",longClickDownListener,this);this._longClickOptionsData={glyphElement:this.longClickGlyph,glyphShadowElement:this.longClickGlyphShadow,longClickDownListener:longClickDownListener};}
5366 this._longClickOptionsData.buttonsProvider=buttonsProvider;}else{if(!this._longClickOptionsData)
5367 return;this.element.removeChild(this._longClickOptionsData.glyphElement);this.element.removeChild(this._longClickOptionsData.glyphShadowElement);this.removeEventListener("longClickDown",this._longClickOptionsData.longClickDownListener,this);delete this._longClickOptionsData;this.unmakeLongClickEnabled();}},_showOptions:function()
5368 {var buttons=this._longClickOptionsData.buttonsProvider();var mainButtonClone=new WebInspector.StatusBarButton(this.title,this.className,this.states);mainButtonClone.addEventListener("click",this._clicked,this);mainButtonClone.state=this.state;buttons.push(mainButtonClone);document.documentElement.addEventListener("mouseup",mouseUp,false);var optionsGlassPane=new WebInspector.GlassPane();var optionsBarElement=optionsGlassPane.element.createChild("div","alternate-status-bar-buttons-bar");const buttonHeight=23;var hostButtonPosition=this.element.totalOffset();var topNotBottom=hostButtonPosition.top+buttonHeight*buttons.length<document.documentElement.offsetHeight;if(topNotBottom)
5369 buttons=buttons.reverse();optionsBarElement.style.height=(buttonHeight*buttons.length)+"px";if(topNotBottom)
5370 optionsBarElement.style.top=(hostButtonPosition.top+1)+"px";else
5371 optionsBarElement.style.top=(hostButtonPosition.top-(buttonHeight*(buttons.length-1)))+"px";optionsBarElement.style.left=(hostButtonPosition.left+1)+"px";for(var i=0;i<buttons.length;++i){buttons[i].element.addEventListener("mousemove",mouseOver,false);buttons[i].element.addEventListener("mouseout",mouseOut,false);optionsBarElement.appendChild(buttons[i].element);}
5372 var hostButtonIndex=topNotBottom?0:buttons.length-1;buttons[hostButtonIndex].element.classList.add("emulate-active");function mouseOver(e)
5373 {if(e.which!==1)
5374 return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.add("emulate-active");}
5375 function mouseOut(e)
5376 {if(e.which!==1)
5377 return;var buttonElement=e.target.enclosingNodeOrSelfWithClass("status-bar-item");buttonElement.classList.remove("emulate-active");}
5378 function mouseUp(e)
5379 {if(e.which!==1)
5380 return;optionsGlassPane.dispose();document.documentElement.removeEventListener("mouseup",mouseUp,false);for(var i=0;i<buttons.length;++i){if(buttons[i].element.classList.contains("emulate-active")){buttons[i].element.classList.remove("emulate-active");buttons[i]._clicked();break;}}}},__proto__:WebInspector.StatusBarItem.prototype}
5381 WebInspector.StatusBarComboBox=function(changeHandler,className)
5382 {WebInspector.StatusBarItem.call(this,"span");this.element.className="status-bar-select-container";this._selectElement=this.element.createChild("select","status-bar-item");this.element.createChild("div","status-bar-select-arrow");if(changeHandler)
5383 this._selectElement.addEventListener("change",changeHandler,false);if(className)
5384 this._selectElement.classList.add(className);}
5385 WebInspector.StatusBarComboBox.prototype={selectElement:function()
5386 {return this._selectElement;},size:function()
5387 {return this._selectElement.childElementCount;},addOption:function(option)
5388 {this._selectElement.appendChild(option);},createOption:function(label,title,value)
5389 {var option=this._selectElement.createChild("option");option.text=label;if(title)
5390 option.title=title;if(typeof value!=="undefined")
5391 option.value=value;return option;},_applyEnabledState:function()
5392 {this._selectElement.disabled=!this._enabled;},removeOption:function(option)
5393 {this._selectElement.removeChild(option);},removeOptions:function()
5394 {this._selectElement.removeChildren();},selectedOption:function()
5395 {if(this._selectElement.selectedIndex>=0)
5396 return this._selectElement[this._selectElement.selectedIndex];return null;},select:function(option)
5397 {this._selectElement.selectedIndex=Array.prototype.indexOf.call(this._selectElement,option);},setSelectedIndex:function(index)
5398 {this._selectElement.selectedIndex=index;},selectedIndex:function()
5399 {return this._selectElement.selectedIndex;},__proto__:WebInspector.StatusBarItem.prototype}
5400 WebInspector.StatusBarCheckbox=function(title)
5401 {WebInspector.StatusBarItem.call(this,"label");this.element.classList.add("status-bar-item","checkbox");this._checkbox=this.element.createChild("input");this._checkbox.type="checkbox";this.element.createTextChild(title);}
5402 WebInspector.StatusBarCheckbox.prototype={checked:function()
5403 {return this._checkbox.checked;},__proto__:WebInspector.StatusBarItem.prototype}
5404 WebInspector.StatusBarStatesSettingButton=function(className,states,titles,currentStateSetting,lastStateSetting,stateChangedCallback)
5405 {WebInspector.StatusBarButton.call(this,"",className,states.length);var onClickBound=this._onClick.bind(this);this.addEventListener("click",onClickBound,this);this._states=states;this._buttons=[];for(var index=0;index<states.length;index++){var button=new WebInspector.StatusBarButton(titles[index],className,states.length);button.state=this._states[index];button.addEventListener("click",onClickBound,this);this._buttons.push(button);}
5406 this._currentStateSetting=currentStateSetting;this._lastStateSetting=lastStateSetting;this._stateChangedCallback=stateChangedCallback;this.setLongClickOptionsEnabled(this._createOptions.bind(this));this._currentState=null;this.toggleState(this._defaultState());}
5407 WebInspector.StatusBarStatesSettingButton.prototype={_onClick:function(e)
5408 {this.toggleState(e.target.state);},toggleState:function(state)
5409 {if(this._currentState===state)
5410 return;if(this._currentState)
5411 this._lastStateSetting.set(this._currentState);this._currentState=state;this._currentStateSetting.set(this._currentState);if(this._stateChangedCallback)
5412 this._stateChangedCallback(state);var defaultState=this._defaultState();this.state=defaultState;this.title=this._buttons[this._states.indexOf(defaultState)].title;},_defaultState:function()
5413 {if(!this._currentState){var state=this._currentStateSetting.get();return this._states.indexOf(state)>=0?state:this._states[0];}
5414 var lastState=this._lastStateSetting.get();if(lastState&&this._states.indexOf(lastState)>=0&&lastState!=this._currentState)
5415 return lastState;if(this._states.length>1&&this._currentState===this._states[0])
5416 return this._states[1];return this._states[0];},_createOptions:function()
5417 {var options=[];for(var index=0;index<this._states.length;index++){if(this._states[index]!==this.state&&this._states[index]!==this._currentState)
5418 options.push(this._buttons[index]);}
5419 return options;},__proto__:WebInspector.StatusBarButton.prototype}
5420 WebInspector.DropDownMenu=function()
5421 {this.element=document.createElementWithClass("select","drop-down-menu");this.element.addEventListener("mousedown",this._onBeforeMouseDown.bind(this),true);this.element.addEventListener("mousedown",consumeEvent,false);this.element.addEventListener("change",this._onChange.bind(this),false);}
5422 WebInspector.DropDownMenu.Events={BeforeShow:"BeforeShow",ItemSelected:"ItemSelected"}
5423 WebInspector.DropDownMenu.prototype={_onBeforeMouseDown:function()
5424 {this.dispatchEventToListeners(WebInspector.DropDownMenu.Events.BeforeShow,null);},_onChange:function()
5425 {var options=this.element.options;var selectedOption=options[this.element.selectedIndex];this.dispatchEventToListeners(WebInspector.DropDownMenu.Events.ItemSelected,selectedOption.id);},addItem:function(id,title)
5426 {var option=new Option(title);option.id=id;this.element.appendChild(option);},selectItem:function(id)
5427 {var children=this.element.children;for(var i=0;i<children.length;++i){var child=children[i];if(child.id===id){this.element.selectedIndex=i;return;}}
5428 this.element.selectedIndex=-1;},clear:function()
5429 {this.element.removeChildren();},__proto__:WebInspector.Object.prototype}
5430 WebInspector.CompletionDictionary=function(){}
5431 WebInspector.CompletionDictionary.prototype={addWord:function(word){},removeWord:function(word){},hasWord:function(word){},wordsWithPrefix:function(prefix){},wordCount:function(word){},reset:function(){}}
5432 WebInspector.SampleCompletionDictionary=function(){this._words={};}
5433 WebInspector.SampleCompletionDictionary.prototype={addWord:function(word)
5434 {if(!this._words[word])
5435 this._words[word]=1;else
5436 ++this._words[word];},removeWord:function(word)
5437 {if(!this._words[word])
5438 return;if(this._words[word]===1)
5439 delete this._words[word];else
5440 --this._words[word];},wordsWithPrefix:function(prefix)
5441 {var words=[];for(var i in this._words){if(i.startsWith(prefix))
5442 words.push(i);}
5443 return words;},hasWord:function(word)
5444 {return!!this._words[word];},wordCount:function(word)
5445 {return this._words[word]?this._words[word]:0;},reset:function()
5446 {this._words={};}}
5447 WebInspector.InplaceEditor=function()
5448 {};WebInspector.InplaceEditor.startEditing=function(element,config)
5449 {if(config.multiline)
5450 return WebInspector.moduleManager.instance(WebInspector.InplaceEditor).startEditing(element,config);if(!WebInspector.InplaceEditor._defaultInstance)
5451 WebInspector.InplaceEditor._defaultInstance=new WebInspector.InplaceEditor();return WebInspector.InplaceEditor._defaultInstance.startEditing(element,config);}
5452 WebInspector.InplaceEditor.prototype={editorContent:function(editingContext){var element=editingContext.element;if(element.tagName==="INPUT"&&element.type==="text")
5453 return element.value;return element.textContent;},setUpEditor:function(editingContext)
5454 {var element=editingContext.element;element.classList.add("editing");var oldTabIndex=element.getAttribute("tabIndex");if(typeof oldTabIndex!=="number"||oldTabIndex<0)
5455 element.tabIndex=0;WebInspector.setCurrentFocusElement(element);editingContext.oldTabIndex=oldTabIndex;},closeEditor:function(editingContext)
5456 {var element=editingContext.element;element.classList.remove("editing");if(typeof editingContext.oldTabIndex!=="number")
5457 element.removeAttribute("tabIndex");else
5458 element.tabIndex=editingContext.oldTabIndex;element.scrollTop=0;element.scrollLeft=0;},cancelEditing:function(editingContext)
5459 {var element=editingContext.element;if(element.tagName==="INPUT"&&element.type==="text")
5460 element.value=editingContext.oldText;else
5461 element.textContent=editingContext.oldText;},augmentEditingHandle:function(editingContext,handle)
5462 {},startEditing:function(element,config)
5463 {if(!WebInspector.markBeingEdited(element,true))
5464 return null;config=config||new WebInspector.InplaceEditor.Config(function(){},function(){});var editingContext={element:element,config:config};var committedCallback=config.commitHandler;var cancelledCallback=config.cancelHandler;var pasteCallback=config.pasteHandler;var context=config.context;var isMultiline=config.multiline||false;var moveDirection="";var self=this;function consumeCopy(e)
5465 {e.consume();}
5466 this.setUpEditor(editingContext);editingContext.oldText=isMultiline?config.initialValue:this.editorContent(editingContext);function blurEventListener(e){if(!isMultiline||!e||!e.relatedTarget||!e.relatedTarget.isSelfOrDescendant(element))
5467 editingCommitted.call(element);}
5468 function cleanUpAfterEditing()
5469 {WebInspector.markBeingEdited(element,false);element.removeEventListener("blur",blurEventListener,isMultiline);element.removeEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
5470 element.removeEventListener("paste",pasteEventListener,true);WebInspector.restoreFocusFromElement(element);self.closeEditor(editingContext);}
5471 function editingCancelled()
5472 {self.cancelEditing(editingContext);cleanUpAfterEditing();cancelledCallback(this,context);}
5473 function editingCommitted()
5474 {cleanUpAfterEditing();committedCallback(this,self.editorContent(editingContext),editingContext.oldText,context,moveDirection);}
5475 function defaultFinishHandler(event)
5476 {var isMetaOrCtrl=WebInspector.isMac()?event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey:event.ctrlKey&&!event.shiftKey&&!event.metaKey&&!event.altKey;if(isEnterKey(event)&&(event.isMetaOrCtrlForTest||!isMultiline||isMetaOrCtrl))
5477 return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code||event.keyIdentifier==="U+001B")
5478 return"cancel";else if(!isMultiline&&event.keyIdentifier==="U+0009")
5479 return"move-"+(event.shiftKey?"backward":"forward");}
5480 function handleEditingResult(result,event)
5481 {if(result==="commit"){editingCommitted.call(element);event.consume(true);}else if(result==="cancel"){editingCancelled.call(element);event.consume(true);}else if(result&&result.startsWith("move-")){moveDirection=result.substring(5);if(event.keyIdentifier!=="U+0009")
5482 blurEventListener();}}
5483 function pasteEventListener(event)
5484 {var result=pasteCallback(event);handleEditingResult(result,event);}
5485 function keyDownEventListener(event)
5486 {var handler=config.customFinishHandler||defaultFinishHandler;var result=handler(event);handleEditingResult(result,event);}
5487 element.addEventListener("blur",blurEventListener,isMultiline);element.addEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
5488 element.addEventListener("paste",pasteEventListener,true);var handle={cancel:editingCancelled.bind(element),commit:editingCommitted.bind(element)};this.augmentEditingHandle(editingContext,handle);return handle;}}
5489 WebInspector.InplaceEditor.Config=function(commitHandler,cancelHandler,context)
5490 {this.commitHandler=commitHandler;this.cancelHandler=cancelHandler
5491 this.context=context;this.pasteHandler;this.multiline;this.customFinishHandler;}
5492 WebInspector.InplaceEditor.Config.prototype={setPasteHandler:function(pasteHandler)
5493 {this.pasteHandler=pasteHandler;},setMultilineOptions:function(initialValue,mode,theme,lineWrapping,smartIndent)
5494 {this.multiline=true;this.initialValue=initialValue;this.mode=mode;this.theme=theme;this.lineWrapping=lineWrapping;this.smartIndent=smartIndent;},setCustomFinishHandler:function(customFinishHandler)
5495 {this.customFinishHandler=customFinishHandler;}}
5496 WebInspector.TextEditor=function(){};WebInspector.TextEditor.Events={GutterClick:"gutterClick"};WebInspector.TextEditor.GutterClickEventData;WebInspector.TextEditor.prototype={undo:function(){},redo:function(){},isClean:function(){},markClean:function(){},indent:function(){},cursorPositionToCoordinates:function(lineNumber,column){return null;},coordinatesToCursorPosition:function(x,y){return null;},tokenAtTextPosition:function(lineNumber,column){return null;},setMimeType:function(mimeType){},setReadOnly:function(readOnly){},readOnly:function(){},defaultFocusedElement:function(){},highlightRange:function(range,cssClass){},removeHighlight:function(highlightDescriptor){},addBreakpoint:function(lineNumber,disabled,conditional){},removeBreakpoint:function(lineNumber){},setExecutionLine:function(lineNumber){},clearExecutionLine:function(){},addDecoration:function(lineNumber,element){},removeDecoration:function(lineNumber,element){},highlightSearchResults:function(regex,range){},revealPosition:function(lineNumber,columnNumber,shouldHighlight){},clearPositionHighlight:function(){},elementsToRestoreScrollPositionsFor:function(){},inheritScrollPositions:function(textEditor){},beginUpdates:function(){},endUpdates:function(){},onResize:function(){},editRange:function(range,text){},scrollToLine:function(lineNumber){},firstVisibleLine:function(){},lastVisibleLine:function(){},selection:function(){},lastSelection:function(){},setSelection:function(textRange){},copyRange:function(range){},setText:function(text){},text:function(){},range:function(){},line:function(lineNumber){},get linesCount(){},setAttribute:function(line,name,value){},getAttribute:function(line,name){},removeAttribute:function(line,name){},wasShown:function(){},willHide:function(){},setCompletionDictionary:function(dictionary){},textEditorPositionHandle:function(lineNumber,columnNumber){}}
5497 WebInspector.TextEditorPositionHandle=function()
5498 {}
5499 WebInspector.TextEditorPositionHandle.prototype={resolve:function(){},equal:function(positionHandle){}}
5500 WebInspector.TextEditorDelegate=function()
5501 {}
5502 WebInspector.TextEditorDelegate.prototype={onTextChanged:function(oldRange,newRange){},selectionChanged:function(textRange){},scrollChanged:function(lineNumber){},editorFocused:function(){},populateLineGutterContextMenu:function(contextMenu,lineNumber){},populateTextAreaContextMenu:function(contextMenu,lineNumber){},createLink:function(hrefValue,isExternal){},onJumpToPosition:function(from,to){}}
5503 WebInspector.TokenizerFactory=function(){}
5504 WebInspector.TokenizerFactory.prototype={createTokenizer:function(mimeType){}}
5505 WebInspector.SourceFrame=function(contentProvider)
5506 {WebInspector.VBox.call(this);this.element.classList.add("script-view");this._url=contentProvider.contentURL();this._contentProvider=contentProvider;var textEditorDelegate=new WebInspector.TextEditorDelegateForSourceFrame(this);WebInspector.moduleManager.loadModule("codemirror");this._textEditor=new WebInspector.CodeMirrorTextEditor(this._url,textEditorDelegate);this._currentSearchResultIndex=-1;this._searchResults=[];this._messages=[];this._rowMessages={};this._messageBubbles={};this._textEditor.setReadOnly(!this.canEditSource());this._shortcuts={};this.element.addEventListener("keydown",this._handleKeyDown.bind(this),false);this._sourcePosition=new WebInspector.StatusBarText("","source-frame-cursor-position");}
5507 WebInspector.SourceFrame.createSearchRegex=function(query,modifiers)
5508 {var regex;modifiers=modifiers||"";try{if(/^\/.+\/$/.test(query)){regex=new RegExp(query.substring(1,query.length-1),modifiers);regex.__fromRegExpQuery=true;}}catch(e){}
5509 if(!regex)
5510 regex=createPlainTextSearchRegex(query,"i"+modifiers);return regex;}
5511 WebInspector.SourceFrame.Events={ScrollChanged:"ScrollChanged",SelectionChanged:"SelectionChanged",JumpHappened:"JumpHappened"}
5512 WebInspector.SourceFrame.prototype={addShortcut:function(key,handler)
5513 {this._shortcuts[key]=handler;},wasShown:function()
5514 {this._ensureContentLoaded();this._textEditor.show(this.element);this._editorAttached=true;this._wasShownOrLoaded();},_isEditorShowing:function()
5515 {return this.isShowing()&&this._editorAttached;},willHide:function()
5516 {WebInspector.View.prototype.willHide.call(this);this._clearPositionToReveal();},statusBarText:function()
5517 {return this._sourcePosition.element;},statusBarItems:function()
5518 {return[];},defaultFocusedElement:function()
5519 {return this._textEditor.defaultFocusedElement();},get loaded()
5520 {return this._loaded;},hasContent:function()
5521 {return true;},get textEditor()
5522 {return this._textEditor;},_ensureContentLoaded:function()
5523 {if(!this._contentRequested){this._contentRequested=true;this._contentProvider.requestContent(this.setContent.bind(this));}},addMessage:function(msg)
5524 {this._messages.push(msg);if(this.loaded)
5525 this.addMessageToSource(msg.line-1,msg);},clearMessages:function()
5526 {for(var line in this._messageBubbles){var bubble=this._messageBubbles[line];var lineNumber=parseInt(line,10);this._textEditor.removeDecoration(lineNumber,bubble);}
5527 this._messages=[];this._rowMessages={};this._messageBubbles={};},revealPosition:function(line,column,shouldHighlight)
5528 {this._clearLineToScrollTo();this._clearSelectionToSet();this._positionToReveal={line:line,column:column,shouldHighlight:shouldHighlight};this._innerRevealPositionIfNeeded();},_innerRevealPositionIfNeeded:function()
5529 {if(!this._positionToReveal)
5530 return;if(!this.loaded||!this._isEditorShowing())
5531 return;this._textEditor.revealPosition(this._positionToReveal.line,this._positionToReveal.column,this._positionToReveal.shouldHighlight);delete this._positionToReveal;},_clearPositionToReveal:function()
5532 {this._textEditor.clearPositionHighlight();delete this._positionToReveal;},scrollToLine:function(line)
5533 {this._clearPositionToReveal();this._lineToScrollTo=line;this._innerScrollToLineIfNeeded();},_innerScrollToLineIfNeeded:function()
5534 {if(typeof this._lineToScrollTo==="number"){if(this.loaded&&this._isEditorShowing()){this._textEditor.scrollToLine(this._lineToScrollTo);delete this._lineToScrollTo;}}},_clearLineToScrollTo:function()
5535 {delete this._lineToScrollTo;},selection:function()
5536 {return this.textEditor.selection();},setSelection:function(textRange)
5537 {this._selectionToSet=textRange;this._innerSetSelectionIfNeeded();},_innerSetSelectionIfNeeded:function()
5538 {if(this._selectionToSet&&this.loaded&&this._isEditorShowing()){this._textEditor.setSelection(this._selectionToSet);delete this._selectionToSet;}},_clearSelectionToSet:function()
5539 {delete this._selectionToSet;},_wasShownOrLoaded:function()
5540 {this._innerRevealPositionIfNeeded();this._innerSetSelectionIfNeeded();this._innerScrollToLineIfNeeded();},onTextChanged:function(oldRange,newRange)
5541 {if(this._searchResultsChangedCallback&&!this._isReplacing)
5542 this._searchResultsChangedCallback();this.clearMessages();},_simplifyMimeType:function(content,mimeType)
5543 {if(!mimeType)
5544 return"";if(mimeType.indexOf("javascript")>=0||mimeType.indexOf("jscript")>=0||mimeType.indexOf("ecmascript")>=0)
5545 return"text/javascript";if(mimeType==="text/x-php"&&content.match(/\<\?.*\?\>/g))
5546 return"application/x-httpd-php";return mimeType;},setHighlighterType:function(highlighterType)
5547 {this._highlighterType=highlighterType;this._updateHighlighterType("");},_updateHighlighterType:function(content)
5548 {this._textEditor.setMimeType(this._simplifyMimeType(content,this._highlighterType));},setContent:function(content)
5549 {if(!this._loaded){this._loaded=true;this._textEditor.setText(content||"");this._textEditor.markClean();}else{var firstLine=this._textEditor.firstVisibleLine();var selection=this._textEditor.selection();this._textEditor.setText(content||"");this._textEditor.scrollToLine(firstLine);this._textEditor.setSelection(selection);}
5550 this._updateHighlighterType(content||"");this._textEditor.beginUpdates();this._setTextEditorDecorations();this._wasShownOrLoaded();if(this._delayedFindSearchMatches){this._delayedFindSearchMatches();delete this._delayedFindSearchMatches;}
5551 this.onTextEditorContentLoaded();this._textEditor.endUpdates();},onTextEditorContentLoaded:function(){},_setTextEditorDecorations:function()
5552 {this._rowMessages={};this._messageBubbles={};this._textEditor.beginUpdates();this._addExistingMessagesToSource();this._textEditor.endUpdates();},performSearch:function(query,shouldJump,callback,currentMatchChangedCallback,searchResultsChangedCallback)
5553 {function doFindSearchMatches(query)
5554 {this._currentSearchResultIndex=-1;this._searchResults=[];var regex=WebInspector.SourceFrame.createSearchRegex(query);this._searchRegex=regex;this._searchResults=this._collectRegexMatches(regex);if(!this._searchResults.length)
5555 this._textEditor.cancelSearchResultsHighlight();else if(shouldJump)
5556 this.jumpToNextSearchResult();else
5557 this._textEditor.highlightSearchResults(regex,null);callback(this,this._searchResults.length);}
5558 this._resetSearch();this._currentSearchMatchChangedCallback=currentMatchChangedCallback;this._searchResultsChangedCallback=searchResultsChangedCallback;if(this.loaded)
5559 doFindSearchMatches.call(this,query);else
5560 this._delayedFindSearchMatches=doFindSearchMatches.bind(this,query);this._ensureContentLoaded();},_editorFocused:function()
5561 {if(!this._searchResults.length)
5562 return;this._currentSearchResultIndex=-1;if(this._currentSearchMatchChangedCallback)
5563 this._currentSearchMatchChangedCallback(this._currentSearchResultIndex);this._textEditor.highlightSearchResults(this._searchRegex,null);},_searchResultAfterSelectionIndex:function(selection)
5564 {if(!selection)
5565 return 0;for(var i=0;i<this._searchResults.length;++i){if(this._searchResults[i].compareTo(selection)>=0)
5566 return i;}
5567 return 0;},_resetSearch:function()
5568 {delete this._delayedFindSearchMatches;delete this._currentSearchMatchChangedCallback;delete this._searchResultsChangedCallback;this._currentSearchResultIndex=-1;this._searchResults=[];delete this._searchRegex;},searchCanceled:function()
5569 {var range=this._currentSearchResultIndex!==-1?this._searchResults[this._currentSearchResultIndex]:null;this._resetSearch();if(!this.loaded)
5570 return;this._textEditor.cancelSearchResultsHighlight();if(range)
5571 this._textEditor.setSelection(range);},hasSearchResults:function()
5572 {return this._searchResults.length>0;},jumpToFirstSearchResult:function()
5573 {this.jumpToSearchResult(0);},jumpToLastSearchResult:function()
5574 {this.jumpToSearchResult(this._searchResults.length-1);},jumpToNextSearchResult:function()
5575 {var currentIndex=this._searchResultAfterSelectionIndex(this._textEditor.selection());var nextIndex=this._currentSearchResultIndex===-1?currentIndex:currentIndex+1;this.jumpToSearchResult(nextIndex);},jumpToPreviousSearchResult:function()
5576 {var currentIndex=this._searchResultAfterSelectionIndex(this._textEditor.selection());this.jumpToSearchResult(currentIndex-1);},showingFirstSearchResult:function()
5577 {return this._searchResults.length&&this._currentSearchResultIndex===0;},showingLastSearchResult:function()
5578 {return this._searchResults.length&&this._currentSearchResultIndex===(this._searchResults.length-1);},get currentSearchResultIndex()
5579 {return this._currentSearchResultIndex;},jumpToSearchResult:function(index)
5580 {if(!this.loaded||!this._searchResults.length)
5581 return;this._currentSearchResultIndex=(index+this._searchResults.length)%this._searchResults.length;if(this._currentSearchMatchChangedCallback)
5582 this._currentSearchMatchChangedCallback(this._currentSearchResultIndex);this._textEditor.highlightSearchResults(this._searchRegex,this._searchResults[this._currentSearchResultIndex]);},replaceSelectionWith:function(text)
5583 {var range=this._searchResults[this._currentSearchResultIndex];if(!range)
5584 return;this._textEditor.highlightSearchResults(this._searchRegex,null);this._isReplacing=true;var newRange=this._textEditor.editRange(range,text);delete this._isReplacing;this._textEditor.setSelection(newRange.collapseToEnd());},replaceAllWith:function(query,replacement)
5585 {this._textEditor.highlightSearchResults(this._searchRegex,null);var text=this._textEditor.text();var range=this._textEditor.range();var regex=WebInspector.SourceFrame.createSearchRegex(query,"g");if(regex.__fromRegExpQuery)
5586 text=text.replace(regex,replacement);else
5587 text=text.replace(regex,function(){return replacement;});this._isReplacing=true;this._textEditor.editRange(range,text);delete this._isReplacing;},_collectRegexMatches:function(regexObject)
5588 {var ranges=[];for(var i=0;i<this._textEditor.linesCount;++i){var line=this._textEditor.line(i);var offset=0;do{var match=regexObject.exec(line);if(match){if(match[0].length)
5589 ranges.push(new WebInspector.TextRange(i,offset+match.index,i,offset+match.index+match[0].length));offset+=match.index+1;line=line.substring(match.index+1);}}while(match&&line);}
5590 return ranges;},_addExistingMessagesToSource:function()
5591 {var length=this._messages.length;for(var i=0;i<length;++i)
5592 this.addMessageToSource(this._messages[i].line-1,this._messages[i]);},addMessageToSource:function(lineNumber,msg)
5593 {if(lineNumber>=this._textEditor.linesCount)
5594 lineNumber=this._textEditor.linesCount-1;if(lineNumber<0)
5595 lineNumber=0;var rowMessages=this._rowMessages[lineNumber];if(!rowMessages){rowMessages=[];this._rowMessages[lineNumber]=rowMessages;}
5596 for(var i=0;i<rowMessages.length;++i){if(rowMessages[i].consoleMessage.isEqual(msg)){rowMessages[i].repeatCount++;this._updateMessageRepeatCount(rowMessages[i]);return;}}
5597 var rowMessage={consoleMessage:msg};rowMessages.push(rowMessage);this._textEditor.beginUpdates();var messageBubbleElement=this._messageBubbles[lineNumber];if(!messageBubbleElement){messageBubbleElement=document.createElement("div");messageBubbleElement.className="webkit-html-message-bubble";this._messageBubbles[lineNumber]=messageBubbleElement;this._textEditor.addDecoration(lineNumber,messageBubbleElement);}
5598 var imageElement=document.createElement("div");switch(msg.level){case WebInspector.ConsoleMessage.MessageLevel.Error:messageBubbleElement.classList.add("webkit-html-error-message");imageElement.className="error-icon-small";break;case WebInspector.ConsoleMessage.MessageLevel.Warning:messageBubbleElement.classList.add("webkit-html-warning-message");imageElement.className="warning-icon-small";break;}
5599 var messageLineElement=document.createElement("div");messageLineElement.className="webkit-html-message-line";messageBubbleElement.appendChild(messageLineElement);messageLineElement.appendChild(imageElement);messageLineElement.appendChild(document.createTextNode(msg.messageText));rowMessage.element=messageLineElement;rowMessage.repeatCount=1;this._updateMessageRepeatCount(rowMessage);this._textEditor.endUpdates();},_updateMessageRepeatCount:function(rowMessage)
5600 {if(rowMessage.repeatCount<2)
5601 return;if(!rowMessage.repeatCountElement){var repeatCountElement=document.createElement("span");rowMessage.element.appendChild(repeatCountElement);rowMessage.repeatCountElement=repeatCountElement;}
5602 rowMessage.repeatCountElement.textContent=WebInspector.UIString(" (repeated %d times)",rowMessage.repeatCount);},removeMessageFromSource:function(lineNumber,msg)
5603 {if(lineNumber>=this._textEditor.linesCount)
5604 lineNumber=this._textEditor.linesCount-1;if(lineNumber<0)
5605 lineNumber=0;var rowMessages=this._rowMessages[lineNumber];for(var i=0;rowMessages&&i<rowMessages.length;++i){var rowMessage=rowMessages[i];if(rowMessage.consoleMessage!==msg)
5606 continue;var messageLineElement=rowMessage.element;var messageBubbleElement=messageLineElement.parentElement;messageBubbleElement.removeChild(messageLineElement);rowMessages.remove(rowMessage);if(!rowMessages.length)
5607 delete this._rowMessages[lineNumber];if(!messageBubbleElement.childElementCount){this._textEditor.removeDecoration(lineNumber,messageBubbleElement);delete this._messageBubbles[lineNumber];}
5608 break;}},populateLineGutterContextMenu:function(contextMenu,lineNumber)
5609 {},populateTextAreaContextMenu:function(contextMenu,lineNumber)
5610 {},onJumpToPosition:function(from,to)
5611 {this.dispatchEventToListeners(WebInspector.SourceFrame.Events.JumpHappened,{from:from,to:to});},inheritScrollPositions:function(sourceFrame)
5612 {this._textEditor.inheritScrollPositions(sourceFrame._textEditor);},canEditSource:function()
5613 {return false;},selectionChanged:function(textRange)
5614 {this._updateSourcePosition(textRange);this.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged,textRange);WebInspector.notifications.dispatchEventToListeners(WebInspector.SourceFrame.Events.SelectionChanged,textRange);},_updateSourcePosition:function(textRange)
5615 {if(!textRange)
5616 return;if(textRange.isEmpty()){this._sourcePosition.setText(WebInspector.UIString("Line %d, Column %d",textRange.endLine+1,textRange.endColumn+1));return;}
5617 textRange=textRange.normalize();var selectedText=this._textEditor.copyRange(textRange);if(textRange.startLine===textRange.endLine)
5618 this._sourcePosition.setText(WebInspector.UIString("%d characters selected",selectedText.length));else
5619 this._sourcePosition.setText(WebInspector.UIString("%d lines, %d characters selected",textRange.endLine-textRange.startLine+1,selectedText.length));},scrollChanged:function(lineNumber)
5620 {this.dispatchEventToListeners(WebInspector.SourceFrame.Events.ScrollChanged,lineNumber);},_handleKeyDown:function(e)
5621 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(e);var handler=this._shortcuts[shortcutKey];if(handler&&handler())
5622 e.consume(true);},__proto__:WebInspector.VBox.prototype}
5623 WebInspector.TextEditorDelegateForSourceFrame=function(sourceFrame)
5624 {this._sourceFrame=sourceFrame;}
5625 WebInspector.TextEditorDelegateForSourceFrame.prototype={onTextChanged:function(oldRange,newRange)
5626 {this._sourceFrame.onTextChanged(oldRange,newRange);},selectionChanged:function(textRange)
5627 {this._sourceFrame.selectionChanged(textRange);},scrollChanged:function(lineNumber)
5628 {this._sourceFrame.scrollChanged(lineNumber);},editorFocused:function()
5629 {this._sourceFrame._editorFocused();},populateLineGutterContextMenu:function(contextMenu,lineNumber)
5630 {this._sourceFrame.populateLineGutterContextMenu(contextMenu,lineNumber);},populateTextAreaContextMenu:function(contextMenu,lineNumber)
5631 {this._sourceFrame.populateTextAreaContextMenu(contextMenu,lineNumber);},createLink:function(hrefValue,isExternal)
5632 {var targetLocation=WebInspector.ParsedURL.completeURL(this._sourceFrame._url,hrefValue);return WebInspector.linkifyURLAsNode(targetLocation||hrefValue,hrefValue,undefined,isExternal);},onJumpToPosition:function(from,to)
5633 {this._sourceFrame.onJumpToPosition(from,to);}}
5634 WebInspector.ResourceView=function(resource)
5635 {WebInspector.VBox.call(this);this.registerRequiredCSS("resourceView.css");this.element.classList.add("resource-view");this.resource=resource;}
5636 WebInspector.ResourceView.prototype={hasContent:function()
5637 {return false;},__proto__:WebInspector.VBox.prototype}
5638 WebInspector.ResourceView.hasTextContent=function(resource)
5639 {if(resource.type.isTextType())
5640 return true;if(resource.type===WebInspector.resourceTypes.Other)
5641 return!!resource.content&&!resource.contentEncoded;return false;}
5642 WebInspector.ResourceView.nonSourceViewForResource=function(resource)
5643 {switch(resource.type){case WebInspector.resourceTypes.Image:return new WebInspector.ImageView(resource);case WebInspector.resourceTypes.Font:return new WebInspector.FontView(resource);default:return new WebInspector.ResourceView(resource);}}
5644 WebInspector.ResourceSourceFrame=function(resource)
5645 {this._resource=resource;WebInspector.SourceFrame.call(this,resource);}
5646 WebInspector.ResourceSourceFrame.prototype={get resource()
5647 {return this._resource;},populateTextAreaContextMenu:function(contextMenu,lineNumber)
5648 {contextMenu.appendApplicableItems(this._resource);},__proto__:WebInspector.SourceFrame.prototype}
5649 WebInspector.ResourceSourceFrameFallback=function(resource)
5650 {WebInspector.VBox.call(this);this._resource=resource;this.element.classList.add("script-view");this._content=this.element.createChild("div","script-view-fallback monospace");}
5651 WebInspector.ResourceSourceFrameFallback.prototype={wasShown:function()
5652 {if(!this._contentRequested){this._contentRequested=true;this._resource.requestContent(this._contentLoaded.bind(this));}},_contentLoaded:function(content)
5653 {this._content.textContent=content;},__proto__:WebInspector.VBox.prototype}
5654 WebInspector.FontView=function(resource)
5655 {WebInspector.ResourceView.call(this,resource);this.element.classList.add("font");}
5656 WebInspector.FontView._fontPreviewLines=["ABCDEFGHIJKLM","NOPQRSTUVWXYZ","abcdefghijklm","nopqrstuvwxyz","1234567890"];WebInspector.FontView._fontId=0;WebInspector.FontView._measureFontSize=50;WebInspector.FontView.prototype={hasContent:function()
5657 {return true;},_createContentIfNeeded:function()
5658 {if(this.fontPreviewElement)
5659 return;var uniqueFontName="WebInspectorFontPreview"+(++WebInspector.FontView._fontId);this.fontStyleElement=document.createElement("style");this.fontStyleElement.textContent="@font-face { font-family: \""+uniqueFontName+"\"; src: url("+this.resource.url+"); }";document.head.appendChild(this.fontStyleElement);var fontPreview=document.createElement("div");for(var i=0;i<WebInspector.FontView._fontPreviewLines.length;++i){if(i>0)
5660 fontPreview.appendChild(document.createElement("br"));fontPreview.appendChild(document.createTextNode(WebInspector.FontView._fontPreviewLines[i]));}
5661 this.fontPreviewElement=fontPreview.cloneNode(true);this.fontPreviewElement.style.setProperty("font-family",uniqueFontName);this.fontPreviewElement.style.setProperty("visibility","hidden");this._dummyElement=fontPreview;this._dummyElement.style.visibility="hidden";this._dummyElement.style.zIndex="-1";this._dummyElement.style.display="inline";this._dummyElement.style.position="absolute";this._dummyElement.style.setProperty("font-family",uniqueFontName);this._dummyElement.style.setProperty("font-size",WebInspector.FontView._measureFontSize+"px");this.element.appendChild(this.fontPreviewElement);},wasShown:function()
5662 {this._createContentIfNeeded();this.updateFontPreviewSize();},onResize:function()
5663 {if(this._inResize)
5664 return;this._inResize=true;try{this.updateFontPreviewSize();}finally{delete this._inResize;}},_measureElement:function()
5665 {this.element.appendChild(this._dummyElement);var result={width:this._dummyElement.offsetWidth,height:this._dummyElement.offsetHeight};this.element.removeChild(this._dummyElement);return result;},updateFontPreviewSize:function()
5666 {if(!this.fontPreviewElement||!this.isShowing())
5667 return;this.fontPreviewElement.style.removeProperty("visibility");var dimension=this._measureElement();const height=dimension.height;const width=dimension.width;const containerWidth=this.element.offsetWidth-50;const containerHeight=this.element.offsetHeight-30;if(!height||!width||!containerWidth||!containerHeight){this.fontPreviewElement.style.removeProperty("font-size");return;}
5668 var widthRatio=containerWidth/width;var heightRatio=containerHeight/height;var finalFontSize=Math.floor(WebInspector.FontView._measureFontSize*Math.min(widthRatio,heightRatio))-2;this.fontPreviewElement.style.setProperty("font-size",finalFontSize+"px",null);},__proto__:WebInspector.ResourceView.prototype}
5669 WebInspector.ImageView=function(resource)
5670 {WebInspector.ResourceView.call(this,resource);this.element.classList.add("image");}
5671 WebInspector.ImageView.prototype={hasContent:function()
5672 {return true;},wasShown:function()
5673 {this._createContentIfNeeded();},_createContentIfNeeded:function()
5674 {if(this._container)
5675 return;var imageContainer=document.createElement("div");imageContainer.className="image";this.element.appendChild(imageContainer);var imagePreviewElement=document.createElement("img");imagePreviewElement.classList.add("resource-image-view");imageContainer.appendChild(imagePreviewElement);imagePreviewElement.addEventListener("contextmenu",this._contextMenu.bind(this),true);this._container=document.createElement("div");this._container.className="info";this.element.appendChild(this._container);var imageNameElement=document.createElement("h1");imageNameElement.className="title";imageNameElement.textContent=this.resource.displayName;this._container.appendChild(imageNameElement);var infoListElement=document.createElement("dl");infoListElement.className="infoList";this.resource.populateImageSource(imagePreviewElement);function onImageLoad()
5676 {var content=this.resource.content;if(content)
5677 var resourceSize=this._base64ToSize(content);else
5678 var resourceSize=this.resource.resourceSize;var imageProperties=[{name:WebInspector.UIString("Dimensions"),value:WebInspector.UIString("%d Ã— %d",imagePreviewElement.naturalWidth,imagePreviewElement.naturalHeight)},{name:WebInspector.UIString("File size"),value:Number.bytesToString(resourceSize)},{name:WebInspector.UIString("MIME type"),value:this.resource.mimeType}];infoListElement.removeChildren();for(var i=0;i<imageProperties.length;++i){var dt=document.createElement("dt");dt.textContent=imageProperties[i].name;infoListElement.appendChild(dt);var dd=document.createElement("dd");dd.textContent=imageProperties[i].value;infoListElement.appendChild(dd);}
5679 var dt=document.createElement("dt");dt.textContent=WebInspector.UIString("URL");infoListElement.appendChild(dt);var dd=document.createElement("dd");var externalResource=true;dd.appendChild(WebInspector.linkifyURLAsNode(this.resource.url,undefined,undefined,externalResource));infoListElement.appendChild(dd);this._container.appendChild(infoListElement);}
5680 imagePreviewElement.addEventListener("load",onImageLoad.bind(this),false);this._imagePreviewElement=imagePreviewElement;},_base64ToSize:function(content)
5681 {if(!content.length)
5682 return 0;var size=(content.length||0)*3/4;if(content.length>0&&content[content.length-1]==="=")
5683 size--;if(content.length>1&&content[content.length-2]==="=")
5684 size--;return size;},_contextMenu:function(event)
5685 {var contextMenu=new WebInspector.ContextMenu(event);contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy image URL":"Copy Image URL"),this._copyImageURL.bind(this));if(this._imagePreviewElement.src)
5686 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy image as Data URL":"Copy Image As Data URL"),this._copyImageAsDataURL.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open image in new tab":"Open Image in New Tab"),this._openInNewTab.bind(this));contextMenu.show();},_copyImageAsDataURL:function()
5687 {InspectorFrontendHost.copyText(this._imagePreviewElement.src);},_copyImageURL:function()
5688 {InspectorFrontendHost.copyText(this.resource.url);},_openInNewTab:function()
5689 {InspectorFrontendHost.openInNewTab(this.resource.url);},__proto__:WebInspector.ResourceView.prototype}
5690 WebInspector.SplitView=function(isVertical,secondIsSidebar,settingName,defaultSidebarWidth,defaultSidebarHeight)
5691 {WebInspector.View.call(this);this.registerRequiredCSS("splitView.css");this.element.classList.add("split-view");this._mainView=new WebInspector.VBox();this._mainView.makeLayoutBoundary();this._mainElement=this._mainView.element;this._mainElement.className="split-view-contents scroll-target split-view-main vbox";this._sidebarView=new WebInspector.VBox();this._sidebarView.makeLayoutBoundary();this._sidebarElement=this._sidebarView.element;this._sidebarElement.className="split-view-contents scroll-target split-view-sidebar vbox";this._resizerElement=this.element.createChild("div","split-view-resizer");this._resizerElement.createChild("div","split-view-resizer-border");if(secondIsSidebar){this._mainView.show(this.element);this._sidebarView.show(this.element);}else{this._sidebarView.show(this.element);this._mainView.show(this.element);}
5692 this._onDragStartBound=this._onDragStart.bind(this);this._resizerElements=[];this._resizable=true;this._defaultSidebarWidth=defaultSidebarWidth||200;this._defaultSidebarHeight=defaultSidebarHeight||this._defaultSidebarWidth;this._settingName=settingName;this.setSecondIsSidebar(secondIsSidebar);this._innerSetVertical(isVertical);this._showMode=WebInspector.SplitView.ShowMode.Both;this.installResizer(this._resizerElement);}
5693 WebInspector.SplitView.SettingForOrientation;WebInspector.SplitView.ShowMode={Both:"Both",OnlyMain:"OnlyMain",OnlySidebar:"OnlySidebar"}
5694 WebInspector.SplitView.Events={SidebarSizeChanged:"SidebarSizeChanged",ShowModeChanged:"ShowModeChanged"}
5695 WebInspector.SplitView.MinPadding=20;WebInspector.SplitView.prototype={isVertical:function()
5696 {return this._isVertical;},setVertical:function(isVertical)
5697 {if(this._isVertical===isVertical)
5698 return;this._innerSetVertical(isVertical);if(this.isShowing())
5699 this._updateLayout();},_innerSetVertical:function(isVertical)
5700 {this.element.classList.remove(this._isVertical?"hbox":"vbox");this._isVertical=isVertical;this.element.classList.add(this._isVertical?"hbox":"vbox");delete this._resizerElementSize;this._sidebarSize=-1;this._restoreSidebarSizeFromSettings();if(this._shouldSaveShowMode)
5701 this._restoreAndApplyShowModeFromSettings();this._updateShowHideSidebarButton();this._updateResizersClass();this.invalidateMinimumSize();},_updateLayout:function(animate)
5702 {delete this._totalSize;this._innerSetSidebarSize(this._preferredSidebarSize(),!!animate);},mainElement:function()
5703 {return this._mainElement;},sidebarElement:function()
5704 {return this._sidebarElement;},isSidebarSecond:function()
5705 {return this._secondIsSidebar;},enableShowModeSaving:function()
5706 {this._shouldSaveShowMode=true;this._restoreAndApplyShowModeFromSettings();},showMode:function()
5707 {return this._showMode;},setSecondIsSidebar:function(secondIsSidebar)
5708 {this._mainElement.classList.toggle("split-view-contents-first",secondIsSidebar);this._mainElement.classList.toggle("split-view-contents-second",!secondIsSidebar);this._sidebarElement.classList.toggle("split-view-contents-first",!secondIsSidebar);this._sidebarElement.classList.toggle("split-view-contents-second",secondIsSidebar);if(secondIsSidebar){if(this._sidebarElement.parentElement&&this._sidebarElement.nextSibling)
5709 this.element.appendChild(this._sidebarElement);}else{if(this._mainElement.parentElement&&this._mainElement.nextSibling)
5710 this.element.appendChild(this._mainElement);}
5711 this._secondIsSidebar=secondIsSidebar;},sidebarSide:function()
5712 {if(this._showMode!==WebInspector.SplitView.ShowMode.Both)
5713 return null;return this._isVertical?(this._secondIsSidebar?"right":"left"):(this._secondIsSidebar?"bottom":"top");},preferredSidebarSize:function()
5714 {return this._preferredSidebarSize();},resizerElement:function()
5715 {return this._resizerElement;},hideMain:function(animate)
5716 {this._showOnly(this._sidebarView,this._mainView,animate);this._updateShowMode(WebInspector.SplitView.ShowMode.OnlySidebar);},hideSidebar:function(animate)
5717 {this._showOnly(this._mainView,this._sidebarView,animate);this._updateShowMode(WebInspector.SplitView.ShowMode.OnlyMain);},detachChildViews:function()
5718 {this._mainView.detachChildViews();this._sidebarView.detachChildViews();},_showOnly:function(sideToShow,sideToHide,animate)
5719 {this._cancelAnimation();function callback()
5720 {sideToShow.show(this.element);sideToHide.detach();sideToShow.element.classList.add("maximized");sideToHide.element.classList.remove("maximized");this._resizerElement.classList.add("hidden");this._removeAllLayoutProperties();}
5721 if(animate){this._animate(true,callback.bind(this));}else{callback.call(this);this.doResize();}
5722 this._sidebarSize=-1;this.setResizable(false);},_removeAllLayoutProperties:function()
5723 {this._sidebarElement.style.removeProperty("flexBasis");this._resizerElement.style.removeProperty("left");this._resizerElement.style.removeProperty("right");this._resizerElement.style.removeProperty("top");this._resizerElement.style.removeProperty("bottom");this._resizerElement.style.removeProperty("margin-left");this._resizerElement.style.removeProperty("margin-right");this._resizerElement.style.removeProperty("margin-top");this._resizerElement.style.removeProperty("margin-bottom");},showBoth:function(animate)
5724 {if(this._showMode===WebInspector.SplitView.ShowMode.Both)
5725 animate=false;this._cancelAnimation();this._mainElement.classList.remove("maximized");this._sidebarElement.classList.remove("maximized");this._resizerElement.classList.remove("hidden");this._mainView.show(this.element);this._sidebarView.show(this.element);this.setSecondIsSidebar(this._secondIsSidebar);this._sidebarSize=-1;this.setResizable(true);this._updateShowMode(WebInspector.SplitView.ShowMode.Both);this._updateLayout(animate);},setResizable:function(resizable)
5726 {this._resizable=resizable;this._updateResizersClass();},setSidebarSize:function(size)
5727 {this._savedSidebarSize=size;this._saveSetting();this._innerSetSidebarSize(size,false);},sidebarSize:function()
5728 {return Math.max(0,this._sidebarSize);},totalSize:function()
5729 {if(!this._totalSize)
5730 this._totalSize=this._isVertical?this.element.offsetWidth:this.element.offsetHeight;return this._totalSize*WebInspector.zoomManager.zoomFactor();},_updateShowMode:function(showMode)
5731 {this._showMode=showMode;this._saveShowModeToSettings();this._updateShowHideSidebarButton();this.dispatchEventToListeners(WebInspector.SplitView.Events.ShowModeChanged,showMode);this.invalidateMinimumSize();},_innerSetSidebarSize:function(size,animate)
5732 {if(this._showMode!==WebInspector.SplitView.ShowMode.Both||!this.isShowing())
5733 return;size=this._applyConstraints(size);if(this._sidebarSize===size)
5734 return;this._removeAllLayoutProperties();var sizeValue=(size/WebInspector.zoomManager.zoomFactor())+"px";this.sidebarElement().style.flexBasis=sizeValue;if(!this._resizerElementSize)
5735 this._resizerElementSize=this._isVertical?this._resizerElement.offsetWidth:this._resizerElement.offsetHeight;if(this._isVertical){if(this._secondIsSidebar){this._resizerElement.style.right=sizeValue;this._resizerElement.style.marginRight=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.left=sizeValue;this._resizerElement.style.marginLeft=-this._resizerElementSize/2+"px";}}else{if(this._secondIsSidebar){this._resizerElement.style.bottom=sizeValue;this._resizerElement.style.marginBottom=-this._resizerElementSize/2+"px";}else{this._resizerElement.style.top=sizeValue;this._resizerElement.style.marginTop=-this._resizerElementSize/2+"px";}}
5736 this._sidebarSize=size;if(animate){this._animate(false);}else{this.doResize();this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged,this.sidebarSize());}},_animate:function(reverse,callback)
5737 {var animationTime=50;this._animationCallback=callback;var animatedMarginPropertyName;if(this._isVertical)
5738 animatedMarginPropertyName=this._secondIsSidebar?"margin-right":"margin-left";else
5739 animatedMarginPropertyName=this._secondIsSidebar?"margin-bottom":"margin-top";var zoomFactor=WebInspector.zoomManager.zoomFactor();var marginFrom=reverse?"0":"-"+(this._sidebarSize/zoomFactor)+"px";var marginTo=reverse?"-"+(this._sidebarSize/zoomFactor)+"px":"0";this.element.style.setProperty(animatedMarginPropertyName,marginFrom);if(!reverse){suppressUnused(this._mainElement.offsetWidth);suppressUnused(this._sidebarElement.offsetWidth);}
5740 if(!reverse)
5741 this._sidebarView.doResize();this.element.style.setProperty("transition",animatedMarginPropertyName+" "+animationTime+"ms linear");var boundAnimationFrame;var startTime;function animationFrame()
5742 {delete this._animationFrameHandle;if(!startTime){this.element.style.setProperty(animatedMarginPropertyName,marginTo);startTime=window.performance.now();}else if(window.performance.now()<startTime+animationTime){this._mainView.doResize();}else{this._cancelAnimation();this._mainView.doResize();this.dispatchEventToListeners(WebInspector.SplitView.Events.SidebarSizeChanged,this.sidebarSize());return;}
5743 this._animationFrameHandle=window.requestAnimationFrame(boundAnimationFrame);}
5744 boundAnimationFrame=animationFrame.bind(this);this._animationFrameHandle=window.requestAnimationFrame(boundAnimationFrame);},_cancelAnimation:function()
5745 {this.element.style.removeProperty("margin-top");this.element.style.removeProperty("margin-right");this.element.style.removeProperty("margin-bottom");this.element.style.removeProperty("margin-left");this.element.style.removeProperty("transition");if(this._animationFrameHandle){window.cancelAnimationFrame(this._animationFrameHandle);delete this._animationFrameHandle;}
5746 if(this._animationCallback){this._animationCallback();delete this._animationCallback;}},_applyConstraints:function(sidebarSize)
5747 {var totalSize=this.totalSize();var size=this._sidebarView.minimumSize();var from=this.isVertical()?size.width:size.height;if(!from)
5748 from=WebInspector.SplitView.MinPadding;size=this._mainView.minimumSize();var minMainSize=this.isVertical()?size.width:size.height;if(!minMainSize)
5749 minMainSize=WebInspector.SplitView.MinPadding;var to=totalSize-minMainSize;if(from<=to)
5750 return Number.constrain(sidebarSize,from,to);return Math.max(0,to);},wasShown:function()
5751 {this._forceUpdateLayout();WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._onZoomChanged,this);},willHide:function()
5752 {WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Events.ZoomChanged,this._onZoomChanged,this);},onResize:function()
5753 {this._updateLayout();},onLayout:function()
5754 {this._updateLayout();},calculateMinimumSize:function()
5755 {if(this._showMode===WebInspector.SplitView.ShowMode.OnlyMain)
5756 return this._mainView.minimumSize();if(this._showMode===WebInspector.SplitView.ShowMode.OnlySidebar)
5757 return this._sidebarView.minimumSize();var mainSize=this._mainView.minimumSize();var sidebarSize=this._sidebarView.minimumSize();var min=WebInspector.SplitView.MinPadding;if(this._isVertical)
5758 return new Size((mainSize.width||min)+(sidebarSize.width||min),Math.max(mainSize.height,sidebarSize.height));else
5759 return new Size(Math.max(mainSize.width,sidebarSize.width),(mainSize.height||min)+(sidebarSize.height||min));},_startResizerDragging:function(event)
5760 {if(!this._resizable)
5761 return false;var dipEventPosition=(this._isVertical?event.pageX:event.pageY)*WebInspector.zoomManager.zoomFactor();this._dragOffset=(this._secondIsSidebar?this.totalSize()-this._sidebarSize:this._sidebarSize)-dipEventPosition;return true;},_resizerDragging:function(event)
5762 {var dipEventPosition=(this._isVertical?event.pageX:event.pageY)*WebInspector.zoomManager.zoomFactor();var newOffset=dipEventPosition+this._dragOffset;var newSize=(this._secondIsSidebar?this.totalSize()-newOffset:newOffset);var constrainedSize=this._applyConstraints(newSize);this._savedSidebarSize=constrainedSize;this._saveSetting();this._innerSetSidebarSize(constrainedSize,false);event.preventDefault();},_endResizerDragging:function(event)
5763 {delete this._dragOffset;},hideDefaultResizer:function()
5764 {this.uninstallResizer(this._resizerElement);},installResizer:function(resizerElement)
5765 {resizerElement.addEventListener("mousedown",this._onDragStartBound,false);resizerElement.classList.toggle("ew-resizer-widget",this._isVertical&&this._resizable);resizerElement.classList.toggle("ns-resizer-widget",!this._isVertical&&this._resizable);if(this._resizerElements.indexOf(resizerElement)===-1)
5766 this._resizerElements.push(resizerElement);},uninstallResizer:function(resizerElement)
5767 {resizerElement.removeEventListener("mousedown",this._onDragStartBound,false);resizerElement.classList.remove("ew-resizer-widget");resizerElement.classList.remove("ns-resizer-widget");this._resizerElements.remove(resizerElement);},hasCustomResizer:function()
5768 {return this._resizerElements.length>1||(this._resizerElements.length==1&&this._resizerElements[0]!==this._resizerElement);},toggleResizer:function(resizer,on)
5769 {if(on)
5770 this.installResizer(resizer);else
5771 this.uninstallResizer(resizer);},_updateResizersClass:function()
5772 {for(var i=0;i<this._resizerElements.length;++i){this._resizerElements[i].classList.toggle("ew-resizer-widget",this._isVertical&&this._resizable);this._resizerElements[i].classList.toggle("ns-resizer-widget",!this._isVertical&&this._resizable);}},_onDragStart:function(event)
5773 {if(this._resizerElements.indexOf(event.target)===-1)
5774 return;WebInspector.elementDragStart(this._startResizerDragging.bind(this),this._resizerDragging.bind(this),this._endResizerDragging.bind(this),this._isVertical?"ew-resize":"ns-resize",event);},_setting:function()
5775 {if(!this._settingName)
5776 return null;if(!WebInspector.settings[this._settingName])
5777 WebInspector.settings[this._settingName]=WebInspector.settings.createSetting(this._settingName,{});return WebInspector.settings[this._settingName];},_settingForOrientation:function()
5778 {var state=this._setting()?this._setting().get():{};return this._isVertical?state.vertical:state.horizontal;},_preferredSidebarSize:function()
5779 {var size=this._savedSidebarSize;if(!size){size=this._isVertical?this._defaultSidebarWidth:this._defaultSidebarHeight;if(0<size&&size<1)
5780 size*=this.totalSize();}
5781 return size;},_restoreSidebarSizeFromSettings:function()
5782 {var settingForOrientation=this._settingForOrientation();this._savedSidebarSize=settingForOrientation?settingForOrientation.size:0;},_restoreAndApplyShowModeFromSettings:function()
5783 {var orientationState=this._settingForOrientation();this._savedShowMode=orientationState?orientationState.showMode:WebInspector.SplitView.ShowMode.Both;this._showMode=this._savedShowMode;switch(this._savedShowMode){case WebInspector.SplitView.ShowMode.Both:this.showBoth();break;case WebInspector.SplitView.ShowMode.OnlyMain:this.hideSidebar();break;case WebInspector.SplitView.ShowMode.OnlySidebar:this.hideMain();break;}},_saveShowModeToSettings:function()
5784 {this._savedShowMode=this._showMode;this._saveSetting();},_saveSetting:function()
5785 {var setting=this._setting();if(!setting)
5786 return;var state=setting.get();var orientationState=(this._isVertical?state.vertical:state.horizontal)||{};orientationState.size=this._savedSidebarSize;if(this._shouldSaveShowMode)
5787 orientationState.showMode=this._savedShowMode;if(this._isVertical)
5788 state.vertical=orientationState;else
5789 state.horizontal=orientationState;setting.set(state);},_forceUpdateLayout:function()
5790 {this._sidebarSize=-1;this._updateLayout();},_onZoomChanged:function(event)
5791 {this._forceUpdateLayout();},createShowHideSidebarButton:function(title,className)
5792 {console.assert(this.isVertical(),"Buttons for split view with horizontal split are not supported yet.");this._showHideSidebarButtonTitle=WebInspector.UIString(title);this._showHideSidebarButton=new WebInspector.StatusBarButton("","sidebar-show-hide-button "+className,3);this._showHideSidebarButton.addEventListener("click",buttonClicked.bind(this));this._updateShowHideSidebarButton();function buttonClicked(event)
5793 {if(this._showMode!==WebInspector.SplitView.ShowMode.Both)
5794 this.showBoth(true);else
5795 this.hideSidebar(true);}
5796 return this._showHideSidebarButton;},_updateShowHideSidebarButton:function()
5797 {if(!this._showHideSidebarButton)
5798 return;var sidebarHidden=this._showMode===WebInspector.SplitView.ShowMode.OnlyMain;this._showHideSidebarButton.state=sidebarHidden?"show":"hide";this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-hide-button",!this.isVertical()&&!this.isSidebarSecond());this._showHideSidebarButton.element.classList.toggle("right-sidebar-show-hide-button",this.isVertical()&&this.isSidebarSecond());this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-show-hide-button",!this.isVertical()&&this.isSidebarSecond());this._showHideSidebarButton.element.classList.toggle("left-sidebar-show-hide-button",this.isVertical()&&!this.isSidebarSecond());this._showHideSidebarButton.title=sidebarHidden?WebInspector.UIString("Show %s",this._showHideSidebarButtonTitle):WebInspector.UIString("Hide %s",this._showHideSidebarButtonTitle);},__proto__:WebInspector.View.prototype}
5799 WebInspector.StackView=function(isVertical)
5800 {WebInspector.VBox.call(this);this._isVertical=isVertical;this._currentSplitView=null;}
5801 WebInspector.StackView.prototype={appendView:function(view,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight)
5802 {var splitView=new WebInspector.SplitView(this._isVertical,true,sidebarSizeSettingName,defaultSidebarWidth,defaultSidebarHeight);view.show(splitView.mainElement());splitView.hideSidebar();if(!this._currentSplitView){splitView.show(this.element);}else{splitView.show(this._currentSplitView.sidebarElement());this._currentSplitView.showBoth();}
5803 this._currentSplitView=splitView;return splitView;},detachChildViews:function()
5804 {WebInspector.View.prototype.detachChildViews.call(this);this._currentSplitView=null;},__proto__:WebInspector.VBox.prototype}
5805 WebInspector.ExtensionServerAPI=function(){}
5806 WebInspector.ExtensionServerAPI.prototype={addExtensions:function(descriptors){}}
5807 WebInspector.ExtensionServerProxy=function()
5808 {}
5809 WebInspector.ExtensionServerProxy._ensureExtensionServer=function()
5810 {if(!WebInspector.extensionServer)
5811 WebInspector.extensionServer=WebInspector.moduleManager.instance(WebInspector.ExtensionServerAPI);},WebInspector.ExtensionServerProxy.prototype={setFrontendReady:function()
5812 {this._frontendReady=true;this._pushExtensionsToServer();},_addExtensions:function(extensions)
5813 {if(extensions.length===0)
5814 return;console.assert(!this._pendingExtensions);this._pendingExtensions=extensions;this._pushExtensionsToServer();},_pushExtensionsToServer:function()
5815 {if(!this._frontendReady||!this._pendingExtensions)
5816 return;WebInspector.ExtensionServerProxy._ensureExtensionServer();WebInspector.extensionServer.addExtensions(this._pendingExtensions);delete this._pendingExtensions;}}
5817 WebInspector.extensionServerProxy=new WebInspector.ExtensionServerProxy();WebInspector.addExtensions=function(extensions)
5818 {WebInspector.extensionServerProxy._addExtensions(extensions);}
5819 WebInspector.setInspectedTabId=function(tabId)
5820 {WebInspector._inspectedTabId=tabId;}
5821 WebInspector.EmptyView=function(text)
5822 {WebInspector.VBox.call(this);this._text=text;}
5823 WebInspector.EmptyView.prototype={wasShown:function()
5824 {this.element.classList.add("empty-view");this.element.textContent=this._text;},set text(text)
5825 {this._text=text;if(this.isShowing())
5826 this.element.textContent=this._text;},__proto__:WebInspector.VBox.prototype}
5827 window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem;WebInspector.TempFile=function(dirPath,name,callback)
5828 {this._fileEntry=null;this._writer=null;function didInitFs(fs)
5829 {fs.root.getDirectory(dirPath,{create:true},didGetDir.bind(this),errorHandler);}
5830 function didGetDir(dir)
5831 {dir.getFile(name,{create:true},didCreateFile.bind(this),errorHandler);}
5832 function didCreateFile(fileEntry)
5833 {this._fileEntry=fileEntry;fileEntry.createWriter(didCreateWriter.bind(this),errorHandler);}
5834 function didCreateWriter(writer)
5835 {function didTruncate(e)
5836 {this._writer=writer;writer.onwrite=null;writer.onerror=null;callback(this);}
5837 function onTruncateError(e)
5838 {WebInspector.console.log("Failed to truncate temp file "+e.code+" : "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
5839 if(writer.length){writer.onwrite=didTruncate.bind(this);writer.onerror=onTruncateError;writer.truncate(0);}else{this._writer=writer;callback(this);}}
5840 function errorHandler(e)
5841 {WebInspector.console.log("Failed to create temp file "+e.code+" : "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
5842 function didClearTempStorage()
5843 {window.requestFileSystem(window.TEMPORARY,10,didInitFs.bind(this),errorHandler);}
5844 WebInspector.TempFile._ensureTempStorageCleared(didClearTempStorage.bind(this));}
5845 WebInspector.TempFile.prototype={write:function(data,callback)
5846 {var blob=new Blob([data],{type:'text/plain'});this._writer.onerror=function(e)
5847 {WebInspector.console.log("Failed to write into a temp file: "+e.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(false);}
5848 this._writer.onwrite=function(e)
5849 {callback(true);}
5850 this._writer.write(blob);},finishWriting:function()
5851 {this._writer=null;},read:function(callback)
5852 {function didGetFile(file)
5853 {var reader=new FileReader();reader.onloadend=function(e)
5854 {callback((this.result));}
5855 reader.onerror=function(error)
5856 {WebInspector.console.log("Failed to read from temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);}
5857 reader.readAsText(file);}
5858 function didFailToGetFile(error)
5859 {WebInspector.console.log("Failed to load temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);callback(null);}
5860 this._fileEntry.file(didGetFile,didFailToGetFile);},writeToOutputSteam:function(outputStream,delegate)
5861 {function didGetFile(file)
5862 {var reader=new WebInspector.ChunkedFileReader(file,10*1000*1000,delegate);reader.start(outputStream);}
5863 function didFailToGetFile(error)
5864 {WebInspector.console.log("Failed to load temp file: "+error.message,WebInspector.ConsoleMessage.MessageLevel.Error);outputStream.close();}
5865 this._fileEntry.file(didGetFile,didFailToGetFile);},remove:function()
5866 {if(this._fileEntry)
5867 this._fileEntry.remove(function(){});}}
5868 WebInspector.BufferedTempFileWriter=function(dirPath,name)
5869 {this._chunks=[];this._tempFile=null;this._isWriting=false;this._finishCallback=null;this._isFinished=false;new WebInspector.TempFile(dirPath,name,this._didCreateTempFile.bind(this));}
5870 WebInspector.BufferedTempFileWriter.prototype={write:function(data)
5871 {if(!this._chunks)
5872 return;if(this._finishCallback)
5873 throw new Error("Now writes are allowed after close.");this._chunks.push(data);if(this._tempFile&&!this._isWriting)
5874 this._writeNextChunk();},close:function(callback)
5875 {this._finishCallback=callback;if(this._isFinished)
5876 callback(this._tempFile);else if(!this._isWriting&&!this._chunks.length)
5877 this._notifyFinished();},_didCreateTempFile:function(tempFile)
5878 {this._tempFile=tempFile;if(!tempFile){this._chunks=null;this._notifyFinished();return;}
5879 if(this._chunks.length)
5880 this._writeNextChunk();},_writeNextChunk:function()
5881 {var chunkSize=0;var endIndex=0;for(;endIndex<this._chunks.length;endIndex++){chunkSize+=this._chunks[endIndex].length;if(chunkSize>10*1000*1000)
5882 break;}
5883 var chunk=this._chunks.slice(0,endIndex+1).join("");this._chunks.splice(0,endIndex+1);this._isWriting=true;this._tempFile.write(chunk,this._didWriteChunk.bind(this));},_didWriteChunk:function(success)
5884 {this._isWriting=false;if(!success){this._tempFile=null;this._chunks=null;this._notifyFinished();return;}
5885 if(this._chunks.length)
5886 this._writeNextChunk();else if(this._finishCallback)
5887 this._notifyFinished();},_notifyFinished:function()
5888 {this._isFinished=true;if(this._tempFile)
5889 this._tempFile.finishWriting();if(this._finishCallback)
5890 this._finishCallback(this._tempFile);}}
5891 WebInspector.TempStorageCleaner=function()
5892 {this._worker=new SharedWorker("TempStorageSharedWorker.js","TempStorage");this._callbacks=[];this._worker.port.onmessage=this._handleMessage.bind(this);this._worker.port.onerror=this._handleError.bind(this);}
5893 WebInspector.TempStorageCleaner.prototype={ensureStorageCleared:function(callback)
5894 {if(this._callbacks)
5895 this._callbacks.push(callback);else
5896 callback();},_handleMessage:function(event)
5897 {if(event.data.type==="tempStorageCleared"){if(event.data.error)
5898 WebInspector.console.log(event.data.error,WebInspector.ConsoleMessage.MessageLevel.Error);this._notifyCallbacks();}},_handleError:function(event)
5899 {WebInspector.console.log(WebInspector.UIString("Failed to clear temp storage: %s",event.data),WebInspector.ConsoleMessage.MessageLevel.Error);this._notifyCallbacks();},_notifyCallbacks:function()
5900 {var callbacks=this._callbacks;this._callbacks=null;for(var i=0;i<callbacks.length;i++)
5901 callbacks[i]();}}
5902 WebInspector.TempFile._ensureTempStorageCleared=function(callback)
5903 {if(!WebInspector.TempFile._storageCleaner)
5904 WebInspector.TempFile._storageCleaner=new WebInspector.TempStorageCleaner();WebInspector.TempFile._storageCleaner.ensureStorageCleared(callback);}
5905 WebInspector.TextRange=function(startLine,startColumn,endLine,endColumn)
5906 {this.startLine=startLine;this.startColumn=startColumn;this.endLine=endLine;this.endColumn=endColumn;}
5907 WebInspector.TextRange.createFromLocation=function(line,column)
5908 {return new WebInspector.TextRange(line,column,line,column);}
5909 WebInspector.TextRange.fromObject=function(serializedTextRange)
5910 {return new WebInspector.TextRange(serializedTextRange.startLine,serializedTextRange.startColumn,serializedTextRange.endLine,serializedTextRange.endColumn);}
5911 WebInspector.TextRange.prototype={isEmpty:function()
5912 {return this.startLine===this.endLine&&this.startColumn===this.endColumn;},immediatelyPrecedes:function(range)
5913 {if(!range)
5914 return false;return this.endLine===range.startLine&&this.endColumn===range.startColumn;},immediatelyFollows:function(range)
5915 {if(!range)
5916 return false;return range.immediatelyPrecedes(this);},get linesCount()
5917 {return this.endLine-this.startLine;},collapseToEnd:function()
5918 {return new WebInspector.TextRange(this.endLine,this.endColumn,this.endLine,this.endColumn);},normalize:function()
5919 {if(this.startLine>this.endLine||(this.startLine===this.endLine&&this.startColumn>this.endColumn))
5920 return new WebInspector.TextRange(this.endLine,this.endColumn,this.startLine,this.startColumn);else
5921 return this.clone();},clone:function()
5922 {return new WebInspector.TextRange(this.startLine,this.startColumn,this.endLine,this.endColumn);},serializeToObject:function()
5923 {var serializedTextRange={};serializedTextRange.startLine=this.startLine;serializedTextRange.startColumn=this.startColumn;serializedTextRange.endLine=this.endLine;serializedTextRange.endColumn=this.endColumn;return serializedTextRange;},compareTo:function(other)
5924 {if(this.startLine>other.startLine)
5925 return 1;if(this.startLine<other.startLine)
5926 return-1;if(this.startColumn>other.startColumn)
5927 return 1;if(this.startColumn<other.startColumn)
5928 return-1;return 0;},equal:function(other)
5929 {return this.startLine===other.startLine&&this.endLine===other.endLine&&this.startColumn===other.startColumn&&this.endColumn===other.endColumn;},shift:function(lineOffset)
5930 {return new WebInspector.TextRange(this.startLine+lineOffset,this.startColumn,this.endLine+lineOffset,this.endColumn);},toString:function()
5931 {return JSON.stringify(this);}}
5932 WebInspector.SourceRange=function(offset,length)
5933 {this.offset=offset;this.length=length;}
5934 WebInspector.TextUtils={isStopChar:function(char)
5935 {return(char>" "&&char<"0")||(char>"9"&&char<"A")||(char>"Z"&&char<"_")||(char>"_"&&char<"a")||(char>"z"&&char<="~");},isWordChar:function(char)
5936 {return!WebInspector.TextUtils.isStopChar(char)&&!WebInspector.TextUtils.isSpaceChar(char);},isSpaceChar:function(char)
5937 {return WebInspector.TextUtils._SpaceCharRegex.test(char);},isWord:function(word)
5938 {for(var i=0;i<word.length;++i){if(!WebInspector.TextUtils.isWordChar(word.charAt(i)))
5939 return false;}
5940 return true;},isOpeningBraceChar:function(char)
5941 {return char==="("||char==="{";},isClosingBraceChar:function(char)
5942 {return char===")"||char==="}";},isBraceChar:function(char)
5943 {return WebInspector.TextUtils.isOpeningBraceChar(char)||WebInspector.TextUtils.isClosingBraceChar(char);},textToWords:function(text)
5944 {var words=[];var startWord=-1;for(var i=0;i<text.length;++i){if(!WebInspector.TextUtils.isWordChar(text.charAt(i))){if(startWord!==-1)
5945 words.push(text.substring(startWord,i));startWord=-1;}else if(startWord===-1)
5946 startWord=i;}
5947 if(startWord!==-1)
5948 words.push(text.substring(startWord));return words;},findBalancedCurlyBrackets:function(source,startIndex,lastIndex){lastIndex=lastIndex||source.length;startIndex=startIndex||0;var counter=0;var inString=false;for(var index=startIndex;index<lastIndex;++index){var character=source[index];if(inString){if(character==="\\")
5949 ++index;else if(character==="\"")
5950 inString=false;}else{if(character==="\"")
5951 inString=true;else if(character==="{")
5952 ++counter;else if(character==="}"){if(--counter===0)
5953 return index+1;}}}
5954 return-1;}}
5955 WebInspector.TextUtils._SpaceCharRegex=/\s/;WebInspector.TextUtils.Indent={TwoSpaces:"  ",FourSpaces:"    ",EightSpaces:"        ",TabCharacter:"\t"}
5956 WebInspector.FileSystemModel=function()
5957 {WebInspector.Object.call(this);this._fileSystemsForOrigin={};WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded,this._securityOriginAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved,this._securityOriginRemoved,this);FileSystemAgent.enable();this._reset();}
5958 WebInspector.FileSystemModel.prototype={_reset:function()
5959 {for(var securityOrigin in this._fileSystemsForOrigin)
5960 this._removeOrigin(securityOrigin);var securityOrigins=WebInspector.resourceTreeModel.securityOrigins();for(var i=0;i<securityOrigins.length;++i)
5961 this._addOrigin(securityOrigins[i]);},_securityOriginAdded:function(event)
5962 {var securityOrigin=(event.data);this._addOrigin(securityOrigin);},_securityOriginRemoved:function(event)
5963 {var securityOrigin=(event.data);this._removeOrigin(securityOrigin);},_addOrigin:function(securityOrigin)
5964 {this._fileSystemsForOrigin[securityOrigin]={};var types=["persistent","temporary"];for(var i=0;i<types.length;++i)
5965 this._requestFileSystemRoot(securityOrigin,types[i],this._fileSystemRootReceived.bind(this,securityOrigin,types[i],this._fileSystemsForOrigin[securityOrigin]));},_removeOrigin:function(securityOrigin)
5966 {for(var type in this._fileSystemsForOrigin[securityOrigin]){var fileSystem=this._fileSystemsForOrigin[securityOrigin][type];delete this._fileSystemsForOrigin[securityOrigin][type];this._fileSystemRemoved(fileSystem);}
5967 delete this._fileSystemsForOrigin[securityOrigin];},_requestFileSystemRoot:function(origin,type,callback)
5968 {function innerCallback(error,errorCode,backendRootEntry)
5969 {if(error){callback(FileError.SECURITY_ERR);return;}
5970 callback(errorCode,backendRootEntry);}
5971 FileSystemAgent.requestFileSystemRoot(origin,type,innerCallback);},_fileSystemAdded:function(fileSystem)
5972 {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemAdded,fileSystem);},_fileSystemRemoved:function(fileSystem)
5973 {this.dispatchEventToListeners(WebInspector.FileSystemModel.EventTypes.FileSystemRemoved,fileSystem);},refreshFileSystemList:function()
5974 {this._reset();},_fileSystemRootReceived:function(origin,type,store,errorCode,backendRootEntry)
5975 {if(!errorCode&&backendRootEntry&&this._fileSystemsForOrigin[origin]===store){var fileSystem=new WebInspector.FileSystemModel.FileSystem(this,origin,type,backendRootEntry);store[type]=fileSystem;this._fileSystemAdded(fileSystem);}},requestDirectoryContent:function(directory,callback)
5976 {this._requestDirectoryContent(directory.url,this._directoryContentReceived.bind(this,directory,callback));},_requestDirectoryContent:function(url,callback)
5977 {function innerCallback(error,errorCode,backendEntries)
5978 {if(error){callback(FileError.SECURITY_ERR);return;}
5979 if(errorCode!==0){callback(errorCode);return;}
5980 callback(errorCode,backendEntries);}
5981 FileSystemAgent.requestDirectoryContent(url,innerCallback);},_directoryContentReceived:function(parentDirectory,callback,errorCode,backendEntries)
5982 {if(!backendEntries){callback(errorCode);return;}
5983 var entries=[];for(var i=0;i<backendEntries.length;++i){if(backendEntries[i].isDirectory)
5984 entries.push(new WebInspector.FileSystemModel.Directory(this,parentDirectory.fileSystem,backendEntries[i]));else
5985 entries.push(new WebInspector.FileSystemModel.File(this,parentDirectory.fileSystem,backendEntries[i]));}
5986 callback(errorCode,entries);},requestMetadata:function(entry,callback)
5987 {function innerCallback(error,errorCode,metadata)
5988 {if(error){callback(FileError.SECURITY_ERR);return;}
5989 callback(errorCode,metadata);}
5990 FileSystemAgent.requestMetadata(entry.url,innerCallback);},requestFileContent:function(file,readAsText,start,end,charset,callback)
5991 {this._requestFileContent(file.url,readAsText,start,end,charset,callback);},_requestFileContent:function(url,readAsText,start,end,charset,callback)
5992 {function innerCallback(error,errorCode,content,charset)
5993 {if(error){if(callback)
5994 callback(FileError.SECURITY_ERR);return;}
5995 if(callback)
5996 callback(errorCode,content,charset);}
5997 FileSystemAgent.requestFileContent(url,readAsText,start,end,charset,innerCallback);},deleteEntry:function(entry,callback)
5998 {var fileSystemModel=this;if(entry===entry.fileSystem.root)
5999 this._deleteEntry(entry.url,hookFileSystemDeletion);else
6000 this._deleteEntry(entry.url,callback);function hookFileSystemDeletion(errorCode)
6001 {callback(errorCode);if(!errorCode)
6002 fileSystemModel._removeFileSystem(entry.fileSystem);}},_deleteEntry:function(url,callback)
6003 {function innerCallback(error,errorCode)
6004 {if(error){if(callback)
6005 callback(FileError.SECURITY_ERR);return;}
6006 if(callback)
6007 callback(errorCode);}
6008 FileSystemAgent.deleteEntry(url,innerCallback);},_removeFileSystem:function(fileSystem)
6009 {var origin=fileSystem.origin;var type=fileSystem.type;if(this._fileSystemsForOrigin[origin]&&this._fileSystemsForOrigin[origin][type]){delete this._fileSystemsForOrigin[origin][type];this._fileSystemRemoved(fileSystem);if(Object.isEmpty(this._fileSystemsForOrigin[origin]))
6010 delete this._fileSystemsForOrigin[origin];}},__proto__:WebInspector.Object.prototype}
6011 WebInspector.FileSystemModel.EventTypes={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
6012 WebInspector.FileSystemModel.FileSystem=function(fileSystemModel,origin,type,backendRootEntry)
6013 {this.origin=origin;this.type=type;this.root=new WebInspector.FileSystemModel.Directory(fileSystemModel,this,backendRootEntry);}
6014 WebInspector.FileSystemModel.FileSystem.prototype={get name()
6015 {return"filesystem:"+this.origin+"/"+this.type;}}
6016 WebInspector.FileSystemModel.Entry=function(fileSystemModel,fileSystem,backendEntry)
6017 {this._fileSystemModel=fileSystemModel;this._fileSystem=fileSystem;this._url=backendEntry.url;this._name=backendEntry.name;this._isDirectory=backendEntry.isDirectory;}
6018 WebInspector.FileSystemModel.Entry.compare=function(x,y)
6019 {if(x.isDirectory!=y.isDirectory)
6020 return y.isDirectory?1:-1;return x.name.compareTo(y.name);}
6021 WebInspector.FileSystemModel.Entry.prototype={get fileSystemModel()
6022 {return this._fileSystemModel;},get fileSystem()
6023 {return this._fileSystem;},get url()
6024 {return this._url;},get name()
6025 {return this._name;},get isDirectory()
6026 {return this._isDirectory;},requestMetadata:function(callback)
6027 {this.fileSystemModel.requestMetadata(this,callback);},deleteEntry:function(callback)
6028 {this.fileSystemModel.deleteEntry(this,callback);}}
6029 WebInspector.FileSystemModel.Directory=function(fileSystemModel,fileSystem,backendEntry)
6030 {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);}
6031 WebInspector.FileSystemModel.Directory.prototype={requestDirectoryContent:function(callback)
6032 {this.fileSystemModel.requestDirectoryContent(this,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype}
6033 WebInspector.FileSystemModel.File=function(fileSystemModel,fileSystem,backendEntry)
6034 {WebInspector.FileSystemModel.Entry.call(this,fileSystemModel,fileSystem,backendEntry);this._mimeType=backendEntry.mimeType;this._resourceType=WebInspector.resourceTypes[backendEntry.resourceType];this._isTextFile=backendEntry.isTextFile;}
6035 WebInspector.FileSystemModel.File.prototype={get mimeType()
6036 {return this._mimeType;},get resourceType()
6037 {return this._resourceType;},get isTextFile()
6038 {return this._isTextFile;},requestFileContent:function(readAsText,start,end,charset,callback)
6039 {this.fileSystemModel.requestFileContent(this,readAsText,start,end,charset,callback);},__proto__:WebInspector.FileSystemModel.Entry.prototype}
6040 WebInspector.OutputStreamDelegate=function()
6041 {}
6042 WebInspector.OutputStreamDelegate.prototype={onTransferStarted:function(){},onTransferFinished:function(){},onChunkTransferred:function(reader){},onError:function(reader,event){},}
6043 WebInspector.OutputStream=function()
6044 {}
6045 WebInspector.OutputStream.prototype={write:function(data,callback){},close:function(){}}
6046 WebInspector.ChunkedReader=function()
6047 {}
6048 WebInspector.ChunkedReader.prototype={fileSize:function(){},loadedSize:function(){},fileName:function(){},cancel:function(){}}
6049 WebInspector.ChunkedFileReader=function(file,chunkSize,delegate)
6050 {this._file=file;this._fileSize=file.size;this._loadedSize=0;this._chunkSize=chunkSize;this._delegate=delegate;this._isCanceled=false;}
6051 WebInspector.ChunkedFileReader.prototype={start:function(output)
6052 {this._output=output;this._reader=new FileReader();this._reader.onload=this._onChunkLoaded.bind(this);this._reader.onerror=this._delegate.onError.bind(this._delegate,this);this._delegate.onTransferStarted();this._loadChunk();},cancel:function()
6053 {this._isCanceled=true;},loadedSize:function()
6054 {return this._loadedSize;},fileSize:function()
6055 {return this._fileSize;},fileName:function()
6056 {return this._file.name;},_onChunkLoaded:function(event)
6057 {if(this._isCanceled)
6058 return;if(event.target.readyState!==FileReader.DONE)
6059 return;var data=event.target.result;this._loadedSize+=data.length;this._output.write(data);if(this._isCanceled)
6060 return;this._delegate.onChunkTransferred(this);if(this._loadedSize===this._fileSize){this._file=null;this._reader=null;this._output.close();this._delegate.onTransferFinished();return;}
6061 this._loadChunk();},_loadChunk:function()
6062 {var chunkStart=this._loadedSize;var chunkEnd=Math.min(this._fileSize,chunkStart+this._chunkSize)
6063 var nextPart=this._file.slice(chunkStart,chunkEnd);this._reader.readAsText(nextPart);}}
6064 WebInspector.ChunkedXHRReader=function(url,delegate)
6065 {this._url=url;this._delegate=delegate;this._fileSize=0;this._loadedSize=0;this._isCanceled=false;}
6066 WebInspector.ChunkedXHRReader.prototype={start:function(output)
6067 {this._output=output;this._xhr=new XMLHttpRequest();this._xhr.open("GET",this._url,true);this._xhr.onload=this._onLoad.bind(this);this._xhr.onprogress=this._onProgress.bind(this);this._xhr.onerror=this._delegate.onError.bind(this._delegate,this);this._xhr.send(null);this._delegate.onTransferStarted();},cancel:function()
6068 {this._isCanceled=true;this._xhr.abort();},loadedSize:function()
6069 {return this._loadedSize;},fileSize:function()
6070 {return this._fileSize;},fileName:function()
6071 {return this._url;},_onProgress:function(event)
6072 {if(this._isCanceled)
6073 return;if(event.lengthComputable)
6074 this._fileSize=event.total;var data=this._xhr.responseText.substring(this._loadedSize);if(!data.length)
6075 return;this._loadedSize+=data.length;this._output.write(data);if(this._isCanceled)
6076 return;this._delegate.onChunkTransferred(this);},_onLoad:function(event)
6077 {this._onProgress(event);if(this._isCanceled)
6078 return;this._output.close();this._delegate.onTransferFinished();}}
6079 WebInspector.createFileSelectorElement=function(callback){var fileSelectorElement=document.createElement("input");fileSelectorElement.type="file";fileSelectorElement.style.display="none";fileSelectorElement.setAttribute("tabindex",-1);fileSelectorElement.onchange=onChange;function onChange(event)
6080 {callback(fileSelectorElement.files[0]);};return fileSelectorElement;}
6081 WebInspector.FileOutputStream=function()
6082 {}
6083 WebInspector.FileOutputStream.prototype={open:function(fileName,callback)
6084 {this._closed=false;this._writeCallbacks=[];this._fileName=fileName;function callbackWrapper(accepted)
6085 {if(accepted)
6086 WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);callback(accepted);}
6087 WebInspector.fileManager.save(this._fileName,"",true,callbackWrapper.bind(this));},write:function(data,callback)
6088 {this._writeCallbacks.push(callback);WebInspector.fileManager.append(this._fileName,data);},close:function()
6089 {this._closed=true;if(this._writeCallbacks.length)
6090 return;WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);},_onAppendDone:function(event)
6091 {if(event.data!==this._fileName)
6092 return;var callback=this._writeCallbacks.shift();if(callback)
6093 callback(this);if(!this._writeCallbacks.length){if(this._closed){WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL,this._onAppendDone,this);WebInspector.fileManager.close(this._fileName);}}}}
6094 WebInspector.DebuggerModel=function(target)
6095 {target.registerDebuggerDispatcher(new WebInspector.DebuggerDispatcher(this));this._agent=target.debuggerAgent();this._target=target;this._debuggerPausedDetails=null;this._scripts={};this._scriptsBySourceURL=new StringMap();this._breakpointsActive=true;WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOnExceptionStateChanged,this);WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncStackTracesStateChanged,this);this.enableDebugger();this.applySkipStackFrameSettings();}
6096 WebInspector.DebuggerModel.PauseOnExceptionsState={DontPauseOnExceptions:"none",PauseOnAllExceptions:"all",PauseOnUncaughtExceptions:"uncaught"};WebInspector.DebuggerModel.Location=function(scriptId,lineNumber,columnNumber)
6097 {this.scriptId=scriptId;this.lineNumber=lineNumber;this.columnNumber=columnNumber;}
6098 WebInspector.DebuggerModel.Events={DebuggerWasEnabled:"DebuggerWasEnabled",DebuggerWasDisabled:"DebuggerWasDisabled",DebuggerPaused:"DebuggerPaused",DebuggerResumed:"DebuggerResumed",ParsedScriptSource:"ParsedScriptSource",FailedToParseScriptSource:"FailedToParseScriptSource",BreakpointResolved:"BreakpointResolved",GlobalObjectCleared:"GlobalObjectCleared",CallFrameSelected:"CallFrameSelected",ConsoleCommandEvaluatedInSelectedCallFrame:"ConsoleCommandEvaluatedInSelectedCallFrame",BreakpointsActiveStateChanged:"BreakpointsActiveStateChanged"}
6099 WebInspector.DebuggerModel.BreakReason={DOM:"DOM",EventListener:"EventListener",XHR:"XHR",Exception:"exception",Assert:"assert",CSPViolation:"CSPViolation",DebugCommand:"debugCommand"}
6100 WebInspector.DebuggerModel.prototype={debuggerEnabled:function()
6101 {return!!this._debuggerEnabled;},enableDebugger:function()
6102 {if(this._debuggerEnabled)
6103 return;this._agent.enable(this._debuggerWasEnabled.bind(this));},disableDebugger:function()
6104 {if(!this._debuggerEnabled)
6105 return;this._agent.disable(this._debuggerWasDisabled.bind(this));},skipAllPauses:function(skip,untilReload)
6106 {if(this._skipAllPausesTimeout){clearTimeout(this._skipAllPausesTimeout);delete this._skipAllPausesTimeout;}
6107 this._agent.setSkipAllPauses(skip,untilReload);},skipAllPausesUntilReloadOrTimeout:function(timeout)
6108 {if(this._skipAllPausesTimeout)
6109 clearTimeout(this._skipAllPausesTimeout);this._agent.setSkipAllPauses(true,true);this._skipAllPausesTimeout=setTimeout(this.skipAllPauses.bind(this,false),timeout);},_debuggerWasEnabled:function()
6110 {this._debuggerEnabled=true;this._pauseOnExceptionStateChanged();this._asyncStackTracesStateChanged();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasEnabled);},_pauseOnExceptionStateChanged:function()
6111 {var state;if(!WebInspector.settings.pauseOnExceptionEnabled.get()){state=WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions;}else if(WebInspector.settings.pauseOnCaughtException.get()){state=WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions;}else{state=WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions;}
6112 this._agent.setPauseOnExceptions(state);},_asyncStackTracesStateChanged:function()
6113 {const maxAsyncStackChainDepth=4;var enabled=WebInspector.settings.enableAsyncStackTraces.get();this._agent.setAsyncCallStackDepth(enabled?maxAsyncStackChainDepth:0);},_debuggerWasDisabled:function()
6114 {this._debuggerEnabled=false;this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasDisabled);},continueToLocation:function(rawLocation)
6115 {this._agent.continueToLocation(rawLocation);},stepInto:function()
6116 {function callback()
6117 {this._agent.stepInto();}
6118 this._agent.setOverlayMessage(undefined,callback.bind(this));},stepOver:function()
6119 {function callback()
6120 {this._agent.stepOver();}
6121 this._agent.setOverlayMessage(undefined,callback.bind(this));},stepOut:function()
6122 {function callback()
6123 {this._agent.stepOut();}
6124 this._agent.setOverlayMessage(undefined,callback.bind(this));},resume:function()
6125 {function callback()
6126 {this._agent.resume();}
6127 this._agent.setOverlayMessage(undefined,callback.bind(this));},setBreakpointByScriptLocation:function(rawLocation,condition,callback)
6128 {var script=this.scriptForId(rawLocation.scriptId);if(script.sourceURL)
6129 this.setBreakpointByURL(script.sourceURL,rawLocation.lineNumber,rawLocation.columnNumber,condition,callback);else
6130 this.setBreakpointBySourceId(rawLocation,condition,callback);},setBreakpointByURL:function(url,lineNumber,columnNumber,condition,callback)
6131 {var minColumnNumber=0;var scripts=this._scriptsBySourceURL.get(url)||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(lineNumber===script.lineOffset)
6132 minColumnNumber=minColumnNumber?Math.min(minColumnNumber,script.columnOffset):script.columnOffset;}
6133 columnNumber=Math.max(columnNumber,minColumnNumber);function didSetBreakpoint(error,breakpointId,locations)
6134 {if(callback){var rawLocations=(locations);callback(error?null:breakpointId,rawLocations);}}
6135 this._agent.setBreakpointByUrl(lineNumber,url,undefined,columnNumber,condition,undefined,didSetBreakpoint);WebInspector.userMetrics.ScriptsBreakpointSet.record();},setBreakpointBySourceId:function(rawLocation,condition,callback)
6136 {function didSetBreakpoint(error,breakpointId,actualLocation)
6137 {if(callback){var rawLocation=(actualLocation);callback(error?null:breakpointId,[rawLocation]);}}
6138 this._agent.setBreakpoint(rawLocation,condition,didSetBreakpoint);WebInspector.userMetrics.ScriptsBreakpointSet.record();},removeBreakpoint:function(breakpointId,callback)
6139 {this._agent.removeBreakpoint(breakpointId,innerCallback);function innerCallback(error)
6140 {if(error)
6141 console.error("Failed to remove breakpoint: "+error);if(callback)
6142 callback();}},_breakpointResolved:function(breakpointId,location)
6143 {this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved,{breakpointId:breakpointId,location:location});},_globalObjectCleared:function()
6144 {this._setDebuggerPausedDetails(null);this._reset();this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.GlobalObjectCleared);},_reset:function()
6145 {this._scripts={};this._scriptsBySourceURL.clear();},get scripts()
6146 {return this._scripts;},scriptForId:function(scriptId)
6147 {return this._scripts[scriptId]||null;},scriptsForSourceURL:function(sourceURL)
6148 {if(!sourceURL)
6149 return[];return this._scriptsBySourceURL.get(sourceURL)||[];},setScriptSource:function(scriptId,newSource,callback)
6150 {this._scripts[scriptId].editSource(newSource,this._didEditScriptSource.bind(this,scriptId,newSource,callback));},_didEditScriptSource:function(scriptId,newSource,callback,error,errorData,callFrames,asyncStackTrace,needsStepIn)
6151 {callback(error,errorData);if(needsStepIn)
6152 this.stepInto();else if(!error&&callFrames&&callFrames.length)
6153 this._pausedScript(callFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);},get callFrames()
6154 {return this._debuggerPausedDetails?this._debuggerPausedDetails.callFrames:null;},debuggerPausedDetails:function()
6155 {return this._debuggerPausedDetails;},_setDebuggerPausedDetails:function(debuggerPausedDetails)
6156 {if(this._debuggerPausedDetails)
6157 this._debuggerPausedDetails.dispose();this._debuggerPausedDetails=debuggerPausedDetails;if(this._debuggerPausedDetails)
6158 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused,this._debuggerPausedDetails);if(debuggerPausedDetails){this.setSelectedCallFrame(debuggerPausedDetails.callFrames[0]);this._agent.setOverlayMessage(WebInspector.UIString("Paused in debugger"));}else{this.setSelectedCallFrame(null);this._agent.setOverlayMessage();}},_pausedScript:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
6159 {this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(this,callFrames,reason,auxData,breakpointIds,asyncStackTrace));},_resumedScript:function()
6160 {this._setDebuggerPausedDetails(null);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);},_parsedScriptSource:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
6161 {var script=new WebInspector.Script(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL);this._registerScript(script);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource,script);},_registerScript:function(script)
6162 {this._scripts[script.scriptId]=script;if(script.isAnonymousScript())
6163 return;var scripts=this._scriptsBySourceURL.get(script.sourceURL);if(!scripts){scripts=[];this._scriptsBySourceURL.put(script.sourceURL,scripts);}
6164 scripts.push(script);},createRawLocation:function(script,lineNumber,columnNumber)
6165 {if(script.sourceURL)
6166 return this.createRawLocationByURL(script.sourceURL,lineNumber,columnNumber)
6167 return new WebInspector.DebuggerModel.Location(script.scriptId,lineNumber,columnNumber);},createRawLocationByURL:function(sourceURL,lineNumber,columnNumber)
6168 {var closestScript=null;var scripts=this._scriptsBySourceURL.get(sourceURL)||[];for(var i=0,l=scripts.length;i<l;++i){var script=scripts[i];if(!closestScript)
6169 closestScript=script;if(script.lineOffset>lineNumber||(script.lineOffset===lineNumber&&script.columnOffset>columnNumber))
6170 continue;if(script.endLine<lineNumber||(script.endLine===lineNumber&&script.endColumn<=columnNumber))
6171 continue;closestScript=script;break;}
6172 return closestScript?new WebInspector.DebuggerModel.Location(closestScript.scriptId,lineNumber,columnNumber):null;},isPaused:function()
6173 {return!!this.debuggerPausedDetails();},setSelectedCallFrame:function(callFrame)
6174 {this._selectedCallFrame=callFrame;if(!this._selectedCallFrame)
6175 return;this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.CallFrameSelected,callFrame);},selectedCallFrame:function()
6176 {return this._selectedCallFrame;},evaluateOnSelectedCallFrame:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
6177 {function didEvaluate(result,wasThrown)
6178 {if(!result)
6179 callback(null,false);else if(returnByValue)
6180 callback(null,!!wasThrown,wasThrown?null:result);else
6181 callback(WebInspector.RemoteObject.fromPayload(result,this._target),!!wasThrown);if(objectGroup==="console")
6182 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ConsoleCommandEvaluatedInSelectedCallFrame);}
6183 this.selectedCallFrame().evaluate(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluate.bind(this));},getSelectedCallFrameVariables:function(callback)
6184 {var result={this:true};var selectedCallFrame=this._selectedCallFrame;if(!selectedCallFrame)
6185 callback(result);var pendingRequests=0;function propertiesCollected(properties)
6186 {for(var i=0;properties&&i<properties.length;++i)
6187 result[properties[i].name]=true;if(--pendingRequests==0)
6188 callback(result);}
6189 for(var i=0;i<selectedCallFrame.scopeChain.length;++i){var scope=selectedCallFrame.scopeChain[i];var object=WebInspector.RemoteObject.fromPayload(scope.object,this._target);pendingRequests++;object.getAllProperties(false,propertiesCollected);}},setBreakpointsActive:function(active)
6190 {if(this._breakpointsActive===active)
6191 return;this._breakpointsActive=active;this._agent.setBreakpointsActive(active);this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointsActiveStateChanged,active);},breakpointsActive:function()
6192 {return this._breakpointsActive;},createLiveLocation:function(rawLocation,updateDelegate)
6193 {var script=this._scripts[rawLocation.scriptId];return script.createLiveLocation(rawLocation,updateDelegate);},rawLocationToUILocation:function(rawLocation)
6194 {var script=this._scripts[rawLocation.scriptId];if(!script)
6195 return null;return script.rawLocationToUILocation(rawLocation.lineNumber,rawLocation.columnNumber);},callStackModified:function(newCallFrames,details,asyncStackTrace)
6196 {if(details&&details["stack_update_needs_step_in"])
6197 this.stepInto();else if(newCallFrames&&newCallFrames.length)
6198 this._pausedScript(newCallFrames,this._debuggerPausedDetails.reason,this._debuggerPausedDetails.auxData,this._debuggerPausedDetails.breakpointIds,asyncStackTrace);},applySkipStackFrameSettings:function()
6199 {if(!WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled())
6200 return;var settings=WebInspector.settings;var patternParameter=settings.skipStackFramesSwitch.get()?settings.skipStackFramesPattern.get():undefined;this._agent.skipStackFrames(patternParameter);},__proto__:WebInspector.Object.prototype}
6201 WebInspector.DebuggerEventTypes={JavaScriptPause:0,JavaScriptBreakpoint:1,NativeBreakpoint:2};WebInspector.DebuggerDispatcher=function(debuggerModel)
6202 {this._debuggerModel=debuggerModel;}
6203 WebInspector.DebuggerDispatcher.prototype={paused:function(callFrames,reason,auxData,breakpointIds,asyncStackTrace)
6204 {this._debuggerModel._pausedScript(callFrames,reason,auxData,breakpointIds||[],asyncStackTrace);},resumed:function()
6205 {this._debuggerModel._resumedScript();},globalObjectCleared:function()
6206 {this._debuggerModel._globalObjectCleared();},scriptParsed:function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
6207 {this._debuggerModel._parsedScriptSource(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,!!isContentScript,sourceMapURL,hasSourceURL);},scriptFailedToParse:function(sourceURL,source,startingLine,errorLine,errorMessage)
6208 {},breakpointResolved:function(breakpointId,location)
6209 {this._debuggerModel._breakpointResolved(breakpointId,location);}}
6210 WebInspector.DebuggerModel.CallFrame=function(debuggerModel,script,payload,isAsync)
6211 {this._debuggerModel=debuggerModel;this._debuggerAgent=debuggerModel._agent;this._script=script;this._payload=payload;this._locations=[];this._isAsync=isAsync;}
6212 WebInspector.DebuggerModel.CallFrame.fromPayloadArray=function(debuggerModel,callFrames,isAsync)
6213 {var result=[];for(var i=0;i<callFrames.length;++i){var callFrame=callFrames[i];var script=debuggerModel.scriptForId(callFrame.location.scriptId);if(script)
6214 result.push(new WebInspector.DebuggerModel.CallFrame(debuggerModel,script,callFrame,isAsync));}
6215 return result;}
6216 WebInspector.DebuggerModel.CallFrame.prototype={get script()
6217 {return this._script;},get type()
6218 {return this._payload.type;},get id()
6219 {return this._payload.callFrameId;},get scopeChain()
6220 {return this._payload.scopeChain;},get this()
6221 {return this._payload.this;},get returnValue()
6222 {return this._payload.returnValue;},get functionName()
6223 {return this._payload.functionName;},get location()
6224 {var rawLocation=(this._payload.location);return rawLocation;},isAsync:function()
6225 {return!!this._isAsync;},evaluate:function(code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
6226 {function didEvaluateOnCallFrame(error,result,wasThrown)
6227 {if(error){console.error(error);callback(null,false);return;}
6228 callback(result,wasThrown);}
6229 this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId,code,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,didEvaluateOnCallFrame);},restart:function(callback)
6230 {function protocolCallback(error,callFrames,details,asyncStackTrace)
6231 {if(!error)
6232 this._debuggerModel.callStackModified(callFrames,details,asyncStackTrace);if(callback)
6233 callback(error);}
6234 this._debuggerAgent.restartFrame(this._payload.callFrameId,protocolCallback.bind(this));},createLiveLocation:function(updateDelegate)
6235 {var location=this._script.createLiveLocation(this.location,updateDelegate);this._locations.push(location);return location;},dispose:function()
6236 {for(var i=0;i<this._locations.length;++i)
6237 this._locations[i].dispose();this._locations=[];}}
6238 WebInspector.DebuggerModel.StackTrace=function(callFrames,asyncStackTrace,description)
6239 {this.callFrames=callFrames;this.asyncStackTrace=asyncStackTrace;this.description=description;}
6240 WebInspector.DebuggerModel.StackTrace.fromPayload=function(debuggerModel,payload,isAsync)
6241 {if(!payload)
6242 return null;var callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(debuggerModel,payload.callFrames,isAsync);if(!callFrames.length)
6243 return null;var asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(debuggerModel,payload.asyncStackTrace,true);return new WebInspector.DebuggerModel.StackTrace(callFrames,asyncStackTrace,payload.description);}
6244 WebInspector.DebuggerModel.StackTrace.prototype={dispose:function()
6245 {for(var i=0;i<this.callFrames.length;++i)
6246 this.callFrames[i].dispose();if(this.asyncStackTrace)
6247 this.asyncStackTrace.dispose();}}
6248 WebInspector.DebuggerPausedDetails=function(debuggerModel,callFrames,reason,auxData,breakpointIds,asyncStackTrace)
6249 {this.callFrames=WebInspector.DebuggerModel.CallFrame.fromPayloadArray(debuggerModel,callFrames);this.reason=reason;this.auxData=auxData;this.breakpointIds=breakpointIds;this.asyncStackTrace=WebInspector.DebuggerModel.StackTrace.fromPayload(debuggerModel,asyncStackTrace,true);}
6250 WebInspector.DebuggerPausedDetails.prototype={dispose:function()
6251 {for(var i=0;i<this.callFrames.length;++i)
6252 this.callFrames[i].dispose();if(this.asyncStackTrace)
6253 this.asyncStackTrace.dispose();}}
6254 WebInspector.debuggerModel;function SourceMapV3()
6255 {this.version;this.file;this.sources;this.sections;this.mappings;this.sourceRoot;}
6256 SourceMapV3.Section=function()
6257 {this.map;this.offset;}
6258 SourceMapV3.Offset=function()
6259 {this.line;this.column;}
6260 WebInspector.SourceMap=function(sourceMappingURL,payload)
6261 {if(!WebInspector.SourceMap.prototype._base64Map){const base64Digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";WebInspector.SourceMap.prototype._base64Map={};for(var i=0;i<base64Digits.length;++i)
6262 WebInspector.SourceMap.prototype._base64Map[base64Digits.charAt(i)]=i;}
6263 this._sourceMappingURL=sourceMappingURL;this._reverseMappingsBySourceURL={};this._mappings=[];this._sources={};this._sourceContentByURL={};this._parseMappingPayload(payload);}
6264 WebInspector.SourceMap._sourceMapRequestHeaderName="X-Source-Map-Request-From";WebInspector.SourceMap._sourceMapRequestHeaderValue="inspector";WebInspector.SourceMap.hasSourceMapRequestHeader=function(request)
6265 {return request&&request.requestHeaderValue(WebInspector.SourceMap._sourceMapRequestHeaderName)===WebInspector.SourceMap._sourceMapRequestHeaderValue;}
6266 WebInspector.SourceMap.load=function(sourceMapURL,compiledURL,callback)
6267 {var headers={};headers[WebInspector.SourceMap._sourceMapRequestHeaderName]=WebInspector.SourceMap._sourceMapRequestHeaderValue;NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,sourceMapURL,headers,contentLoaded);function contentLoaded(error,statusCode,headers,content)
6268 {if(error||!content||statusCode>=400){callback(null);return;}
6269 if(content.slice(0,3)===")]}")
6270 content=content.substring(content.indexOf('\n'));try{var payload=(JSON.parse(content));var baseURL=sourceMapURL.startsWith("data:")?compiledURL:sourceMapURL;callback(new WebInspector.SourceMap(baseURL,payload));}catch(e){console.error(e.message);callback(null);}}}
6271 WebInspector.SourceMap.prototype={url:function()
6272 {return this._sourceMappingURL;},sources:function()
6273 {return Object.keys(this._sources);},sourceContent:function(sourceURL)
6274 {return this._sourceContentByURL[sourceURL];},sourceContentProvider:function(sourceURL,contentType)
6275 {var sourceContent=this.sourceContent(sourceURL);if(sourceContent)
6276 return new WebInspector.StaticContentProvider(contentType,sourceContent);return new WebInspector.CompilerSourceMappingContentProvider(sourceURL,contentType);},_parseMappingPayload:function(mappingPayload)
6277 {if(mappingPayload.sections)
6278 this._parseSections(mappingPayload.sections);else
6279 this._parseMap(mappingPayload,0,0);},_parseSections:function(sections)
6280 {for(var i=0;i<sections.length;++i){var section=sections[i];this._parseMap(section.map,section.offset.line,section.offset.column);}},findEntry:function(lineNumber,columnNumber)
6281 {var first=0;var count=this._mappings.length;while(count>1){var step=count>>1;var middle=first+step;var mapping=this._mappings[middle];if(lineNumber<mapping[0]||(lineNumber===mapping[0]&&columnNumber<mapping[1]))
6282 count=step;else{first=middle;count-=step;}}
6283 var entry=this._mappings[first];if(!first&&entry&&(lineNumber<entry[0]||(lineNumber===entry[0]&&columnNumber<entry[1])))
6284 return null;return entry;},findEntryReversed:function(sourceURL,lineNumber)
6285 {var mappings=this._reverseMappingsBySourceURL[sourceURL];for(;lineNumber<mappings.length;++lineNumber){var mapping=mappings[lineNumber];if(mapping)
6286 return mapping;}
6287 return this._mappings[0];},_parseMap:function(map,lineNumber,columnNumber)
6288 {var sourceIndex=0;var sourceLineNumber=0;var sourceColumnNumber=0;var nameIndex=0;var sources=[];var originalToCanonicalURLMap={};for(var i=0;i<map.sources.length;++i){var originalSourceURL=map.sources[i];var sourceRoot=map.sourceRoot||"";if(sourceRoot&&!sourceRoot.endsWith("/"))
6289 sourceRoot+="/";var href=sourceRoot+originalSourceURL;var url=WebInspector.ParsedURL.completeURL(this._sourceMappingURL,href)||href;originalToCanonicalURLMap[originalSourceURL]=url;sources.push(url);this._sources[url]=true;if(map.sourcesContent&&map.sourcesContent[i])
6290 this._sourceContentByURL[url]=map.sourcesContent[i];}
6291 var stringCharIterator=new WebInspector.SourceMap.StringCharIterator(map.mappings);var sourceURL=sources[sourceIndex];while(true){if(stringCharIterator.peek()===",")
6292 stringCharIterator.next();else{while(stringCharIterator.peek()===";"){lineNumber+=1;columnNumber=0;stringCharIterator.next();}
6293 if(!stringCharIterator.hasNext())
6294 break;}
6295 columnNumber+=this._decodeVLQ(stringCharIterator);if(this._isSeparator(stringCharIterator.peek())){this._mappings.push([lineNumber,columnNumber]);continue;}
6296 var sourceIndexDelta=this._decodeVLQ(stringCharIterator);if(sourceIndexDelta){sourceIndex+=sourceIndexDelta;sourceURL=sources[sourceIndex];}
6297 sourceLineNumber+=this._decodeVLQ(stringCharIterator);sourceColumnNumber+=this._decodeVLQ(stringCharIterator);if(!this._isSeparator(stringCharIterator.peek()))
6298 nameIndex+=this._decodeVLQ(stringCharIterator);this._mappings.push([lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber]);}
6299 for(var i=0;i<this._mappings.length;++i){var mapping=this._mappings[i];var url=mapping[2];if(!url)
6300 continue;if(!this._reverseMappingsBySourceURL[url])
6301 this._reverseMappingsBySourceURL[url]=[];var reverseMappings=this._reverseMappingsBySourceURL[url];var sourceLine=mapping[3];if(!reverseMappings[sourceLine])
6302 reverseMappings[sourceLine]=[mapping[0],mapping[1]];}},_isSeparator:function(char)
6303 {return char===","||char===";";},_decodeVLQ:function(stringCharIterator)
6304 {var result=0;var shift=0;do{var digit=this._base64Map[stringCharIterator.next()];result+=(digit&this._VLQ_BASE_MASK)<<shift;shift+=this._VLQ_BASE_SHIFT;}while(digit&this._VLQ_CONTINUATION_MASK);var negative=result&1;result>>=1;return negative?-result:result;},_VLQ_BASE_SHIFT:5,_VLQ_BASE_MASK:(1<<5)-1,_VLQ_CONTINUATION_MASK:1<<5}
6305 WebInspector.SourceMap.StringCharIterator=function(string)
6306 {this._string=string;this._position=0;}
6307 WebInspector.SourceMap.StringCharIterator.prototype={next:function()
6308 {return this._string.charAt(this._position++);},peek:function()
6309 {return this._string.charAt(this._position);},hasNext:function()
6310 {return this._position<this._string.length;}}
6311 WebInspector.SourceMapping=function()
6312 {}
6313 WebInspector.SourceMapping.prototype={rawLocationToUILocation:function(rawLocation){},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber){},isIdentity:function(){}}
6314 WebInspector.ScriptSourceMapping=function()
6315 {}
6316 WebInspector.ScriptSourceMapping.prototype={addScript:function(script){}}
6317 WebInspector.LayerTreeModel=function()
6318 {WebInspector.Object.call(this);this._layersById={};this._lastPaintRectByLayerId={};this._backendNodeIdToNodeId={};InspectorBackend.registerLayerTreeDispatcher(new WebInspector.LayerTreeDispatcher(this));WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUpdated,this._onDocumentUpdated,this);}
6319 WebInspector.LayerTreeModel.Events={LayerTreeChanged:"LayerTreeChanged",LayerPainted:"LayerPainted",}
6320 WebInspector.LayerTreeModel.prototype={disable:function()
6321 {if(!this._enabled)
6322 return;this._enabled=false;this._backendNodeIdToNodeId={};LayerTreeAgent.disable();},enable:function(callback)
6323 {if(this._enabled)
6324 return;this._enabled=true;LayerTreeAgent.enable();},setSnapshot:function(snapshot)
6325 {this.disable();this._resolveNodesAndRepopulate(snapshot.layers);},root:function()
6326 {return this._root;},contentRoot:function()
6327 {return this._contentRoot;},forEachLayer:function(callback,root)
6328 {if(!root){root=this.root();if(!root)
6329 return false;}
6330 return callback(root)||root.children().some(this.forEachLayer.bind(this,callback));},layerById:function(id)
6331 {return this._layersById[id]||null;},_resolveNodesAndRepopulate:function(payload)
6332 {if(payload)
6333 this._resolveBackendNodeIdsForLayers(payload,onBackendNodeIdsResolved.bind(this));else
6334 onBackendNodeIdsResolved.call(this);function onBackendNodeIdsResolved()
6335 {this._repopulate(payload||[]);this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChanged);}},_repopulate:function(layers)
6336 {this._root=null;this._contentRoot=null;if(!layers)
6337 return;var oldLayersById=this._layersById;this._layersById={};for(var i=0;i<layers.length;++i){var layerId=layers[i].layerId;var layer=oldLayersById[layerId];if(layer)
6338 layer._reset(layers[i]);else
6339 layer=new WebInspector.Layer(layers[i]);this._layersById[layerId]=layer;if(layers[i].backendNodeId){layer._setNodeId(this._backendNodeIdToNodeId[layers[i].backendNodeId]);if(!this._contentRoot)
6340 this._contentRoot=layer;}
6341 var lastPaintRect=this._lastPaintRectByLayerId[layerId];if(lastPaintRect)
6342 layer._lastPaintRect=lastPaintRect;var parentId=layer.parentId();if(parentId){var parent=this._layersById[parentId];if(!parent)
6343 console.assert(parent,"missing parent "+parentId+" for layer "+layerId);parent.addChild(layer);}else{if(this._root)
6344 console.assert(false,"Multiple root layers");this._root=layer;}}
6345 this._lastPaintRectByLayerId={};},_layerTreeChanged:function(layers)
6346 {if(!this._enabled)
6347 return;this._resolveNodesAndRepopulate(layers);},_resolveBackendNodeIdsForLayers:function(layers,callback)
6348 {var idsToResolve={};var requestedIds=[];for(var i=0;i<layers.length;++i){var backendNodeId=layers[i].backendNodeId;if(!backendNodeId||idsToResolve[backendNodeId]||(this._backendNodeIdToNodeId[backendNodeId]&&WebInspector.domModel.nodeForId(this._backendNodeIdToNodeId[backendNodeId]))){continue;}
6349 idsToResolve[backendNodeId]=true;requestedIds.push(backendNodeId);}
6350 if(!requestedIds.length){callback();return;}
6351 WebInspector.domModel.pushNodesByBackendIdsToFrontend(requestedIds,populateBackendNodeIdMap.bind(this));function populateBackendNodeIdMap(nodeIds)
6352 {if(nodeIds){for(var i=0;i<requestedIds.length;++i){var nodeId=nodeIds[i];if(nodeId)
6353 this._backendNodeIdToNodeId[requestedIds[i]]=nodeId;}}
6354 callback();}},_layerPainted:function(layerId,clipRect)
6355 {var layer=this._layersById[layerId];if(!layer){this._lastPaintRectByLayerId[layerId]=clipRect;return;}
6356 layer._didPaint(clipRect);this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerPainted,layer);},_onDocumentUpdated:function()
6357 {this.disable();this.enable();},__proto__:WebInspector.Object.prototype}
6358 WebInspector.Layer=function(layerPayload)
6359 {this._scrollRects=[];this._reset(layerPayload);}
6360 WebInspector.Layer.prototype={id:function()
6361 {return this._layerPayload.layerId;},parentId:function()
6362 {return this._layerPayload.parentLayerId;},parent:function()
6363 {return this._parent;},isRoot:function()
6364 {return!this.parentId();},children:function()
6365 {return this._children;},addChild:function(child)
6366 {if(child._parent)
6367 console.assert(false,"Child already has a parent");this._children.push(child);child._parent=this;},_setNodeId:function(nodeId)
6368 {this._nodeId=nodeId;},nodeId:function()
6369 {return this._nodeId;},nodeIdForSelfOrAncestor:function()
6370 {for(var layer=this;layer;layer=layer._parent){var nodeId=layer._nodeId;if(nodeId)
6371 return nodeId;}
6372 return null;},offsetX:function()
6373 {return this._layerPayload.offsetX;},offsetY:function()
6374 {return this._layerPayload.offsetY;},width:function()
6375 {return this._layerPayload.width;},height:function()
6376 {return this._layerPayload.height;},transform:function()
6377 {return this._layerPayload.transform;},anchorPoint:function()
6378 {return[this._layerPayload.anchorX||0,this._layerPayload.anchorY||0,this._layerPayload.anchorZ||0,];},invisible:function()
6379 {return this._layerPayload.invisible;},paintCount:function()
6380 {return this._paintCount||this._layerPayload.paintCount;},lastPaintRect:function()
6381 {return this._lastPaintRect;},scrollRects:function()
6382 {return this._scrollRects;},requestCompositingReasons:function(callback)
6383 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.reasonsForCompositingLayer(): ",undefined,[]);LayerTreeAgent.compositingReasons(this.id(),wrappedCallback);},requestSnapshot:function(callback)
6384 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.makeSnapshot(): ",WebInspector.PaintProfilerSnapshot);LayerTreeAgent.makeSnapshot(this.id(),wrappedCallback);},_didPaint:function(rect)
6385 {this._lastPaintRect=rect;this._paintCount=this.paintCount()+1;this._image=null;},_reset:function(layerPayload)
6386 {this._children=[];this._parent=null;this._paintCount=0;this._layerPayload=layerPayload;this._image=null;this._nodeId=0;this._scrollRects=this._layerPayload.scrollRects||[];}}
6387 WebInspector.LayerTreeSnapshot=function(layers)
6388 {this.layers=layers;}
6389 WebInspector.LayerTreeDispatcher=function(layerTreeModel)
6390 {this._layerTreeModel=layerTreeModel;}
6391 WebInspector.LayerTreeDispatcher.prototype={layerTreeDidChange:function(layers)
6392 {this._layerTreeModel._layerTreeChanged(layers);},layerPainted:function(layerId,clipRect)
6393 {this._layerTreeModel._layerPainted(layerId,clipRect);}}
6394 WebInspector.Script=function(scriptId,sourceURL,startLine,startColumn,endLine,endColumn,isContentScript,sourceMapURL,hasSourceURL)
6395 {this.scriptId=scriptId;this.sourceURL=sourceURL;this.lineOffset=startLine;this.columnOffset=startColumn;this.endLine=endLine;this.endColumn=endColumn;this.isContentScript=isContentScript;this.sourceMapURL=sourceMapURL;this.hasSourceURL=hasSourceURL;this._locations=new Set();this._sourceMappings=[];}
6396 WebInspector.Script.Events={ScriptEdited:"ScriptEdited",}
6397 WebInspector.Script.snippetSourceURLPrefix="snippets:///";WebInspector.Script._trimSourceURLComment=function(source)
6398 {var sourceURLRegex=/\n[\040\t]*\/\/[@#]\ssourceURL=\s*(\S*?)\s*$/mg;return source.replace(sourceURLRegex,"");},WebInspector.Script.prototype={contentURL:function()
6399 {return this.sourceURL;},contentType:function()
6400 {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
6401 {if(this._source){callback(this._source);return;}
6402 function didGetScriptSource(error,source)
6403 {this._source=WebInspector.Script._trimSourceURLComment(error?"":source);callback(this._source);}
6404 if(this.scriptId){DebuggerAgent.getScriptSource(this.scriptId,didGetScriptSource.bind(this));}else
6405 callback("");},searchInContent:function(query,caseSensitive,isRegex,callback)
6406 {function innerCallback(error,searchMatches)
6407 {if(error)
6408 console.error(error);var result=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber,searchMatches[i].lineContent);result.push(searchMatch);}
6409 callback(result||[]);}
6410 if(this.scriptId){DebuggerAgent.searchInContent(this.scriptId,query,caseSensitive,isRegex,innerCallback);}else
6411 callback([]);},_appendSourceURLCommentIfNeeded:function(source)
6412 {if(!this.hasSourceURL)
6413 return source;return source+"\n //# sourceURL="+this.sourceURL;},editSource:function(newSource,callback)
6414 {function didEditScriptSource(error,errorData,callFrames,debugData,asyncStackTrace)
6415 {if(!error)
6416 this._source=newSource;var needsStepIn=!!debugData&&debugData["stack_update_needs_step_in"]===true;callback(error,errorData,callFrames,asyncStackTrace,needsStepIn);if(!error)
6417 this.dispatchEventToListeners(WebInspector.Script.Events.ScriptEdited,newSource);}
6418 newSource=WebInspector.Script._trimSourceURLComment(newSource);newSource=this._appendSourceURLCommentIfNeeded(newSource);if(this.scriptId)
6419 DebuggerAgent.setScriptSource(this.scriptId,newSource,undefined,didEditScriptSource.bind(this));else
6420 callback("Script failed to parse");},isInlineScript:function()
6421 {var startsAtZero=!this.lineOffset&&!this.columnOffset;return!!this.sourceURL&&!startsAtZero;},isAnonymousScript:function()
6422 {return!this.sourceURL;},isSnippet:function()
6423 {return!!this.sourceURL&&this.sourceURL.startsWith(WebInspector.Script.snippetSourceURLPrefix);},rawLocationToUILocation:function(lineNumber,columnNumber)
6424 {var uiLocation;var rawLocation=new WebInspector.DebuggerModel.Location(this.scriptId,lineNumber,columnNumber||0);for(var i=this._sourceMappings.length-1;!uiLocation&&i>=0;--i)
6425 uiLocation=this._sourceMappings[i].rawLocationToUILocation(rawLocation);console.assert(uiLocation,"Script raw location can not be mapped to any ui location.");return(uiLocation);},pushSourceMapping:function(sourceMapping)
6426 {this._sourceMappings.push(sourceMapping);this.updateLocations();},popSourceMapping:function()
6427 {var sourceMapping=this._sourceMappings.pop();this.updateLocations();return sourceMapping;},updateLocations:function()
6428 {var items=this._locations.items();for(var i=0;i<items.length;++i)
6429 items[i].update();},createLiveLocation:function(rawLocation,updateDelegate)
6430 {console.assert(rawLocation.scriptId===this.scriptId);var location=new WebInspector.Script.Location(this,rawLocation,updateDelegate);this._locations.add(location);location.update();return location;},__proto__:WebInspector.Object.prototype}
6431 WebInspector.Script.Location=function(script,rawLocation,updateDelegate)
6432 {WebInspector.LiveLocation.call(this,rawLocation,updateDelegate);this._script=script;}
6433 WebInspector.Script.Location.prototype={uiLocation:function()
6434 {var debuggerModelLocation=(this.rawLocation());return this._script.rawLocationToUILocation(debuggerModelLocation.lineNumber,debuggerModelLocation.columnNumber);},dispose:function()
6435 {WebInspector.LiveLocation.prototype.dispose.call(this);this._script._locations.remove(this);},__proto__:WebInspector.LiveLocation.prototype}
6436 WebInspector.LinkifierFormatter=function()
6437 {}
6438 WebInspector.LinkifierFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation){}}
6439 WebInspector.Linkifier=function(formatter)
6440 {this._formatter=formatter||new WebInspector.Linkifier.DefaultFormatter(WebInspector.Linkifier.MaxLengthForDisplayedURLs);this._liveLocations=[];}
6441 WebInspector.Linkifier.setLinkHandler=function(handler)
6442 {WebInspector.Linkifier._linkHandler=handler;}
6443 WebInspector.Linkifier.handleLink=function(url,lineNumber)
6444 {if(!WebInspector.Linkifier._linkHandler)
6445 return false;return WebInspector.Linkifier._linkHandler.handleLink(url,lineNumber)}
6446 WebInspector.Linkifier.linkifyUsingRevealer=function(revealable,text,fallbackHref,fallbackLineNumber,title,classes)
6447 {var a=document.createElement("a");a.className=(classes||"")+" webkit-html-resource-link";a.textContent=text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayedURLs);a.title=title||text;if(fallbackHref){a.href=fallbackHref;a.lineNumber=fallbackLineNumber;}
6448 function clickHandler(event)
6449 {event.consume(true);if(fallbackHref&&WebInspector.Linkifier.handleLink(fallbackHref,fallbackLineNumber))
6450 return;WebInspector.Revealer.reveal(this);}
6451 a.addEventListener("click",clickHandler.bind(revealable),false);return a;}
6452 WebInspector.Linkifier.prototype={linkifyLocation:function(sourceURL,lineNumber,columnNumber,classes)
6453 {var rawLocation=WebInspector.debuggerModel.createRawLocationByURL(sourceURL,lineNumber,columnNumber||0);if(!rawLocation)
6454 return WebInspector.linkifyResourceAsNode(sourceURL,lineNumber,classes);return this.linkifyRawLocation(rawLocation,classes);},linkifyRawLocation:function(rawLocation,classes)
6455 {var script=WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);if(!script)
6456 return null;var anchor=this._createAnchor(classes);var liveLocation=script.createLiveLocation(rawLocation,this._updateAnchor.bind(this,anchor));this._liveLocations.push(liveLocation);return anchor;},linkifyCSSLocation:function(styleSheetId,rawLocation,classes)
6457 {var anchor=this._createAnchor(classes);var liveLocation=WebInspector.cssModel.createLiveLocation(styleSheetId,rawLocation,this._updateAnchor.bind(this,anchor));if(!liveLocation)
6458 return null;this._liveLocations.push(liveLocation);return anchor;},_createAnchor:function(classes)
6459 {var anchor=document.createElement("a");anchor.className=(classes||"")+" webkit-html-resource-link";function clickHandler(event)
6460 {event.consume(true);if(!anchor.__uiLocation)
6461 return;if(WebInspector.Linkifier.handleLink(anchor.__uiLocation.url(),anchor.__uiLocation.lineNumber))
6462 return;WebInspector.Revealer.reveal(anchor.__uiLocation);}
6463 anchor.addEventListener("click",clickHandler,false);return anchor;},reset:function()
6464 {for(var i=0;i<this._liveLocations.length;++i)
6465 this._liveLocations[i].dispose();this._liveLocations=[];},_updateAnchor:function(anchor,uiLocation)
6466 {anchor.__uiLocation=uiLocation;this._formatter.formatLiveAnchor(anchor,uiLocation);}}
6467 WebInspector.Linkifier.DefaultFormatter=function(maxLength)
6468 {this._maxLength=maxLength;}
6469 WebInspector.Linkifier.DefaultFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
6470 {var text=uiLocation.linkText();if(this._maxLength)
6471 text=text.trimMiddle(this._maxLength);anchor.textContent=text;var titleText=uiLocation.uiSourceCode.originURL();if(typeof uiLocation.lineNumber==="number")
6472 titleText+=":"+(uiLocation.lineNumber+1);anchor.title=titleText;}}
6473 WebInspector.Linkifier.DefaultCSSFormatter=function()
6474 {WebInspector.Linkifier.DefaultFormatter.call(this,WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs);}
6475 WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs=30;WebInspector.Linkifier.DefaultCSSFormatter.prototype={formatLiveAnchor:function(anchor,uiLocation)
6476 {WebInspector.Linkifier.DefaultFormatter.prototype.formatLiveAnchor.call(this,anchor,uiLocation);anchor.classList.add("webkit-html-resource-link");anchor.setAttribute("data-uncopyable",anchor.textContent);anchor.textContent="";},__proto__:WebInspector.Linkifier.DefaultFormatter.prototype}
6477 WebInspector.Linkifier.MaxLengthForDisplayedURLs=150;WebInspector.Linkifier.LinkHandler=function()
6478 {}
6479 WebInspector.Linkifier.LinkHandler.prototype={handleLink:function(url,lineNumber){}}
6480 WebInspector.Linkifier.liveLocationText=function(scriptId,lineNumber,columnNumber)
6481 {var script=WebInspector.debuggerModel.scriptForId(scriptId);if(!script)
6482 return"";var uiLocation=script.rawLocationToUILocation(lineNumber,columnNumber);return uiLocation.linkText();}
6483 WebInspector.DebuggerScriptMapping=function(debuggerModel,workspace,networkWorkspaceProvider)
6484 {this._defaultMapping=new WebInspector.DefaultScriptMapping(debuggerModel,workspace);this._resourceMapping=new WebInspector.ResourceScriptMapping(debuggerModel,workspace);this._compilerMapping=new WebInspector.CompilerScriptMapping(debuggerModel,workspace,networkWorkspaceProvider);this._snippetMapping=WebInspector.scriptSnippetModel.scriptMapping;WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);}
6485 WebInspector.DebuggerScriptMapping.prototype={_parsedScriptSource:function(event)
6486 {var script=(event.data);this._defaultMapping.addScript(script);if(script.isSnippet()){this._snippetMapping.addScript(script);return;}
6487 this._resourceMapping.addScript(script);if(WebInspector.settings.jsSourceMapsEnabled.get())
6488 this._compilerMapping.addScript(script);}}
6489 WebInspector.PresentationConsoleMessageHelper=function(workspace)
6490 {this._pendingConsoleMessages={};this._presentationConsoleMessages=[];this._workspace=workspace;WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,this._consoleMessageAdded,this);WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared,this._consoleCleared,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource,this._parsedScriptSource,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
6491 WebInspector.PresentationConsoleMessageHelper.prototype={_consoleMessageAdded:function(event)
6492 {var message=(event.data);if(!message.url||!message.isErrorOrWarning())
6493 return;var rawLocation=this._rawLocation(message);if(rawLocation)
6494 this._addConsoleMessageToScript(message,rawLocation);else
6495 this._addPendingConsoleMessage(message);},_rawLocation:function(message)
6496 {var lineNumber=message.stackTrace?message.stackTrace[0].lineNumber-1:message.line-1;var columnNumber=message.stackTrace&&message.stackTrace[0].columnNumber?message.stackTrace[0].columnNumber-1:0;return WebInspector.debuggerModel.createRawLocationByURL(message.url,lineNumber,columnNumber);},_addConsoleMessageToScript:function(message,rawLocation)
6497 {this._presentationConsoleMessages.push(new WebInspector.PresentationConsoleMessage(message,rawLocation));},_addPendingConsoleMessage:function(message)
6498 {if(!message.url)
6499 return;if(!this._pendingConsoleMessages[message.url])
6500 this._pendingConsoleMessages[message.url]=[];this._pendingConsoleMessages[message.url].push(message);},_parsedScriptSource:function(event)
6501 {var script=(event.data);var messages=this._pendingConsoleMessages[script.sourceURL];if(!messages)
6502 return;var pendingMessages=[];for(var i=0;i<messages.length;i++){var message=messages[i];var rawLocation=this._rawLocation(message);if(script.scriptId===rawLocation.scriptId)
6503 this._addConsoleMessageToScript(message,rawLocation);else
6504 pendingMessages.push(message);}
6505 if(pendingMessages.length)
6506 this._pendingConsoleMessages[script.sourceURL]=pendingMessages;else
6507 delete this._pendingConsoleMessages[script.sourceURL];},_consoleCleared:function()
6508 {this._pendingConsoleMessages={};for(var i=0;i<this._presentationConsoleMessages.length;++i)
6509 this._presentationConsoleMessages[i].dispose();this._presentationConsoleMessages=[];var uiSourceCodes=this._workspace.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
6510 uiSourceCodes[i].consoleMessagesCleared();},_debuggerReset:function()
6511 {this._pendingConsoleMessages={};this._presentationConsoleMessages=[];}}
6512 WebInspector.PresentationConsoleMessage=function(message,rawLocation)
6513 {this.originalMessage=message;this._liveLocation=WebInspector.debuggerModel.createLiveLocation(rawLocation,this._updateLocation.bind(this));}
6514 WebInspector.PresentationConsoleMessage.prototype={_updateLocation:function(uiLocation)
6515 {if(this._uiLocation)
6516 this._uiLocation.uiSourceCode.consoleMessageRemoved(this);this._uiLocation=uiLocation;this._uiLocation.uiSourceCode.consoleMessageAdded(this);},get lineNumber()
6517 {return this._uiLocation.lineNumber;},dispose:function()
6518 {this._liveLocation.dispose();}}
6519 WebInspector.FileSystemProjectDelegate=function(isolatedFileSystem,workspace)
6520 {this._fileSystem=isolatedFileSystem;this._normalizedFileSystemPath=this._fileSystem.path();if(WebInspector.isWin())
6521 this._normalizedFileSystemPath=this._normalizedFileSystemPath.replace(/\\/g,"/");this._fileSystemURL="file://"+this._normalizedFileSystemPath+"/";this._workspace=workspace;this._searchCallbacks={};this._indexingCallbacks={};this._indexingProgresses={};}
6522 WebInspector.FileSystemProjectDelegate._scriptExtensions=["js","java","coffee","ts","dart"].keySet();WebInspector.FileSystemProjectDelegate._styleSheetExtensions=["css","scss","sass","less"].keySet();WebInspector.FileSystemProjectDelegate._documentExtensions=["htm","html","asp","aspx","phtml","jsp"].keySet();WebInspector.FileSystemProjectDelegate.projectId=function(fileSystemPath)
6523 {return"filesystem:"+fileSystemPath;}
6524 WebInspector.FileSystemProjectDelegate._lastRequestId=0;WebInspector.FileSystemProjectDelegate.prototype={id:function()
6525 {return WebInspector.FileSystemProjectDelegate.projectId(this._fileSystem.path());},type:function()
6526 {return WebInspector.projectTypes.FileSystem;},fileSystemPath:function()
6527 {return this._fileSystem.path();},displayName:function()
6528 {return this._normalizedFileSystemPath.substr(this._normalizedFileSystemPath.lastIndexOf("/")+1);},_filePathForPath:function(path)
6529 {return"/"+path;},requestFileContent:function(path,callback)
6530 {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,callback);},requestMetadata:function(path,callback)
6531 {var filePath=this._filePathForPath(path);this._fileSystem.requestMetadata(filePath,callback);},canSetFileContent:function()
6532 {return true;},setFileContent:function(path,newContent,callback)
6533 {var filePath=this._filePathForPath(path);this._fileSystem.setFileContent(filePath,newContent,callback.bind(this,""));},canRename:function()
6534 {return true;},rename:function(path,newName,callback)
6535 {var filePath=this._filePathForPath(path);this._fileSystem.renameFile(filePath,newName,innerCallback.bind(this));function innerCallback(success,newName)
6536 {if(!success){callback(false,newName);return;}
6537 var validNewName=(newName);console.assert(validNewName);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);filePath=parentPath+"/"+validNewName;var newURL=this._workspace.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(validNewName);var newOriginURL=this._fileSystemURL+filePath
6538 var newContentType=this._contentTypeForExtension(extension);callback(true,validNewName,newURL,newOriginURL,newContentType);}},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
6539 {var filePath=this._filePathForPath(path);this._fileSystem.requestFileContent(filePath,contentCallback);function contentCallback(content)
6540 {var result=[];if(content!==null)
6541 result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
6542 {var result=null;var queriesToRun=queries.slice();if(!queriesToRun.length)
6543 queriesToRun.push("");progress.setTotalWork(queriesToRun.length);searchNextQuery.call(this);function searchNextQuery()
6544 {if(!queriesToRun.length){matchFileQueries.call(null,result);return;}
6545 var query=queriesToRun.shift();this._searchInPath(isRegex?"":query,progress,innerCallback.bind(this));}
6546 function innerCallback(files)
6547 {files=files.sort();progress.worked(1);if(!result)
6548 result=files;else
6549 result=result.intersectOrdered(files,String.naturalOrderComparator);searchNextQuery.call(this);}
6550 function matchFileQueries(files)
6551 {var fileRegexes=[];for(var i=0;i<fileQueries.length;++i)
6552 fileRegexes.push(new RegExp(fileQueries[i],caseSensitive?"":"i"));function filterOutNonMatchingFiles(file)
6553 {for(var i=0;i<fileRegexes.length;++i){if(!file.match(fileRegexes[i]))
6554 return false;}
6555 return true;}
6556 files=files.filter(filterOutNonMatchingFiles);progress.done();callback(files);}},_searchInPath:function(query,progress,callback)
6557 {var requestId=++WebInspector.FileSystemProjectDelegate._lastRequestId;this._searchCallbacks[requestId]=innerCallback.bind(this);InspectorFrontendHost.searchInPath(requestId,this._fileSystem.path(),query);function innerCallback(files)
6558 {function trimAndNormalizeFileSystemPath(fullPath)
6559 {var trimmedPath=fullPath.substr(this._fileSystem.path().length+1);if(WebInspector.isWin())
6560 trimmedPath=trimmedPath.replace(/\\/g,"/");return trimmedPath;}
6561 files=files.map(trimAndNormalizeFileSystemPath.bind(this));progress.worked(1);callback(files);}},searchCompleted:function(requestId,files)
6562 {if(!this._searchCallbacks[requestId])
6563 return;var callback=this._searchCallbacks[requestId];delete this._searchCallbacks[requestId];callback(files);},indexContent:function(progress,callback)
6564 {var requestId=++WebInspector.FileSystemProjectDelegate._lastRequestId;this._indexingCallbacks[requestId]=callback;this._indexingProgresses[requestId]=progress;progress.setTotalWork(1);progress.addEventListener(WebInspector.Progress.Events.Canceled,this._indexingCanceled.bind(this,requestId));InspectorFrontendHost.indexPath(requestId,this._fileSystem.path());},_indexingCanceled:function(requestId)
6565 {if(!this._indexingProgresses[requestId])
6566 return;InspectorFrontendHost.stopIndexing(requestId);delete this._indexingProgresses[requestId];delete this._indexingCallbacks[requestId];},indexingTotalWorkCalculated:function(requestId,totalWork)
6567 {if(!this._indexingProgresses[requestId])
6568 return;var progress=this._indexingProgresses[requestId];progress.setTotalWork(totalWork);},indexingWorked:function(requestId,worked)
6569 {if(!this._indexingProgresses[requestId])
6570 return;var progress=this._indexingProgresses[requestId];progress.worked(worked);},indexingDone:function(requestId)
6571 {if(!this._indexingProgresses[requestId])
6572 return;var progress=this._indexingProgresses[requestId];var callback=this._indexingCallbacks[requestId];delete this._indexingProgresses[requestId];delete this._indexingCallbacks[requestId];progress.done();callback.call();},_extensionForPath:function(path)
6573 {var extensionIndex=path.lastIndexOf(".");if(extensionIndex===-1)
6574 return"";return path.substring(extensionIndex+1).toLowerCase();},_contentTypeForExtension:function(extension)
6575 {if(WebInspector.FileSystemProjectDelegate._scriptExtensions[extension])
6576 return WebInspector.resourceTypes.Script;if(WebInspector.FileSystemProjectDelegate._styleSheetExtensions[extension])
6577 return WebInspector.resourceTypes.Stylesheet;if(WebInspector.FileSystemProjectDelegate._documentExtensions[extension])
6578 return WebInspector.resourceTypes.Document;return WebInspector.resourceTypes.Other;},populate:function()
6579 {this._fileSystem.requestFilesRecursive("",this._addFile.bind(this));},refresh:function(path)
6580 {this._fileSystem.requestFilesRecursive(path,this._addFile.bind(this));},excludeFolder:function(path)
6581 {WebInspector.isolatedFileSystemManager.mapping().addExcludedFolder(this._fileSystem.path(),path);},createFile:function(path,name,content,callback)
6582 {this._fileSystem.createFile(path,name,innerCallback.bind(this));var createFilePath;function innerCallback(filePath)
6583 {if(!filePath){callback(null);return;}
6584 createFilePath=filePath;if(!content){contentSet.call(this);return;}
6585 this._fileSystem.setFileContent(filePath,content,contentSet.bind(this));}
6586 function contentSet()
6587 {this._addFile(createFilePath);callback(createFilePath);}},deleteFile:function(path)
6588 {this._fileSystem.deleteFile(path);this._removeFile(path);},remove:function()
6589 {WebInspector.isolatedFileSystemManager.removeFileSystem(this._fileSystem.path());},_addFile:function(filePath)
6590 {if(!filePath)
6591 console.assert(false);var slash=filePath.lastIndexOf("/");var parentPath=filePath.substring(0,slash);var name=filePath.substring(slash+1);var url=this._workspace.urlForPath(this._fileSystem.path(),filePath);var extension=this._extensionForPath(name);var contentType=this._contentTypeForExtension(extension);var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,this._fileSystemURL+filePath,url,contentType,true);this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);},_removeFile:function(path)
6592 {this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},reset:function()
6593 {this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset,null);},__proto__:WebInspector.Object.prototype}
6594 WebInspector.fileSystemProjectDelegate;WebInspector.FileSystemWorkspaceProvider=function(isolatedFileSystemManager,workspace)
6595 {this._isolatedFileSystemManager=isolatedFileSystemManager;this._workspace=workspace;this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,this._fileSystemAdded,this);this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,this._fileSystemRemoved,this);this._projectDelegates={};}
6596 WebInspector.FileSystemWorkspaceProvider.prototype={_fileSystemAdded:function(event)
6597 {var fileSystem=(event.data);var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());var projectDelegate=new WebInspector.FileSystemProjectDelegate(fileSystem,this._workspace)
6598 this._projectDelegates[projectDelegate.id()]=projectDelegate;console.assert(!this._workspace.project(projectDelegate.id()));this._workspace.addProject(projectDelegate);projectDelegate.populate();},_fileSystemRemoved:function(event)
6599 {var fileSystem=(event.data);var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());this._workspace.removeProject(projectId);delete this._projectDelegates[projectId];},fileSystemPath:function(uiSourceCode)
6600 {var projectDelegate=this._projectDelegates[uiSourceCode.project().id()];return projectDelegate.fileSystemPath();},delegate:function(fileSystemPath)
6601 {var projectId=WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);return this._projectDelegates[projectId];}}
6602 WebInspector.fileSystemWorkspaceProvider;WebInspector.FileSystemMapping=function()
6603 {WebInspector.Object.call(this);this._fileSystemMappingSetting=WebInspector.settings.createSetting("fileSystemMapping",{});this._excludedFoldersSetting=WebInspector.settings.createSetting("workspaceExcludedFolders",{});var defaultCommonExcludedFolders=["/\\.git/","/\\.sass-cache/","/\\.hg/","/\\.idea/","/\\.svn/","/\\.cache/","/\\.project/"];var defaultWinExcludedFolders=["/Thumbs.db$","/ehthumbs.db$","/Desktop.ini$","/\\$RECYCLE.BIN/"];var defaultMacExcludedFolders=["/\\.DS_Store$","/\\.Trashes$","/\\.Spotlight-V100$","/\\.AppleDouble$","/\\.LSOverride$","/Icon$","/\\._.*$"];var defaultLinuxExcludedFolders=["/.*~$"];var defaultExcludedFolders=defaultCommonExcludedFolders;if(WebInspector.isWin())
6604 defaultExcludedFolders=defaultExcludedFolders.concat(defaultWinExcludedFolders);else if(WebInspector.isMac())
6605 defaultExcludedFolders=defaultExcludedFolders.concat(defaultMacExcludedFolders);else
6606 defaultExcludedFolders=defaultExcludedFolders.concat(defaultLinuxExcludedFolders);var defaultExcludedFoldersPattern=defaultExcludedFolders.join("|");WebInspector.settings.workspaceFolderExcludePattern=WebInspector.settings.createRegExpSetting("workspaceFolderExcludePattern",defaultExcludedFoldersPattern,WebInspector.isWin()?"i":"");this._fileSystemMappings={};this._excludedFolders={};this._loadFromSettings();}
6607 WebInspector.FileSystemMapping.Events={FileMappingAdded:"FileMappingAdded",FileMappingRemoved:"FileMappingRemoved",ExcludedFolderAdded:"ExcludedFolderAdded",ExcludedFolderRemoved:"ExcludedFolderRemoved"}
6608 WebInspector.FileSystemMapping.prototype={_loadFromSettings:function()
6609 {var savedMapping=this._fileSystemMappingSetting.get();this._fileSystemMappings={};for(var fileSystemPath in savedMapping){var savedFileSystemMappings=savedMapping[fileSystemPath];this._fileSystemMappings[fileSystemPath]=[];var fileSystemMappings=this._fileSystemMappings[fileSystemPath];for(var i=0;i<savedFileSystemMappings.length;++i){var savedEntry=savedFileSystemMappings[i];var entry=new WebInspector.FileSystemMapping.Entry(savedEntry.fileSystemPath,savedEntry.urlPrefix,savedEntry.pathPrefix);fileSystemMappings.push(entry);}}
6610 var savedExcludedFolders=this._excludedFoldersSetting.get();this._excludedFolders={};for(var fileSystemPath in savedExcludedFolders){var savedExcludedFoldersForPath=savedExcludedFolders[fileSystemPath];this._excludedFolders[fileSystemPath]=[];var excludedFolders=this._excludedFolders[fileSystemPath];for(var i=0;i<savedExcludedFoldersForPath.length;++i){var savedEntry=savedExcludedFoldersForPath[i];var entry=new WebInspector.FileSystemMapping.ExcludedFolderEntry(savedEntry.fileSystemPath,savedEntry.path);excludedFolders.push(entry);}}
6611 this._rebuildIndexes();},_saveToSettings:function()
6612 {var savedMapping=this._fileSystemMappings;this._fileSystemMappingSetting.set(savedMapping);var savedExcludedFolders=this._excludedFolders;this._excludedFoldersSetting.set(savedExcludedFolders);this._rebuildIndexes();},_rebuildIndexes:function()
6613 {this._mappingForURLPrefix={};this._urlPrefixes=[];for(var fileSystemPath in this._fileSystemMappings){var fileSystemMapping=this._fileSystemMappings[fileSystemPath];for(var i=0;i<fileSystemMapping.length;++i){var entry=fileSystemMapping[i];this._mappingForURLPrefix[entry.urlPrefix]=entry;this._urlPrefixes.push(entry.urlPrefix);}}
6614 this._urlPrefixes.sort();},addFileSystem:function(fileSystemPath)
6615 {if(this._fileSystemMappings[fileSystemPath])
6616 return;this._fileSystemMappings[fileSystemPath]=[];this._saveToSettings();},removeFileSystem:function(fileSystemPath)
6617 {if(!this._fileSystemMappings[fileSystemPath])
6618 return;delete this._fileSystemMappings[fileSystemPath];delete this._excludedFolders[fileSystemPath];this._saveToSettings();},addFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
6619 {var entry=new WebInspector.FileSystemMapping.Entry(fileSystemPath,urlPrefix,pathPrefix);this._fileSystemMappings[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingAdded,entry);},removeFileMapping:function(fileSystemPath,urlPrefix,pathPrefix)
6620 {var entry=this._mappingEntryForPathPrefix(fileSystemPath,pathPrefix);if(!entry)
6621 return;this._fileSystemMappings[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.FileMappingRemoved,entry);},addExcludedFolder:function(fileSystemPath,excludedFolderPath)
6622 {if(!this._excludedFolders[fileSystemPath])
6623 this._excludedFolders[fileSystemPath]=[];var entry=new WebInspector.FileSystemMapping.ExcludedFolderEntry(fileSystemPath,excludedFolderPath);this._excludedFolders[fileSystemPath].push(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.ExcludedFolderAdded,entry);},removeExcludedFolder:function(fileSystemPath,path)
6624 {var entry=this._excludedFolderEntryForPath(fileSystemPath,path);if(!entry)
6625 return;this._excludedFolders[fileSystemPath].remove(entry);this._saveToSettings();this.dispatchEventToListeners(WebInspector.FileSystemMapping.Events.ExcludedFolderRemoved,entry);},fileSystemPaths:function()
6626 {return Object.keys(this._fileSystemMappings);},_mappingEntryForURL:function(url)
6627 {for(var i=this._urlPrefixes.length-1;i>=0;--i){var urlPrefix=this._urlPrefixes[i];if(url.startsWith(urlPrefix))
6628 return this._mappingForURLPrefix[urlPrefix];}
6629 return null;},_excludedFolderEntryForPath:function(fileSystemPath,path)
6630 {var entries=this._excludedFolders[fileSystemPath];if(!entries)
6631 return null;for(var i=0;i<entries.length;++i){if(entries[i].path===path)
6632 return entries[i];}
6633 return null;},_mappingEntryForPath:function(fileSystemPath,filePath)
6634 {var entries=this._fileSystemMappings[fileSystemPath];if(!entries)
6635 return null;var entry=null;for(var i=0;i<entries.length;++i){var pathPrefix=entries[i].pathPrefix;if(entry&&entry.pathPrefix.length>pathPrefix.length)
6636 continue;if(filePath.startsWith(pathPrefix.substr(1)))
6637 entry=entries[i];}
6638 return entry;},_mappingEntryForPathPrefix:function(fileSystemPath,pathPrefix)
6639 {var entries=this._fileSystemMappings[fileSystemPath];for(var i=0;i<entries.length;++i){if(pathPrefix===entries[i].pathPrefix)
6640 return entries[i];}
6641 return null;},isFileExcluded:function(fileSystemPath,folderPath)
6642 {var excludedFolders=this._excludedFolders[fileSystemPath]||[];for(var i=0;i<excludedFolders.length;++i){var entry=excludedFolders[i];if(entry.path===folderPath)
6643 return true;}
6644 var regex=WebInspector.settings.workspaceFolderExcludePattern.asRegExp();return regex&&regex.test(folderPath);},excludedFolders:function(fileSystemPath)
6645 {var excludedFolders=this._excludedFolders[fileSystemPath];return excludedFolders?excludedFolders.slice():[];},mappingEntries:function(fileSystemPath)
6646 {return this._fileSystemMappings[fileSystemPath].slice();},hasMappingForURL:function(url)
6647 {return!!this._mappingEntryForURL(url);},fileForURL:function(url)
6648 {var entry=this._mappingEntryForURL(url);if(!entry)
6649 return null;var file={};file.fileSystemPath=entry.fileSystemPath;file.filePath=entry.pathPrefix.substr(1)+url.substr(entry.urlPrefix.length);return file;},urlForPath:function(fileSystemPath,filePath)
6650 {var entry=this._mappingEntryForPath(fileSystemPath,filePath);if(!entry)
6651 return"";return entry.urlPrefix+filePath.substring(entry.pathPrefix.length-1);},removeMappingForURL:function(url)
6652 {var entry=this._mappingEntryForURL(url);if(!entry)
6653 return;this._fileSystemMappings[entry.fileSystemPath].remove(entry);this._saveToSettings();},addMappingForResource:function(url,fileSystemPath,filePath)
6654 {var commonPathSuffixLength=0;var normalizedFilePath="/"+filePath;for(var i=0;i<normalizedFilePath.length;++i){var filePathCharacter=normalizedFilePath[normalizedFilePath.length-1-i];var urlCharacter=url[url.length-1-i];if(filePathCharacter!==urlCharacter)
6655 break;if(filePathCharacter==="/")
6656 commonPathSuffixLength=i;}
6657 var pathPrefix=normalizedFilePath.substr(0,normalizedFilePath.length-commonPathSuffixLength);var urlPrefix=url.substr(0,url.length-commonPathSuffixLength);this.addFileMapping(fileSystemPath,urlPrefix,pathPrefix);},__proto__:WebInspector.Object.prototype}
6658 WebInspector.FileSystemMapping.Entry=function(fileSystemPath,urlPrefix,pathPrefix)
6659 {this.fileSystemPath=fileSystemPath;this.urlPrefix=urlPrefix;this.pathPrefix=pathPrefix;}
6660 WebInspector.FileSystemMapping.ExcludedFolderEntry=function(fileSystemPath,path)
6661 {this.fileSystemPath=fileSystemPath;this.path=path;}
6662 WebInspector.IsolatedFileSystem=function(manager,path,name,rootURL)
6663 {this._manager=manager;this._path=path;this._name=name;this._rootURL=rootURL;}
6664 WebInspector.IsolatedFileSystem.errorMessage=function(error)
6665 {var msg;switch(error.code){case FileError.QUOTA_EXCEEDED_ERR:msg="QUOTA_EXCEEDED_ERR";break;case FileError.NOT_FOUND_ERR:msg="NOT_FOUND_ERR";break;case FileError.SECURITY_ERR:msg="SECURITY_ERR";break;case FileError.INVALID_MODIFICATION_ERR:msg="INVALID_MODIFICATION_ERR";break;case FileError.INVALID_STATE_ERR:msg="INVALID_STATE_ERR";break;default:msg=WebInspector.UIString("Unknown Error");break;};return WebInspector.UIString("File system error: %s",msg);}
6666 WebInspector.IsolatedFileSystem.prototype={path:function()
6667 {return this._path;},name:function()
6668 {return this._name;},rootURL:function()
6669 {return this._rootURL;},_requestFileSystem:function(callback)
6670 {this._manager.requestDOMFileSystem(this._path,callback);},requestFilesRecursive:function(path,callback)
6671 {this._requestFileSystem(fileSystemLoaded.bind(this));var domFileSystem;function fileSystemLoaded(fs)
6672 {domFileSystem=(fs);console.assert(domFileSystem);this._requestEntries(domFileSystem,path,innerCallback.bind(this));}
6673 function innerCallback(entries)
6674 {for(var i=0;i<entries.length;++i){var entry=entries[i];if(!entry.isDirectory){if(this._manager.mapping().isFileExcluded(this._path,entry.fullPath))
6675 continue;callback(entry.fullPath.substr(1));}
6676 else{if(this._manager.mapping().isFileExcluded(this._path,entry.fullPath+"/"))
6677 continue;this._requestEntries(domFileSystem,entry.fullPath,innerCallback.bind(this));}}}},createFile:function(path,name,callback)
6678 {this._requestFileSystem(fileSystemLoaded.bind(this));var newFileIndex=1;if(!name)
6679 name="NewFile";var nameCandidate;function fileSystemLoaded(fs)
6680 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getDirectory(path,null,dirEntryLoaded.bind(this),errorHandler.bind(this));}
6681 function dirEntryLoaded(dirEntry)
6682 {var nameCandidate=name;if(newFileIndex>1)
6683 nameCandidate+=newFileIndex;++newFileIndex;dirEntry.getFile(nameCandidate,{create:true,exclusive:true},fileCreated,fileCreationError.bind(this));function fileCreated(entry)
6684 {callback(entry.fullPath.substr(1));}
6685 function fileCreationError(error)
6686 {if(error.code===FileError.INVALID_MODIFICATION_ERR){dirEntryLoaded.call(this,dirEntry);return;}
6687 var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when testing if file exists '"+(this._path+"/"+path+"/"+nameCandidate)+"'");callback(null);}}
6688 function errorHandler(error)
6689 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);var filePath=this._path+"/"+path;if(nameCandidate)
6690 filePath+="/"+nameCandidate;console.error(errorMessage+" when getting content for file '"+(filePath)+"'");callback(null);}},deleteFile:function(path)
6691 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
6692 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
6693 function fileEntryLoaded(fileEntry)
6694 {fileEntry.remove(fileEntryRemoved,errorHandler.bind(this));}
6695 function fileEntryRemoved()
6696 {}
6697 function errorHandler(error)
6698 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when deleting file '"+(this._path+"/"+path)+"'");}},requestMetadata:function(path,callback)
6699 {this._requestFileSystem(fileSystemLoaded);function fileSystemLoaded(fs)
6700 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded,errorHandler);}
6701 function fileEntryLoaded(entry)
6702 {entry.getMetadata(successHandler,errorHandler);}
6703 function successHandler(metadata)
6704 {callback(metadata.modificationTime,metadata.size);}
6705 function errorHandler(error)
6706 {callback(null,null);}},requestFileContent:function(path,callback)
6707 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
6708 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
6709 function fileEntryLoaded(entry)
6710 {entry.file(fileLoaded,errorHandler.bind(this));}
6711 function fileLoaded(file)
6712 {var reader=new FileReader();reader.onloadend=readerLoadEnd;reader.readAsText(file);}
6713 function readerLoadEnd()
6714 {callback((this.result));}
6715 function errorHandler(error)
6716 {if(error.code===FileError.NOT_FOUND_ERR){callback(null);return;}
6717 var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when getting content for file '"+(this._path+"/"+path)+"'");callback(null);}},setFileContent:function(path,content,callback)
6718 {this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
6719 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,{create:true},fileEntryLoaded.bind(this),errorHandler.bind(this));}
6720 function fileEntryLoaded(entry)
6721 {entry.createWriter(fileWriterCreated.bind(this),errorHandler.bind(this));}
6722 function fileWriterCreated(fileWriter)
6723 {fileWriter.onerror=errorHandler.bind(this);fileWriter.onwriteend=fileTruncated;fileWriter.truncate(0);function fileTruncated()
6724 {fileWriter.onwriteend=writerEnd;var blob=new Blob([content],{type:"text/plain"});fileWriter.write(blob);}}
6725 function writerEnd()
6726 {callback();}
6727 function errorHandler(error)
6728 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when setting content for file '"+(this._path+"/"+path)+"'");callback();}},renameFile:function(path,newName,callback)
6729 {newName=newName?newName.trim():newName;if(!newName||newName.indexOf("/")!==-1){callback(false);return;}
6730 var fileEntry;var dirEntry;var newFileEntry;this._requestFileSystem(fileSystemLoaded.bind(this));function fileSystemLoaded(fs)
6731 {var domFileSystem=(fs);console.assert(domFileSystem);domFileSystem.root.getFile(path,null,fileEntryLoaded.bind(this),errorHandler.bind(this));}
6732 function fileEntryLoaded(entry)
6733 {if(entry.name===newName){callback(false);return;}
6734 fileEntry=entry;fileEntry.getParent(dirEntryLoaded.bind(this),errorHandler.bind(this));}
6735 function dirEntryLoaded(entry)
6736 {dirEntry=entry;dirEntry.getFile(newName,null,newFileEntryLoaded,newFileEntryLoadErrorHandler.bind(this));}
6737 function newFileEntryLoaded(entry)
6738 {callback(false);}
6739 function newFileEntryLoadErrorHandler(error)
6740 {if(error.code!==FileError.NOT_FOUND_ERR){callback(false);return;}
6741 fileEntry.moveTo(dirEntry,newName,fileRenamed,errorHandler.bind(this));}
6742 function fileRenamed(entry)
6743 {callback(true,entry.name);}
6744 function errorHandler(error)
6745 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when renaming file '"+(this._path+"/"+path)+"' to '"+newName+"'");callback(false);}},_readDirectory:function(dirEntry,callback)
6746 {var dirReader=dirEntry.createReader();var entries=[];function innerCallback(results)
6747 {if(!results.length)
6748 callback(entries.sort());else{entries=entries.concat(toArray(results));dirReader.readEntries(innerCallback,errorHandler);}}
6749 function toArray(list)
6750 {return Array.prototype.slice.call(list||[],0);}
6751 dirReader.readEntries(innerCallback,errorHandler);function errorHandler(error)
6752 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when reading directory '"+dirEntry.fullPath+"'");callback([]);}},_requestEntries:function(domFileSystem,path,callback)
6753 {domFileSystem.root.getDirectory(path,null,innerCallback.bind(this),errorHandler);function innerCallback(dirEntry)
6754 {this._readDirectory(dirEntry,callback)}
6755 function errorHandler(error)
6756 {var errorMessage=WebInspector.IsolatedFileSystem.errorMessage(error);console.error(errorMessage+" when requesting entry '"+path+"'");callback([]);}}}
6757 WebInspector.IsolatedFileSystemManager=function()
6758 {this._fileSystems={};this._pendingFileSystemRequests={};this._fileSystemMapping=new WebInspector.FileSystemMapping();this._requestFileSystems();}
6759 WebInspector.IsolatedFileSystemManager.FileSystem;WebInspector.IsolatedFileSystemManager.Events={FileSystemAdded:"FileSystemAdded",FileSystemRemoved:"FileSystemRemoved"}
6760 WebInspector.IsolatedFileSystemManager.prototype={mapping:function()
6761 {return this._fileSystemMapping;},_requestFileSystems:function()
6762 {console.assert(!this._loaded);InspectorFrontendHost.requestFileSystems();},addFileSystem:function()
6763 {InspectorFrontendHost.addFileSystem();},removeFileSystem:function(fileSystemPath)
6764 {InspectorFrontendHost.removeFileSystem(fileSystemPath);},_fileSystemsLoaded:function(fileSystems)
6765 {var addedFileSystemPaths={};for(var i=0;i<fileSystems.length;++i){this._innerAddFileSystem(fileSystems[i]);addedFileSystemPaths[fileSystems[i].fileSystemPath]=true;}
6766 var fileSystemPaths=this._fileSystemMapping.fileSystemPaths();for(var i=0;i<fileSystemPaths.length;++i){var fileSystemPath=fileSystemPaths[i];if(!addedFileSystemPaths[fileSystemPath])
6767 this._fileSystemRemoved(fileSystemPath);}
6768 this._loaded=true;this._processPendingFileSystemRequests();},_innerAddFileSystem:function(fileSystem)
6769 {var fileSystemPath=fileSystem.fileSystemPath;this._fileSystemMapping.addFileSystem(fileSystemPath);var isolatedFileSystem=new WebInspector.IsolatedFileSystem(this,fileSystemPath,fileSystem.fileSystemName,fileSystem.rootURL);this._fileSystems[fileSystemPath]=isolatedFileSystem;this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,isolatedFileSystem);},_processPendingFileSystemRequests:function()
6770 {for(var fileSystemPath in this._pendingFileSystemRequests){var callbacks=this._pendingFileSystemRequests[fileSystemPath];for(var i=0;i<callbacks.length;++i)
6771 callbacks[i](this._isolatedFileSystem(fileSystemPath));}
6772 delete this._pendingFileSystemRequests;},_fileSystemAdded:function(errorMessage,fileSystem)
6773 {var fileSystemPath;if(errorMessage)
6774 WebInspector.console.showErrorMessage(errorMessage)
6775 else if(fileSystem){this._innerAddFileSystem(fileSystem);fileSystemPath=fileSystem.fileSystemPath;}},_fileSystemRemoved:function(fileSystemPath)
6776 {this._fileSystemMapping.removeFileSystem(fileSystemPath);var isolatedFileSystem=this._fileSystems[fileSystemPath];delete this._fileSystems[fileSystemPath];if(isolatedFileSystem)
6777 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,isolatedFileSystem);},_isolatedFileSystem:function(fileSystemPath)
6778 {var fileSystem=this._fileSystems[fileSystemPath];if(!fileSystem)
6779 return null;if(!InspectorFrontendHost.isolatedFileSystem)
6780 return null;return InspectorFrontendHost.isolatedFileSystem(fileSystem.name(),fileSystem.rootURL());},requestDOMFileSystem:function(fileSystemPath,callback)
6781 {if(!this._loaded){if(!this._pendingFileSystemRequests[fileSystemPath])
6782 this._pendingFileSystemRequests[fileSystemPath]=this._pendingFileSystemRequests[fileSystemPath]||[];this._pendingFileSystemRequests[fileSystemPath].push(callback);return;}
6783 callback(this._isolatedFileSystem(fileSystemPath));},__proto__:WebInspector.Object.prototype}
6784 WebInspector.isolatedFileSystemManager;WebInspector.IsolatedFileSystemDispatcher=function(IsolatedFileSystemManager)
6785 {this._IsolatedFileSystemManager=IsolatedFileSystemManager;}
6786 WebInspector.IsolatedFileSystemDispatcher.prototype={fileSystemsLoaded:function(fileSystems)
6787 {this._IsolatedFileSystemManager._fileSystemsLoaded(fileSystems);},fileSystemRemoved:function(fileSystemPath)
6788 {this._IsolatedFileSystemManager._fileSystemRemoved(fileSystemPath);},fileSystemAdded:function(errorMessage,fileSystem)
6789 {this._IsolatedFileSystemManager._fileSystemAdded(errorMessage,fileSystem);}}
6790 WebInspector.isolatedFileSystemDispatcher;WebInspector.FileDescriptor=function(parentPath,name,originURL,url,contentType,isEditable,isContentScript)
6791 {this.parentPath=parentPath;this.name=name;this.originURL=originURL;this.url=url;this.contentType=contentType;this.isEditable=isEditable;this.isContentScript=isContentScript||false;}
6792 WebInspector.ProjectDelegate=function(){}
6793 WebInspector.ProjectDelegate.Events={FileAdded:"FileAdded",FileRemoved:"FileRemoved",Reset:"Reset",}
6794 WebInspector.ProjectDelegate.prototype={id:function(){},type:function(){},displayName:function(){},requestMetadata:function(path,callback){},requestFileContent:function(path,callback){},canSetFileContent:function(){},setFileContent:function(path,newContent,callback){},canRename:function(){},rename:function(path,newName,callback){},refresh:function(path){},excludeFolder:function(path){},createFile:function(path,name,content,callback){},deleteFile:function(path){},remove:function(){},searchInFileContent:function(path,query,caseSensitive,isRegex,callback){},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback){},indexContent:function(progress,callback){}}
6795 WebInspector.Project=function(workspace,projectDelegate)
6796 {this._uiSourceCodesMap={};this._uiSourceCodesList=[];this._workspace=workspace;this._projectDelegate=projectDelegate;this._displayName=this._projectDelegate.displayName();this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileAdded,this._fileAdded,this);this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.FileRemoved,this._fileRemoved,this);this._projectDelegate.addEventListener(WebInspector.ProjectDelegate.Events.Reset,this._reset,this);}
6797 WebInspector.Project.prototype={id:function()
6798 {return this._projectDelegate.id();},type:function()
6799 {return this._projectDelegate.type();},displayName:function()
6800 {return this._displayName;},isServiceProject:function()
6801 {return this._projectDelegate.type()===WebInspector.projectTypes.Debugger||this._projectDelegate.type()===WebInspector.projectTypes.Formatter||this._projectDelegate.type()===WebInspector.projectTypes.LiveEdit;},_fileAdded:function(event)
6802 {var fileDescriptor=(event.data);var path=fileDescriptor.parentPath?fileDescriptor.parentPath+"/"+fileDescriptor.name:fileDescriptor.name;var uiSourceCode=this.uiSourceCode(path);if(uiSourceCode)
6803 return;uiSourceCode=new WebInspector.UISourceCode(this,fileDescriptor.parentPath,fileDescriptor.name,fileDescriptor.originURL,fileDescriptor.url,fileDescriptor.contentType,fileDescriptor.isEditable);uiSourceCode.isContentScript=fileDescriptor.isContentScript;this._uiSourceCodesMap[path]={uiSourceCode:uiSourceCode,index:this._uiSourceCodesList.length};this._uiSourceCodesList.push(uiSourceCode);this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeAdded,uiSourceCode);},_fileRemoved:function(event)
6804 {var path=(event.data);this._removeFile(path);},_removeFile:function(path)
6805 {var uiSourceCode=this.uiSourceCode(path);if(!uiSourceCode)
6806 return;var entry=this._uiSourceCodesMap[path];var movedUISourceCode=this._uiSourceCodesList[this._uiSourceCodesList.length-1];this._uiSourceCodesList[entry.index]=movedUISourceCode;var movedEntry=this._uiSourceCodesMap[movedUISourceCode.path()];movedEntry.index=entry.index;this._uiSourceCodesList.splice(this._uiSourceCodesList.length-1,1);delete this._uiSourceCodesMap[path];this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeRemoved,entry.uiSourceCode);},_reset:function()
6807 {this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.ProjectWillReset,this);this._uiSourceCodesMap={};this._uiSourceCodesList=[];},workspace:function()
6808 {return this._workspace;},uiSourceCode:function(path)
6809 {var entry=this._uiSourceCodesMap[path];return entry?entry.uiSourceCode:null;},uiSourceCodeForOriginURL:function(originURL)
6810 {for(var i=0;i<this._uiSourceCodesList.length;++i){var uiSourceCode=this._uiSourceCodesList[i];if(uiSourceCode.originURL()===originURL)
6811 return uiSourceCode;}
6812 return null;},uiSourceCodes:function()
6813 {return this._uiSourceCodesList;},requestMetadata:function(uiSourceCode,callback)
6814 {this._projectDelegate.requestMetadata(uiSourceCode.path(),callback);},requestFileContent:function(uiSourceCode,callback)
6815 {this._projectDelegate.requestFileContent(uiSourceCode.path(),callback);},canSetFileContent:function()
6816 {return this._projectDelegate.canSetFileContent();},setFileContent:function(uiSourceCode,newContent,callback)
6817 {this._projectDelegate.setFileContent(uiSourceCode.path(),newContent,onSetContent.bind(this));function onSetContent(content)
6818 {this._workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted,{uiSourceCode:uiSourceCode,content:newContent});callback(content);}},canRename:function()
6819 {return this._projectDelegate.canRename();},rename:function(uiSourceCode,newName,callback)
6820 {if(newName===uiSourceCode.name()){callback(true,uiSourceCode.name(),uiSourceCode.url,uiSourceCode.originURL(),uiSourceCode.contentType());return;}
6821 this._projectDelegate.rename(uiSourceCode.path(),newName,innerCallback.bind(this));function innerCallback(success,newName,newURL,newOriginURL,newContentType)
6822 {if(!success||!newName){callback(false);return;}
6823 var oldPath=uiSourceCode.path();var newPath=uiSourceCode.parentPath()?uiSourceCode.parentPath()+"/"+newName:newName;this._uiSourceCodesMap[newPath]=this._uiSourceCodesMap[oldPath];delete this._uiSourceCodesMap[oldPath];callback(true,newName,newURL,newOriginURL,newContentType);}},refresh:function(path)
6824 {this._projectDelegate.refresh(path);},excludeFolder:function(path)
6825 {this._projectDelegate.excludeFolder(path);var uiSourceCodes=this._uiSourceCodesList.slice();for(var i=0;i<uiSourceCodes.length;++i){var uiSourceCode=uiSourceCodes[i];if(uiSourceCode.path().startsWith(path.substr(1)))
6826 this._removeFile(uiSourceCode.path());}},createFile:function(path,name,content,callback)
6827 {this._projectDelegate.createFile(path,name,content,innerCallback);function innerCallback(filePath)
6828 {callback(filePath);}},deleteFile:function(path)
6829 {this._projectDelegate.deleteFile(path);},remove:function()
6830 {this._projectDelegate.remove();},searchInFileContent:function(uiSourceCode,query,caseSensitive,isRegex,callback)
6831 {this._projectDelegate.searchInFileContent(uiSourceCode.path(),query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
6832 {this._projectDelegate.findFilesMatchingSearchRequest(queries,fileQueries,caseSensitive,isRegex,progress,callback);},indexContent:function(progress,callback)
6833 {this._projectDelegate.indexContent(progress,callback);},dispose:function()
6834 {this._projectDelegate.reset();}}
6835 WebInspector.projectTypes={Debugger:"debugger",Formatter:"formatter",LiveEdit:"liveedit",Network:"network",Snippets:"snippets",FileSystem:"filesystem"}
6836 WebInspector.Workspace=function(fileSystemMapping)
6837 {this._fileSystemMapping=fileSystemMapping;this._projects={};this._hasResourceContentTrackingExtensions=false;}
6838 WebInspector.Workspace.Events={UISourceCodeAdded:"UISourceCodeAdded",UISourceCodeRemoved:"UISourceCodeRemoved",UISourceCodeContentCommitted:"UISourceCodeContentCommitted",ProjectWillReset:"ProjectWillReset"}
6839 WebInspector.Workspace.prototype={unsavedSourceCodes:function()
6840 {function filterUnsaved(sourceCode)
6841 {return sourceCode.isDirty();}
6842 return this.uiSourceCodes().filter(filterUnsaved);},uiSourceCode:function(projectId,path)
6843 {var project=this._projects[projectId];return project?project.uiSourceCode(path):null;},uiSourceCodeForOriginURL:function(originURL)
6844 {var networkProjects=this.projectsForType(WebInspector.projectTypes.Network)
6845 for(var i=0;i<networkProjects.length;++i){var project=networkProjects[i];var uiSourceCode=project.uiSourceCodeForOriginURL(originURL);if(uiSourceCode)
6846 return uiSourceCode;}
6847 return null;},uiSourceCodesForProjectType:function(type)
6848 {var result=[];for(var projectName in this._projects){var project=this._projects[projectName];if(project.type()===type)
6849 result=result.concat(project.uiSourceCodes());}
6850 return result;},addProject:function(projectDelegate)
6851 {var projectId=projectDelegate.id();this._projects[projectId]=new WebInspector.Project(this,projectDelegate);return this._projects[projectId];},removeProject:function(projectId)
6852 {var project=this._projects[projectId];if(!project)
6853 return;project.dispose();delete this._projects[projectId];},project:function(projectId)
6854 {return this._projects[projectId];},projects:function()
6855 {return Object.values(this._projects);},projectsForType:function(type)
6856 {function filterByType(project)
6857 {return project.type()===type;}
6858 return this.projects().filter(filterByType);},uiSourceCodes:function()
6859 {var result=[];for(var projectId in this._projects){var project=this._projects[projectId];result=result.concat(project.uiSourceCodes());}
6860 return result;},hasMappingForURL:function(url)
6861 {return this._fileSystemMapping.hasMappingForURL(url);},_networkUISourceCodeForURL:function(url)
6862 {var splitURL=WebInspector.ParsedURL.splitURL(url);var projectId=WebInspector.SimpleProjectDelegate.projectId(splitURL[0],WebInspector.projectTypes.Network);var project=this.project(projectId);return project?project.uiSourceCode(splitURL.slice(1).join("/")):null;},uiSourceCodeForURL:function(url)
6863 {var file=this._fileSystemMapping.fileForURL(url);if(!file)
6864 return this._networkUISourceCodeForURL(url);var projectId=WebInspector.FileSystemProjectDelegate.projectId(file.fileSystemPath);var project=this.project(projectId);return project?project.uiSourceCode(file.filePath):null;},urlForPath:function(fileSystemPath,filePath)
6865 {return this._fileSystemMapping.urlForPath(fileSystemPath,filePath);},addMapping:function(networkUISourceCode,uiSourceCode,fileSystemWorkspaceProvider)
6866 {var url=networkUISourceCode.url;var path=uiSourceCode.path();var fileSystemPath=fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);this._fileSystemMapping.addMappingForResource(url,fileSystemPath,path);},removeMapping:function(uiSourceCode)
6867 {this._fileSystemMapping.removeMappingForURL(uiSourceCode.url);},setHasResourceContentTrackingExtensions:function(hasExtensions)
6868 {this._hasResourceContentTrackingExtensions=hasExtensions;},hasResourceContentTrackingExtensions:function()
6869 {return this._hasResourceContentTrackingExtensions;},__proto__:WebInspector.Object.prototype}
6870 WebInspector.workspace;WebInspector.WorkspaceController=function(workspace)
6871 {this._workspace=workspace;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._inspectedURLChanged,this);window.addEventListener("focus",this._windowFocused.bind(this),false);}
6872 WebInspector.WorkspaceController.prototype={_inspectedURLChanged:function(event)
6873 {WebInspector.Revision.filterOutStaleRevisions();},_windowFocused:function(event)
6874 {if(this._fileSystemRefreshTimeout)
6875 return;this._fileSystemRefreshTimeout=setTimeout(refreshFileSystems.bind(this),1000);function refreshFileSystems()
6876 {delete this._fileSystemRefreshTimeout;var projects=this._workspace.projects();for(var i=0;i<projects.length;++i)
6877 projects[i].refresh("/");}}}
6878 WebInspector.ContentProviderBasedProjectDelegate=function(type)
6879 {this._type=type;this._contentProviders={};this._isContentScriptMap={};}
6880 WebInspector.ContentProviderBasedProjectDelegate.prototype={id:function()
6881 {return"";},type:function()
6882 {return this._type;},displayName:function()
6883 {return"";},requestMetadata:function(path,callback)
6884 {callback(null,null);},requestFileContent:function(path,callback)
6885 {var contentProvider=this._contentProviders[path];contentProvider.requestContent(callback);function innerCallback(content,encoded,mimeType)
6886 {callback(content);}},canSetFileContent:function()
6887 {return false;},setFileContent:function(path,newContent,callback)
6888 {callback(null);},canRename:function()
6889 {return false;},rename:function(path,newName,callback)
6890 {this.performRename(path,newName,innerCallback.bind(this));function innerCallback(success,newName)
6891 {if(success)
6892 this._updateName(path,(newName));callback(success,newName);}},refresh:function(path)
6893 {},excludeFolder:function(path)
6894 {},createFile:function(path,name,content,callback)
6895 {},deleteFile:function(path)
6896 {},remove:function()
6897 {},performRename:function(path,newName,callback)
6898 {callback(false);},_updateName:function(path,newName)
6899 {var oldPath=path;var copyOfPath=path.split("/");copyOfPath[copyOfPath.length-1]=newName;var newPath=copyOfPath.join("/");this._contentProviders[newPath]=this._contentProviders[oldPath];delete this._contentProviders[oldPath];},searchInFileContent:function(path,query,caseSensitive,isRegex,callback)
6900 {var contentProvider=this._contentProviders[path];contentProvider.searchInContent(query,caseSensitive,isRegex,callback);},findFilesMatchingSearchRequest:function(queries,fileQueries,caseSensitive,isRegex,progress,callback)
6901 {var result=[];var paths=Object.keys(this._contentProviders);var totalCount=paths.length;if(totalCount===0){setTimeout(doneCallback,0);return;}
6902 function filterOutContentScripts(path)
6903 {return!this._isContentScriptMap[path];}
6904 if(!WebInspector.settings.searchInContentScripts.get())
6905 paths=paths.filter(filterOutContentScripts.bind(this));var fileRegexes=[];for(var i=0;i<fileQueries.length;++i)
6906 fileRegexes.push(new RegExp(fileQueries[i],caseSensitive?"":"i"));function filterOutNonMatchingFiles(file)
6907 {for(var i=0;i<fileRegexes.length;++i){if(!file.match(fileRegexes[i]))
6908 return false;}
6909 return true;}
6910 paths=paths.filter(filterOutNonMatchingFiles);var barrier=new CallbackBarrier();progress.setTotalWork(paths.length);for(var i=0;i<paths.length;++i)
6911 searchInContent.call(this,paths[i],barrier.createCallback(searchInContentCallback.bind(null,paths[i])));barrier.callWhenDone(doneCallback);function searchInContent(path,callback)
6912 {var queriesToRun=queries.slice();searchNextQuery.call(this);function searchNextQuery()
6913 {if(!queriesToRun.length){callback(true);return;}
6914 var query=queriesToRun.shift();this._contentProviders[path].searchInContent(query,caseSensitive,isRegex,contentCallback.bind(this));}
6915 function contentCallback(searchMatches)
6916 {if(!searchMatches.length){callback(false);return;}
6917 searchNextQuery.call(this);}}
6918 function searchInContentCallback(path,matches)
6919 {if(matches)
6920 result.push(path);progress.worked(1);}
6921 function doneCallback()
6922 {callback(result);progress.done();}},indexContent:function(progress,callback)
6923 {setTimeout(innerCallback,0);function innerCallback()
6924 {progress.done();callback();}},addContentProvider:function(parentPath,name,url,contentProvider,isEditable,isContentScript)
6925 {var path=parentPath?parentPath+"/"+name:name;if(this._contentProviders[path])
6926 return path;var fileDescriptor=new WebInspector.FileDescriptor(parentPath,name,url,url,contentProvider.contentType(),isEditable,isContentScript);this._contentProviders[path]=contentProvider;this._isContentScriptMap[path]=isContentScript||false;this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded,fileDescriptor);return path;},removeFile:function(path)
6927 {delete this._contentProviders[path];delete this._isContentScriptMap[path];this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved,path);},contentProviders:function()
6928 {return this._contentProviders;},reset:function()
6929 {this._contentProviders={};this._isContentScriptMap={};this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.Reset,null);},__proto__:WebInspector.Object.prototype}
6930 WebInspector.SimpleProjectDelegate=function(name,type)
6931 {WebInspector.ContentProviderBasedProjectDelegate.call(this,type);this._name=name;this._lastUniqueSuffix=0;}
6932 WebInspector.SimpleProjectDelegate.projectId=function(name,type)
6933 {var typePrefix=type!==WebInspector.projectTypes.Network?(type+":"):"";return typePrefix+name;}
6934 WebInspector.SimpleProjectDelegate.prototype={id:function()
6935 {return WebInspector.SimpleProjectDelegate.projectId(this._name,this.type());},displayName:function()
6936 {if(typeof this._displayName!=="undefined")
6937 return this._displayName;if(!this._name){this._displayName=this.type()!==WebInspector.projectTypes.Snippets?WebInspector.UIString("(no domain)"):"";return this._displayName;}
6938 var parsedURL=new WebInspector.ParsedURL(this._name);if(parsedURL.isValid){this._displayName=parsedURL.host+(parsedURL.port?(":"+parsedURL.port):"");if(!this._displayName)
6939 this._displayName=this._name;}
6940 else
6941 this._displayName=this._name;return this._displayName;},addFile:function(parentPath,name,forceUniquePath,url,contentProvider,isEditable,isContentScript)
6942 {if(forceUniquePath)
6943 name=this._ensureUniqueName(parentPath,name);return this.addContentProvider(parentPath,name,url,contentProvider,isEditable,isContentScript);},_ensureUniqueName:function(parentPath,name)
6944 {var path=parentPath?parentPath+"/"+name:name;var uniquePath=path;var suffix="";var contentProviders=this.contentProviders();while(contentProviders[uniquePath]){suffix=" ("+(++this._lastUniqueSuffix)+")";uniquePath=path+suffix;}
6945 return name+suffix;},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
6946 WebInspector.SimpleWorkspaceProvider=function(workspace,type)
6947 {this._workspace=workspace;this._type=type;this._simpleProjectDelegates={};}
6948 WebInspector.SimpleWorkspaceProvider.prototype={_projectDelegate:function(projectName)
6949 {if(this._simpleProjectDelegates[projectName])
6950 return this._simpleProjectDelegates[projectName];var simpleProjectDelegate=new WebInspector.SimpleProjectDelegate(projectName,this._type);this._simpleProjectDelegates[projectName]=simpleProjectDelegate;this._workspace.addProject(simpleProjectDelegate);return simpleProjectDelegate;},addFileForURL:function(url,contentProvider,isEditable,isContentScript)
6951 {return this._innerAddFileForURL(url,contentProvider,isEditable,false,isContentScript);},addUniqueFileForURL:function(url,contentProvider,isEditable,isContentScript)
6952 {return this._innerAddFileForURL(url,contentProvider,isEditable,true,isContentScript);},_innerAddFileForURL:function(url,contentProvider,isEditable,forceUnique,isContentScript)
6953 {var splitURL=WebInspector.ParsedURL.splitURL(url);var projectName=splitURL[0];var parentPath=splitURL.slice(1,splitURL.length-1).join("/");var name=splitURL[splitURL.length-1];var projectDelegate=this._projectDelegate(projectName);var path=projectDelegate.addFile(parentPath,name,forceUnique,url,contentProvider,isEditable,isContentScript);var uiSourceCode=(this._workspace.uiSourceCode(projectDelegate.id(),path));console.assert(uiSourceCode);return uiSourceCode;},reset:function()
6954 {for(var projectName in this._simpleProjectDelegates)
6955 this._simpleProjectDelegates[projectName].reset();this._simpleProjectDelegates={};},__proto__:WebInspector.Object.prototype}
6956 WebInspector.BreakpointManager=function(breakpointStorage,debuggerModel,workspace)
6957 {this._storage=new WebInspector.BreakpointManager.Storage(this,breakpointStorage);this._debuggerModel=debuggerModel;this._workspace=workspace;this._breakpointForDebuggerId={};this._breakpointsForUISourceCode=new Map();this._breakpointsForPrimaryUISourceCode=new Map();this._sourceFilesWithRestoredBreakpoints={};this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved,this._breakpointResolved,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._projectWillReset,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);}
6958 WebInspector.BreakpointManager.Events={BreakpointAdded:"breakpoint-added",BreakpointRemoved:"breakpoint-removed"}
6959 WebInspector.BreakpointManager._sourceFileId=function(uiSourceCode)
6960 {if(!uiSourceCode.url)
6961 return"";return uiSourceCode.uri();}
6962 WebInspector.BreakpointManager._breakpointStorageId=function(sourceFileId,lineNumber,columnNumber)
6963 {if(!sourceFileId)
6964 return"";return sourceFileId+":"+lineNumber+":"+columnNumber;}
6965 WebInspector.BreakpointManager.prototype={_provisionalBreakpointsForSourceFileId:function(sourceFileId)
6966 {var result=new StringMap();for(var debuggerId in this._breakpointForDebuggerId){var breakpoint=this._breakpointForDebuggerId[debuggerId];if(breakpoint._sourceFileId===sourceFileId)
6967 result.put(breakpoint._breakpointStorageId(),breakpoint);}
6968 return result;},removeProvisionalBreakpointsForTest:function()
6969 {for(var debuggerId in this._breakpointForDebuggerId)
6970 this._debuggerModel.removeBreakpoint(debuggerId);},_restoreBreakpoints:function(uiSourceCode)
6971 {var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);if(!sourceFileId||this._sourceFilesWithRestoredBreakpoints[sourceFileId])
6972 return;this._sourceFilesWithRestoredBreakpoints[sourceFileId]=true;this._storage.mute();var breakpointItems=this._storage.breakpointItems(uiSourceCode);var provisionalBreakpoints=this._provisionalBreakpointsForSourceFileId(sourceFileId);for(var i=0;i<breakpointItems.length;++i){var breakpointItem=breakpointItems[i];var itemStorageId=WebInspector.BreakpointManager._breakpointStorageId(breakpointItem.sourceFileId,breakpointItem.lineNumber,breakpointItem.columnNumber);var provisionalBreakpoint=provisionalBreakpoints.get(itemStorageId);if(provisionalBreakpoint){if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
6973 this._breakpointsForPrimaryUISourceCode.put(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provisionalBreakpoint);provisionalBreakpoint._updateInDebugger();}else{this._innerSetBreakpoint(uiSourceCode,breakpointItem.lineNumber,breakpointItem.columnNumber,breakpointItem.condition,breakpointItem.enabled);}}
6974 this._storage.unmute();},_uiSourceCodeAdded:function(event)
6975 {var uiSourceCode=(event.data);this._restoreBreakpoints(uiSourceCode);if(uiSourceCode.contentType()===WebInspector.resourceTypes.Script||uiSourceCode.contentType()===WebInspector.resourceTypes.Document)
6976 uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);},_uiSourceCodeRemoved:function(event)
6977 {var uiSourceCode=(event.data);this._removeUISourceCode(uiSourceCode);},_uiSourceCodeMappingChanged:function(event)
6978 {var uiSourceCode=(event.target);var isIdentity=(event.data.isIdentity);if(isIdentity)
6979 return;var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];for(var i=0;i<breakpoints.length;++i)
6980 breakpoints[i]._updateInDebugger();},_removeUISourceCode:function(uiSourceCode)
6981 {var breakpoints=this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[];for(var i=0;i<breakpoints.length;++i)
6982 breakpoints[i]._resetLocations();var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);delete this._sourceFilesWithRestoredBreakpoints[sourceFileId];uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.SourceMappingChanged,this._uiSourceCodeMappingChanged,this);this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode);},setBreakpoint:function(uiSourceCode,lineNumber,columnNumber,condition,enabled)
6983 {this._debuggerModel.setBreakpointsActive(true);return this._innerSetBreakpoint(uiSourceCode,lineNumber,columnNumber,condition,enabled);},_innerSetBreakpoint:function(uiSourceCode,lineNumber,columnNumber,condition,enabled)
6984 {var breakpoint=this.findBreakpoint(uiSourceCode,lineNumber,columnNumber);if(breakpoint){breakpoint._updateBreakpoint(condition,enabled);return breakpoint;}
6985 var projectId=uiSourceCode.project().id();var path=uiSourceCode.path();var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);breakpoint=new WebInspector.BreakpointManager.Breakpoint(this,projectId,path,sourceFileId,lineNumber,columnNumber,condition,enabled);if(!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
6986 this._breakpointsForPrimaryUISourceCode.put(uiSourceCode,[]);this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint);return breakpoint;},findBreakpoint:function(uiSourceCode,lineNumber,columnNumber)
6987 {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineBreakpoints=breakpoints?breakpoints.get(String(lineNumber)):null;var columnBreakpoints=lineBreakpoints?lineBreakpoints.get(String(columnNumber)):null;return columnBreakpoints?columnBreakpoints[0]:null;},findBreakpointOnLine:function(uiSourceCode,lineNumber)
6988 {var breakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineBreakpoints=breakpoints?breakpoints.get(String(lineNumber)):null;return lineBreakpoints?lineBreakpoints.values()[0][0]:null;},breakpointsForUISourceCode:function(uiSourceCode)
6989 {var result=[];var uiSourceCodeBreakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var breakpoints=uiSourceCodeBreakpoints?uiSourceCodeBreakpoints.values():[];for(var i=0;i<breakpoints.length;++i){var lineBreakpoints=breakpoints[i];var columnBreakpointArrays=lineBreakpoints?lineBreakpoints.values():[];result=result.concat.apply(result,columnBreakpointArrays);}
6990 return result;},allBreakpoints:function()
6991 {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keys();for(var i=0;i<uiSourceCodes.length;++i)
6992 result=result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i]));return result;},breakpointLocationsForUISourceCode:function(uiSourceCode)
6993 {var uiSourceCodeBreakpoints=this._breakpointsForUISourceCode.get(uiSourceCode);var lineNumbers=uiSourceCodeBreakpoints?uiSourceCodeBreakpoints.keys():[];var result=[];for(var i=0;i<lineNumbers.length;++i){var lineBreakpoints=uiSourceCodeBreakpoints.get(lineNumbers[i]);var columnNumbers=lineBreakpoints.keys();for(var j=0;j<columnNumbers.length;++j){var columnBreakpoints=lineBreakpoints.get(columnNumbers[j]);var lineNumber=parseInt(lineNumbers[i],10);var columnNumber=parseInt(columnNumbers[j],10);for(var k=0;k<columnBreakpoints.length;++k){var breakpoint=columnBreakpoints[k];var uiLocation=new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber);result.push({breakpoint:breakpoint,uiLocation:uiLocation});}}}
6994 return result;},allBreakpointLocations:function()
6995 {var result=[];var uiSourceCodes=this._breakpointsForUISourceCode.keys();for(var i=0;i<uiSourceCodes.length;++i)
6996 result=result.concat(this.breakpointLocationsForUISourceCode(uiSourceCodes[i]));return result;},toggleAllBreakpoints:function(toggleState)
6997 {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
6998 breakpoints[i].setEnabled(toggleState);},removeAllBreakpoints:function()
6999 {var breakpoints=this.allBreakpoints();for(var i=0;i<breakpoints.length;++i)
7000 breakpoints[i].remove();},_projectWillReset:function(event)
7001 {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
7002 this._removeUISourceCode(uiSourceCodes[i]);},_breakpointResolved:function(event)
7003 {var breakpointId=(event.data.breakpointId);var location=(event.data.location);var breakpoint=this._breakpointForDebuggerId[breakpointId];if(!breakpoint)
7004 return;breakpoint._addResolvedLocation(location);},_removeBreakpoint:function(breakpoint,removeFromStorage)
7005 {var uiSourceCode=breakpoint.uiSourceCode();var breakpoints=uiSourceCode?this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)||[]:[];var index=breakpoints.indexOf(breakpoint);if(index>-1)
7006 breakpoints.splice(index,1);if(removeFromStorage)
7007 this._storage._removeBreakpoint(breakpoint);},_uiLocationAdded:function(breakpoint,uiLocation)
7008 {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints){breakpoints=new StringMap();this._breakpointsForUISourceCode.put(uiLocation.uiSourceCode,breakpoints);}
7009 var lineBreakpoints=breakpoints.get(String(uiLocation.lineNumber));if(!lineBreakpoints){lineBreakpoints=new StringMap();breakpoints.put(String(uiLocation.lineNumber),lineBreakpoints);}
7010 var columnBreakpoints=lineBreakpoints.get(String(uiLocation.columnNumber));if(!columnBreakpoints){columnBreakpoints=[];lineBreakpoints.put(String(uiLocation.columnNumber),columnBreakpoints);}
7011 columnBreakpoints.push(breakpoint);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointAdded,{breakpoint:breakpoint,uiLocation:uiLocation});},_uiLocationRemoved:function(breakpoint,uiLocation)
7012 {var breakpoints=this._breakpointsForUISourceCode.get(uiLocation.uiSourceCode);if(!breakpoints)
7013 return;var lineBreakpoints=breakpoints.get(String(uiLocation.lineNumber));if(!lineBreakpoints)
7014 return;var columnBreakpoints=lineBreakpoints.get(String(uiLocation.columnNumber));if(!columnBreakpoints)
7015 return;columnBreakpoints.remove(breakpoint);if(!columnBreakpoints.length)
7016 lineBreakpoints.remove(String(uiLocation.columnNumber));if(!lineBreakpoints.size())
7017 breakpoints.remove(String(uiLocation.lineNumber));if(!breakpoints.size())
7018 this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode);this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.BreakpointRemoved,{breakpoint:breakpoint,uiLocation:uiLocation});},__proto__:WebInspector.Object.prototype}
7019 WebInspector.BreakpointManager.Breakpoint=function(breakpointManager,projectId,path,sourceFileId,lineNumber,columnNumber,condition,enabled)
7020 {this._breakpointManager=breakpointManager;this._projectId=projectId;this._path=path;this._lineNumber=lineNumber;this._columnNumber=columnNumber;this._sourceFileId=sourceFileId;this._liveLocations=[];this._uiLocations={};this._condition;this._enabled;this._updateBreakpoint(condition,enabled);}
7021 WebInspector.BreakpointManager.Breakpoint.prototype={projectId:function()
7022 {return this._projectId;},path:function()
7023 {return this._path;},lineNumber:function()
7024 {return this._lineNumber;},columnNumber:function()
7025 {return this._columnNumber;},uiSourceCode:function()
7026 {return this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);},_addResolvedLocation:function(location)
7027 {this._liveLocations.push(this._breakpointManager._debuggerModel.createLiveLocation(location,this._locationUpdated.bind(this,location)));},_locationUpdated:function(location,uiLocation)
7028 {var stringifiedLocation=location.scriptId+":"+location.lineNumber+":"+location.columnNumber;var oldUILocation=(this._uiLocations[stringifiedLocation]);if(oldUILocation)
7029 this._breakpointManager._uiLocationRemoved(this,oldUILocation);if(this._uiLocations[""]){var defaultLocation=this._uiLocations[""];delete this._uiLocations[""];this._breakpointManager._uiLocationRemoved(this,defaultLocation);}
7030 this._uiLocations[stringifiedLocation]=uiLocation;this._breakpointManager._uiLocationAdded(this,uiLocation);},enabled:function()
7031 {return this._enabled;},setEnabled:function(enabled)
7032 {this._updateBreakpoint(this._condition,enabled);},condition:function()
7033 {return this._condition;},setCondition:function(condition)
7034 {this._updateBreakpoint(condition,this._enabled);},_updateBreakpoint:function(condition,enabled)
7035 {if(this._enabled===enabled&&this._condition===condition)
7036 return;this._removeFromDebugger();this._enabled=enabled;this._condition=condition;this._breakpointManager._storage._updateBreakpoint(this);this._fakeBreakpointAtPrimaryLocation();this._updateInDebugger();},_updateInDebugger:function()
7037 {var uiSourceCode=this.uiSourceCode();if(!uiSourceCode)
7038 return;var scriptFile=uiSourceCode&&uiSourceCode.scriptFile();if(this._enabled&&!(scriptFile&&scriptFile.hasDivergedFromVM()))
7039 this._setInDebugger();},remove:function(keepInStorage)
7040 {var removeFromStorage=!keepInStorage;this._resetLocations();this._removeFromDebugger();this._breakpointManager._removeBreakpoint(this,removeFromStorage);},_setInDebugger:function()
7041 {this._removeFromDebugger();var uiSourceCode=this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);if(!uiSourceCode)
7042 return;var rawLocation=uiSourceCode.uiLocationToRawLocation(this._lineNumber,this._columnNumber);var debuggerModelLocation=(rawLocation);if(debuggerModelLocation)
7043 this._breakpointManager._debuggerModel.setBreakpointByScriptLocation(debuggerModelLocation,this._condition,this._didSetBreakpointInDebugger.bind(this));else if(uiSourceCode.url)
7044 this._breakpointManager._debuggerModel.setBreakpointByURL(uiSourceCode.url,this._lineNumber,this._columnNumber,this._condition,this._didSetBreakpointInDebugger.bind(this));},_didSetBreakpointInDebugger:function(breakpointId,locations)
7045 {if(!breakpointId){this._resetLocations();this._breakpointManager._removeBreakpoint(this,false);return;}
7046 this._debuggerId=breakpointId;this._breakpointManager._breakpointForDebuggerId[breakpointId]=this;if(!locations.length){this._fakeBreakpointAtPrimaryLocation();return;}
7047 this._resetLocations();for(var i=0;i<locations.length;++i){var script=this._breakpointManager._debuggerModel.scriptForId(locations[i].scriptId);var uiLocation=script.rawLocationToUILocation(locations[i].lineNumber,locations[i].columnNumber);if(this._breakpointManager.findBreakpoint(uiLocation.uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber)){this.remove();return;}}
7048 for(var i=0;i<locations.length;++i)
7049 this._addResolvedLocation(locations[i]);},_removeFromDebugger:function()
7050 {if(!this._debuggerId)
7051 return;this._breakpointManager._debuggerModel.removeBreakpoint(this._debuggerId,this._didRemoveFromDebugger.bind(this));},_didRemoveFromDebugger:function()
7052 {delete this._breakpointManager._breakpointForDebuggerId[this._debuggerId];delete this._debuggerId;},_resetLocations:function()
7053 {for(var stringifiedLocation in this._uiLocations)
7054 this._breakpointManager._uiLocationRemoved(this,this._uiLocations[stringifiedLocation]);for(var i=0;i<this._liveLocations.length;++i)
7055 this._liveLocations[i].dispose();this._liveLocations=[];this._uiLocations={};},_breakpointStorageId:function()
7056 {return WebInspector.BreakpointManager._breakpointStorageId(this._sourceFileId,this._lineNumber,this._columnNumber);},_fakeBreakpointAtPrimaryLocation:function()
7057 {this._resetLocations();var uiSourceCode=this._breakpointManager._workspace.uiSourceCode(this._projectId,this._path);if(!uiSourceCode)
7058 return;var uiLocation=new WebInspector.UILocation(uiSourceCode,this._lineNumber,this._columnNumber);this._uiLocations[""]=uiLocation;this._breakpointManager._uiLocationAdded(this,uiLocation);}}
7059 WebInspector.BreakpointManager.Storage=function(breakpointManager,setting)
7060 {this._breakpointManager=breakpointManager;this._setting=setting;var breakpoints=this._setting.get();this._breakpoints={};for(var i=0;i<breakpoints.length;++i){var breakpoint=(breakpoints[i]);breakpoint.columnNumber=breakpoint.columnNumber||0;this._breakpoints[breakpoint.sourceFileId+":"+breakpoint.lineNumber+":"+breakpoint.columnNumber]=breakpoint;}}
7061 WebInspector.BreakpointManager.Storage.prototype={mute:function()
7062 {this._muted=true;},unmute:function()
7063 {delete this._muted;},breakpointItems:function(uiSourceCode)
7064 {var result=[];var sourceFileId=WebInspector.BreakpointManager._sourceFileId(uiSourceCode);for(var id in this._breakpoints){var breakpoint=this._breakpoints[id];if(breakpoint.sourceFileId===sourceFileId)
7065 result.push(breakpoint);}
7066 return result;},_updateBreakpoint:function(breakpoint)
7067 {if(this._muted||!breakpoint._breakpointStorageId())
7068 return;this._breakpoints[breakpoint._breakpointStorageId()]=new WebInspector.BreakpointManager.Storage.Item(breakpoint);this._save();},_removeBreakpoint:function(breakpoint)
7069 {if(this._muted)
7070 return;delete this._breakpoints[breakpoint._breakpointStorageId()];this._save();},_save:function()
7071 {var breakpointsArray=[];for(var id in this._breakpoints)
7072 breakpointsArray.push(this._breakpoints[id]);this._setting.set(breakpointsArray);}}
7073 WebInspector.BreakpointManager.Storage.Item=function(breakpoint)
7074 {this.sourceFileId=breakpoint._sourceFileId;this.lineNumber=breakpoint.lineNumber();this.columnNumber=breakpoint.columnNumber();this.condition=breakpoint.condition();this.enabled=breakpoint.enabled();}
7075 WebInspector.breakpointManager;WebInspector.ConcatenatedScriptsContentProvider=function(scripts)
7076 {this._scripts=scripts;}
7077 WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag="<script>";WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag="</script>";WebInspector.ConcatenatedScriptsContentProvider.prototype={_sortedScripts:function()
7078 {if(this._sortedScriptsArray)
7079 return this._sortedScriptsArray;this._sortedScriptsArray=[];var scripts=this._scripts.slice();scripts.sort(function(x,y){return x.lineOffset-y.lineOffset||x.columnOffset-y.columnOffset;});var scriptOpenTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag.length;var scriptCloseTagLength=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag.length;this._sortedScriptsArray.push(scripts[0]);for(var i=1;i<scripts.length;++i){var previousScript=this._sortedScriptsArray[this._sortedScriptsArray.length-1];var lineNumber=previousScript.endLine;var columnNumber=previousScript.endColumn+scriptCloseTagLength+scriptOpenTagLength;if(lineNumber<scripts[i].lineOffset||(lineNumber===scripts[i].lineOffset&&columnNumber<=scripts[i].columnOffset))
7080 this._sortedScriptsArray.push(scripts[i]);}
7081 return this._sortedScriptsArray;},contentURL:function()
7082 {return"";},contentType:function()
7083 {return WebInspector.resourceTypes.Document;},requestContent:function(callback)
7084 {var scripts=this._sortedScripts();var sources=[];function didRequestSource(content)
7085 {sources.push(content);if(sources.length==scripts.length)
7086 callback(this._concatenateScriptsContent(scripts,sources));}
7087 for(var i=0;i<scripts.length;++i)
7088 scripts[i].requestContent(didRequestSource.bind(this));},searchInContent:function(query,caseSensitive,isRegex,callback)
7089 {var results={};var scripts=this._sortedScripts();var scriptsLeft=scripts.length;function maybeCallback()
7090 {if(scriptsLeft)
7091 return;var result=[];for(var i=0;i<scripts.length;++i)
7092 result=result.concat(results[scripts[i].scriptId]);callback(result);}
7093 function searchCallback(script,searchMatches)
7094 {results[script.scriptId]=[];for(var i=0;i<searchMatches.length;++i){var searchMatch=new WebInspector.ContentProvider.SearchMatch(searchMatches[i].lineNumber+script.lineOffset,searchMatches[i].lineContent);results[script.scriptId].push(searchMatch);}
7095 scriptsLeft--;maybeCallback();}
7096 maybeCallback();for(var i=0;i<scripts.length;++i)
7097 scripts[i].searchInContent(query,caseSensitive,isRegex,searchCallback.bind(null,scripts[i]));},_concatenateScriptsContent:function(scripts,sources)
7098 {var content="";var lineNumber=0;var columnNumber=0;var scriptOpenTag=WebInspector.ConcatenatedScriptsContentProvider.scriptOpenTag;var scriptCloseTag=WebInspector.ConcatenatedScriptsContentProvider.scriptCloseTag;for(var i=0;i<scripts.length;++i){for(var newLinesCount=scripts[i].lineOffset-lineNumber;newLinesCount>0;--newLinesCount){columnNumber=0;content+="\n";}
7099 for(var spacesCount=scripts[i].columnOffset-columnNumber-scriptOpenTag.length;spacesCount>0;--spacesCount)
7100 content+=" ";content+=scriptOpenTag;content+=sources[i];content+=scriptCloseTag;lineNumber=scripts[i].endLine;columnNumber=scripts[i].endColumn+scriptCloseTag.length;}
7101 return content;}}
7102 WebInspector.CompilerSourceMappingContentProvider=function(sourceURL,contentType)
7103 {this._sourceURL=sourceURL;this._contentType=contentType;}
7104 WebInspector.CompilerSourceMappingContentProvider.prototype={contentURL:function()
7105 {return this._sourceURL;},contentType:function()
7106 {return this._contentType;},requestContent:function(callback)
7107 {NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,this._sourceURL,undefined,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
7108 {if(error||statusCode>=400){console.error("Could not load content for "+this._sourceURL+" : "+(error||("HTTP status code: "+statusCode)));callback(null);return;}
7109 callback(content);}},searchInContent:function(query,caseSensitive,isRegex,callback)
7110 {this.requestContent(contentLoaded);function contentLoaded(content)
7111 {if(typeof content!=="string"){callback([]);return;}
7112 callback(WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex));}}}
7113 WebInspector.StaticContentProvider=function(contentType,content)
7114 {this._content=content;this._contentType=contentType;}
7115 WebInspector.StaticContentProvider.prototype={contentURL:function()
7116 {return"";},contentType:function()
7117 {return this._contentType;},requestContent:function(callback)
7118 {callback(this._content);},searchInContent:function(query,caseSensitive,isRegex,callback)
7119 {function performSearch()
7120 {callback(WebInspector.ContentProvider.performSearchInContent(this._content,query,caseSensitive,isRegex));}
7121 window.setTimeout(performSearch.bind(this),0);}}
7122 WebInspector.DefaultScriptMapping=function(debuggerModel,workspace)
7123 {this._debuggerModel=debuggerModel;this._projectDelegate=new WebInspector.DebuggerProjectDelegate();this._workspace=workspace;this._workspace.addProject(this._projectDelegate);debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._debuggerReset();}
7124 WebInspector.DefaultScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
7125 {var debuggerModelLocation=(rawLocation);var script=this._debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiSourceCode=this._uiSourceCodeForScriptId[script.scriptId];var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;return new WebInspector.UILocation(uiSourceCode,lineNumber,columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
7126 {var scriptId=this._scriptIdForUISourceCode.get(uiSourceCode);var script=this._debuggerModel.scriptForId(scriptId);return this._debuggerModel.createRawLocation(script,lineNumber,columnNumber);},addScript:function(script)
7127 {var path=this._projectDelegate.addScript(script);var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode){console.assert(uiSourceCode);return;}
7128 this._uiSourceCodeForScriptId[script.scriptId]=uiSourceCode;this._scriptIdForUISourceCode.put(uiSourceCode,script.scriptId);uiSourceCode.setSourceMapping(this);script.pushSourceMapping(this);script.addEventListener(WebInspector.Script.Events.ScriptEdited,this._scriptEdited.bind(this,script.scriptId));},isIdentity:function()
7129 {return true;},_scriptEdited:function(scriptId,event)
7130 {var content=(event.data);this._uiSourceCodeForScriptId[scriptId].addRevision(content);},_debuggerReset:function()
7131 {this._uiSourceCodeForScriptId={};this._scriptIdForUISourceCode=new Map();this._projectDelegate.reset();}}
7132 WebInspector.DebuggerProjectDelegate=function()
7133 {WebInspector.ContentProviderBasedProjectDelegate.call(this,WebInspector.projectTypes.Debugger);}
7134 WebInspector.DebuggerProjectDelegate.prototype={id:function()
7135 {return"debugger:";},displayName:function()
7136 {return"debugger";},addScript:function(script)
7137 {var contentProvider=script.isInlineScript()?new WebInspector.ConcatenatedScriptsContentProvider([script]):script;var splitURL=WebInspector.ParsedURL.splitURL(script.sourceURL);var name=splitURL[splitURL.length-1];name="VM"+script.scriptId+(name?" "+name:"");return this.addContentProvider("",name,script.sourceURL,contentProvider,false,script.isContentScript);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
7138 WebInspector.ResourceScriptMapping=function(debuggerModel,workspace)
7139 {this._debuggerModel=debuggerModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._boundURLs=new StringSet();debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
7140 WebInspector.ResourceScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
7141 {var debuggerModelLocation=(rawLocation);var script=this._debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
7142 return null;var scriptFile=uiSourceCode.scriptFile();if(scriptFile&&((scriptFile.hasDivergedFromVM()&&!scriptFile.isMergingToVM())||scriptFile.isDivergingFromVM()))
7143 return null;return new WebInspector.UILocation(uiSourceCode,debuggerModelLocation.lineNumber,debuggerModelLocation.columnNumber||0);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
7144 {var scripts=this._scriptsForUISourceCode(uiSourceCode);console.assert(scripts.length);return this._debuggerModel.createRawLocation(scripts[0],lineNumber,columnNumber);},addScript:function(script)
7145 {if(script.isAnonymousScript())
7146 return;script.pushSourceMapping(this);var uiSourceCode=this._workspaceUISourceCodeForScript(script);if(!uiSourceCode)
7147 return;this._bindUISourceCodeToScripts(uiSourceCode,[script]);},isIdentity:function()
7148 {return true;},_uiSourceCodeAddedToWorkspace:function(event)
7149 {var uiSourceCode=(event.data);if(uiSourceCode.project().isServiceProject())
7150 return;if(!uiSourceCode.url)
7151 return;var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
7152 return;this._bindUISourceCodeToScripts(uiSourceCode,scripts);},_hasMergedToVM:function(uiSourceCode)
7153 {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
7154 return;for(var i=0;i<scripts.length;++i)
7155 scripts[i].updateLocations();},_hasDivergedFromVM:function(uiSourceCode)
7156 {var scripts=this._scriptsForUISourceCode(uiSourceCode);if(!scripts.length)
7157 return;for(var i=0;i<scripts.length;++i)
7158 scripts[i].updateLocations();},_workspaceUISourceCodeForScript:function(script)
7159 {if(script.isAnonymousScript())
7160 return null;return this._workspace.uiSourceCodeForURL(script.sourceURL);},_scriptsForUISourceCode:function(uiSourceCode)
7161 {if(!uiSourceCode.url)
7162 return[];return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url);},_bindUISourceCodeToScripts:function(uiSourceCode,scripts)
7163 {console.assert(scripts.length);var scriptFile=new WebInspector.ResourceScriptFile(this,uiSourceCode,scripts);uiSourceCode.setScriptFile(scriptFile);for(var i=0;i<scripts.length;++i)
7164 scripts[i].updateLocations();uiSourceCode.setSourceMapping(this);this._boundURLs.put(uiSourceCode.url);},_unbindUISourceCode:function(uiSourceCode)
7165 {var scriptFile=(uiSourceCode.scriptFile());if(scriptFile){scriptFile.dispose();uiSourceCode.setScriptFile(null);}
7166 uiSourceCode.setSourceMapping(null);},_debuggerReset:function()
7167 {var boundURLs=this._boundURLs.values();for(var i=0;i<boundURLs.length;++i)
7168 {var uiSourceCode=this._workspace.uiSourceCodeForURL(boundURLs[i]);if(!uiSourceCode)
7169 continue;this._unbindUISourceCode(uiSourceCode);}
7170 this._boundURLs.clear();},}
7171 WebInspector.ScriptFile=function()
7172 {}
7173 WebInspector.ScriptFile.Events={DidMergeToVM:"DidMergeToVM",DidDivergeFromVM:"DidDivergeFromVM",}
7174 WebInspector.ScriptFile.prototype={hasDivergedFromVM:function(){return false;},isDivergingFromVM:function(){return false;},isMergingToVM:function(){return false;},checkMapping:function(){},}
7175 WebInspector.ResourceScriptFile=function(resourceScriptMapping,uiSourceCode,scripts)
7176 {console.assert(scripts.length);WebInspector.ScriptFile.call(this);this._resourceScriptMapping=resourceScriptMapping;this._uiSourceCode=uiSourceCode;if(this._uiSourceCode.contentType()===WebInspector.resourceTypes.Script)
7177 this._script=scripts[0];this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._update();}
7178 WebInspector.ResourceScriptFile.prototype={_workingCopyCommitted:function(event)
7179 {function innerCallback(error,errorData)
7180 {if(error){this._update();WebInspector.LiveEditSupport.logDetailedError(error,errorData,this._script);return;}
7181 this._scriptSource=source;this._update();WebInspector.LiveEditSupport.logSuccess();}
7182 if(!this._script)
7183 return;var source=this._uiSourceCode.workingCopy();this._resourceScriptMapping._debuggerModel.setScriptSource(this._script.scriptId,source,innerCallback.bind(this));},_isDiverged:function()
7184 {if(this._uiSourceCode.isDirty())
7185 return true;if(!this._script)
7186 return false;if(typeof this._scriptSource==="undefined")
7187 return false;return this._uiSourceCode.workingCopy()!==this._scriptSource;},_workingCopyChanged:function(event)
7188 {this._update();},_update:function()
7189 {if(this._isDiverged()&&!this._hasDivergedFromVM)
7190 this._divergeFromVM();else if(!this._isDiverged()&&this._hasDivergedFromVM)
7191 this._mergeToVM();},_divergeFromVM:function()
7192 {this._isDivergingFromVM=true;this._resourceScriptMapping._hasDivergedFromVM(this._uiSourceCode);delete this._isDivergingFromVM;this._hasDivergedFromVM=true;this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidDivergeFromVM,this._uiSourceCode);},_mergeToVM:function()
7193 {delete this._hasDivergedFromVM;this._isMergingToVM=true;this._resourceScriptMapping._hasMergedToVM(this._uiSourceCode);delete this._isMergingToVM;this.dispatchEventToListeners(WebInspector.ScriptFile.Events.DidMergeToVM,this._uiSourceCode);},hasDivergedFromVM:function()
7194 {return this._hasDivergedFromVM;},isDivergingFromVM:function()
7195 {return this._isDivergingFromVM;},isMergingToVM:function()
7196 {return this._isMergingToVM;},checkMapping:function()
7197 {if(!this._script)
7198 return;if(typeof this._scriptSource!=="undefined")
7199 return;this._script.requestContent(callback.bind(this));function callback(source)
7200 {this._scriptSource=source;this._update();}},dispose:function()
7201 {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);},__proto__:WebInspector.Object.prototype}
7202 WebInspector.CompilerScriptMapping=function(debuggerModel,workspace,networkWorkspaceProvider)
7203 {this._debuggerModel=debuggerModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._networkWorkspaceProvider=networkWorkspaceProvider;this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap=new Map();this._sourceMapForURL=new StringMap();debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
7204 WebInspector.CompilerScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
7205 {var debuggerModelLocation=(rawLocation);var sourceMap=this._sourceMapForScriptId[debuggerModelLocation.scriptId];if(!sourceMap)
7206 return null;var lineNumber=debuggerModelLocation.lineNumber;var columnNumber=debuggerModelLocation.columnNumber||0;var entry=sourceMap.findEntry(lineNumber,columnNumber);if(!entry||entry.length===2)
7207 return null;var url=(entry[2]);var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(!uiSourceCode)
7208 return null;return new WebInspector.UILocation(uiSourceCode,(entry[3]),(entry[4]));},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
7209 {if(!uiSourceCode.url)
7210 return null;var sourceMap=this._sourceMapForURL.get(uiSourceCode.url);if(!sourceMap)
7211 return null;var script=(this._scriptForSourceMap.get(sourceMap));console.assert(script);var entry=sourceMap.findEntryReversed(uiSourceCode.url,lineNumber);return this._debuggerModel.createRawLocation(script,(entry[0]),(entry[1]));},addScript:function(script)
7212 {script.pushSourceMapping(this);this.loadSourceMapForScript(script,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
7213 {if(!sourceMap)
7214 return;if(this._scriptForSourceMap.get(sourceMap)){this._sourceMapForScriptId[script.scriptId]=sourceMap;script.updateLocations();return;}
7215 this._sourceMapForScriptId[script.scriptId]=sourceMap;this._scriptForSourceMap.put(sourceMap,script);var sourceURLs=sourceMap.sources();for(var i=0;i<sourceURLs.length;++i){var sourceURL=sourceURLs[i];if(this._sourceMapForURL.get(sourceURL))
7216 continue;this._sourceMapForURL.put(sourceURL,sourceMap);if(!this._workspace.hasMappingForURL(sourceURL)&&!this._workspace.uiSourceCodeForURL(sourceURL)){var contentProvider=sourceMap.sourceContentProvider(sourceURL,WebInspector.resourceTypes.Script);this._networkWorkspaceProvider.addFileForURL(sourceURL,contentProvider,true);}
7217 var uiSourceCode=this._workspace.uiSourceCodeForURL(sourceURL);if(uiSourceCode){this._bindUISourceCode(uiSourceCode);uiSourceCode.isContentScript=script.isContentScript;}else{WebInspector.console.showErrorMessage(WebInspector.UIString("Failed to locate workspace file mapped to URL %s from source map %s",sourceURL,sourceMap.url()));}}
7218 script.updateLocations();}},isIdentity:function()
7219 {return false;},_bindUISourceCode:function(uiSourceCode)
7220 {uiSourceCode.setSourceMapping(this);},_unbindUISourceCode:function(uiSourceCode)
7221 {uiSourceCode.setSourceMapping(null);},_uiSourceCodeAddedToWorkspace:function(event)
7222 {var uiSourceCode=(event.data);if(!uiSourceCode.url||!this._sourceMapForURL.get(uiSourceCode.url))
7223 return;this._bindUISourceCode(uiSourceCode);},loadSourceMapForScript:function(script,callback)
7224 {if(!script.sourceMapURL){callback(null);return;}
7225 var scriptURL=WebInspector.ParsedURL.completeURL(WebInspector.resourceTreeModel.inspectedPageURL(),script.sourceURL);if(!scriptURL){callback(null);return;}
7226 var sourceMapURL=WebInspector.ParsedURL.completeURL(scriptURL,script.sourceMapURL);if(!sourceMapURL){callback(null);return;}
7227 var sourceMap=this._sourceMapForSourceMapURL[sourceMapURL];if(sourceMap){callback(sourceMap);return;}
7228 var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[sourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
7229 pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[sourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(sourceMapURL,scriptURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
7230 {var url=(sourceMapURL);var callbacks=this._pendingSourceMapLoadingCallbacks[url];delete this._pendingSourceMapLoadingCallbacks[url];if(!callbacks)
7231 return;if(sourceMap)
7232 this._sourceMapForSourceMapURL[url]=sourceMap;for(var i=0;i<callbacks.length;++i)
7233 callbacks[i](sourceMap);}},_debuggerReset:function()
7234 {function unbindUISourceCodesForSourceMap(sourceMap)
7235 {var sourceURLs=sourceMap.sources();for(var i=0;i<sourceURLs.length;++i){var sourceURL=sourceURLs[i];var uiSourceCode=this._workspace.uiSourceCodeForURL(sourceURL);if(!uiSourceCode)
7236 continue;this._unbindUISourceCode(uiSourceCode);}}
7237 this._sourceMapForURL.values().forEach(unbindUISourceCodesForSourceMap.bind(this));this._sourceMapForSourceMapURL={};this._pendingSourceMapLoadingCallbacks={};this._sourceMapForScriptId={};this._scriptForSourceMap.clear();this._sourceMapForURL.clear();}}
7238 WebInspector.LiveEditSupport=function(workspace)
7239 {this._workspaceProvider=new WebInspector.SimpleWorkspaceProvider(workspace,WebInspector.projectTypes.LiveEdit);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);this._debuggerReset();}
7240 WebInspector.LiveEditSupport.prototype={uiSourceCodeForLiveEdit:function(uiSourceCode)
7241 {var rawLocation=uiSourceCode.uiLocationToRawLocation(0,0);var debuggerModelLocation=(rawLocation);var script=WebInspector.debuggerModel.scriptForId(debuggerModelLocation.scriptId);var uiLocation=script.rawLocationToUILocation(0,0);if(uiLocation.uiSourceCode!==uiSourceCode)
7242 return uiLocation.uiSourceCode;if(this._uiSourceCodeForScriptId[script.scriptId])
7243 return this._uiSourceCodeForScriptId[script.scriptId];console.assert(!script.isInlineScript());var liveEditUISourceCode=this._workspaceProvider.addUniqueFileForURL(script.sourceURL,script,true,script.isContentScript);liveEditUISourceCode.setScriptFile(new WebInspector.LiveEditScriptFile(uiSourceCode,liveEditUISourceCode,script.scriptId));this._uiSourceCodeForScriptId[script.scriptId]=liveEditUISourceCode;this._scriptIdForUISourceCode.put(liveEditUISourceCode,script.scriptId);return liveEditUISourceCode;},_debuggerReset:function()
7244 {this._uiSourceCodeForScriptId={};this._scriptIdForUISourceCode=new Map();this._workspaceProvider.reset();},}
7245 WebInspector.LiveEditSupport.logDetailedError=function(error,errorData,contextScript)
7246 {var warningLevel=WebInspector.ConsoleMessage.MessageLevel.Warning;if(!errorData){if(error)
7247 WebInspector.console.log(WebInspector.UIString("LiveEdit failed: %s",error),warningLevel,false);return;}
7248 var compileError=errorData.compileError;if(compileError){var location=contextScript?WebInspector.UIString(" at %s:%d:%d",contextScript.sourceURL,compileError.lineNumber,compileError.columnNumber):"";var message=WebInspector.UIString("LiveEdit compile failed: %s%s",compileError.message,location);WebInspector.console.log(message,WebInspector.ConsoleMessage.MessageLevel.Error,false);}else{WebInspector.console.log(WebInspector.UIString("Unknown LiveEdit error: %s; %s",JSON.stringify(errorData),error),warningLevel,false);}}
7249 WebInspector.LiveEditSupport.logSuccess=function()
7250 {WebInspector.console.log(WebInspector.UIString("Recompilation and update succeeded."),WebInspector.ConsoleMessage.MessageLevel.Debug,false);}
7251 WebInspector.LiveEditScriptFile=function(uiSourceCode,liveEditUISourceCode,scriptId)
7252 {WebInspector.ScriptFile.call(this);this._uiSourceCode=uiSourceCode;this._liveEditUISourceCode=liveEditUISourceCode;this._scriptId=scriptId;this._liveEditUISourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);}
7253 WebInspector.LiveEditScriptFile.prototype={_workingCopyCommitted:function(event)
7254 {function innerCallback(error,errorData)
7255 {if(error){var script=WebInspector.debuggerModel.scriptForId(this._scriptId);WebInspector.LiveEditSupport.logDetailedError(error,errorData,script);return;}
7256 WebInspector.LiveEditSupport.logSuccess();}
7257 var script=WebInspector.debuggerModel.scriptForId(this._scriptId);WebInspector.debuggerModel.setScriptSource(script.scriptId,this._liveEditUISourceCode.workingCopy(),innerCallback.bind(this));},hasDivergedFromVM:function()
7258 {return true;},isDivergingFromVM:function()
7259 {return false;},isMergingToVM:function()
7260 {return false;},checkMapping:function()
7261 {},__proto__:WebInspector.Object.prototype}
7262 WebInspector.liveEditSupport;WebInspector.CSSStyleSheetMapping=function(cssModel,workspace,networkWorkspaceProvider)
7263 {this._cssModel=cssModel;this._workspace=workspace;this._stylesSourceMapping=new WebInspector.StylesSourceMapping(cssModel,workspace);this._sassSourceMapping=new WebInspector.SASSSourceMapping(cssModel,workspace,networkWorkspaceProvider);cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRemoved,this._styleSheetRemoved,this);}
7264 WebInspector.CSSStyleSheetMapping.prototype={_styleSheetAdded:function(event)
7265 {var header=(event.data);this._stylesSourceMapping.addHeader(header);this._sassSourceMapping.addHeader(header);},_styleSheetRemoved:function(event)
7266 {var header=(event.data);this._stylesSourceMapping.removeHeader(header);this._sassSourceMapping.removeHeader(header);}}
7267 WebInspector.SASSSourceMapping=function(cssModel,workspace,networkWorkspaceProvider)
7268 {this.pollPeriodMs=5000;this.pollIntervalMs=200;this._cssModel=cssModel;this._workspace=workspace;this._networkWorkspaceProvider=networkWorkspaceProvider;this._addingRevisionCounter=0;this._reset();WebInspector.fileManager.addEventListener(WebInspector.FileManager.EventTypes.SavedURL,this._fileSaveFinished,this);WebInspector.settings.cssSourceMapsEnabled.addChangeListener(this._toggleSourceMapSupport,this)
7269 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAdded,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted,this._uiSourceCodeContentCommitted,this);this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._reset,this);}
7270 WebInspector.SASSSourceMapping.prototype={_styleSheetChanged:function(event)
7271 {var id=(event.data.styleSheetId);if(this._addingRevisionCounter){--this._addingRevisionCounter;return;}
7272 var header=this._cssModel.styleSheetHeaderForId(id);if(!header)
7273 return;this.removeHeader(header);},_toggleSourceMapSupport:function(event)
7274 {var enabled=(event.data);var headers=this._cssModel.styleSheetHeaders();for(var i=0;i<headers.length;++i){if(enabled)
7275 this.addHeader(headers[i]);else
7276 this.removeHeader(headers[i]);}},_fileSaveFinished:function(event)
7277 {var sassURL=(event.data);this._sassFileSaved(sassURL,false);},_headerValue:function(headerName,headers)
7278 {headerName=headerName.toLowerCase();var value=null;for(var name in headers){if(name.toLowerCase()===headerName){value=headers[name];break;}}
7279 return value;},_lastModified:function(headers)
7280 {var lastModifiedHeader=this._headerValue("last-modified",headers);if(!lastModifiedHeader)
7281 return null;var lastModified=new Date(lastModifiedHeader);if(isNaN(lastModified.getTime()))
7282 return null;return lastModified;},_checkLastModified:function(headers,url)
7283 {var lastModified=this._lastModified(headers);if(lastModified)
7284 return lastModified;var etagMessage=this._headerValue("etag",headers)?", \"ETag\" response header found instead":"";var message=String.sprintf("The \"Last-Modified\" response header is missing or invalid for %s%s. The CSS auto-reload functionality will not work correctly.",url,etagMessage);WebInspector.console.log(message);return null;},_sassFileSaved:function(sassURL,wasLoadedFromFileSystem)
7285 {var cssURLs=this._cssURLsForSASSURL[sassURL];if(!cssURLs)
7286 return;if(!WebInspector.settings.cssReloadEnabled.get())
7287 return;var sassFile=this._workspace.uiSourceCodeForURL(sassURL);console.assert(sassFile);if(wasLoadedFromFileSystem)
7288 sassFile.requestMetadata(metadataReceived.bind(this));else
7289 NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,sassURL,undefined,sassLoadedViaNetwork.bind(this));function sassLoadedViaNetwork(error,statusCode,headers,content)
7290 {if(error||statusCode>=400){console.error("Could not load content for "+sassURL+" : "+(error||("HTTP status code: "+statusCode)));return;}
7291 var lastModified=this._checkLastModified(headers,sassURL);if(!lastModified)
7292 return;metadataReceived.call(this,lastModified);}
7293 function metadataReceived(timestamp)
7294 {if(!timestamp)
7295 return;var now=Date.now();var deadlineMs=now+this.pollPeriodMs;var pollData=this._pollDataForSASSURL[sassURL];if(pollData){var dataByURL=pollData.dataByURL;for(var url in dataByURL)
7296 clearTimeout(dataByURL[url].timer);}
7297 pollData={dataByURL:{},deadlineMs:deadlineMs,sassTimestamp:timestamp};this._pollDataForSASSURL[sassURL]=pollData;for(var i=0;i<cssURLs.length;++i){pollData.dataByURL[cssURLs[i]]={previousPoll:now};this._pollCallback(cssURLs[i],sassURL,false);}}},_pollCallback:function(cssURL,sassURL,stopPolling)
7298 {var now;var pollData=this._pollDataForSASSURL[sassURL];if(!pollData)
7299 return;if(stopPolling||(now=new Date().getTime())>pollData.deadlineMs){delete pollData.dataByURL[cssURL];if(!Object.keys(pollData.dataByURL).length)
7300 delete this._pollDataForSASSURL[sassURL];return;}
7301 var nextPoll=this.pollIntervalMs+pollData.dataByURL[cssURL].previousPoll;var remainingTimeoutMs=Math.max(0,nextPoll-now);pollData.dataByURL[cssURL].previousPoll=now+remainingTimeoutMs;pollData.dataByURL[cssURL].timer=setTimeout(this._reloadCSS.bind(this,cssURL,sassURL,this._pollCallback.bind(this)),remainingTimeoutMs);},_reloadCSS:function(cssURL,sassURL,callback)
7302 {var cssUISourceCode=this._workspace.uiSourceCodeForURL(cssURL);if(!cssUISourceCode){WebInspector.console.log(WebInspector.UIString("%s resource missing. Please reload the page.",cssURL));callback(cssURL,sassURL,true);return;}
7303 if(this._workspace.hasMappingForURL(sassURL))
7304 this._reloadCSSFromFileSystem(cssUISourceCode,sassURL,callback);else
7305 this._reloadCSSFromNetwork(cssUISourceCode,sassURL,callback);},_reloadCSSFromNetwork:function(cssUISourceCode,sassURL,callback)
7306 {var cssURL=cssUISourceCode.url;var data=this._pollDataForSASSURL[sassURL];if(!data){callback(cssURL,sassURL,true);return;}
7307 var headers={"if-modified-since":new Date(data.sassTimestamp.getTime()-1000).toUTCString()};NetworkAgent.loadResourceForFrontend(WebInspector.resourceTreeModel.mainFrame.id,cssURL,headers,contentLoaded.bind(this));function contentLoaded(error,statusCode,headers,content)
7308 {if(error||statusCode>=400){console.error("Could not load content for "+cssURL+" : "+(error||("HTTP status code: "+statusCode)));callback(cssURL,sassURL,true);return;}
7309 if(!this._pollDataForSASSURL[sassURL]){callback(cssURL,sassURL,true);return;}
7310 if(statusCode===304){callback(cssURL,sassURL,false);return;}
7311 var lastModified=this._checkLastModified(headers,cssURL);if(!lastModified){callback(cssURL,sassURL,true);return;}
7312 if(lastModified.getTime()<data.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
7313 this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}},_updateCSSRevision:function(cssUISourceCode,content,sassURL,callback)
7314 {++this._addingRevisionCounter;cssUISourceCode.addRevision(content);this._cssUISourceCodeUpdated(cssUISourceCode.url,sassURL,callback);},_reloadCSSFromFileSystem:function(cssUISourceCode,sassURL,callback)
7315 {cssUISourceCode.requestMetadata(metadataCallback.bind(this));function metadataCallback(timestamp)
7316 {var cssURL=cssUISourceCode.url;if(!timestamp){callback(cssURL,sassURL,false);return;}
7317 var cssTimestamp=timestamp.getTime();var pollData=this._pollDataForSASSURL[sassURL];if(!pollData){callback(cssURL,sassURL,true);return;}
7318 if(cssTimestamp<pollData.sassTimestamp.getTime()){callback(cssURL,sassURL,false);return;}
7319 cssUISourceCode.requestOriginalContent(contentCallback.bind(this));function contentCallback(content)
7320 {if(content===null)
7321 return;this._updateCSSRevision(cssUISourceCode,content,sassURL,callback);}}},_cssUISourceCodeUpdated:function(cssURL,sassURL,callback)
7322 {var completeSourceMapURL=this._completeSourceMapURLForCSSURL[cssURL];if(!completeSourceMapURL)
7323 return;var ids=this._cssModel.styleSheetIdsForURL(cssURL);if(!ids)
7324 return;var headers=[];for(var i=0;i<ids.length;++i)
7325 headers.push(this._cssModel.styleSheetHeaderForId(ids[i]));for(var i=0;i<ids.length;++i)
7326 this._loadSourceMapAndBindUISourceCode(headers,true,completeSourceMapURL);callback(cssURL,sassURL,true);},addHeader:function(header)
7327 {if(!header.sourceMapURL||!header.sourceURL||header.isInline||!WebInspector.settings.cssSourceMapsEnabled.get())
7328 return;var completeSourceMapURL=WebInspector.ParsedURL.completeURL(header.sourceURL,header.sourceMapURL);if(!completeSourceMapURL)
7329 return;this._completeSourceMapURLForCSSURL[header.sourceURL]=completeSourceMapURL;this._loadSourceMapAndBindUISourceCode([header],false,completeSourceMapURL);},removeHeader:function(header)
7330 {var sourceURL=header.sourceURL;if(!sourceURL||!header.sourceMapURL||header.isInline||!this._completeSourceMapURLForCSSURL[sourceURL])
7331 return;delete this._sourceMapByStyleSheetURL[sourceURL];delete this._completeSourceMapURLForCSSURL[sourceURL];for(var sassURL in this._cssURLsForSASSURL){var urls=this._cssURLsForSASSURL[sassURL];urls.remove(sourceURL);if(!urls.length)
7332 delete this._cssURLsForSASSURL[sassURL];}
7333 var completeSourceMapURL=WebInspector.ParsedURL.completeURL(sourceURL,header.sourceMapURL);if(completeSourceMapURL)
7334 delete this._sourceMapByURL[completeSourceMapURL];header.updateLocations();},_loadSourceMapAndBindUISourceCode:function(headersWithSameSourceURL,forceRebind,completeSourceMapURL)
7335 {console.assert(headersWithSameSourceURL.length);var sourceURL=headersWithSameSourceURL[0].sourceURL;this._loadSourceMapForStyleSheet(completeSourceMapURL,sourceURL,forceRebind,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
7336 {if(!sourceMap)
7337 return;this._sourceMapByStyleSheetURL[sourceURL]=sourceMap;for(var i=0;i<headersWithSameSourceURL.length;++i){if(forceRebind)
7338 headersWithSameSourceURL[i].updateLocations();else
7339 this._bindUISourceCode(headersWithSameSourceURL[i],sourceMap);}}},_addCSSURLforSASSURL:function(cssURL,sassURL)
7340 {var cssURLs;if(this._cssURLsForSASSURL.hasOwnProperty(sassURL))
7341 cssURLs=this._cssURLsForSASSURL[sassURL];else{cssURLs=[];this._cssURLsForSASSURL[sassURL]=cssURLs;}
7342 if(cssURLs.indexOf(cssURL)===-1)
7343 cssURLs.push(cssURL);},_loadSourceMapForStyleSheet:function(completeSourceMapURL,completeStyleSheetURL,forceReload,callback)
7344 {var sourceMap=this._sourceMapByURL[completeSourceMapURL];if(sourceMap&&!forceReload){callback(sourceMap);return;}
7345 var pendingCallbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(pendingCallbacks){pendingCallbacks.push(callback);return;}
7346 pendingCallbacks=[callback];this._pendingSourceMapLoadingCallbacks[completeSourceMapURL]=pendingCallbacks;WebInspector.SourceMap.load(completeSourceMapURL,completeStyleSheetURL,sourceMapLoaded.bind(this));function sourceMapLoaded(sourceMap)
7347 {var callbacks=this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];delete this._pendingSourceMapLoadingCallbacks[completeSourceMapURL];if(!callbacks)
7348 return;if(sourceMap)
7349 this._sourceMapByURL[completeSourceMapURL]=sourceMap;else
7350 delete this._sourceMapByURL[completeSourceMapURL];for(var i=0;i<callbacks.length;++i)
7351 callbacks[i](sourceMap);}},_bindUISourceCode:function(header,sourceMap)
7352 {header.pushSourceMapping(this);var rawURL=header.sourceURL;var sources=sourceMap.sources();for(var i=0;i<sources.length;++i){var url=sources[i];this._addCSSURLforSASSURL(rawURL,url);if(!this._workspace.hasMappingForURL(url)&&!this._workspace.uiSourceCodeForURL(url)){var contentProvider=sourceMap.sourceContentProvider(url,WebInspector.resourceTypes.Stylesheet);this._networkWorkspaceProvider.addFileForURL(url,contentProvider,true);}}},rawLocationToUILocation:function(rawLocation)
7353 {var location=(rawLocation);var entry;var sourceMap=this._sourceMapByStyleSheetURL[location.url];if(!sourceMap)
7354 return null;entry=sourceMap.findEntry(location.lineNumber,location.columnNumber);if(!entry||entry.length===2)
7355 return null;var uiSourceCode=this._workspace.uiSourceCodeForURL(entry[2]);if(!uiSourceCode)
7356 return null;return new WebInspector.UILocation(uiSourceCode,entry[3],entry[4]);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
7357 {return new WebInspector.CSSLocation(uiSourceCode.url||"",lineNumber,columnNumber);},isIdentity:function()
7358 {return false;},_uiSourceCodeAdded:function(event)
7359 {var uiSourceCode=(event.data);var cssURLs=this._cssURLsForSASSURL[uiSourceCode.url];if(!cssURLs)
7360 return;for(var i=0;i<cssURLs.length;++i){var ids=this._cssModel.styleSheetIdsForURL(cssURLs[i]);for(var j=0;j<ids.length;++j){var header=this._cssModel.styleSheetHeaderForId(ids[j]);console.assert(header);header.updateLocations();}}},_uiSourceCodeContentCommitted:function(event)
7361 {var uiSourceCode=(event.data.uiSourceCode);if(uiSourceCode.project().type()===WebInspector.projectTypes.FileSystem)
7362 this._sassFileSaved(uiSourceCode.url,true);},_reset:function()
7363 {this._addingRevisionCounter=0;this._completeSourceMapURLForCSSURL={};this._cssURLsForSASSURL={};this._pendingSourceMapLoadingCallbacks={};this._pollDataForSASSURL={};this._sourceMapByURL={};this._sourceMapByStyleSheetURL={};}}
7364 WebInspector.DOMNode=function(domModel,doc,isInShadowTree,payload){this._domModel=domModel;this.ownerDocument=doc;this._isInShadowTree=isInShadowTree;this.id=payload.nodeId;domModel._idToDOMNode[this.id]=this;this._nodeType=payload.nodeType;this._nodeName=payload.nodeName;this._localName=payload.localName;this._nodeValue=payload.nodeValue;this._pseudoType=payload.pseudoType;this._shadowRootType=payload.shadowRootType;this._frameId=payload.frameId||null;this._shadowRoots=[];this._attributes=[];this._attributesMap={};if(payload.attributes)
7365 this._setAttributesPayload(payload.attributes);this._userProperties={};this._descendantUserPropertyCounters={};this._childNodeCount=payload.childNodeCount||0;this._children=null;this.nextSibling=null;this.previousSibling=null;this.firstChild=null;this.lastChild=null;this.parentNode=null;if(payload.shadowRoots){for(var i=0;i<payload.shadowRoots.length;++i){var root=payload.shadowRoots[i];var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,root);this._shadowRoots.push(node);node.parentNode=this;}}
7366 if(payload.templateContent){this._templateContent=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,payload.templateContent);this._templateContent.parentNode=this;}
7367 if(payload.importedDocument){this._importedDocument=new WebInspector.DOMNode(this._domModel,this.ownerDocument,true,payload.importedDocument);this._importedDocument.parentNode=this;}
7368 if(payload.children)
7369 this._setChildrenPayload(payload.children);this._setPseudoElements(payload.pseudoElements);if(payload.contentDocument){this._contentDocument=new WebInspector.DOMDocument(domModel,payload.contentDocument);this._children=[this._contentDocument];this._renumber();}
7370 if(this._nodeType===Node.ELEMENT_NODE){if(this.ownerDocument&&!this.ownerDocument.documentElement&&this._nodeName==="HTML")
7371 this.ownerDocument.documentElement=this;if(this.ownerDocument&&!this.ownerDocument.body&&this._nodeName==="BODY")
7372 this.ownerDocument.body=this;}else if(this._nodeType===Node.DOCUMENT_TYPE_NODE){this.publicId=payload.publicId;this.systemId=payload.systemId;this.internalSubset=payload.internalSubset;}else if(this._nodeType===Node.ATTRIBUTE_NODE){this.name=payload.name;this.value=payload.value;}}
7373 WebInspector.DOMNode.PseudoElementNames={Before:"before",After:"after"}
7374 WebInspector.DOMNode.ShadowRootTypes={UserAgent:"user-agent",Author:"author"}
7375 WebInspector.DOMNode.prototype={children:function()
7376 {return this._children?this._children.slice():null;},hasAttributes:function()
7377 {return this._attributes.length>0;},childNodeCount:function()
7378 {return this._childNodeCount;},hasShadowRoots:function()
7379 {return!!this._shadowRoots.length;},shadowRoots:function()
7380 {return this._shadowRoots.slice();},templateContent:function()
7381 {return this._templateContent;},importedDocument:function()
7382 {return this._importedDocument;},nodeType:function()
7383 {return this._nodeType;},nodeName:function()
7384 {return this._nodeName;},pseudoType:function()
7385 {return this._pseudoType;},hasPseudoElements:function()
7386 {return Object.keys(this._pseudoElements).length!==0;},pseudoElements:function()
7387 {return this._pseudoElements;},isInShadowTree:function()
7388 {return this._isInShadowTree;},ancestorUserAgentShadowRoot:function()
7389 {if(!this._isInShadowTree)
7390 return null;var current=this;while(!current.isShadowRoot())
7391 current=current.parentNode;return current.shadowRootType()===WebInspector.DOMNode.ShadowRootTypes.UserAgent?current:null;},isShadowRoot:function()
7392 {return!!this._shadowRootType;},shadowRootType:function()
7393 {return this._shadowRootType||null;},nodeNameInCorrectCase:function()
7394 {var shadowRootType=this.shadowRootType();if(shadowRootType)
7395 return"#shadow-root"+(shadowRootType===WebInspector.DOMNode.ShadowRootTypes.UserAgent?" (user-agent)":"");return this.isXMLNode()?this.nodeName():this.nodeName().toLowerCase();},setNodeName:function(name,callback)
7396 {DOMAgent.setNodeName(this.id,name,WebInspector.domModel._markRevision(this,callback));},localName:function()
7397 {return this._localName;},nodeValue:function()
7398 {return this._nodeValue;},setNodeValue:function(value,callback)
7399 {DOMAgent.setNodeValue(this.id,value,WebInspector.domModel._markRevision(this,callback));},getAttribute:function(name)
7400 {var attr=this._attributesMap[name];return attr?attr.value:undefined;},setAttribute:function(name,text,callback)
7401 {DOMAgent.setAttributesAsText(this.id,text,name,WebInspector.domModel._markRevision(this,callback));},setAttributeValue:function(name,value,callback)
7402 {DOMAgent.setAttributeValue(this.id,name,value,WebInspector.domModel._markRevision(this,callback));},attributes:function()
7403 {return this._attributes;},removeAttribute:function(name,callback)
7404 {function mycallback(error)
7405 {if(!error){delete this._attributesMap[name];for(var i=0;i<this._attributes.length;++i){if(this._attributes[i].name===name){this._attributes.splice(i,1);break;}}}
7406 WebInspector.domModel._markRevision(this,callback)(error);}
7407 DOMAgent.removeAttribute(this.id,name,mycallback.bind(this));},getChildNodes:function(callback)
7408 {if(this._children){if(callback)
7409 callback(this.children());return;}
7410 function mycallback(error)
7411 {if(callback)
7412 callback(error?null:this.children());}
7413 DOMAgent.requestChildNodes(this.id,undefined,mycallback.bind(this));},getSubtree:function(depth,callback)
7414 {function mycallback(error)
7415 {if(callback)
7416 callback(error?null:this._children);}
7417 DOMAgent.requestChildNodes(this.id,depth,mycallback.bind(this));},getOuterHTML:function(callback)
7418 {DOMAgent.getOuterHTML(this.id,callback);},setOuterHTML:function(html,callback)
7419 {DOMAgent.setOuterHTML(this.id,html,WebInspector.domModel._markRevision(this,callback));},removeNode:function(callback)
7420 {DOMAgent.removeNode(this.id,WebInspector.domModel._markRevision(this,callback));},copyNode:function()
7421 {function copy(error,text)
7422 {if(!error)
7423 InspectorFrontendHost.copyText(text);}
7424 DOMAgent.getOuterHTML(this.id,copy);},eventListeners:function(objectGroupId,callback)
7425 {DOMAgent.getEventListenersForNode(this.id,objectGroupId,callback);},path:function()
7426 {function canPush(node)
7427 {return node&&("index"in node||(node.isShadowRoot()&&node.parentNode))&&node._nodeName.length;}
7428 var path=[];var node=this;while(canPush(node)){var index=typeof node.index==="number"?node.index:(node.shadowRootType()===WebInspector.DOMNode.ShadowRootTypes.UserAgent?"u":"a");path.push([index,node._nodeName]);node=node.parentNode;}
7429 path.reverse();return path.join(",");},isAncestor:function(node)
7430 {if(!node)
7431 return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
7432 return true;currentNode=currentNode.parentNode;}
7433 return false;},isDescendant:function(descendant)
7434 {return descendant!==null&&descendant.isAncestor(this);},frameId:function()
7435 {var node=this;while(!node._frameId&&node.parentNode)
7436 node=node.parentNode;return node._frameId;},_setAttributesPayload:function(attrs)
7437 {var attributesChanged=!this._attributes||attrs.length!==this._attributes.length*2;var oldAttributesMap=this._attributesMap||{};this._attributes=[];this._attributesMap={};for(var i=0;i<attrs.length;i+=2){var name=attrs[i];var value=attrs[i+1];this._addAttribute(name,value);if(attributesChanged)
7438 continue;if(!oldAttributesMap[name]||oldAttributesMap[name].value!==value)
7439 attributesChanged=true;}
7440 return attributesChanged;},_insertChild:function(prev,payload)
7441 {var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payload);this._children.splice(this._children.indexOf(prev)+1,0,node);this._renumber();return node;},_removeChild:function(node)
7442 {if(node.pseudoType()){delete this._pseudoElements[node.pseudoType()];}else{var shadowRootIndex=this._shadowRoots.indexOf(node);if(shadowRootIndex!==-1)
7443 this._shadowRoots.splice(shadowRootIndex,1);else
7444 this._children.splice(this._children.indexOf(node),1);}
7445 node.parentNode=null;node._updateChildUserPropertyCountsOnRemoval(this);this._renumber();},_setChildrenPayload:function(payloads)
7446 {if(this._contentDocument)
7447 return;this._children=[];for(var i=0;i<payloads.length;++i){var payload=payloads[i];var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payload);this._children.push(node);}
7448 this._renumber();},_setPseudoElements:function(payloads)
7449 {this._pseudoElements={};if(!payloads)
7450 return;for(var i=0;i<payloads.length;++i){var node=new WebInspector.DOMNode(this._domModel,this.ownerDocument,this._isInShadowTree,payloads[i]);node.parentNode=this;this._pseudoElements[node.pseudoType()]=node;}},_renumber:function()
7451 {this._childNodeCount=this._children.length;if(this._childNodeCount==0){this.firstChild=null;this.lastChild=null;return;}
7452 this.firstChild=this._children[0];this.lastChild=this._children[this._childNodeCount-1];for(var i=0;i<this._childNodeCount;++i){var child=this._children[i];child.index=i;child.nextSibling=i+1<this._childNodeCount?this._children[i+1]:null;child.previousSibling=i-1>=0?this._children[i-1]:null;child.parentNode=this;}},_addAttribute:function(name,value)
7453 {var attr={name:name,value:value,_node:this};this._attributesMap[name]=attr;this._attributes.push(attr);},_setAttribute:function(name,value)
7454 {var attr=this._attributesMap[name];if(attr)
7455 attr.value=value;else
7456 this._addAttribute(name,value);},_removeAttribute:function(name)
7457 {var attr=this._attributesMap[name];if(attr){this._attributes.remove(attr);delete this._attributesMap[name];}},moveTo:function(targetNode,anchorNode,callback)
7458 {DOMAgent.moveTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,WebInspector.domModel._markRevision(this,callback));},isXMLNode:function()
7459 {return!!this.ownerDocument&&!!this.ownerDocument.xmlVersion;},_updateChildUserPropertyCountsOnRemoval:function(parentNode)
7460 {var result={};if(this._userProperties){for(var name in this._userProperties)
7461 result[name]=(result[name]||0)+1;}
7462 if(this._descendantUserPropertyCounters){for(var name in this._descendantUserPropertyCounters){var counter=this._descendantUserPropertyCounters[name];result[name]=(result[name]||0)+counter;}}
7463 for(var name in result)
7464 parentNode._updateDescendantUserPropertyCount(name,-result[name]);},_updateDescendantUserPropertyCount:function(name,delta)
7465 {if(!this._descendantUserPropertyCounters.hasOwnProperty(name))
7466 this._descendantUserPropertyCounters[name]=0;this._descendantUserPropertyCounters[name]+=delta;if(!this._descendantUserPropertyCounters[name])
7467 delete this._descendantUserPropertyCounters[name];if(this.parentNode)
7468 this.parentNode._updateDescendantUserPropertyCount(name,delta);},setUserProperty:function(name,value)
7469 {if(value===null){this.removeUserProperty(name);return;}
7470 if(this.parentNode&&!this._userProperties.hasOwnProperty(name))
7471 this.parentNode._updateDescendantUserPropertyCount(name,1);this._userProperties[name]=value;},removeUserProperty:function(name)
7472 {if(!this._userProperties.hasOwnProperty(name))
7473 return;delete this._userProperties[name];if(this.parentNode)
7474 this.parentNode._updateDescendantUserPropertyCount(name,-1);},getUserProperty:function(name)
7475 {return(this._userProperties&&this._userProperties[name])||null;},descendantUserPropertyCount:function(name)
7476 {return this._descendantUserPropertyCounters&&this._descendantUserPropertyCounters[name]?this._descendantUserPropertyCounters[name]:0;},resolveURL:function(url)
7477 {if(!url)
7478 return url;for(var frameOwnerCandidate=this;frameOwnerCandidate;frameOwnerCandidate=frameOwnerCandidate.parentNode){if(frameOwnerCandidate.baseURL)
7479 return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL,url);}
7480 return null;}}
7481 WebInspector.DOMDocument=function(domModel,payload)
7482 {WebInspector.DOMNode.call(this,domModel,this,false,payload);this.documentURL=payload.documentURL||"";this.baseURL=payload.baseURL||"";this.xmlVersion=payload.xmlVersion;this._listeners={};}
7483 WebInspector.DOMDocument.prototype={__proto__:WebInspector.DOMNode.prototype}
7484 WebInspector.DOMModel=function(){this._idToDOMNode={};this._document=null;this._attributeLoadNodeIds={};InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));this._defaultHighlighter=new WebInspector.DefaultDOMNodeHighlighter();this._highlighter=this._defaultHighlighter;}
7485 WebInspector.DOMModel.Events={AttrModified:"AttrModified",AttrRemoved:"AttrRemoved",CharacterDataModified:"CharacterDataModified",NodeInserted:"NodeInserted",NodeRemoved:"NodeRemoved",DocumentUpdated:"DocumentUpdated",ChildNodeCountUpdated:"ChildNodeCountUpdated",UndoRedoRequested:"UndoRedoRequested",UndoRedoCompleted:"UndoRedoCompleted",}
7486 WebInspector.DOMModel.prototype={requestDocument:function(callback)
7487 {if(this._document){if(callback)
7488 callback(this._document);return;}
7489 if(this._pendingDocumentRequestCallbacks){this._pendingDocumentRequestCallbacks.push(callback);return;}
7490 this._pendingDocumentRequestCallbacks=[callback];function onDocumentAvailable(error,root)
7491 {if(!error)
7492 this._setDocument(root);for(var i=0;i<this._pendingDocumentRequestCallbacks.length;++i){var callback=this._pendingDocumentRequestCallbacks[i];if(callback)
7493 callback(this._document);}
7494 delete this._pendingDocumentRequestCallbacks;}
7495 DOMAgent.getDocument(onDocumentAvailable.bind(this));},existingDocument:function()
7496 {return this._document;},pushNodeToFrontend:function(objectId,callback)
7497 {this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent,objectId),callback);},pushNodeByPathToFrontend:function(path,callback)
7498 {this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent,path),callback);},pushNodesByBackendIdsToFrontend:function(backendNodeIds,callback)
7499 {this._dispatchWhenDocumentAvailable(DOMAgent.pushNodesByBackendIdsToFrontend.bind(DOMAgent,backendNodeIds),callback);},_wrapClientCallback:function(callback)
7500 {if(!callback)
7501 return;return function(error,result)
7502 {callback(error?null:result);}},_dispatchWhenDocumentAvailable:function(func,callback)
7503 {var callbackWrapper=this._wrapClientCallback(callback);function onDocumentAvailable()
7504 {if(this._document)
7505 func(callbackWrapper);else{if(callbackWrapper)
7506 callbackWrapper("No document");}}
7507 this.requestDocument(onDocumentAvailable.bind(this));},_attributeModified:function(nodeId,name,value)
7508 {var node=this._idToDOMNode[nodeId];if(!node)
7509 return;node._setAttribute(name,value);this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrModified,{node:node,name:name});},_attributeRemoved:function(nodeId,name)
7510 {var node=this._idToDOMNode[nodeId];if(!node)
7511 return;node._removeAttribute(name);this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrRemoved,{node:node,name:name});},_inlineStyleInvalidated:function(nodeIds)
7512 {for(var i=0;i<nodeIds.length;++i)
7513 this._attributeLoadNodeIds[nodeIds[i]]=true;if("_loadNodeAttributesTimeout"in this)
7514 return;this._loadNodeAttributesTimeout=setTimeout(this._loadNodeAttributes.bind(this),20);},_loadNodeAttributes:function()
7515 {function callback(nodeId,error,attributes)
7516 {if(error){return;}
7517 var node=this._idToDOMNode[nodeId];if(node){if(node._setAttributesPayload(attributes))
7518 this.dispatchEventToListeners(WebInspector.DOMModel.Events.AttrModified,{node:node,name:"style"});}}
7519 delete this._loadNodeAttributesTimeout;for(var nodeId in this._attributeLoadNodeIds){var nodeIdAsNumber=parseInt(nodeId,10);DOMAgent.getAttributes(nodeIdAsNumber,callback.bind(this,nodeIdAsNumber));}
7520 this._attributeLoadNodeIds={};},_characterDataModified:function(nodeId,newValue)
7521 {var node=this._idToDOMNode[nodeId];node._nodeValue=newValue;this.dispatchEventToListeners(WebInspector.DOMModel.Events.CharacterDataModified,node);},nodeForId:function(nodeId)
7522 {return this._idToDOMNode[nodeId]||null;},_documentUpdated:function()
7523 {this._setDocument(null);},_setDocument:function(payload)
7524 {this._idToDOMNode={};if(payload&&"nodeId"in payload)
7525 this._document=new WebInspector.DOMDocument(this,payload);else
7526 this._document=null;this.dispatchEventToListeners(WebInspector.DOMModel.Events.DocumentUpdated,this._document);},_setDetachedRoot:function(payload)
7527 {if(payload.nodeName==="#document")
7528 new WebInspector.DOMDocument(this,payload);else
7529 new WebInspector.DOMNode(this,null,false,payload);},_setChildNodes:function(parentId,payloads)
7530 {if(!parentId&&payloads.length){this._setDetachedRoot(payloads[0]);return;}
7531 var parent=this._idToDOMNode[parentId];parent._setChildrenPayload(payloads);},_childNodeCountUpdated:function(nodeId,newValue)
7532 {var node=this._idToDOMNode[nodeId];node._childNodeCount=newValue;this.dispatchEventToListeners(WebInspector.DOMModel.Events.ChildNodeCountUpdated,node);},_childNodeInserted:function(parentId,prevId,payload)
7533 {var parent=this._idToDOMNode[parentId];var prev=this._idToDOMNode[prevId];var node=parent._insertChild(prev,payload);this._idToDOMNode[node.id]=node;this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_childNodeRemoved:function(parentId,nodeId)
7534 {var parent=this._idToDOMNode[parentId];var node=this._idToDOMNode[nodeId];parent._removeChild(node);this._unbind(node);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:node,parent:parent});},_shadowRootPushed:function(hostId,root)
7535 {var host=this._idToDOMNode[hostId];if(!host)
7536 return;var node=new WebInspector.DOMNode(this,host.ownerDocument,true,root);node.parentNode=host;this._idToDOMNode[node.id]=node;host._shadowRoots.push(node);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_shadowRootPopped:function(hostId,rootId)
7537 {var host=this._idToDOMNode[hostId];if(!host)
7538 return;var root=this._idToDOMNode[rootId];if(!root)
7539 return;host._removeChild(root);this._unbind(root);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:root,parent:host});},_pseudoElementAdded:function(parentId,pseudoElement)
7540 {var parent=this._idToDOMNode[parentId];if(!parent)
7541 return;var node=new WebInspector.DOMNode(this,parent.ownerDocument,false,pseudoElement);node.parentNode=parent;this._idToDOMNode[node.id]=node;console.assert(!parent._pseudoElements[node.pseudoType()]);parent._pseudoElements[node.pseudoType()]=node;this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeInserted,node);},_pseudoElementRemoved:function(parentId,pseudoElementId)
7542 {var parent=this._idToDOMNode[parentId];if(!parent)
7543 return;var pseudoElement=this._idToDOMNode[pseudoElementId];if(!pseudoElement)
7544 return;parent._removeChild(pseudoElement);this._unbind(pseudoElement);this.dispatchEventToListeners(WebInspector.DOMModel.Events.NodeRemoved,{node:pseudoElement,parent:parent});},_unbind:function(node)
7545 {delete this._idToDOMNode[node.id];for(var i=0;node._children&&i<node._children.length;++i)
7546 this._unbind(node._children[i]);for(var i=0;i<node._shadowRoots.length;++i)
7547 this._unbind(node._shadowRoots[i]);var pseudoElements=node.pseudoElements();for(var id in pseudoElements)
7548 this._unbind(pseudoElements[id]);if(node._templateContent)
7549 this._unbind(node._templateContent);},inspectElement:function(nodeId)
7550 {WebInspector.Revealer.reveal(this.nodeForId(nodeId));},_inspectNodeRequested:function(nodeId)
7551 {this.inspectElement(nodeId);},performSearch:function(query,searchCallback)
7552 {this.cancelSearch();function callback(error,searchId,resultsCount)
7553 {this._searchId=searchId;searchCallback(resultsCount);}
7554 DOMAgent.performSearch(query,callback.bind(this));},searchResult:function(index,callback)
7555 {if(this._searchId)
7556 DOMAgent.getSearchResults(this._searchId,index,index+1,searchResultsCallback.bind(this));else
7557 callback(null);function searchResultsCallback(error,nodeIds)
7558 {if(error){console.error(error);callback(null);return;}
7559 if(nodeIds.length!=1)
7560 return;callback(this.nodeForId(nodeIds[0]));}},cancelSearch:function()
7561 {if(this._searchId){DOMAgent.discardSearchResults(this._searchId);delete this._searchId;}},querySelector:function(nodeId,selectors,callback)
7562 {DOMAgent.querySelector(nodeId,selectors,this._wrapClientCallback(callback));},querySelectorAll:function(nodeId,selectors,callback)
7563 {DOMAgent.querySelectorAll(nodeId,selectors,this._wrapClientCallback(callback));},highlightDOMNode:function(nodeId,mode,objectId)
7564 {if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);delete this._hideDOMNodeHighlightTimeout;}
7565 this._highlighter.highlightDOMNode(nodeId||0,this._buildHighlightConfig(mode),objectId);},hideDOMNodeHighlight:function()
7566 {this.highlightDOMNode(0);},highlightDOMNodeForTwoSeconds:function(nodeId)
7567 {this.highlightDOMNode(nodeId);this._hideDOMNodeHighlightTimeout=setTimeout(this.hideDOMNodeHighlight.bind(this),2000);},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,callback)
7568 {function onDocumentAvailable()
7569 {this._highlighter.setInspectModeEnabled(enabled,inspectUAShadowDOM,this._buildHighlightConfig(),callback);}
7570 this.requestDocument(onDocumentAvailable.bind(this));},_buildHighlightConfig:function(mode)
7571 {mode=mode||"all";var highlightConfig={showInfo:mode==="all",showRulers:WebInspector.settings.showMetricsRulers.get()};if(mode==="all"||mode==="content")
7572 highlightConfig.contentColor=WebInspector.Color.PageHighlight.Content.toProtocolRGBA();if(mode==="all"||mode==="padding")
7573 highlightConfig.paddingColor=WebInspector.Color.PageHighlight.Padding.toProtocolRGBA();if(mode==="all"||mode==="border")
7574 highlightConfig.borderColor=WebInspector.Color.PageHighlight.Border.toProtocolRGBA();if(mode==="all"||mode==="margin")
7575 highlightConfig.marginColor=WebInspector.Color.PageHighlight.Margin.toProtocolRGBA();if(mode==="all")
7576 highlightConfig.eventTargetColor=WebInspector.Color.PageHighlight.EventTarget.toProtocolRGBA();return highlightConfig;},_markRevision:function(node,callback)
7577 {function wrapperFunction(error)
7578 {if(!error)
7579 this.markUndoableState();if(callback)
7580 callback.apply(this,arguments);}
7581 return wrapperFunction.bind(this);},emulateTouchEventObjects:function(emulationEnabled)
7582 {const injectedFunction=function(){const touchEvents=["ontouchstart","ontouchend","ontouchmove","ontouchcancel"];var recepients=[window.__proto__,document.__proto__];for(var i=0;i<touchEvents.length;++i){for(var j=0;j<recepients.length;++j){if(!(touchEvents[i]in recepients[j]))
7583 Object.defineProperty(recepients[j],touchEvents[i],{value:null,writable:true,configurable:true,enumerable:true});}}}
7584 if(emulationEnabled&&!this._addTouchEventsScriptInjecting){this._addTouchEventsScriptInjecting=true;PageAgent.addScriptToEvaluateOnLoad("("+injectedFunction.toString()+")()",scriptAddedCallback.bind(this));}else{if(typeof this._addTouchEventsScriptId!=="undefined"){PageAgent.removeScriptToEvaluateOnLoad(this._addTouchEventsScriptId);delete this._addTouchEventsScriptId;}}
7585 function scriptAddedCallback(error,scriptId)
7586 {delete this._addTouchEventsScriptInjecting;if(error)
7587 return;this._addTouchEventsScriptId=scriptId;}
7588 PageAgent.setTouchEmulationEnabled(emulationEnabled);},markUndoableState:function()
7589 {DOMAgent.markUndoableState();},undo:function(callback)
7590 {function mycallback(error)
7591 {this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoCompleted);callback(error);}
7592 this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoRequested);DOMAgent.undo(callback);},redo:function(callback)
7593 {function mycallback(error)
7594 {this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoCompleted);callback(error);}
7595 this.dispatchEventToListeners(WebInspector.DOMModel.Events.UndoRedoRequested);DOMAgent.redo(callback);},setHighlighter:function(highlighter)
7596 {this._highlighter=highlighter||this._defaultHighlighter;},__proto__:WebInspector.Object.prototype}
7597 WebInspector.DOMDispatcher=function(domModel)
7598 {this._domModel=domModel;}
7599 WebInspector.DOMDispatcher.prototype={documentUpdated:function()
7600 {this._domModel._documentUpdated();},inspectNodeRequested:function(nodeId)
7601 {this._domModel._inspectNodeRequested(nodeId);},attributeModified:function(nodeId,name,value)
7602 {this._domModel._attributeModified(nodeId,name,value);},attributeRemoved:function(nodeId,name)
7603 {this._domModel._attributeRemoved(nodeId,name);},inlineStyleInvalidated:function(nodeIds)
7604 {this._domModel._inlineStyleInvalidated(nodeIds);},characterDataModified:function(nodeId,characterData)
7605 {this._domModel._characterDataModified(nodeId,characterData);},setChildNodes:function(parentId,payloads)
7606 {this._domModel._setChildNodes(parentId,payloads);},childNodeCountUpdated:function(nodeId,childNodeCount)
7607 {this._domModel._childNodeCountUpdated(nodeId,childNodeCount);},childNodeInserted:function(parentNodeId,previousNodeId,payload)
7608 {this._domModel._childNodeInserted(parentNodeId,previousNodeId,payload);},childNodeRemoved:function(parentNodeId,nodeId)
7609 {this._domModel._childNodeRemoved(parentNodeId,nodeId);},shadowRootPushed:function(hostId,root)
7610 {this._domModel._shadowRootPushed(hostId,root);},shadowRootPopped:function(hostId,rootId)
7611 {this._domModel._shadowRootPopped(hostId,rootId);},pseudoElementAdded:function(parentId,pseudoElement)
7612 {this._domModel._pseudoElementAdded(parentId,pseudoElement);},pseudoElementRemoved:function(parentId,pseudoElementId)
7613 {this._domModel._pseudoElementRemoved(parentId,pseudoElementId);}}
7614 WebInspector.DOMNodeHighlighter=function(){}
7615 WebInspector.DOMNodeHighlighter.prototype={highlightDOMNode:function(nodeId,config,objectId){},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,config,callback){}}
7616 WebInspector.DefaultDOMNodeHighlighter=function(){}
7617 WebInspector.DefaultDOMNodeHighlighter.prototype={highlightDOMNode:function(nodeId,config,objectId)
7618 {if(objectId||nodeId)
7619 DOMAgent.highlightNode(config,objectId?undefined:nodeId,objectId);else
7620 DOMAgent.hideHighlight();},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,config,callback)
7621 {DOMAgent.setInspectModeEnabled(enabled,inspectUAShadowDOM,config,callback);}}
7622 WebInspector.domModel;WebInspector.evaluateForTestInFrontend=function(callId,script)
7623 {if(!InspectorFrontendHost.isUnderTest())
7624 return;function invokeMethod()
7625 {var message;try{script=script+"//# sourceURL=evaluateInWebInspector"+callId+".js";var result=window.eval(script);message=typeof result==="undefined"?"\"<undefined>\"":JSON.stringify(result);}catch(e){message=e.toString();}
7626 RuntimeAgent.evaluate("didEvaluateForTestInFrontend("+callId+", "+message+")","test");}
7627 InspectorBackend.connection().runAfterPendingDispatches(invokeMethod);}
7628 WebInspector.Dialog=function(relativeToElement,delegate)
7629 {this._delegate=delegate;this._relativeToElement=relativeToElement;this._glassPane=new WebInspector.GlassPane();this._glassPane.element.tabIndex=0;this._glassPane.element.addEventListener("focus",this._onGlassPaneFocus.bind(this),false);this._element=this._glassPane.element.createChild("div");this._element.tabIndex=0;this._element.addEventListener("focus",this._onFocus.bind(this),false);this._element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._closeKeys=[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,];delegate.show(this._element);this._position();this._delegate.focus();}
7630 WebInspector.Dialog.currentInstance=function()
7631 {return WebInspector.Dialog._instance;}
7632 WebInspector.Dialog.show=function(relativeToElement,delegate)
7633 {if(WebInspector.Dialog._instance)
7634 return;WebInspector.Dialog._instance=new WebInspector.Dialog(relativeToElement,delegate);}
7635 WebInspector.Dialog.hide=function()
7636 {if(!WebInspector.Dialog._instance)
7637 return;WebInspector.Dialog._instance._hide();}
7638 WebInspector.Dialog.prototype={_hide:function()
7639 {if(this._isHiding)
7640 return;this._isHiding=true;this._delegate.willHide();delete WebInspector.Dialog._instance;this._glassPane.dispose();},_onGlassPaneFocus:function(event)
7641 {this._hide();},_onFocus:function(event)
7642 {this._delegate.focus();},_position:function()
7643 {this._delegate.position(this._element,this._relativeToElement);},_onKeyDown:function(event)
7644 {if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Tab.code){event.preventDefault();return;}
7645 if(event.keyCode===WebInspector.KeyboardShortcut.Keys.Enter.code)
7646 this._delegate.onEnter();if(this._closeKeys.indexOf(event.keyCode)>=0){this._hide();event.consume(true);}}};WebInspector.DialogDelegate=function()
7647 {this.element;}
7648 WebInspector.DialogDelegate.prototype={show:function(element)
7649 {element.appendChild(this.element);this.element.classList.add("dialog-contents");element.classList.add("dialog");},position:function(element,relativeToElement)
7650 {var container=WebInspector.Dialog._modalHostView.element;var box=relativeToElement.boxInWindow(window).relativeToElement(container);var positionX=box.x+(relativeToElement.offsetWidth-element.offsetWidth)/2;positionX=Number.constrain(positionX,0,container.offsetWidth-element.offsetWidth);var positionY=box.y+(relativeToElement.offsetHeight-element.offsetHeight)/2;positionY=Number.constrain(positionY,0,container.offsetHeight-element.offsetHeight);element.style.position="absolute";element.positionAt(positionX,positionY,container);},focus:function(){},onEnter:function(){},willHide:function(){},__proto__:WebInspector.Object.prototype}
7651 WebInspector.Dialog._modalHostView=null;WebInspector.Dialog.setModalHostView=function(view)
7652 {WebInspector.Dialog._modalHostView=view;};WebInspector.Dialog.modalHostView=function()
7653 {return WebInspector.Dialog._modalHostView;};WebInspector.Dialog.modalHostRepositioned=function()
7654 {if(WebInspector.Dialog._instance)
7655 WebInspector.Dialog._instance._position();};WebInspector.GoToLineDialog=function(sourceFrame)
7656 {WebInspector.DialogDelegate.call(this);this.element=document.createElement("div");this.element.className="go-to-line-dialog";this.element.createChild("label").textContent=WebInspector.UIString("Go to line: ");this._input=this.element.createChild("input");this._input.setAttribute("type","text");this._input.setAttribute("size",6);this._goButton=this.element.createChild("button");this._goButton.textContent=WebInspector.UIString("Go");this._goButton.addEventListener("click",this._onGoClick.bind(this),false);this._sourceFrame=sourceFrame;}
7657 WebInspector.GoToLineDialog.install=function(panel,sourceFrameGetter)
7658 {var goToLineShortcut=WebInspector.GoToLineDialog.createShortcut();panel.registerShortcuts([goToLineShortcut],WebInspector.GoToLineDialog._show.bind(null,sourceFrameGetter));}
7659 WebInspector.GoToLineDialog._show=function(sourceFrameGetter,event)
7660 {var sourceFrame=sourceFrameGetter();if(!sourceFrame)
7661 return false;WebInspector.Dialog.show(sourceFrame.element,new WebInspector.GoToLineDialog(sourceFrame));return true;}
7662 WebInspector.GoToLineDialog.createShortcut=function()
7663 {return WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Ctrl);}
7664 WebInspector.GoToLineDialog.prototype={focus:function()
7665 {WebInspector.setCurrentFocusElement(this._input);this._input.select();},_onGoClick:function()
7666 {this._applyLineNumber();WebInspector.Dialog.hide();},_applyLineNumber:function()
7667 {var value=this._input.value;var lineNumber=parseInt(value,10)-1;if(!isNaN(lineNumber)&&lineNumber>=0)
7668 this._sourceFrame.revealPosition(lineNumber,0,true);},onEnter:function()
7669 {this._applyLineNumber();},__proto__:WebInspector.DialogDelegate.prototype}
7670 WebInspector.SettingsScreen=function(onHide)
7671 {WebInspector.HelpScreen.call(this);this.element.id="settings-screen";this._onHide=onHide;this._tabbedPane=new WebInspector.TabbedPane();this._tabbedPane.element.classList.add("help-window-main");var settingsLabelElement=document.createElement("div");settingsLabelElement.className="help-window-label";settingsLabelElement.createTextChild(WebInspector.UIString("Settings"));this._tabbedPane.element.insertBefore(settingsLabelElement,this._tabbedPane.element.firstChild);this._tabbedPane.element.appendChild(this._createCloseButton());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.General,WebInspector.UIString("General"),new WebInspector.GenericSettingsTab());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace,WebInspector.UIString("Workspace"),new WebInspector.WorkspaceSettingsTab());if(WebInspector.experimentsSettings.experimentsEnabled)
7672 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments,WebInspector.UIString("Experiments"),new WebInspector.ExperimentsSettingsTab());this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts,WebInspector.UIString("Shortcuts"),WebInspector.shortcutsScreen.createShortcutsTabView());this._tabbedPane.shrinkableTabs=false;this._tabbedPane.verticalTabLayout=true;this._lastSelectedTabSetting=WebInspector.settings.createSetting("lastSelectedSettingsTab",WebInspector.SettingsScreen.Tabs.General);this.selectTab(this._lastSelectedTabSetting.get());this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSelected,this._tabSelected,this);}
7673 WebInspector.SettingsScreen.regexValidator=function(text)
7674 {var regex;try{regex=new RegExp(text);}catch(e){}
7675 return regex?null:WebInspector.UIString("Invalid pattern");}
7676 WebInspector.SettingsScreen.integerValidator=function(min,max,text)
7677 {var value=Number(text);if(isNaN(value))
7678 return WebInspector.UIString("Invalid number format");if(value<min||value>max)
7679 return WebInspector.UIString("Value is out of range [%d, %d]",min,max);return null;}
7680 WebInspector.SettingsScreen.Tabs={General:"general",Overrides:"overrides",Workspace:"workspace",Experiments:"experiments",Shortcuts:"shortcuts"}
7681 WebInspector.SettingsScreen.prototype={selectTab:function(tabId)
7682 {this._tabbedPane.selectTab(tabId);},_tabSelected:function(event)
7683 {this._lastSelectedTabSetting.set(this._tabbedPane.selectedTabId);},wasShown:function()
7684 {this._tabbedPane.show(this.element);WebInspector.HelpScreen.prototype.wasShown.call(this);},isClosingKey:function(keyCode)
7685 {return[WebInspector.KeyboardShortcut.Keys.Enter.code,WebInspector.KeyboardShortcut.Keys.Esc.code,].indexOf(keyCode)>=0;},willHide:function()
7686 {this._onHide();WebInspector.HelpScreen.prototype.willHide.call(this);},__proto__:WebInspector.HelpScreen.prototype}
7687 WebInspector.SettingsTab=function(name,id)
7688 {WebInspector.VBox.call(this);this.element.classList.add("settings-tab-container");if(id)
7689 this.element.id=id;var header=this.element.createChild("header");header.createChild("h3").appendChild(document.createTextNode(name));this.containerElement=this.element.createChild("div","help-container-wrapper").createChild("div","settings-tab help-content help-container");}
7690 WebInspector.SettingsTab.prototype={_appendSection:function(name)
7691 {var block=this.containerElement.createChild("div","help-block");if(name)
7692 block.createChild("div","help-section-title").textContent=name;return block;},_createSelectSetting:function(name,options,setting)
7693 {var p=document.createElement("p");var labelElement=p.createChild("label");labelElement.textContent=name;var select=p.createChild("select");var settingValue=setting.get();for(var i=0;i<options.length;++i){var option=options[i];select.add(new Option(option[0],option[1]));if(settingValue===option[1])
7694 select.selectedIndex=i;}
7695 function changeListener(e)
7696 {setting.set(options[select.selectedIndex][1]);}
7697 select.addEventListener("change",changeListener,false);return p;},_createInputSetting:function(label,setting,numeric,maxLength,width,validatorCallback)
7698 {var p=document.createElement("p");var labelElement=p.createChild("label");labelElement.textContent=label;var inputElement=p.createChild("input");inputElement.value=setting.get();inputElement.type="text";if(numeric)
7699 inputElement.className="numeric";if(maxLength)
7700 inputElement.maxLength=maxLength;if(width)
7701 inputElement.style.width=width;if(validatorCallback){var errorMessageLabel=p.createChild("div");errorMessageLabel.classList.add("field-error-message");errorMessageLabel.style.color="DarkRed";inputElement.oninput=function()
7702 {var error=validatorCallback(inputElement.value);if(!error)
7703 error="";errorMessageLabel.textContent=error;};}
7704 function onBlur()
7705 {setting.set(numeric?Number(inputElement.value):inputElement.value);}
7706 inputElement.addEventListener("blur",onBlur,false);return p;},_createCustomSetting:function(name,element)
7707 {var p=document.createElement("p");var fieldsetElement=document.createElement("fieldset");fieldsetElement.createChild("label").textContent=name;fieldsetElement.appendChild(element);p.appendChild(fieldsetElement);return p;},__proto__:WebInspector.VBox.prototype}
7708 WebInspector.GenericSettingsTab=function()
7709 {WebInspector.SettingsTab.call(this,WebInspector.UIString("General"),"general-tab-content");var p=this._appendSection();p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Disable cache (while DevTools is open)"),WebInspector.settings.cacheDisabled));var disableJSElement=WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Disable JavaScript"),WebInspector.settings.javaScriptDisabled);p.appendChild(disableJSElement);WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptDisabledChanged,this);this._disableJSCheckbox=disableJSElement.getElementsByTagName("input")[0];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();p=this._appendSection(WebInspector.UIString("Appearance"));var splitVerticallyTitle=WebInspector.UIString("Split panels vertically when docked to %s",WebInspector.experimentsSettings.dockToLeft.isEnabled()?"left or right":"right");p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(splitVerticallyTitle,WebInspector.settings.splitVerticallyWhenDockedToRight));var panelShortcutTitle=WebInspector.UIString("Enable %s + 1-9 shortcut to switch panels",WebInspector.isMac()?"Cmd":"Ctrl");p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(panelShortcutTitle,WebInspector.settings.shortcutPanelSwitch));p=this._appendSection(WebInspector.UIString("Elements"));var colorFormatElement=this._createSelectSetting(WebInspector.UIString("Color format"),[[WebInspector.UIString("As authored"),WebInspector.Color.Format.Original],["HEX: #DAC0DE",WebInspector.Color.Format.HEX],["RGB: rgb(128, 255, 255)",WebInspector.Color.Format.RGB],["HSL: hsl(300, 80%, 90%)",WebInspector.Color.Format.HSL]],WebInspector.settings.colorFormat);p.appendChild(colorFormatElement);p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show user agent styles"),WebInspector.settings.showUserAgentStyles));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show user agent shadow DOM"),WebInspector.settings.showUAShadowDOM));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Word wrap"),WebInspector.settings.domWordWrap));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show rulers"),WebInspector.settings.showMetricsRulers));p=this._appendSection(WebInspector.UIString("Sources"));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Search in content scripts"),WebInspector.settings.searchInContentScripts));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Enable JavaScript source maps"),WebInspector.settings.jsSourceMapsEnabled));var checkbox=WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Enable CSS source maps"),WebInspector.settings.cssSourceMapsEnabled);p.appendChild(checkbox);var fieldset=WebInspector.SettingsUI.createSettingFieldset(WebInspector.settings.cssSourceMapsEnabled);var autoReloadCSSCheckbox=fieldset.createChild("input");fieldset.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Auto-reload generated CSS"),WebInspector.settings.cssReloadEnabled,false,autoReloadCSSCheckbox));checkbox.appendChild(fieldset);var indentationElement=this._createSelectSetting(WebInspector.UIString("Default indentation"),[[WebInspector.UIString("2 spaces"),WebInspector.TextUtils.Indent.TwoSpaces],[WebInspector.UIString("4 spaces"),WebInspector.TextUtils.Indent.FourSpaces],[WebInspector.UIString("8 spaces"),WebInspector.TextUtils.Indent.EightSpaces],[WebInspector.UIString("Tab character"),WebInspector.TextUtils.Indent.TabCharacter]],WebInspector.settings.textEditorIndent);p.appendChild(indentationElement);p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Detect indentation"),WebInspector.settings.textEditorAutoDetectIndent));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Autocompletion"),WebInspector.settings.textEditorAutocompletion));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Bracket matching"),WebInspector.settings.textEditorBracketMatching));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show whitespace characters"),WebInspector.settings.showWhitespacesInEditor));if(WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled()){checkbox=WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Skip stepping through sources with particular names"),WebInspector.settings.skipStackFramesSwitch);fieldset=WebInspector.SettingsUI.createSettingFieldset(WebInspector.settings.skipStackFramesSwitch);fieldset.appendChild(this._createInputSetting(WebInspector.UIString("Pattern"),WebInspector.settings.skipStackFramesPattern,false,1000,"100px",WebInspector.SettingsScreen.regexValidator));checkbox.appendChild(fieldset);p.appendChild(checkbox);}
7710 WebInspector.settings.skipStackFramesSwitch.addChangeListener(this._skipStackFramesSwitchOrPatternChanged,this);WebInspector.settings.skipStackFramesPattern.addChangeListener(this._skipStackFramesSwitchOrPatternChanged,this);p=this._appendSection(WebInspector.UIString("Profiler"));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show advanced heap snapshot properties"),WebInspector.settings.showAdvancedHeapSnapshotProperties));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("High resolution CPU profiling"),WebInspector.settings.highResolutionCpuProfiling));p=this._appendSection(WebInspector.UIString("Console"));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Log XMLHttpRequests"),WebInspector.settings.monitoringXHREnabled));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Preserve log upon navigation"),WebInspector.settings.preserveConsoleLog));p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Show timestamps"),WebInspector.settings.consoleTimestampsEnabled));if(WebInspector.openAnchorLocationRegistry.handlerNames.length>0){var handlerSelector=new WebInspector.HandlerSelector(WebInspector.openAnchorLocationRegistry);p=this._appendSection(WebInspector.UIString("Extensions"));p.appendChild(this._createCustomSetting(WebInspector.UIString("Open links in"),handlerSelector.element));}
7711 p=this._appendSection();var restoreDefaults=p.createChild("input","settings-tab-text-button");restoreDefaults.type="button";restoreDefaults.value=WebInspector.UIString("Restore defaults and reload");restoreDefaults.addEventListener("click",restoreAndReload);function restoreAndReload()
7712 {if(window.localStorage)
7713 window.localStorage.clear();WebInspector.reload();}}
7714 WebInspector.GenericSettingsTab.prototype={_updateScriptDisabledCheckbox:function()
7715 {function executionStatusCallback(error,status)
7716 {if(error||!status)
7717 return;var forbidden=(status==="forbidden");var disabled=forbidden||(status==="disabled");this._disableJSInfo.classList.toggle("hidden",!forbidden);this._disableJSCheckbox.checked=disabled;this._disableJSCheckbox.disabled=forbidden;}
7718 PageAgent.getScriptExecutionStatus(executionStatusCallback.bind(this));},_javaScriptDisabledChanged:function()
7719 {PageAgent.setScriptExecutionDisabled(WebInspector.settings.javaScriptDisabled.get(),this._updateScriptDisabledCheckbox.bind(this));},_skipStackFramesSwitchOrPatternChanged:function()
7720 {WebInspector.debuggerModel.applySkipStackFrameSettings();},_appendDrawerNote:function(p)
7721 {var noteElement=p.createChild("div","help-field-note");noteElement.createTextChild("Hit ");noteElement.createChild("span","help-key").textContent="Esc";noteElement.createTextChild(WebInspector.UIString(" or click the"));noteElement.appendChild(new WebInspector.StatusBarButton(WebInspector.UIString("Drawer"),"console-status-bar-item").element);noteElement.createTextChild(WebInspector.UIString("toolbar item"));},__proto__:WebInspector.SettingsTab.prototype}
7722 WebInspector.WorkspaceSettingsTab=function()
7723 {WebInspector.SettingsTab.call(this,WebInspector.UIString("Workspace"),"workspace-tab-content");WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded,this._fileSystemAdded,this);WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved,this._fileSystemRemoved,this);this._commonSection=this._appendSection(WebInspector.UIString("Common"));var folderExcludePatternInput=this._createInputSetting(WebInspector.UIString("Folder exclude pattern"),WebInspector.settings.workspaceFolderExcludePattern,false,0,"270px",WebInspector.SettingsScreen.regexValidator);this._commonSection.appendChild(folderExcludePatternInput);this._fileSystemsSection=this._appendSection(WebInspector.UIString("Folders"));this._fileSystemsListContainer=this._fileSystemsSection.createChild("p","settings-list-container");this._addFileSystemRowElement=this._fileSystemsSection.createChild("div");var addFileSystemButton=this._addFileSystemRowElement.createChild("input","settings-tab-text-button");addFileSystemButton.type="button";addFileSystemButton.value=WebInspector.UIString("Add folder\u2026");addFileSystemButton.addEventListener("click",this._addFileSystemClicked.bind(this));this._editFileSystemButton=this._addFileSystemRowElement.createChild("input","settings-tab-text-button");this._editFileSystemButton.type="button";this._editFileSystemButton.value=WebInspector.UIString("Edit\u2026");this._editFileSystemButton.addEventListener("click",this._editFileSystemClicked.bind(this));this._updateEditFileSystemButtonState();this._reset();}
7724 WebInspector.WorkspaceSettingsTab.prototype={wasShown:function()
7725 {WebInspector.SettingsTab.prototype.wasShown.call(this);this._reset();},_reset:function()
7726 {this._resetFileSystems();},_resetFileSystems:function()
7727 {this._fileSystemsListContainer.removeChildren();var fileSystemPaths=WebInspector.isolatedFileSystemManager.mapping().fileSystemPaths();delete this._fileSystemsList;if(!fileSystemPaths.length){var noFileSystemsMessageElement=this._fileSystemsListContainer.createChild("div","no-file-systems-message");noFileSystemsMessageElement.textContent=WebInspector.UIString("You have no file systems added.");return;}
7728 this._fileSystemsList=new WebInspector.SettingsList(["path"],this._renderFileSystem.bind(this));this._fileSystemsList.element.classList.add("file-systems-list");this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.Selected,this._fileSystemSelected.bind(this));this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.Removed,this._fileSystemRemovedfromList.bind(this));this._fileSystemsList.addEventListener(WebInspector.SettingsList.Events.DoubleClicked,this._fileSystemDoubleClicked.bind(this));this._fileSystemsListContainer.appendChild(this._fileSystemsList.element);for(var i=0;i<fileSystemPaths.length;++i)
7729 this._fileSystemsList.addItem(fileSystemPaths[i]);this._updateEditFileSystemButtonState();},_updateEditFileSystemButtonState:function()
7730 {this._editFileSystemButton.disabled=!this._selectedFileSystemPath();},_fileSystemSelected:function(event)
7731 {this._updateEditFileSystemButtonState();},_fileSystemDoubleClicked:function(event)
7732 {var id=(event.data);this._editFileSystem(id);},_editFileSystemClicked:function(event)
7733 {this._editFileSystem(this._selectedFileSystemPath());},_editFileSystem:function(id)
7734 {WebInspector.EditFileSystemDialog.show(WebInspector.inspectorView.element,id);},_createRemoveButton:function(handler)
7735 {var removeButton=document.createElement("button");removeButton.classList.add("button");removeButton.classList.add("remove-item-button");removeButton.value=WebInspector.UIString("Remove");if(handler)
7736 removeButton.addEventListener("click",handler,false);else
7737 removeButton.disabled=true;return removeButton;},_renderFileSystem:function(columnElement,column,id)
7738 {if(!id)
7739 return"";var fileSystemPath=id;var textElement=columnElement.createChild("span","list-column-text");var pathElement=textElement.createChild("span","file-system-path");pathElement.title=fileSystemPath;const maxTotalPathLength=55;const maxFolderNameLength=30;var lastIndexOfSlash=fileSystemPath.lastIndexOf(WebInspector.isWin()?"\\":"/");var folderName=fileSystemPath.substr(lastIndexOfSlash+1);var folderPath=fileSystemPath.substr(0,lastIndexOfSlash+1);folderPath=folderPath.trimMiddle(maxTotalPathLength-Math.min(maxFolderNameLength,folderName.length));folderName=folderName.trimMiddle(maxFolderNameLength);var folderPathElement=pathElement.createChild("span");folderPathElement.textContent=folderPath;var nameElement=pathElement.createChild("span","file-system-path-name");nameElement.textContent=folderName;},_fileSystemRemovedfromList:function(event)
7740 {var id=(event.data);if(!id)
7741 return;WebInspector.isolatedFileSystemManager.removeFileSystem(id);},_addFileSystemClicked:function()
7742 {WebInspector.isolatedFileSystemManager.addFileSystem();},_fileSystemAdded:function(event)
7743 {var fileSystem=(event.data);if(!this._fileSystemsList)
7744 this._reset();else
7745 this._fileSystemsList.addItem(fileSystem.path());},_fileSystemRemoved:function(event)
7746 {var fileSystem=(event.data);var selectedFileSystemPath=this._selectedFileSystemPath();if(this._fileSystemsList.itemForId(fileSystem.path()))
7747 this._fileSystemsList.removeItem(fileSystem.path());if(!this._fileSystemsList.itemIds().length)
7748 this._reset();this._updateEditFileSystemButtonState();},_selectedFileSystemPath:function()
7749 {return this._fileSystemsList?this._fileSystemsList.selectedId():null;},__proto__:WebInspector.SettingsTab.prototype}
7750 WebInspector.ExperimentsSettingsTab=function()
7751 {WebInspector.SettingsTab.call(this,WebInspector.UIString("Experiments"),"experiments-tab-content");var experiments=WebInspector.experimentsSettings.experiments;if(experiments.length){var experimentsSection=this._appendSection();experimentsSection.appendChild(this._createExperimentsWarningSubsection());for(var i=0;i<experiments.length;++i)
7752 experimentsSection.appendChild(this._createExperimentCheckbox(experiments[i]));}}
7753 WebInspector.ExperimentsSettingsTab.prototype={_createExperimentsWarningSubsection:function()
7754 {var subsection=document.createElement("div");var warning=subsection.createChild("span","settings-experiments-warning-subsection-warning");warning.textContent=WebInspector.UIString("WARNING:");subsection.appendChild(document.createTextNode(" "));var message=subsection.createChild("span","settings-experiments-warning-subsection-message");message.textContent=WebInspector.UIString("These experiments could be dangerous and may require restart.");return subsection;},_createExperimentCheckbox:function(experiment)
7755 {var input=document.createElement("input");input.type="checkbox";input.name=experiment.name;input.checked=experiment.isEnabled();function listener()
7756 {experiment.setEnabled(input.checked);}
7757 input.addEventListener("click",listener,false);var p=document.createElement("p");var label=document.createElement("label");label.appendChild(input);label.appendChild(document.createTextNode(WebInspector.UIString(experiment.title)));p.appendChild(label);return p;},__proto__:WebInspector.SettingsTab.prototype}
7758 WebInspector.SettingsController=function()
7759 {this._statusBarButton=new WebInspector.StatusBarButton(WebInspector.UIString("Settings"),"settings-status-bar-item");this._statusBarButton.element.addEventListener("mouseup",this._mouseUp.bind(this),false);this._settingsScreen;}
7760 WebInspector.SettingsController.prototype={get statusBarItem()
7761 {return this._statusBarButton.element;},_mouseUp:function()
7762 {this.showSettingsScreen();},_onHideSettingsScreen:function()
7763 {delete this._settingsScreenVisible;},showSettingsScreen:function(tabId)
7764 {if(!this._settingsScreen)
7765 this._settingsScreen=new WebInspector.SettingsScreen(this._onHideSettingsScreen.bind(this));if(tabId)
7766 this._settingsScreen.selectTab(tabId);this._settingsScreen.showModal();this._settingsScreenVisible=true;},resize:function()
7767 {if(this._settingsScreen&&this._settingsScreen.isShowing())
7768 this._settingsScreen.doResize();}}
7769 WebInspector.SettingsController.SettingsScreenActionDelegate=function(){}
7770 WebInspector.SettingsController.SettingsScreenActionDelegate.prototype={handleAction:function()
7771 {WebInspector.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.General);return true;}}
7772 WebInspector.SettingsList=function(columns,itemRenderer)
7773 {this.element=document.createElement("div");this.element.classList.add("settings-list");this.element.tabIndex=-1;this._itemRenderer=itemRenderer;this._listItems={};this._ids=[];this._columns=columns;}
7774 WebInspector.SettingsList.Events={Selected:"Selected",Removed:"Removed",DoubleClicked:"DoubleClicked",}
7775 WebInspector.SettingsList.prototype={addItem:function(itemId,beforeId)
7776 {var listItem=document.createElement("div");listItem._id=itemId;listItem.classList.add("settings-list-item");if(typeof beforeId!==undefined)
7777 this.element.insertBefore(listItem,this._listItems[beforeId]);else
7778 this.element.appendChild(listItem);var listItemContents=listItem.createChild("div","settings-list-item-contents");var listItemColumnsElement=listItemContents.createChild("div","settings-list-item-columns");listItem.columnElements={};for(var i=0;i<this._columns.length;++i){var columnElement=listItemColumnsElement.createChild("div","list-column");var columnId=this._columns[i];listItem.columnElements[columnId]=columnElement;this._itemRenderer(columnElement,columnId,itemId);}
7779 var removeItemButton=this._createRemoveButton(removeItemClicked.bind(this));listItemContents.addEventListener("click",this.selectItem.bind(this,itemId),false);listItemContents.addEventListener("dblclick",this._onDoubleClick.bind(this,itemId),false);listItemContents.appendChild(removeItemButton);this._listItems[itemId]=listItem;if(typeof beforeId!==undefined)
7780 this._ids.splice(this._ids.indexOf(beforeId),0,itemId);else
7781 this._ids.push(itemId);function removeItemClicked(event)
7782 {removeItemButton.disabled=true;this.removeItem(itemId);this.dispatchEventToListeners(WebInspector.SettingsList.Events.Removed,itemId);event.consume();}
7783 return listItem;},removeItem:function(id)
7784 {this._listItems[id].remove();delete this._listItems[id];this._ids.remove(id);if(id===this._selectedId){delete this._selectedId;if(this._ids.length)
7785 this.selectItem(this._ids[0]);}},itemIds:function()
7786 {return this._ids.slice();},columns:function()
7787 {return this._columns.slice();},selectedId:function()
7788 {return this._selectedId;},selectedItem:function()
7789 {return this._selectedId?this._listItems[this._selectedId]:null;},itemForId:function(itemId)
7790 {return this._listItems[itemId];},_onDoubleClick:function(id,event)
7791 {this.dispatchEventToListeners(WebInspector.SettingsList.Events.DoubleClicked,id);},selectItem:function(id,event)
7792 {if(typeof this._selectedId!=="undefined"){this._listItems[this._selectedId].classList.remove("selected");}
7793 this._selectedId=id;if(typeof this._selectedId!=="undefined"){this._listItems[this._selectedId].classList.add("selected");}
7794 this.dispatchEventToListeners(WebInspector.SettingsList.Events.Selected,id);if(event)
7795 event.consume();},_createRemoveButton:function(handler)
7796 {var removeButton=document.createElement("button");removeButton.classList.add("remove-item-button");removeButton.value=WebInspector.UIString("Remove");removeButton.addEventListener("click",handler,false);return removeButton;},__proto__:WebInspector.Object.prototype}
7797 WebInspector.EditableSettingsList=function(columns,valuesProvider,validateHandler,editHandler)
7798 {WebInspector.SettingsList.call(this,columns,this._renderColumn.bind(this));this._validateHandler=validateHandler;this._editHandler=editHandler;this._valuesProvider=valuesProvider;this._addInputElements={};this._editInputElements={};this._textElements={};this._addMappingItem=this.addItem(null);this._addMappingItem.classList.add("item-editing");this._addMappingItem.classList.add("add-list-item");}
7799 WebInspector.EditableSettingsList.prototype={addItem:function(itemId,beforeId)
7800 {var listItem=WebInspector.SettingsList.prototype.addItem.call(this,itemId,beforeId);listItem.classList.add("editable");return listItem;},_renderColumn:function(columnElement,columnId,itemId)
7801 {columnElement.classList.add("settings-list-column-"+columnId);var placeholder=(columnId==="url")?WebInspector.UIString("URL prefix"):WebInspector.UIString("Folder path");if(itemId===null){var inputElement=columnElement.createChild("input","list-column-editor");inputElement.placeholder=placeholder;inputElement.addEventListener("blur",this._onAddMappingInputBlur.bind(this));inputElement.addEventListener("input",this._validateEdit.bind(this,itemId));this._addInputElements[columnId]=inputElement;return;}
7802 var validItemId=itemId;if(!this._editInputElements[itemId])
7803 this._editInputElements[itemId]={};if(!this._textElements[itemId])
7804 this._textElements[itemId]={};var value=this._valuesProvider(itemId,columnId);var textElement=columnElement.createChild("span","list-column-text");textElement.textContent=value;textElement.title=value;columnElement.addEventListener("click",rowClicked.bind(this),false);this._textElements[itemId][columnId]=textElement;var inputElement=columnElement.createChild("input","list-column-editor");inputElement.value=value;inputElement.addEventListener("blur",this._editMappingBlur.bind(this,itemId));inputElement.addEventListener("input",this._validateEdit.bind(this,itemId));columnElement.inputElement=inputElement;this._editInputElements[itemId][columnId]=inputElement;function rowClicked(event)
7805 {if(itemId===this._editingId)
7806 return;event.consume();console.assert(!this._editingId);this._editingId=validItemId;var listItem=this.itemForId(validItemId);listItem.classList.add("item-editing");var inputElement=event.target.inputElement||this._editInputElements[validItemId][this.columns()[0]];inputElement.focus();inputElement.select();}},_data:function(itemId)
7807 {var inputElements=this._inputElements(itemId);var data={};var columns=this.columns();for(var i=0;i<columns.length;++i)
7808 data[columns[i]]=inputElements[columns[i]].value;return data;},_inputElements:function(itemId)
7809 {if(!itemId)
7810 return this._addInputElements;return this._editInputElements[itemId]||null;},_validateEdit:function(itemId)
7811 {var errorColumns=this._validateHandler(itemId,this._data(itemId));var hasChanges=this._hasChanges(itemId);var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._inputElements(itemId)[columnId];if(hasChanges&&errorColumns.indexOf(columnId)!==-1)
7812 inputElement.classList.add("editable-item-error");else
7813 inputElement.classList.remove("editable-item-error");}
7814 return!errorColumns.length;},_hasChanges:function(itemId)
7815 {var hasChanges=false;var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var oldValue=itemId?this._textElements[itemId][columnId].textContent:"";var newValue=this._inputElements(itemId)[columnId].value;if(oldValue!==newValue){hasChanges=true;break;}}
7816 return hasChanges;},_editMappingBlur:function(itemId,event)
7817 {var inputElements=Object.values(this._editInputElements[itemId]);if(inputElements.indexOf(event.relatedTarget)!==-1)
7818 return;var listItem=this.itemForId(itemId);listItem.classList.remove("item-editing");delete this._editingId;if(!this._hasChanges(itemId))
7819 return;if(!this._validateEdit(itemId)){var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._editInputElements[itemId][columnId];inputElement.value=this._textElements[itemId][columnId].textContent;inputElement.classList.remove("editable-item-error");}
7820 return;}
7821 this._editHandler(itemId,this._data(itemId));},_onAddMappingInputBlur:function(event)
7822 {var inputElements=Object.values(this._addInputElements);if(inputElements.indexOf(event.relatedTarget)!==-1)
7823 return;if(!this._hasChanges(null))
7824 return;if(!this._validateEdit(null))
7825 return;this._editHandler(null,this._data(null));var columns=this.columns();for(var i=0;i<columns.length;++i){var columnId=columns[i];var inputElement=this._addInputElements[columnId];inputElement.value="";}},__proto__:WebInspector.SettingsList.prototype}
7826 WebInspector.settingsController;WebInspector.EditFileSystemDialog=function(fileSystemPath)
7827 {WebInspector.DialogDelegate.call(this);this._fileSystemPath=fileSystemPath;this.element=document.createElement("div");this.element.className="edit-file-system-dialog";var header=this.element.createChild("div","header");var headerText=header.createChild("span");headerText.textContent=WebInspector.UIString("Edit file system");var closeButton=header.createChild("div","close-button-gray done-button");closeButton.addEventListener("click",this._onDoneClick.bind(this),false);var contents=this.element.createChild("div","contents");WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.FileMappingAdded,this._fileMappingAdded,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.FileMappingRemoved,this._fileMappingRemoved,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.ExcludedFolderAdded,this._excludedFolderAdded,this);WebInspector.isolatedFileSystemManager.mapping().addEventListener(WebInspector.FileSystemMapping.Events.ExcludedFolderRemoved,this._excludedFolderRemoved,this);var blockHeader=contents.createChild("div","block-header");blockHeader.textContent=WebInspector.UIString("Mappings");this._fileMappingsSection=contents.createChild("div","section file-mappings-section");this._fileMappingsListContainer=this._fileMappingsSection.createChild("div","settings-list-container");var entries=WebInspector.isolatedFileSystemManager.mapping().mappingEntries(this._fileSystemPath);this._fileMappingsList=new WebInspector.EditableSettingsList(["url","path"],this._fileMappingValuesProvider.bind(this),this._fileMappingValidate.bind(this),this._fileMappingEdit.bind(this));this._fileMappingsList.addEventListener(WebInspector.SettingsList.Events.Removed,this._fileMappingRemovedfromList.bind(this));this._fileMappingsList.element.classList.add("file-mappings-list");this._fileMappingsListContainer.appendChild(this._fileMappingsList.element);this._entries={};for(var i=0;i<entries.length;++i)
7828 this._addMappingRow(entries[i]);blockHeader=contents.createChild("div","block-header");blockHeader.textContent=WebInspector.UIString("Excluded folders");this._excludedFolderListSection=contents.createChild("div","section excluded-folders-section");this._excludedFolderListContainer=this._excludedFolderListSection.createChild("div","settings-list-container");var excludedFolderEntries=WebInspector.isolatedFileSystemManager.mapping().excludedFolders(fileSystemPath);this._excludedFolderList=new WebInspector.EditableSettingsList(["path"],this._excludedFolderValueProvider.bind(this),this._excludedFolderValidate.bind(this),this._excludedFolderEdit.bind(this));this._excludedFolderList.addEventListener(WebInspector.SettingsList.Events.Removed,this._excludedFolderRemovedfromList.bind(this));this._excludedFolderList.element.classList.add("excluded-folders-list");this._excludedFolderListContainer.appendChild(this._excludedFolderList.element);this._excludedFolderEntries=new StringMap();for(var i=0;i<excludedFolderEntries.length;++i)
7829 this._addExcludedFolderRow(excludedFolderEntries[i]);this.element.tabIndex=0;}
7830 WebInspector.EditFileSystemDialog.show=function(element,fileSystemPath)
7831 {WebInspector.Dialog.show(element,new WebInspector.EditFileSystemDialog(fileSystemPath));var glassPane=document.getElementById("glass-pane");glassPane.classList.add("settings-glass-pane");}
7832 WebInspector.EditFileSystemDialog.prototype={show:function(element)
7833 {element.appendChild(this.element);this.element.classList.add("dialog-contents");element.classList.add("settings-dialog");element.classList.add("settings-tab");this._dialogElement=element;},_resize:function()
7834 {if(!this._dialogElement||!this._relativeToElement)
7835 return;const minWidth=200;const minHeight=150;var maxHeight=this._relativeToElement.offsetHeight-10;maxHeight=Math.max(minHeight,maxHeight);var maxWidth=Math.min(540,this._relativeToElement.offsetWidth-10);maxWidth=Math.max(minWidth,maxWidth);this._dialogElement.style.maxHeight=maxHeight+"px";this._dialogElement.style.width=maxWidth+"px";WebInspector.DialogDelegate.prototype.position(this._dialogElement,this._relativeToElement);},position:function(element,relativeToElement)
7836 {this._relativeToElement=relativeToElement;this._resize();},willHide:function(event)
7837 {},_fileMappingAdded:function(event)
7838 {var entry=(event.data);this._addMappingRow(entry);},_fileMappingRemoved:function(event)
7839 {var entry=(event.data);if(this._fileSystemPath!==entry.fileSystemPath)
7840 return;delete this._entries[entry.urlPrefix];if(this._fileMappingsList.itemForId(entry.urlPrefix))
7841 this._fileMappingsList.removeItem(entry.urlPrefix);this._resize();},_fileMappingValuesProvider:function(itemId,columnId)
7842 {if(!itemId)
7843 return"";var entry=this._entries[itemId];switch(columnId){case"url":return entry.urlPrefix;case"path":return entry.pathPrefix;default:console.assert("Should not be reached.");}
7844 return"";},_fileMappingValidate:function(itemId,data)
7845 {var oldPathPrefix=itemId?this._entries[itemId].pathPrefix:null;return this._validateMapping(data["url"],itemId,data["path"],oldPathPrefix);},_fileMappingEdit:function(itemId,data)
7846 {if(itemId){var urlPrefix=itemId;var pathPrefix=this._entries[itemId].pathPrefix;var fileSystemPath=this._entries[itemId].fileSystemPath;WebInspector.isolatedFileSystemManager.mapping().removeFileMapping(fileSystemPath,urlPrefix,pathPrefix);}
7847 this._addFileMapping(data["url"],data["path"]);},_validateMapping:function(urlPrefix,allowedURLPrefix,path,allowedPathPrefix)
7848 {var columns=[];if(!this._checkURLPrefix(urlPrefix,allowedURLPrefix))
7849 columns.push("url");if(!this._checkPathPrefix(path,allowedPathPrefix))
7850 columns.push("path");return columns;},_fileMappingRemovedfromList:function(event)
7851 {var urlPrefix=(event.data);if(!urlPrefix)
7852 return;var entry=this._entries[urlPrefix];WebInspector.isolatedFileSystemManager.mapping().removeFileMapping(entry.fileSystemPath,entry.urlPrefix,entry.pathPrefix);},_addFileMapping:function(urlPrefix,pathPrefix)
7853 {var normalizedURLPrefix=this._normalizePrefix(urlPrefix);var normalizedPathPrefix=this._normalizePrefix(pathPrefix);WebInspector.isolatedFileSystemManager.mapping().addFileMapping(this._fileSystemPath,normalizedURLPrefix,normalizedPathPrefix);this._fileMappingsList.selectItem(normalizedURLPrefix);return true;},_normalizePrefix:function(prefix)
7854 {if(!prefix)
7855 return"";return prefix+(prefix[prefix.length-1]==="/"?"":"/");},_addMappingRow:function(entry)
7856 {var fileSystemPath=entry.fileSystemPath;var urlPrefix=entry.urlPrefix;if(!this._fileSystemPath||this._fileSystemPath!==fileSystemPath)
7857 return;this._entries[urlPrefix]=entry;var fileMappingListItem=this._fileMappingsList.addItem(urlPrefix,null);this._resize();},_excludedFolderAdded:function(event)
7858 {var entry=(event.data);this._addExcludedFolderRow(entry);},_excludedFolderRemoved:function(event)
7859 {var entry=(event.data);var fileSystemPath=entry.fileSystemPath;if(!fileSystemPath||this._fileSystemPath!==fileSystemPath)
7860 return;delete this._excludedFolderEntries[entry.path];if(this._excludedFolderList.itemForId(entry.path))
7861 this._excludedFolderList.removeItem(entry.path);},_excludedFolderValueProvider:function(itemId,columnId)
7862 {return itemId;},_excludedFolderValidate:function(itemId,data)
7863 {var fileSystemPath=this._fileSystemPath;var columns=[];if(!this._validateExcludedFolder(data["path"],itemId))
7864 columns.push("path");return columns;},_validateExcludedFolder:function(path,allowedPath)
7865 {return!!path&&(path===allowedPath||!this._excludedFolderEntries.contains(path));},_excludedFolderEdit:function(itemId,data)
7866 {var fileSystemPath=this._fileSystemPath;if(itemId)
7867 WebInspector.isolatedFileSystemManager.mapping().removeExcludedFolder(fileSystemPath,itemId);var excludedFolderPath=data["path"];WebInspector.isolatedFileSystemManager.mapping().addExcludedFolder(fileSystemPath,excludedFolderPath);},_excludedFolderRemovedfromList:function(event)
7868 {var itemId=(event.data);if(!itemId)
7869 return;WebInspector.isolatedFileSystemManager.mapping().removeExcludedFolder(this._fileSystemPath,itemId);},_addExcludedFolderRow:function(entry)
7870 {var fileSystemPath=entry.fileSystemPath;if(!fileSystemPath||this._fileSystemPath!==fileSystemPath)
7871 return;var path=entry.path;this._excludedFolderEntries.put(path,entry);this._excludedFolderList.addItem(path,null);this._resize();},_checkURLPrefix:function(value,allowedPrefix)
7872 {var prefix=this._normalizePrefix(value);return!!prefix&&(prefix===allowedPrefix||!this._entries[prefix]);},_checkPathPrefix:function(value,allowedPrefix)
7873 {var prefix=this._normalizePrefix(value);if(!prefix)
7874 return false;if(prefix===allowedPrefix)
7875 return true;for(var urlPrefix in this._entries){var entry=this._entries[urlPrefix];if(urlPrefix&&entry.pathPrefix===prefix)
7876 return false;}
7877 return true;},focus:function()
7878 {WebInspector.setCurrentFocusElement(this.element);},_onDoneClick:function()
7879 {WebInspector.Dialog.hide();},onEnter:function()
7880 {},__proto__:WebInspector.DialogDelegate.prototype}
7881 WebInspector.ShortcutsScreen=function()
7882 {this._sections={};}
7883 WebInspector.ShortcutsScreen.prototype={section:function(name)
7884 {var section=this._sections[name];if(!section)
7885 this._sections[name]=section=new WebInspector.ShortcutsSection(name);return section;},createShortcutsTabView:function()
7886 {var orderedSections=[];for(var section in this._sections)
7887 orderedSections.push(this._sections[section]);function compareSections(a,b)
7888 {return a.order-b.order;}
7889 orderedSections.sort(compareSections);var view=new WebInspector.View();view.element.className="settings-tab-container";view.element.createChild("header").createChild("h3").appendChild(document.createTextNode(WebInspector.UIString("Shortcuts")));var scrollPane=view.element.createChild("div","help-container-wrapper");var container=scrollPane.createChild("div");container.className="help-content help-container";for(var i=0;i<orderedSections.length;++i)
7890 orderedSections[i].renderSection(container);var note=scrollPane.createChild("p","help-footnote");var noteLink=note.createChild("a");noteLink.href="https://developers.google.com/chrome-developer-tools/docs/shortcuts";noteLink.target="_blank";noteLink.createTextChild(WebInspector.UIString("Full list of keyboard shortcuts and gestures"));return view;}}
7891 WebInspector.shortcutsScreen;WebInspector.ShortcutsSection=function(name)
7892 {this.name=name;this._lines=([]);this.order=++WebInspector.ShortcutsSection._sequenceNumber;};WebInspector.ShortcutsSection._sequenceNumber=0;WebInspector.ShortcutsSection.prototype={addKey:function(key,description)
7893 {this._addLine(this._renderKey(key),description);},addRelatedKeys:function(keys,description)
7894 {this._addLine(this._renderSequence(keys,"/"),description);},addAlternateKeys:function(keys,description)
7895 {this._addLine(this._renderSequence(keys,WebInspector.UIString("or")),description);},_addLine:function(keyElement,description)
7896 {this._lines.push({key:keyElement,text:description})},renderSection:function(container)
7897 {var parent=container.createChild("div","help-block");var headLine=parent.createChild("div","help-line");headLine.createChild("div","help-key-cell");headLine.createChild("div","help-section-title help-cell").textContent=this.name;for(var i=0;i<this._lines.length;++i){var line=parent.createChild("div","help-line");var keyCell=line.createChild("div","help-key-cell");keyCell.appendChild(this._lines[i].key);keyCell.appendChild(this._createSpan("help-key-delimiter",":"));line.createChild("div","help-cell").textContent=this._lines[i].text;}},_renderSequence:function(sequence,delimiter)
7898 {var delimiterSpan=this._createSpan("help-key-delimiter",delimiter);return this._joinNodes(sequence.map(this._renderKey.bind(this)),delimiterSpan);},_renderKey:function(key)
7899 {var keyName=key.name;var plus=this._createSpan("help-combine-keys","+");return this._joinNodes(keyName.split(" + ").map(this._createSpan.bind(this,"help-key")),plus);},_createSpan:function(className,textContent)
7900 {var node=document.createElement("span");node.className=className;node.textContent=textContent;return node;},_joinNodes:function(nodes,delimiter)
7901 {var result=document.createDocumentFragment();for(var i=0;i<nodes.length;++i){if(i>0)
7902 result.appendChild(delimiter.cloneNode(true));result.appendChild(nodes[i]);}
7903 return result;}}
7904 WebInspector.ShortcutsScreen.registerShortcuts=function()
7905 {var elementsSection=WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));var navigate=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NavigateUp.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NavigateDown);elementsSection.addRelatedKeys(navigate,WebInspector.UIString("Navigate elements"));var expandCollapse=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.Expand.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.Collapse);elementsSection.addRelatedKeys(expandCollapse,WebInspector.UIString("Expand/collapse"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.EditAttribute,WebInspector.UIString("Edit attribute"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.HideElement,WebInspector.UIString("Hide element"));elementsSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.ToggleEditAsHTML,WebInspector.UIString("Toggle edit as HTML"));var stylesPaneSection=WebInspector.shortcutsScreen.section(WebInspector.UIString("Styles Pane"));var nextPreviousProperty=WebInspector.ShortcutsScreen.ElementsPanelShortcuts.NextProperty.concat(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.PreviousProperty);stylesPaneSection.addRelatedKeys(nextPreviousProperty,WebInspector.UIString("Next/previous property"));stylesPaneSection.addRelatedKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementValue,WebInspector.UIString("Increment value"));stylesPaneSection.addRelatedKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementValue,WebInspector.UIString("Decrement value"));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy10,WebInspector.UIString("Increment by %f",10));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy10,WebInspector.UIString("Decrement by %f",10));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy100,WebInspector.UIString("Increment by %f",100));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy100,WebInspector.UIString("Decrement by %f",100));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.IncrementBy01,WebInspector.UIString("Increment by %f",0.1));stylesPaneSection.addAlternateKeys(WebInspector.ShortcutsScreen.ElementsPanelShortcuts.DecrementBy01,WebInspector.UIString("Decrement by %f",0.1));var section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Sources Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PauseContinue,WebInspector.UIString("Pause/Continue"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOver,WebInspector.UIString("Step over"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepInto,WebInspector.UIString("Step into"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.StepOut,WebInspector.UIString("Step out"));var nextAndPrevFrameKeys=WebInspector.ShortcutsScreen.SourcesPanelShortcuts.NextCallFrame.concat(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PrevCallFrame);section.addRelatedKeys(nextAndPrevFrameKeys,WebInspector.UIString("Next/previous call frame"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.EvaluateSelectionInConsole,WebInspector.UIString("Evaluate selection in console"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.AddSelectionToWatch,WebInspector.UIString("Add selection to watch"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToMember,WebInspector.UIString("Go to member"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.GoToLine,WebInspector.UIString("Go to line"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleBreakpoint,WebInspector.UIString("Toggle breakpoint"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.ToggleComment,WebInspector.UIString("Toggle comment"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.CloseEditorTab,WebInspector.UIString("Close editor tab"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByOne,WebInspector.UIString("Increment CSS unit by 1"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByOne,WebInspector.UIString("Decrement CSS unit by 1"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.IncreaseCSSUnitByTen,WebInspector.UIString("Increment CSS unit by 10"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.DecreaseCSSUnitByTen,WebInspector.UIString("Decrement CSS unit by 10"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToPreviousLocation,WebInspector.UIString("Jump to previous editing location"));section.addAlternateKeys(WebInspector.ShortcutsScreen.SourcesPanelShortcuts.JumpToNextLocation,WebInspector.UIString("Jump to next editing location"));section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Timeline Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.StartStopRecording,WebInspector.UIString("Start/stop recording"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.SaveToFile,WebInspector.UIString("Save timeline data"));section.addAlternateKeys(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.LoadFromFile,WebInspector.UIString("Load timeline data"));section=WebInspector.shortcutsScreen.section(WebInspector.UIString("Profiles Panel"));section.addAlternateKeys(WebInspector.ShortcutsScreen.ProfilesPanelShortcuts.StartStopRecording,WebInspector.UIString("Start/stop recording"));}
7906 WebInspector.ShortcutsScreen.ElementsPanelShortcuts={NavigateUp:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)],NavigateDown:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)],Expand:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Right)],Collapse:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Left)],EditAttribute:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter)],HideElement:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.H)],ToggleEditAsHTML:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F2)],NextProperty:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab)],PreviousProperty:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Tab,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementValue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up)],DecrementValue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down)],IncrementBy10:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up,WebInspector.KeyboardShortcut.Modifiers.Shift)],DecrementBy10:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementBy100:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Shift)],DecrementBy100:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Shift)],IncrementBy01:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecrementBy01:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Alt)]};WebInspector.ShortcutsScreen.SourcesPanelShortcuts={IncreaseCSSUnitByOne:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Up,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecreaseCSSUnitByOne:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Down,WebInspector.KeyboardShortcut.Modifiers.Alt)],IncreaseCSSUnitByTen:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageUp,WebInspector.KeyboardShortcut.Modifiers.Alt)],DecreaseCSSUnitByTen:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.PageDown,WebInspector.KeyboardShortcut.Modifiers.Alt)],RunSnippet:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],PauseContinue:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Backslash,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepOver:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepInto:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],StepOut:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11,WebInspector.KeyboardShortcut.Modifiers.Shift),WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon,WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],EvaluateSelectionInConsole:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.Ctrl)],AddSelectionToWatch:[WebInspector.KeyboardShortcut.makeDescriptor("a",WebInspector.KeyboardShortcut.Modifiers.Shift|WebInspector.KeyboardShortcut.Modifiers.Ctrl)],GoToMember:[WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift)],GoToLine:[WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Ctrl)],ToggleBreakpoint:[WebInspector.KeyboardShortcut.makeDescriptor("b",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],NextCallFrame:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period,WebInspector.KeyboardShortcut.Modifiers.Ctrl)],PrevCallFrame:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma,WebInspector.KeyboardShortcut.Modifiers.Ctrl)],ToggleComment:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash,WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],JumpToPreviousLocation:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Minus,WebInspector.KeyboardShortcut.Modifiers.Alt)],JumpToNextLocation:[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Plus,WebInspector.KeyboardShortcut.Modifiers.Alt)],CloseEditorTab:[WebInspector.KeyboardShortcut.makeDescriptor("w",WebInspector.KeyboardShortcut.Modifiers.Alt)],Save:[WebInspector.KeyboardShortcut.makeDescriptor("s",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],};WebInspector.ShortcutsScreen.TimelinePanelShortcuts={StartStopRecording:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],SaveToFile:[WebInspector.KeyboardShortcut.makeDescriptor("s",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)],LoadFromFile:[WebInspector.KeyboardShortcut.makeDescriptor("o",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]};WebInspector.ShortcutsScreen.ProfilesPanelShortcuts={StartStopRecording:[WebInspector.KeyboardShortcut.makeDescriptor("e",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)]}
7907 WebInspector.HAREntry=function(request)
7908 {this._request=request;}
7909 WebInspector.HAREntry.prototype={build:function()
7910 {var entry={startedDateTime:new Date(this._request.startTime*1000),time:this._request.timing?WebInspector.HAREntry._toMilliseconds(this._request.duration):0,request:this._buildRequest(),response:this._buildResponse(),cache:{},timings:this._buildTimings()};if(this._request.connectionId)
7911 entry.connection=String(this._request.connectionId);var page=WebInspector.networkLog.pageLoadForRequest(this._request);if(page)
7912 entry.pageref="page_"+page.id;return entry;},_buildRequest:function()
7913 {var headersText=this._request.requestHeadersText();var res={method:this._request.requestMethod,url:this._buildRequestURL(this._request.url),httpVersion:this._request.requestHttpVersion(),headers:this._request.requestHeaders(),queryString:this._buildParameters(this._request.queryParameters||[]),cookies:this._buildCookies(this._request.requestCookies||[]),headersSize:headersText?headersText.length:-1,bodySize:this.requestBodySize};if(this._request.requestFormData)
7914 res.postData=this._buildPostData();return res;},_buildResponse:function()
7915 {var headersText=this._request.responseHeadersText;return{status:this._request.statusCode,statusText:this._request.statusText,httpVersion:this._request.responseHttpVersion,headers:this._request.responseHeaders,cookies:this._buildCookies(this._request.responseCookies||[]),content:this._buildContent(),redirectURL:this._request.responseHeaderValue("Location")||"",headersSize:headersText?headersText.length:-1,bodySize:this.responseBodySize,_error:this._request.localizedFailDescription};},_buildContent:function()
7916 {var content={size:this._request.resourceSize,mimeType:this._request.mimeType||"x-unknown",};var compression=this.responseCompression;if(typeof compression==="number")
7917 content.compression=compression;return content;},_buildTimings:function()
7918 {var timing=this._request.timing;if(!timing)
7919 return{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1};function firstNonNegative(values)
7920 {for(var i=0;i<values.length;++i){if(values[i]>=0)
7921 return values[i];}
7922 console.assert(false,"Incomplete requet timing information.");}
7923 var blocked=firstNonNegative([timing.dnsStart,timing.connectStart,timing.sendStart]);var dns=-1;if(timing.dnsStart>=0)
7924 dns=firstNonNegative([timing.connectStart,timing.sendStart])-timing.dnsStart;var connect=-1;if(timing.connectStart>=0)
7925 connect=timing.sendStart-timing.connectStart;var send=timing.sendEnd-timing.sendStart;var wait=timing.receiveHeadersEnd-timing.sendEnd;var receive=WebInspector.HAREntry._toMilliseconds(this._request.duration)-timing.receiveHeadersEnd;var ssl=-1;if(timing.sslStart>=0&&timing.sslEnd>=0)
7926 ssl=timing.sslEnd-timing.sslStart;return{blocked:blocked,dns:dns,connect:connect,send:send,wait:wait,receive:receive,ssl:ssl};},_buildPostData:function()
7927 {var res={mimeType:this._request.requestContentType(),text:this._request.requestFormData};if(this._request.formParameters)
7928 res.params=this._buildParameters(this._request.formParameters);return res;},_buildParameters:function(parameters)
7929 {return parameters.slice();},_buildRequestURL:function(url)
7930 {return url.split("#",2)[0];},_buildCookies:function(cookies)
7931 {return cookies.map(this._buildCookie.bind(this));},_buildCookie:function(cookie)
7932 {return{name:cookie.name(),value:cookie.value(),path:cookie.path(),domain:cookie.domain(),expires:cookie.expiresDate(new Date(this._request.startTime*1000)),httpOnly:cookie.httpOnly(),secure:cookie.secure()};},get requestBodySize()
7933 {return!this._request.requestFormData?0:this._request.requestFormData.length;},get responseBodySize()
7934 {if(this._request.cached||this._request.statusCode===304)
7935 return 0;if(!this._request.responseHeadersText)
7936 return-1;return this._request.transferSize-this._request.responseHeadersText.length;},get responseCompression()
7937 {if(this._request.cached||this._request.statusCode===304||this._request.statusCode===206)
7938 return;if(!this._request.responseHeadersText)
7939 return;return this._request.resourceSize-this.responseBodySize;}}
7940 WebInspector.HAREntry._toMilliseconds=function(time)
7941 {return time===-1?-1:time*1000;}
7942 WebInspector.HARLog=function(requests)
7943 {this._requests=requests;}
7944 WebInspector.HARLog.prototype={build:function()
7945 {return{version:"1.2",creator:this._creator(),pages:this._buildPages(),entries:this._requests.map(this._convertResource.bind(this))}},_creator:function()
7946 {var webKitVersion=/AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);return{name:"WebInspector",version:webKitVersion?webKitVersion[1]:"n/a"};},_buildPages:function()
7947 {var seenIdentifiers={};var pages=[];for(var i=0;i<this._requests.length;++i){var page=WebInspector.networkLog.pageLoadForRequest(this._requests[i]);if(!page||seenIdentifiers[page.id])
7948 continue;seenIdentifiers[page.id]=true;pages.push(this._convertPage(page));}
7949 return pages;},_convertPage:function(page)
7950 {return{startedDateTime:new Date(page.startTime*1000),id:"page_"+page.id,title:page.url,pageTimings:{onContentLoad:this._pageEventTime(page,page.contentLoadTime),onLoad:this._pageEventTime(page,page.loadTime)}}},_convertResource:function(request)
7951 {return(new WebInspector.HAREntry(request)).build();},_pageEventTime:function(page,time)
7952 {var startTime=page.startTime;if(time===-1||startTime===-1)
7953 return-1;return WebInspector.HAREntry._toMilliseconds(time-startTime);}}
7954 WebInspector.HARWriter=function()
7955 {}
7956 WebInspector.HARWriter.prototype={write:function(stream,requests,progress)
7957 {this._stream=stream;this._harLog=(new WebInspector.HARLog(requests)).build();this._pendingRequests=1;var entries=this._harLog.entries;for(var i=0;i<entries.length;++i){var content=requests[i].content;if(typeof content==="undefined"&&requests[i].finished){++this._pendingRequests;requests[i].requestContent(this._onContentAvailable.bind(this,entries[i]));}else if(content!==null)
7958 entries[i].response.content.text=content;}
7959 var compositeProgress=new WebInspector.CompositeProgress(progress);this._writeProgress=compositeProgress.createSubProgress();if(--this._pendingRequests){this._requestsProgress=compositeProgress.createSubProgress();this._requestsProgress.setTitle(WebInspector.UIString("Collecting content…"));this._requestsProgress.setTotalWork(this._pendingRequests);}else
7960 this._beginWrite();},_onContentAvailable:function(entry,content)
7961 {if(content!==null)
7962 entry.response.content.text=content;if(this._requestsProgress)
7963 this._requestsProgress.worked();if(!--this._pendingRequests){this._requestsProgress.done();this._beginWrite();}},_beginWrite:function()
7964 {const jsonIndent=2;this._text=JSON.stringify({log:this._harLog},null,jsonIndent);this._writeProgress.setTitle(WebInspector.UIString("Writing file…"));this._writeProgress.setTotalWork(this._text.length);this._bytesWritten=0;this._writeNextChunk(this._stream);},_writeNextChunk:function(stream,error)
7965 {if(this._bytesWritten>=this._text.length||error){stream.close();this._writeProgress.done();return;}
7966 const chunkSize=100000;var text=this._text.substring(this._bytesWritten,this._bytesWritten+chunkSize);this._bytesWritten+=text.length;stream.write(text,this._writeNextChunk.bind(this));this._writeProgress.setWorked(this._bytesWritten);}}
7967 WebInspector.CookieParser=function()
7968 {}
7969 WebInspector.CookieParser.KeyValue=function(key,value,position)
7970 {this.key=key;this.value=value;this.position=position;}
7971 WebInspector.CookieParser.prototype={cookies:function()
7972 {return this._cookies;},parseCookie:function(cookieHeader)
7973 {if(!this._initialize(cookieHeader))
7974 return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(kv.key.charAt(0)==="$"&&this._lastCookie)
7975 this._lastCookie.addAttribute(kv.key.slice(1),kv.value);else if(kv.key.toLowerCase()!=="$version"&&typeof kv.value==="string")
7976 this._addCookie(kv,WebInspector.Cookie.Type.Request);this._advanceAndCheckCookieDelimiter();}
7977 this._flushCookie();return this._cookies;},parseSetCookie:function(setCookieHeader)
7978 {if(!this._initialize(setCookieHeader))
7979 return null;for(var kv=this._extractKeyValue();kv;kv=this._extractKeyValue()){if(this._lastCookie)
7980 this._lastCookie.addAttribute(kv.key,kv.value);else
7981 this._addCookie(kv,WebInspector.Cookie.Type.Response);if(this._advanceAndCheckCookieDelimiter())
7982 this._flushCookie();}
7983 this._flushCookie();return this._cookies;},_initialize:function(headerValue)
7984 {this._input=headerValue;if(typeof headerValue!=="string")
7985 return false;this._cookies=[];this._lastCookie=null;this._originalInputLength=this._input.length;return true;},_flushCookie:function()
7986 {if(this._lastCookie)
7987 this._lastCookie.setSize(this._originalInputLength-this._input.length-this._lastCookiePosition);this._lastCookie=null;},_extractKeyValue:function()
7988 {if(!this._input||!this._input.length)
7989 return null;var keyValueMatch=/^[ \t]*([^\s=;]+)[ \t]*(?:=[ \t]*([^;\n]*))?/.exec(this._input);if(!keyValueMatch){console.log("Failed parsing cookie header before: "+this._input);return null;}
7990 var result=new WebInspector.CookieParser.KeyValue(keyValueMatch[1],keyValueMatch[2]&&keyValueMatch[2].trim(),this._originalInputLength-this._input.length);this._input=this._input.slice(keyValueMatch[0].length);return result;},_advanceAndCheckCookieDelimiter:function()
7991 {var match=/^\s*[\n;]\s*/.exec(this._input);if(!match)
7992 return false;this._input=this._input.slice(match[0].length);return match[0].match("\n")!==null;},_addCookie:function(keyValue,type)
7993 {if(this._lastCookie)
7994 this._lastCookie.setSize(keyValue.position-this._lastCookiePosition);this._lastCookie=typeof keyValue.value==="string"?new WebInspector.Cookie(keyValue.key,keyValue.value,type):new WebInspector.Cookie("",keyValue.key,type);this._lastCookiePosition=keyValue.position;this._cookies.push(this._lastCookie);}};WebInspector.CookieParser.parseCookie=function(header)
7995 {return(new WebInspector.CookieParser()).parseCookie(header);}
7996 WebInspector.CookieParser.parseSetCookie=function(header)
7997 {return(new WebInspector.CookieParser()).parseSetCookie(header);}
7998 WebInspector.Cookie=function(name,value,type)
7999 {this._name=name;this._value=value;this._type=type;this._attributes={};}
8000 WebInspector.Cookie.prototype={name:function()
8001 {return this._name;},value:function()
8002 {return this._value;},type:function()
8003 {return this._type;},httpOnly:function()
8004 {return"httponly"in this._attributes;},secure:function()
8005 {return"secure"in this._attributes;},session:function()
8006 {return!("expires"in this._attributes||"max-age"in this._attributes);},path:function()
8007 {return this._attributes["path"];},port:function()
8008 {return this._attributes["port"];},domain:function()
8009 {return this._attributes["domain"];},expires:function()
8010 {return this._attributes["expires"];},maxAge:function()
8011 {return this._attributes["max-age"];},size:function()
8012 {return this._size;},setSize:function(size)
8013 {this._size=size;},expiresDate:function(requestDate)
8014 {if(this.maxAge()){var targetDate=requestDate===null?new Date():requestDate;return new Date(targetDate.getTime()+1000*this.maxAge());}
8015 if(this.expires())
8016 return new Date(this.expires());return null;},attributes:function()
8017 {return this._attributes;},addAttribute:function(key,value)
8018 {this._attributes[key.toLowerCase()]=value;},remove:function(callback)
8019 {PageAgent.deleteCookie(this.name(),(this.secure()?"https://":"http://")+this.domain()+this.path(),callback);}}
8020 WebInspector.Cookie.Type={Request:0,Response:1};WebInspector.Cookies={}
8021 WebInspector.Cookies.getCookiesAsync=function(callback)
8022 {function mycallback(error,cookies)
8023 {if(error)
8024 return;callback(cookies.map(WebInspector.Cookies.buildCookieProtocolObject));}
8025 PageAgent.getCookies(mycallback);}
8026 WebInspector.Cookies.buildCookieProtocolObject=function(protocolCookie)
8027 {var cookie=new WebInspector.Cookie(protocolCookie.name,protocolCookie.value,null);cookie.addAttribute("domain",protocolCookie["domain"]);cookie.addAttribute("path",protocolCookie["path"]);cookie.addAttribute("port",protocolCookie["port"]);if(protocolCookie["expires"])
8028 cookie.addAttribute("expires",protocolCookie["expires"]);if(protocolCookie["httpOnly"])
8029 cookie.addAttribute("httpOnly");if(protocolCookie["secure"])
8030 cookie.addAttribute("secure");cookie.setSize(protocolCookie["size"]);return cookie;}
8031 WebInspector.Cookies.cookieMatchesResourceURL=function(cookie,resourceURL)
8032 {var url=resourceURL.asParsedURL();if(!url||!WebInspector.Cookies.cookieDomainMatchesResourceDomain(cookie.domain(),url.host))
8033 return false;return(url.path.startsWith(cookie.path())&&(!cookie.port()||url.port==cookie.port())&&(!cookie.secure()||url.scheme==="https"));}
8034 WebInspector.Cookies.cookieDomainMatchesResourceDomain=function(cookieDomain,resourceDomain)
8035 {if(cookieDomain.charAt(0)!=='.')
8036 return resourceDomain===cookieDomain;return!!resourceDomain.match(new RegExp("^([^\\.]+\\.)*"+cookieDomain.substring(1).escapeForRegExp()+"$","i"));}
8037 WebInspector.SearchableView=function(searchable)
8038 {WebInspector.VBox.call(this);this._searchProvider=searchable;this.element.addEventListener("keydown",this._onKeyDown.bind(this),false);this._footerElementContainer=this.element.createChild("div","search-bar status-bar hidden");this._footerElementContainer.style.order=100;this._footerElement=this._footerElementContainer.createChild("table","toolbar-search");this._footerElement.cellSpacing=0;this._firstRowElement=this._footerElement.createChild("tr");this._secondRowElement=this._footerElement.createChild("tr","hidden");var searchControlElementColumn=this._firstRowElement.createChild("td");this._searchControlElement=searchControlElementColumn.createChild("span","toolbar-search-control");this._searchInputElement=this._searchControlElement.createChild("input","search-replace");this._searchInputElement.id="search-input-field";this._searchInputElement.placeholder=WebInspector.UIString("Find");this._matchesElement=this._searchControlElement.createChild("label","search-results-matches");this._matchesElement.setAttribute("for","search-input-field");this._searchNavigationElement=this._searchControlElement.createChild("div","toolbar-search-navigation-controls");this._searchNavigationPrevElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-prev");this._searchNavigationPrevElement.addEventListener("click",this._onPrevButtonSearch.bind(this),false);this._searchNavigationPrevElement.title=WebInspector.UIString("Search Previous");this._searchNavigationNextElement=this._searchNavigationElement.createChild("div","toolbar-search-navigation toolbar-search-navigation-next");this._searchNavigationNextElement.addEventListener("click",this._onNextButtonSearch.bind(this),false);this._searchNavigationNextElement.title=WebInspector.UIString("Search Next");this._searchInputElement.addEventListener("mousedown",this._onSearchFieldManualFocus.bind(this),false);this._searchInputElement.addEventListener("keydown",this._onSearchKeyDown.bind(this),true);this._searchInputElement.addEventListener("input",this._onInput.bind(this),false);this._replaceInputElement=this._secondRowElement.createChild("td").createChild("input","search-replace toolbar-replace-control");this._replaceInputElement.addEventListener("keydown",this._onReplaceKeyDown.bind(this),true);this._replaceInputElement.placeholder=WebInspector.UIString("Replace");this._findButtonElement=this._firstRowElement.createChild("td").createChild("button","hidden");this._findButtonElement.textContent=WebInspector.UIString("Find");this._findButtonElement.tabIndex=-1;this._findButtonElement.addEventListener("click",this._onNextButtonSearch.bind(this),false);this._replaceButtonElement=this._secondRowElement.createChild("td").createChild("button");this._replaceButtonElement.textContent=WebInspector.UIString("Replace");this._replaceButtonElement.disabled=true;this._replaceButtonElement.tabIndex=-1;this._replaceButtonElement.addEventListener("click",this._replace.bind(this),false);this._prevButtonElement=this._firstRowElement.createChild("td").createChild("button","hidden");this._prevButtonElement.textContent=WebInspector.UIString("Previous");this._prevButtonElement.disabled=true;this._prevButtonElement.tabIndex=-1;this._prevButtonElement.addEventListener("click",this._onPrevButtonSearch.bind(this),false);this._replaceAllButtonElement=this._secondRowElement.createChild("td").createChild("button");this._replaceAllButtonElement.textContent=WebInspector.UIString("Replace All");this._replaceAllButtonElement.addEventListener("click",this._replaceAll.bind(this),false);this._replaceElement=this._firstRowElement.createChild("td").createChild("span");this._replaceCheckboxElement=this._replaceElement.createChild("input");this._replaceCheckboxElement.type="checkbox";this._replaceCheckboxElement.id="search-replace-trigger";this._replaceCheckboxElement.addEventListener("change",this._updateSecondRowVisibility.bind(this),false);this._replaceLabelElement=this._replaceElement.createChild("label");this._replaceLabelElement.textContent=WebInspector.UIString("Replace");this._replaceLabelElement.setAttribute("for","search-replace-trigger");var cancelButtonElement=this._firstRowElement.createChild("td").createChild("button");cancelButtonElement.textContent=WebInspector.UIString("Cancel");cancelButtonElement.tabIndex=-1;cancelButtonElement.addEventListener("click",this.closeSearch.bind(this),false);this._minimalSearchQuerySize=3;this._registerShortcuts();}
8039 WebInspector.SearchableView.findShortcuts=function()
8040 {if(WebInspector.SearchableView._findShortcuts)
8041 return WebInspector.SearchableView._findShortcuts;WebInspector.SearchableView._findShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor("f",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)];if(!WebInspector.isMac())
8042 WebInspector.SearchableView._findShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F3));return WebInspector.SearchableView._findShortcuts;}
8043 WebInspector.SearchableView.cancelSearchShortcuts=function()
8044 {if(WebInspector.SearchableView._cancelSearchShortcuts)
8045 return WebInspector.SearchableView._cancelSearchShortcuts;WebInspector.SearchableView._cancelSearchShortcuts=[WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Esc)];return WebInspector.SearchableView._cancelSearchShortcuts;}
8046 WebInspector.SearchableView.findNextShortcut=function()
8047 {if(WebInspector.SearchableView._findNextShortcut)
8048 return WebInspector.SearchableView._findNextShortcut;WebInspector.SearchableView._findNextShortcut=[];if(WebInspector.isMac())
8049 WebInspector.SearchableView._findNextShortcut.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Meta));return WebInspector.SearchableView._findNextShortcut;}
8050 WebInspector.SearchableView.findPreviousShortcuts=function()
8051 {if(WebInspector.SearchableView._findPreviousShortcuts)
8052 return WebInspector.SearchableView._findPreviousShortcuts;WebInspector.SearchableView._findPreviousShortcuts=[];if(WebInspector.isMac())
8053 WebInspector.SearchableView._findPreviousShortcuts.push(WebInspector.KeyboardShortcut.makeDescriptor("g",WebInspector.KeyboardShortcut.Modifiers.Meta|WebInspector.KeyboardShortcut.Modifiers.Shift));return WebInspector.SearchableView._findPreviousShortcuts;}
8054 WebInspector.SearchableView.prototype={_onKeyDown:function(event)
8055 {var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event))
8056 event.consume(true);},_registerShortcuts:function()
8057 {this._shortcuts={};function register(shortcuts,handler)
8058 {for(var i=0;i<shortcuts.length;++i)
8059 this._shortcuts[shortcuts[i].key]=handler;}
8060 register.call(this,WebInspector.SearchableView.findShortcuts(),this.handleFindShortcut.bind(this));register.call(this,WebInspector.SearchableView.cancelSearchShortcuts(),this.handleCancelSearchShortcut.bind(this));register.call(this,WebInspector.SearchableView.findNextShortcut(),this.handleFindNextShortcut.bind(this));register.call(this,WebInspector.SearchableView.findPreviousShortcuts(),this.handleFindPreviousShortcut.bind(this));},setMinimalSearchQuerySize:function(minimalSearchQuerySize)
8061 {this._minimalSearchQuerySize=minimalSearchQuerySize;},setReplaceable:function(replaceable)
8062 {this._replaceable=replaceable;},updateSearchMatchesCount:function(matches)
8063 {this._searchProvider.currentSearchMatches=matches;this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentQuery?matches:0,-1);},updateCurrentMatchIndex:function(currentMatchIndex)
8064 {this._updateSearchMatchesCountAndCurrentMatchIndex(this._searchProvider.currentSearchMatches,currentMatchIndex);},isSearchVisible:function()
8065 {return this._searchIsVisible;},closeSearch:function()
8066 {this.cancelSearch();if(WebInspector.currentFocusElement().isDescendant(this._footerElementContainer))
8067 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement());},_toggleSearchBar:function(toggled)
8068 {this._footerElementContainer.classList.toggle("hidden",!toggled);this.doResize();},cancelSearch:function()
8069 {if(!this._searchIsVisible)
8070 return;this.resetSearch();delete this._searchIsVisible;this._toggleSearchBar(false);},resetSearch:function()
8071 {this._clearSearch();this._updateReplaceVisibility();this._matchesElement.textContent="";},handleFindNextShortcut:function()
8072 {if(!this._searchIsVisible)
8073 return false;this._searchProvider.jumpToNextSearchResult();return true;},handleFindPreviousShortcut:function()
8074 {if(!this._searchIsVisible)
8075 return false;this._searchProvider.jumpToPreviousSearchResult();return true;},handleFindShortcut:function()
8076 {this.showSearchField();return true;},handleCancelSearchShortcut:function()
8077 {if(!this._searchIsVisible)
8078 return false;this.closeSearch();return true;},_updateSearchNavigationButtonState:function(enabled)
8079 {this._replaceButtonElement.disabled=!enabled;this._prevButtonElement.disabled=!enabled;if(enabled){this._searchNavigationPrevElement.classList.add("enabled");this._searchNavigationNextElement.classList.add("enabled");}else{this._searchNavigationPrevElement.classList.remove("enabled");this._searchNavigationNextElement.classList.remove("enabled");}},_updateSearchMatchesCountAndCurrentMatchIndex:function(matches,currentMatchIndex)
8080 {if(!this._currentQuery)
8081 this._matchesElement.textContent="";else if(matches===0||currentMatchIndex>=0)
8082 this._matchesElement.textContent=WebInspector.UIString("%d of %d",currentMatchIndex+1,matches);else if(matches===1)
8083 this._matchesElement.textContent=WebInspector.UIString("1 match");else
8084 this._matchesElement.textContent=WebInspector.UIString("%d matches",matches);this._updateSearchNavigationButtonState(matches>0);},showSearchField:function()
8085 {if(this._searchIsVisible)
8086 this.cancelSearch();this._toggleSearchBar(true);this._updateReplaceVisibility();if(WebInspector.currentFocusElement()!==this._searchInputElement){var selection=window.getSelection();if(selection.rangeCount){var queryCandidate=selection.toString().replace(/\r?\n.*/,"");if(queryCandidate)
8087 this._searchInputElement.value=queryCandidate;}}
8088 this._performSearch(false,false);this._searchInputElement.focus();this._searchInputElement.select();this._searchIsVisible=true;},_updateReplaceVisibility:function()
8089 {this._replaceElement.classList.toggle("hidden",!this._replaceable);if(!this._replaceable){this._replaceCheckboxElement.checked=false;this._updateSecondRowVisibility();}},_onSearchFieldManualFocus:function(event)
8090 {WebInspector.setCurrentFocusElement(event.target);},_onSearchKeyDown:function(event)
8091 {if(isEnterKey(event)){if(!this._currentQuery)
8092 this._performSearch(true,true);else
8093 this._jumpToNextSearchResult(event.shiftKey);}},_onReplaceKeyDown:function(event)
8094 {if(isEnterKey(event))
8095 this._replace();},_jumpToNextSearchResult:function(isBackwardSearch)
8096 {if(!this._currentQuery||!this._searchNavigationPrevElement.classList.contains("enabled"))
8097 return;if(isBackwardSearch)
8098 this._searchProvider.jumpToPreviousSearchResult();else
8099 this._searchProvider.jumpToNextSearchResult();},_onNextButtonSearch:function(event)
8100 {if(!this._searchNavigationNextElement.classList.contains("enabled"))
8101 return;this._jumpToNextSearchResult();this._searchInputElement.focus();},_onPrevButtonSearch:function(event)
8102 {if(!this._searchNavigationPrevElement.classList.contains("enabled"))
8103 return;this._jumpToNextSearchResult(true);this._searchInputElement.focus();},_clearSearch:function()
8104 {delete this._currentQuery;if(!!this._searchProvider.currentQuery){delete this._searchProvider.currentQuery;this._searchProvider.searchCanceled();}
8105 this._updateSearchMatchesCountAndCurrentMatchIndex(0,-1);},_performSearch:function(forceSearch,shouldJump)
8106 {var query=this._searchInputElement.value;if(!query||(!forceSearch&&query.length<this._minimalSearchQuerySize&&!this._currentQuery)){this._clearSearch();return;}
8107 this._currentQuery=query;this._searchProvider.currentQuery=query;this._searchProvider.performSearch(query,shouldJump);},_updateSecondRowVisibility:function()
8108 {var secondRowVisible=this._replaceCheckboxElement.checked;this._footerElementContainer.classList.toggle("replaceable",secondRowVisible);this._footerElement.classList.toggle("toolbar-search-replace",secondRowVisible);this._secondRowElement.classList.toggle("hidden",!secondRowVisible);this._prevButtonElement.classList.toggle("hidden",!secondRowVisible);this._findButtonElement.classList.toggle("hidden",!secondRowVisible);this._replaceCheckboxElement.tabIndex=secondRowVisible?-1:0;if(secondRowVisible)
8109 this._replaceInputElement.focus();else
8110 this._searchInputElement.focus();this.doResize();},_replace:function()
8111 {(this._searchProvider).replaceSelectionWith(this._replaceInputElement.value);delete this._currentQuery;this._performSearch(true,true);},_replaceAll:function()
8112 {(this._searchProvider).replaceAllWith(this._searchInputElement.value,this._replaceInputElement.value);},_onInput:function(event)
8113 {this._onValueChanged();},_onValueChanged:function()
8114 {this._performSearch(false,true);},__proto__:WebInspector.VBox.prototype}
8115 WebInspector.Searchable=function()
8116 {}
8117 WebInspector.Searchable.prototype={searchCanceled:function(){},performSearch:function(query,shouldJump){},jumpToNextSearchResult:function(){},jumpToPreviousSearchResult:function(){}}
8118 WebInspector.Replaceable=function()
8119 {}
8120 WebInspector.Replaceable.prototype={replaceSelectionWith:function(text){},replaceAllWith:function(query,replacement){}}
8121 WebInspector.FilterBar=function()
8122 {this._filtersShown=false;this._element=document.createElement("div");this._element.className="hbox";this._filterButton=new WebInspector.StatusBarButton(WebInspector.UIString("Filter"),"filters-toggle",3);this._filterButton.element.addEventListener("click",this._handleFilterButtonClick.bind(this),false);this._filters=[];}
8123 WebInspector.FilterBar.Events={FiltersToggled:"FiltersToggled"}
8124 WebInspector.FilterBar.FilterBarState={Inactive:"inactive",Active:"active",Shown:"shown"};WebInspector.FilterBar.prototype={setName:function(name)
8125 {this._stateSetting=WebInspector.settings.createSetting("filterBar-"+name+"-toggled",false);this._setState(this._stateSetting.get());},filterButton:function()
8126 {return this._filterButton;},filtersElement:function()
8127 {return this._element;},filtersToggled:function()
8128 {return this._filtersShown;},addFilter:function(filter)
8129 {this._filters.push(filter);this._element.appendChild(filter.element());filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged,this);this._updateFilterButton();},_filterChanged:function(event)
8130 {this._updateFilterButton();},_filterBarState:function()
8131 {if(this._filtersShown)
8132 return WebInspector.FilterBar.FilterBarState.Shown;var isActive=false;for(var i=0;i<this._filters.length;++i){if(this._filters[i].isActive())
8133 return WebInspector.FilterBar.FilterBarState.Active;}
8134 return WebInspector.FilterBar.FilterBarState.Inactive;},_updateFilterButton:function()
8135 {this._filterButton.state=this._filterBarState();},_handleFilterButtonClick:function(event)
8136 {this._setState(!this._filtersShown);},_setState:function(filtersShown)
8137 {if(this._filtersShown===filtersShown)
8138 return;this._filtersShown=filtersShown;if(this._stateSetting)
8139 this._stateSetting.set(filtersShown);this._updateFilterButton();this.dispatchEventToListeners(WebInspector.FilterBar.Events.FiltersToggled,this._filtersShown);if(this._filtersShown){for(var i=0;i<this._filters.length;++i){if(this._filters[i]instanceof WebInspector.TextFilterUI){var textFilterUI=(this._filters[i]);textFilterUI.focus();}}}},clear:function()
8140 {this._element.removeChildren();this._filters=[];this._updateFilterButton();},__proto__:WebInspector.Object.prototype}
8141 WebInspector.FilterUI=function()
8142 {}
8143 WebInspector.FilterUI.Events={FilterChanged:"FilterChanged"}
8144 WebInspector.FilterUI.prototype={isActive:function(){},element:function(){}}
8145 WebInspector.TextFilterUI=function(supportRegex)
8146 {this._supportRegex=!!supportRegex;this._regex=null;this._filterElement=document.createElement("div");this._filterElement.className="filter-text-filter";this._filterInputElement=this._filterElement.createChild("input","search-replace toolbar-replace-control");this._filterInputElement.placeholder=WebInspector.UIString("Filter");this._filterInputElement.id="filter-input-field";this._filterInputElement.addEventListener("mousedown",this._onFilterFieldManualFocus.bind(this),false);this._filterInputElement.addEventListener("input",this._onInput.bind(this),false);this._filterInputElement.addEventListener("change",this._onChange.bind(this),false);this._filterInputElement.addEventListener("keydown",this._onInputKeyDown.bind(this),true);this._filterInputElement.addEventListener("blur",this._onBlur.bind(this),true);this._suggestionBuilder=null;this._suggestBox=new WebInspector.SuggestBox(this,this._filterElement);if(this._supportRegex){this._filterElement.classList.add("supports-regex");this._regexCheckBox=this._filterElement.createChild("input");this._regexCheckBox.type="checkbox";this._regexCheckBox.id="text-filter-regex";this._regexCheckBox.addEventListener("change",this._onInput.bind(this),false);this._regexLabel=this._filterElement.createChild("label");this._regexLabel.htmlFor="text-filter-regex";this._regexLabel.textContent=WebInspector.UIString("Regex");}}
8147 WebInspector.TextFilterUI.prototype={isActive:function()
8148 {return!!this._filterInputElement.value;},element:function()
8149 {return this._filterElement;},value:function()
8150 {return this._filterInputElement.value;},setValue:function(value)
8151 {this._filterInputElement.value=value;this._valueChanged(false);},regex:function()
8152 {return this._regex;},_onFilterFieldManualFocus:function(event)
8153 {WebInspector.setCurrentFocusElement(event.target);},_onBlur:function(event)
8154 {this._cancelSuggestion();},_cancelSuggestion:function()
8155 {if(this._suggestionBuilder&&this._suggestBox.visible){this._suggestionBuilder.unapplySuggestion(this._filterInputElement);this._suggestBox.hide();}},_onInput:function(event)
8156 {this._valueChanged(true);},_onChange:function(event)
8157 {this._valueChanged(false);},focus:function()
8158 {this._filterInputElement.focus();},setSuggestionBuilder:function(suggestionBuilder)
8159 {this._cancelSuggestion();this._suggestionBuilder=suggestionBuilder;},_updateSuggestions:function()
8160 {if(!this._suggestionBuilder)
8161 return;var suggestions=this._suggestionBuilder.buildSuggestions(this._filterInputElement);if(suggestions&&suggestions.length){if(this._suppressSuggestion)
8162 delete this._suppressSuggestion;else
8163 this._suggestionBuilder.applySuggestion(this._filterInputElement,suggestions[0],true);this._suggestBox.updateSuggestions(null,suggestions,0,true,"");}else{this._suggestBox.hide();}},_valueChanged:function(showSuggestions)
8164 {if(showSuggestions)
8165 this._updateSuggestions();else
8166 this._suggestBox.hide();var filterQuery=this.value();this._regex=null;this._filterInputElement.classList.remove("filter-text-invalid");if(filterQuery){if(this._supportRegex&&this._regexCheckBox.checked){try{this._regex=new RegExp(filterQuery,"i");}catch(e){this._filterInputElement.classList.add("filter-text-invalid");}}else{this._regex=createPlainTextSearchRegex(filterQuery,"i");}}
8167 this._dispatchFilterChanged();},_dispatchFilterChanged:function()
8168 {this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_onInputKeyDown:function(event)
8169 {var handled=false;if(event.keyIdentifier==="U+0008"){this._suppressSuggestion=true;}else if(this._suggestBox.visible()){if(event.keyIdentifier==="U+001B"){this._cancelSuggestion();handled=true;}else if(event.keyIdentifier==="U+0009"){this._suggestBox.acceptSuggestion();this._valueChanged(true);handled=true;}else{handled=this._suggestBox.keyPressed(event);}}
8170 if(handled)
8171 event.consume(true);return handled;},applySuggestion:function(suggestion,isIntermediateSuggestion)
8172 {if(!this._suggestionBuilder)
8173 return;this._suggestionBuilder.applySuggestion(this._filterInputElement,suggestion,!!isIntermediateSuggestion);if(isIntermediateSuggestion)
8174 this._dispatchFilterChanged();},acceptSuggestion:function()
8175 {this._filterInputElement.scrollLeft=this._filterInputElement.scrollWidth;this._valueChanged(true);},__proto__:WebInspector.Object.prototype}
8176 WebInspector.TextFilterUI.SuggestionBuilder=function()
8177 {}
8178 WebInspector.TextFilterUI.SuggestionBuilder.prototype={buildSuggestions:function(input){},applySuggestion:function(input,suggestion,isIntermediate){},unapplySuggestion:function(input){}}
8179 WebInspector.NamedBitSetFilterUI=function(items,setting)
8180 {this._filtersElement=document.createElement("div");this._filtersElement.className="filter-bitset-filter status-bar-item";this._filtersElement.title=WebInspector.UIString("Use %s Click to select multiple types.",WebInspector.KeyboardShortcut.shortcutToString("",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));this._allowedTypes={};this._typeFilterElements={};this._addBit(WebInspector.NamedBitSetFilterUI.ALL_TYPES,WebInspector.UIString("All"));this._filtersElement.createChild("div","filter-bitset-filter-divider");for(var i=0;i<items.length;++i)
8181 this._addBit(items[i].name,items[i].label);if(setting){this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();}else{this._toggleTypeFilter(WebInspector.NamedBitSetFilterUI.ALL_TYPES,false);}}
8182 WebInspector.NamedBitSetFilterUI.Item;WebInspector.NamedBitSetFilterUI.ALL_TYPES="all";WebInspector.NamedBitSetFilterUI.prototype={isActive:function()
8183 {return!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES];},element:function()
8184 {return this._filtersElement;},accept:function(typeName)
8185 {return!!this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]||!!this._allowedTypes[typeName];},_settingChanged:function()
8186 {var allowedTypes=this._setting.get();this._allowedTypes={};for(var typeName in this._typeFilterElements){if(allowedTypes[typeName])
8187 this._allowedTypes[typeName]=true;}
8188 this._update();},_update:function()
8189 {if((Object.keys(this._allowedTypes).length===0)||this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]){this._allowedTypes={};this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=true;}
8190 for(var typeName in this._typeFilterElements)
8191 this._typeFilterElements[typeName].classList.toggle("selected",this._allowedTypes[typeName]);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_addBit:function(name,label)
8192 {var typeFilterElement=this._filtersElement.createChild("li",name);typeFilterElement.typeName=name;typeFilterElement.createTextChild(label);typeFilterElement.addEventListener("click",this._onTypeFilterClicked.bind(this),false);this._typeFilterElements[name]=typeFilterElement;},_onTypeFilterClicked:function(e)
8193 {var toggle;if(WebInspector.isMac())
8194 toggle=e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey;else
8195 toggle=e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey;this._toggleTypeFilter(e.target.typeName,toggle);},_toggleTypeFilter:function(typeName,allowMultiSelect)
8196 {if(allowMultiSelect&&typeName!==WebInspector.NamedBitSetFilterUI.ALL_TYPES)
8197 this._allowedTypes[WebInspector.NamedBitSetFilterUI.ALL_TYPES]=false;else
8198 this._allowedTypes={};this._allowedTypes[typeName]=!this._allowedTypes[typeName];if(this._setting)
8199 this._setting.set(this._allowedTypes);else
8200 this._update();},__proto__:WebInspector.Object.prototype}
8201 WebInspector.ComboBoxFilterUI=function(options)
8202 {this._filterElement=document.createElement("div");this._filterElement.className="filter-combobox-filter";this._options=options;this._filterComboBox=new WebInspector.StatusBarComboBox(this._filterChanged.bind(this));for(var i=0;i<options.length;++i){var filterOption=options[i];var option=document.createElement("option");option.text=filterOption.label;option.title=filterOption.title;this._filterComboBox.addOption(option);this._filterComboBox.element.title=this._filterComboBox.selectedOption().title;}
8203 this._filterElement.appendChild(this._filterComboBox.element);}
8204 WebInspector.ComboBoxFilterUI.prototype={isActive:function()
8205 {return this._filterComboBox.selectedIndex()!==0;},element:function()
8206 {return this._filterElement;},value:function(typeName)
8207 {var option=this._options[this._filterComboBox.selectedIndex()];return option.value;},setSelectedIndex:function(index)
8208 {this._filterComboBox.setSelectedIndex(index);},selectedIndex:function(index)
8209 {return this._filterComboBox.selectedIndex();},_filterChanged:function(event)
8210 {var option=this._options[this._filterComboBox.selectedIndex()];this._filterComboBox.element.title=option.title;this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},__proto__:WebInspector.Object.prototype}
8211 WebInspector.CheckboxFilterUI=function(className,title,activeWhenChecked,setting)
8212 {this._filterElement=document.createElement("div");this._filterElement.classList.add("filter-checkbox-filter","filter-checkbox-filter-"+className);this._activeWhenChecked=!!activeWhenChecked;this._createCheckbox(title);if(setting){this._setting=setting;setting.addChangeListener(this._settingChanged.bind(this));this._settingChanged();}else{this._checked=!this._activeWhenChecked;this._update();}}
8213 WebInspector.CheckboxFilterUI.prototype={isActive:function()
8214 {return this._activeWhenChecked===this._checked;},element:function()
8215 {return this._filterElement;},checked:function()
8216 {return this._checked;},setState:function(state)
8217 {this._checked=state;this._update();},_update:function()
8218 {this._checkElement.classList.toggle("checkbox-filter-checkbox-checked",this._checked);this.dispatchEventToListeners(WebInspector.FilterUI.Events.FilterChanged,null);},_settingChanged:function()
8219 {this._checked=this._setting.get();this._update();},_onClick:function(event)
8220 {this._checked=!this._checked;if(this._setting)
8221 this._setting.set(this._checked);else
8222 this._update();},_createCheckbox:function(title)
8223 {var label=this._filterElement.createChild("label");var checkBorder=label.createChild("div","checkbox-filter-checkbox");this._checkElement=checkBorder.createChild("div","checkbox-filter-checkbox-check");this._filterElement.addEventListener("click",this._onClick.bind(this),false);var typeElement=label.createChild("span","type");typeElement.textContent=title;},__proto__:WebInspector.Object.prototype}
8224 WebInspector.FilterSuggestionBuilder=function(keys)
8225 {this._keys=keys;this._valueSets={};this._valueLists={};}
8226 WebInspector.FilterSuggestionBuilder.prototype={buildSuggestions:function(input)
8227 {var text=input.value;var end=input.selectionEnd;if(end!=text.length)
8228 return null;var start=input.selectionStart;text=text.substring(0,start);var prefixIndex=text.lastIndexOf(" ")+1;var prefix=text.substring(prefixIndex);if(!prefix)
8229 return[];var valueDelimiterIndex=prefix.indexOf(":");var suggestions=[];if(valueDelimiterIndex===-1){for(var j=0;j<this._keys.length;++j){if(this._keys[j].startsWith(prefix))
8230 suggestions.push(this._keys[j]+":");}}else{var key=prefix.substring(0,valueDelimiterIndex);var value=prefix.substring(valueDelimiterIndex+1);var items=this._values(key);for(var i=0;i<items.length;++i){if(items[i].startsWith(value)&&(items[i]!==value))
8231 suggestions.push(key+":"+items[i]);}}
8232 return suggestions;},applySuggestion:function(input,suggestion,isIntermediate)
8233 {var text=input.value;var start=input.selectionStart;text=text.substring(0,start);var prefixIndex=text.lastIndexOf(" ")+1;text=text.substring(0,prefixIndex)+suggestion;input.value=text;if(!isIntermediate)
8234 start=text.length;input.setSelectionRange(start,text.length);},unapplySuggestion:function(input)
8235 {var start=input.selectionStart;var end=input.selectionEnd;var text=input.value;if(start!==end&&end===text.length)
8236 input.value=text.substring(0,start);},_values:function(key)
8237 {var result=this._valueLists[key];if(!result)
8238 return[];result.sort();return result;},addItem:function(key,value)
8239 {if(!value)
8240 return;var set=this._valueSets[key];var list=this._valueLists[key];if(!set){set={};this._valueSets[key]=set;list=[];this._valueLists[key]=list;}
8241 if(set[value])
8242 return;set[value]=true;list.push(value);},parseQuery:function(query)
8243 {var filters={};var text=[];var i=0;var j=0;var part;while(true){var colonIndex=query.indexOf(":",i);if(colonIndex==-1){part=query.substring(j);if(part)
8244 text.push(part);break;}
8245 var spaceIndex=query.lastIndexOf(" ",colonIndex);var key=query.substring(spaceIndex+1,colonIndex);if(this._keys.indexOf(key)==-1){i=colonIndex+1;continue;}
8246 part=spaceIndex>j?query.substring(j,spaceIndex):"";if(part)
8247 text.push(part);var nextSpace=query.indexOf(" ",colonIndex+1);if(nextSpace==-1){filters[key]=query.substring(colonIndex+1);break;}
8248 filters[key]=query.substring(colonIndex+1,nextSpace);i=nextSpace+1;j=i;}
8249 return{text:text,filters:filters};}};WebInspector.InspectElementModeController=function()
8250 {this.toggleSearchButton=new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."),"node-search-status-bar-item");this.toggleSearchButton.addEventListener("click",this.toggleSearch,this);this._shortcut=WebInspector.InspectElementModeController.createShortcut();}
8251 WebInspector.InspectElementModeController.createShortcut=function()
8252 {return WebInspector.KeyboardShortcut.makeDescriptor("c",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta|WebInspector.KeyboardShortcut.Modifiers.Shift);}
8253 WebInspector.InspectElementModeController.prototype={enabled:function()
8254 {return this.toggleSearchButton.toggled;},disable:function()
8255 {if(this.enabled())
8256 this.toggleSearch();},toggleSearch:function()
8257 {var enabled=!this.enabled();function callback(error)
8258 {if(!error)
8259 this.toggleSearchButton.toggled=enabled;}
8260 WebInspector.domModel.setInspectModeEnabled(enabled,WebInspector.settings.showUAShadowDOM.get(),callback.bind(this));},handleShortcut:function(event)
8261 {if(WebInspector.KeyboardShortcut.makeKeyFromEvent(event)!==this._shortcut.key)
8262 return false;this.toggleSearch();event.consume(true);return true;}}
8263 WebInspector.inspectElementModeController;WebInspector.WorkerManager=function(target,isMainFrontend)
8264 {this._reset();target.registerWorkerDispatcher(new WebInspector.WorkerDispatcher(this));if(isMainFrontend){WorkerAgent.enable();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);}}
8265 WebInspector.WorkerManager.Events={WorkerAdded:"WorkerAdded",WorkerRemoved:"WorkerRemoved",WorkersCleared:"WorkersCleared",WorkerSelectionChanged:"WorkerSelectionChanged",WorkerDisconnected:"WorkerDisconnected",MessageFromWorker:"MessageFromWorker",}
8266 WebInspector.WorkerManager.MainThreadId=0;WebInspector.WorkerManager.prototype={_reset:function()
8267 {this._threadUrlByThreadId={};this._threadUrlByThreadId[WebInspector.WorkerManager.MainThreadId]=WebInspector.UIString("Thread: Main");this._threadsList=[WebInspector.WorkerManager.MainThreadId];this._selectedThreadId=WebInspector.WorkerManager.MainThreadId;},_workerCreated:function(workerId,url,inspectorConnected)
8268 {this._threadsList.push(workerId);this._threadUrlByThreadId[workerId]=url;this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerAdded,{workerId:workerId,url:url,inspectorConnected:inspectorConnected});},_workerTerminated:function(workerId)
8269 {this._threadsList.remove(workerId);delete this._threadUrlByThreadId[workerId];this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerRemoved,workerId);},_dispatchMessageFromWorker:function(workerId,message)
8270 {this.dispatchEventToListeners(WebInspector.WorkerManager.Events.MessageFromWorker,{workerId:workerId,message:message})},_disconnectedFromWorker:function()
8271 {this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkerDisconnected)},_mainFrameNavigated:function(event)
8272 {this._reset();this.dispatchEventToListeners(WebInspector.WorkerManager.Events.WorkersCleared);},threadsList:function()
8273 {return this._threadsList;},threadUrl:function(threadId)
8274 {return this._threadUrlByThreadId[threadId];},setSelectedThreadId:function(threadId)
8275 {this._selectedThreadId=threadId;},selectedThreadId:function()
8276 {return this._selectedThreadId;},__proto__:WebInspector.Object.prototype}
8277 WebInspector.WorkerDispatcher=function(workerManager)
8278 {this._workerManager=workerManager;}
8279 WebInspector.WorkerDispatcher.prototype={workerCreated:function(workerId,url,inspectorConnected)
8280 {this._workerManager._workerCreated(workerId,url,inspectorConnected);},workerTerminated:function(workerId)
8281 {this._workerManager._workerTerminated(workerId);},dispatchMessageFromWorker:function(workerId,message)
8282 {this._workerManager._dispatchMessageFromWorker(workerId,message);},disconnectedFromWorker:function()
8283 {this._workerManager._disconnectedFromWorker();}}
8284 WebInspector.workerManager;WebInspector.ExternalWorkerConnection=function(workerId,onConnectionReady)
8285 {InspectorBackendClass.Connection.call(this);this._workerId=workerId;window.addEventListener("message",this._processMessage.bind(this),true);onConnectionReady(this);}
8286 WebInspector.ExternalWorkerConnection.prototype={_processMessage:function(event)
8287 {if(!event)
8288 return;var message=event.data;this.dispatch(message);},sendMessage:function(messageObject)
8289 {window.opener.postMessage({workerId:this._workerId,command:"sendMessageToBackend",message:messageObject},"*");},__proto__:InspectorBackendClass.Connection.prototype}
8290 WebInspector.WorkerFrontendManager=function()
8291 {this._workerIdToWindow={};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);WebInspector.workerManager.addEventListener(WebInspector.WorkerManager.Events.MessageFromWorker,this._sendMessageToWorkerInspector,this);window.addEventListener("message",this._handleMessage.bind(this),true);}
8292 WebInspector.WorkerFrontendManager.prototype={_workerAdded:function(event)
8293 {var data=(event.data);if(data.inspectorConnected)
8294 this._openInspectorWindow(data.workerId,true);},_workerRemoved:function(event)
8295 {var data=(event.data);this.closeWorkerInspector(data.workerId);},_workersCleared:function()
8296 {for(var workerId in this._workerIdToWindow)
8297 this.closeWorkerInspector(workerId);},_handleMessage:function(event)
8298 {var data=(event.data);var workerId=data["workerId"];workerId=parseInt(workerId,10);var command=data.command;var message=data.message;if(command=="sendMessageToBackend")
8299 WorkerAgent.sendMessageToWorker(workerId,message);},_sendMessageToWorkerInspector:function(event)
8300 {var data=(event.data);var workerInspectorWindow=this._workerIdToWindow[data.workerId];if(workerInspectorWindow)
8301 workerInspectorWindow.postMessage(data.message,"*");},openWorkerInspector:function(workerId)
8302 {var existingInspector=this._workerIdToWindow[workerId];if(existingInspector){existingInspector.focus();return;}
8303 this._openInspectorWindow(workerId,false);WorkerAgent.connectToWorker(workerId);},_openInspectorWindow:function(workerId,workerIsPaused)
8304 {var search=window.location.search;var hash=window.location.hash;var url=window.location.href;url=url.replace(hash,"");url+=(search?"&dedicatedWorkerId=":"?dedicatedWorkerId=")+workerId;if(workerIsPaused)
8305 url+="&workerPaused=true";url=url.replace("docked=true&","");url=url.replace("can_dock=true&","");url+=hash;var width=WebInspector.settings.workerInspectorWidth.get();var height=WebInspector.settings.workerInspectorHeight.get();var workerInspectorWindow=window.open(url,undefined,"location=0,width="+width+",height="+height);workerInspectorWindow.addEventListener("resize",this._onWorkerInspectorResize.bind(this,workerInspectorWindow),false);this._workerIdToWindow[workerId]=workerInspectorWindow;workerInspectorWindow.addEventListener("beforeunload",this._workerInspectorClosing.bind(this,workerId),true);window.addEventListener("unload",this._pageInspectorClosing.bind(this),true);},closeWorkerInspector:function(workerId)
8306 {var workerInspectorWindow=this._workerIdToWindow[workerId];if(workerInspectorWindow)
8307 workerInspectorWindow.close();},_onWorkerInspectorResize:function(workerInspectorWindow)
8308 {var doc=workerInspectorWindow.document;WebInspector.settings.workerInspectorWidth.set(doc.width);WebInspector.settings.workerInspectorHeight.set(doc.height);},_workerInspectorClosing:function(workerId,event)
8309 {if(event.target.location.href==="about:blank")
8310 return;if(this._ignoreWorkerInspectorClosing)
8311 return;delete this._workerIdToWindow[workerId];WorkerAgent.disconnectFromWorker(workerId);},_pageInspectorClosing:function()
8312 {this._ignoreWorkerInspectorClosing=true;for(var workerId in this._workerIdToWindow){this._workerIdToWindow[workerId].close();WorkerAgent.disconnectFromWorker(parseInt(workerId,10));}}}
8313 WebInspector.workerFrontendManager=null;WebInspector.WorkerTargetManager=function(mainTarget,targetManager)
8314 {this._mainTarget=mainTarget;this._targetManager=targetManager;mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded,this._onWorkerAdded,this);}
8315 WebInspector.WorkerTargetManager.prototype={_onWorkerAdded:function(event)
8316 {var data=(event.data);new WebInspector.WorkerConnection(this._mainTarget,data.workerId,onConnectionReady.bind(this));function onConnectionReady(connection)
8317 {this._targetManager.createTarget(connection,workerTargetInitialization)}
8318 function workerTargetInitialization(target)
8319 {target.runtimeModel.addWorkerContextList(data.url);}}}
8320 WebInspector.WorkerConnection=function(target,workerId,onConnectionReady)
8321 {InspectorBackendClass.Connection.call(this);this._workerId=workerId;this._workerAgent=target.workerAgent();this._workerAgent.connectToWorker(workerId,onConnectionReady.bind(null,this));target.workerManager.addEventListener(WebInspector.WorkerManager.Events.MessageFromWorker,this._dispatchMessageFromWorker,this);}
8322 WebInspector.WorkerConnection.prototype={_dispatchMessageFromWorker:function(event)
8323 {var data=(event.data);if(data.workerId===this._workerId)
8324 this.dispatch(data.message);},sendMessage:function(messageObject)
8325 {this._workerAgent.sendMessageToWorker(this._workerId,messageObject);},__proto__:InspectorBackendClass.Connection.prototype}
8326 WebInspector.UserMetrics=function()
8327 {for(var actionName in WebInspector.UserMetrics._ActionCodes){var actionCode=WebInspector.UserMetrics._ActionCodes[actionName];this[actionName]=new WebInspector.UserMetrics._Recorder(actionCode);}}
8328 WebInspector.UserMetrics._ActionCodes={WindowDocked:1,WindowUndocked:2,ScriptsBreakpointSet:3,TimelineStarted:4,ProfilesCPUProfileTaken:5,ProfilesHeapProfileTaken:6,AuditsStarted:7,ConsoleEvaluated:8}
8329 WebInspector.UserMetrics._PanelCodes={elements:1,resources:2,network:3,scripts:4,timeline:5,profiles:6,audits:7,console:8}
8330 WebInspector.UserMetrics.UserAction="UserAction";WebInspector.UserMetrics.UserActionNames={ForcedElementState:"forcedElementState",FileSaved:"fileSaved",RevertRevision:"revertRevision",ApplyOriginalContent:"applyOriginalContent",TogglePrettyPrint:"togglePrettyPrint",SetBreakpoint:"setBreakpoint",OpenSourceLink:"openSourceLink",NetworkSort:"networkSort",NetworkRequestSelected:"networkRequestSelected",NetworkRequestTabSelected:"networkRequestTabSelected",HeapSnapshotFilterChanged:"heapSnapshotFilterChanged"};WebInspector.UserMetrics.prototype={panelShown:function(panelName)
8331 {InspectorFrontendHost.recordPanelShown(WebInspector.UserMetrics._PanelCodes[panelName]||0);}}
8332 WebInspector.UserMetrics._Recorder=function(actionCode)
8333 {this._actionCode=actionCode;}
8334 WebInspector.UserMetrics._Recorder.prototype={record:function()
8335 {InspectorFrontendHost.recordActionTaken(this._actionCode);}}
8336 WebInspector.userMetrics=new WebInspector.UserMetrics();WebInspector.RuntimeModel=function(target)
8337 {target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameAdded,this._frameAdded,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated,this._frameNavigated,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached,this._frameDetached,this);target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded,this._didLoadCachedResources,this);this._target=target;this._debuggerModel=target.debuggerModel;this._agent=target.runtimeAgent();this._contextListById={};}
8338 WebInspector.RuntimeModel.Events={ExecutionContextListAdded:"ExecutionContextListAdded",ExecutionContextListRemoved:"ExecutionContextListRemoved",}
8339 WebInspector.RuntimeModel.prototype={addWorkerContextList:function(url)
8340 {console.assert(this._target.isWorkerTarget(),"Worker context list was added in a non-worker target");var fakeContextList=new WebInspector.WorkerExecutionContextList("worker",url);this._addContextList(fakeContextList);var fakeExecutionContext=new WebInspector.ExecutionContext(undefined,url,true);fakeContextList._addExecutionContext(fakeExecutionContext);},setCurrentExecutionContext:function(executionContext)
8341 {this._currentExecutionContext=executionContext;},currentExecutionContext:function()
8342 {return this._currentExecutionContext;},contextLists:function()
8343 {return Object.values(this._contextListById);},contextListByFrame:function(frame)
8344 {return this._contextListById[frame.id];},_frameAdded:function(event)
8345 {console.assert(!this._target.isWorkerTarget(),"Frame was added in a worker target.t");var frame=(event.data);var contextList=new WebInspector.FrameExecutionContextList(frame);this._addContextList(contextList);},_addContextList:function(executionContextList)
8346 {this._contextListById[executionContextList.id()]=executionContextList;this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.ExecutionContextListAdded,executionContextList);},_frameNavigated:function(event)
8347 {console.assert(!this._target.isWorkerTarget(),"Frame was navigated in worker's target");var frame=(event.data);var context=this._contextListById[frame.id];if(context)
8348 context._frameNavigated(frame);},_frameDetached:function(event)
8349 {console.assert(!this._target.isWorkerTarget(),"Frame was detached in worker's target");var frame=(event.data);var context=this._contextListById[frame.id];if(!context)
8350 return;this.dispatchEventToListeners(WebInspector.RuntimeModel.Events.ExecutionContextListRemoved,context);delete this._contextListById[frame.id];},_didLoadCachedResources:function()
8351 {this._target.registerRuntimeDispatcher(new WebInspector.RuntimeDispatcher(this));this._agent.enable();},_executionContextCreated:function(context)
8352 {var contextList=this._contextListById[context.frameId];console.assert(contextList);contextList._addExecutionContext(new WebInspector.ExecutionContext(context.id,context.name,context.isPageContext));},evaluate:function(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback)
8353 {if(this._debuggerModel.selectedCallFrame()){this._debuggerModel.evaluateOnSelectedCallFrame(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,callback);return;}
8354 if(!expression){expression="this";}
8355 function evalCallback(error,result,wasThrown)
8356 {if(error){callback(null,false);return;}
8357 if(returnByValue)
8358 callback(null,!!wasThrown,wasThrown?null:result);else
8359 callback(WebInspector.RemoteObject.fromPayload(result,this._target),!!wasThrown);}
8360 this._agent.evaluate(expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,this._currentExecutionContext?this._currentExecutionContext.id:undefined,returnByValue,generatePreview,evalCallback.bind(this));},completionsForTextPrompt:function(proxyElement,wordRange,force,completionsReadyCallback)
8361 {var expressionRange=wordRange.startContainer.rangeOfWord(wordRange.startOffset," =:[({;,!+-*/&|^<>",proxyElement,"backward");var expressionString=expressionRange.toString();var prefix=wordRange.toString();this._completionsForExpression(expressionString,prefix,force,completionsReadyCallback);},_completionsForExpression:function(expressionString,prefix,force,completionsReadyCallback)
8362 {var lastIndex=expressionString.length-1;var dotNotation=(expressionString[lastIndex]===".");var bracketNotation=(expressionString[lastIndex]==="[");if(dotNotation||bracketNotation)
8363 expressionString=expressionString.substr(0,lastIndex);if(expressionString&&parseInt(expressionString,10)==expressionString){completionsReadyCallback([]);return;}
8364 if(!prefix&&!expressionString&&!force){completionsReadyCallback([]);return;}
8365 if(!expressionString&&this._debuggerModel.selectedCallFrame())
8366 this._debuggerModel.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));else
8367 this.evaluate(expressionString,"completion",true,true,false,false,evaluated.bind(this));function evaluated(result,wasThrown)
8368 {if(!result||wasThrown){completionsReadyCallback([]);return;}
8369 function getCompletions(primitiveType)
8370 {var object;if(primitiveType==="string")
8371 object=new String("");else if(primitiveType==="number")
8372 object=new Number(0);else if(primitiveType==="boolean")
8373 object=new Boolean(false);else
8374 object=this;var resultSet={};for(var o=object;o;o=o.__proto__){try{var names=Object.getOwnPropertyNames(o);for(var i=0;i<names.length;++i)
8375 resultSet[names[i]]=true;}catch(e){}}
8376 return resultSet;}
8377 if(result.type==="object"||result.type==="function")
8378 result.callFunctionJSON(getCompletions,undefined,receivedPropertyNames.bind(this));else if(result.type==="string"||result.type==="number"||result.type==="boolean")
8379 this.evaluate("("+getCompletions+")(\""+result.type+"\")","completion",false,true,true,false,receivedPropertyNamesFromEval.bind(this));}
8380 function receivedPropertyNamesFromEval(notRelevant,wasThrown,result)
8381 {if(result&&!wasThrown)
8382 receivedPropertyNames.call(this,result.value);else
8383 completionsReadyCallback([]);}
8384 function receivedPropertyNames(propertyNames)
8385 {this._agent.releaseObjectGroup("completion");if(!propertyNames){completionsReadyCallback([]);return;}
8386 var includeCommandLineAPI=(!dotNotation&&!bracketNotation);if(includeCommandLineAPI){const commandLineAPI=["dir","dirxml","keys","values","profile","profileEnd","monitorEvents","unmonitorEvents","inspect","copy","clear","getEventListeners","debug","undebug","monitor","unmonitor","table","$","$$","$x"];for(var i=0;i<commandLineAPI.length;++i)
8387 propertyNames[commandLineAPI[i]]=true;}
8388 this._reportCompletions(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,Object.keys(propertyNames));}},_reportCompletions:function(completionsReadyCallback,dotNotation,bracketNotation,expressionString,prefix,properties){if(bracketNotation){if(prefix.length&&prefix[0]==="'")
8389 var quoteUsed="'";else
8390 var quoteUsed="\"";}
8391 var results=[];if(!expressionString){const keywords=["break","case","catch","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","this","throw","try","typeof","var","void","while","with"];properties=properties.concat(keywords);}
8392 properties.sort();for(var i=0;i<properties.length;++i){var property=properties[i];if(dotNotation&&!/^[a-zA-Z_$\u008F-\uFFFF][a-zA-Z0-9_$\u008F-\uFFFF]*$/.test(property))
8393 continue;if(bracketNotation){if(!/^[0-9]+$/.test(property))
8394 property=quoteUsed+property.escapeCharacters(quoteUsed+"\\")+quoteUsed;property+="]";}
8395 if(property.length<prefix.length)
8396 continue;if(prefix.length&&!property.startsWith(prefix))
8397 continue;results.push(property);}
8398 completionsReadyCallback(results);},__proto__:WebInspector.Object.prototype}
8399 WebInspector.runtimeModel;WebInspector.RuntimeDispatcher=function(runtimeModel)
8400 {this._runtimeModel=runtimeModel;}
8401 WebInspector.RuntimeDispatcher.prototype={executionContextCreated:function(context)
8402 {this._runtimeModel._executionContextCreated(context);}}
8403 WebInspector.ExecutionContext=function(id,name,isPageContext)
8404 {this.id=id;this.name=(isPageContext&&!name)?"<page context>":name;this.isMainWorldContext=isPageContext;}
8405 WebInspector.ExecutionContext.comparator=function(a,b)
8406 {if(a.isMainWorldContext)
8407 return-1;if(b.isMainWorldContext)
8408 return+1;return a.name.localeCompare(b.name);}
8409 WebInspector.ExecutionContextList=function()
8410 {this._executionContexts=[];}
8411 WebInspector.ExecutionContextList.EventTypes={Reset:"Reset",ContextAdded:"ContextAdded"}
8412 WebInspector.ExecutionContextList.prototype={_reset:function()
8413 {this._executionContexts=[];this.dispatchEventToListeners(WebInspector.ExecutionContextList.EventTypes.Reset,this);},_addExecutionContext:function(context)
8414 {var insertAt=insertionIndexForObjectInListSortedByFunction(context,this._executionContexts,WebInspector.ExecutionContext.comparator);this._executionContexts.splice(insertAt,0,context);this.dispatchEventToListeners(WebInspector.ExecutionContextList.EventTypes.ContextAdded,this);},executionContexts:function()
8415 {return this._executionContexts;},mainWorldContext:function()
8416 {return this._executionContexts[0];},contextBySecurityOrigin:function(securityOrigin)
8417 {for(var i=0;i<this._executionContexts.length;++i){var context=this._executionContexts[i];if(!context.isMainWorldContext&&context.name===securityOrigin)
8418 return context;}
8419 return null;},id:function()
8420 {throw"Not implemented";},url:function()
8421 {throw"Not implemented";},displayName:function()
8422 {throw"Not implemented";},__proto__:WebInspector.Object.prototype}
8423 WebInspector.FrameExecutionContextList=function(frame)
8424 {WebInspector.ExecutionContextList.call(this);this._frame=frame;}
8425 WebInspector.FrameExecutionContextList.prototype={_frameNavigated:function(frame)
8426 {this._frame=frame;this._reset();},id:function()
8427 {return this._frame.id;},url:function()
8428 {return this._frame.url;},displayName:function()
8429 {return this._frame.displayName();},__proto__:WebInspector.ExecutionContextList.prototype}
8430 WebInspector.WorkerExecutionContextList=function(id,url)
8431 {WebInspector.ExecutionContextList.call(this);this._url=url;this._id=id;}
8432 WebInspector.WorkerExecutionContextList.prototype={id:function()
8433 {return this._id;},url:function()
8434 {return this._url;},displayName:function()
8435 {return this._url;},__proto__:WebInspector.ExecutionContextList.prototype}
8436 WebInspector.HandlerRegistry=function(setting)
8437 {WebInspector.Object.call(this);this._handlers={};this._setting=setting;this._activeHandler=this._setting.get();WebInspector.moduleManager.registerModule("handler-registry");}
8438 WebInspector.HandlerRegistry.prototype={get handlerNames()
8439 {return Object.getOwnPropertyNames(this._handlers);},get activeHandler()
8440 {return this._activeHandler;},set activeHandler(value)
8441 {this._activeHandler=value;this._setting.set(value);},dispatch:function(data)
8442 {return this.dispatchToHandler(this._activeHandler,data);},dispatchToHandler:function(name,data)
8443 {var handler=this._handlers[name];var result=handler&&handler(data);return!!result;},registerHandler:function(name,handler)
8444 {this._handlers[name]=handler;this.dispatchEventToListeners(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated);},unregisterHandler:function(name)
8445 {delete this._handlers[name];this.dispatchEventToListeners(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated);},_openInNewTab:function(url)
8446 {InspectorFrontendHost.openInNewTab(url);},_appendContentProviderItems:function(contextMenu,target)
8447 {if(!(target instanceof WebInspector.UISourceCode||target instanceof WebInspector.Resource||target instanceof WebInspector.NetworkRequest))
8448 return;var contentProvider=(target);if(!contentProvider.contentURL())
8449 return;contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),this._openInNewTab.bind(this,contentProvider.contentURL()));for(var i=1;i<this.handlerNames.length;++i){var handler=this.handlerNames[i];contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open using %s":"Open Using %s",handler),this.dispatchToHandler.bind(this,handler,{url:contentProvider.contentURL()}));}
8450 contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),InspectorFrontendHost.copyText.bind(InspectorFrontendHost,contentProvider.contentURL()));if(!contentProvider.contentURL())
8451 return;var contentType=contentProvider.contentType();if(contentType!==WebInspector.resourceTypes.Document&&contentType!==WebInspector.resourceTypes.Stylesheet&&contentType!==WebInspector.resourceTypes.Script)
8452 return;function doSave(forceSaveAs,content)
8453 {var url=contentProvider.contentURL();WebInspector.fileManager.save(url,(content),forceSaveAs);WebInspector.fileManager.close(url);}
8454 function save(forceSaveAs)
8455 {if(contentProvider instanceof WebInspector.UISourceCode){var uiSourceCode=(contentProvider);uiSourceCode.saveToFileSystem(forceSaveAs);return;}
8456 contentProvider.requestContent(doSave.bind(null,forceSaveAs));}
8457 contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Save"),save.bind(null,false));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Save as...":"Save As..."),save.bind(null,true));},_appendHrefItems:function(contextMenu,target)
8458 {if(!(target instanceof Node))
8459 return;var targetNode=(target);var anchorElement=targetNode.enclosingNodeOrSelfWithClass("webkit-html-resource-link")||targetNode.enclosingNodeOrSelfWithClass("webkit-html-external-link");if(!anchorElement)
8460 return;var resourceURL=anchorElement.href;if(!resourceURL)
8461 return;contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),this._openInNewTab.bind(this,resourceURL));function openInResourcesPanel(resourceURL)
8462 {var resource=WebInspector.resourceForURL(resourceURL);if(resource)
8463 WebInspector.Revealer.reveal(resource);else
8464 InspectorFrontendHost.openInNewTab(resourceURL);}
8465 if(WebInspector.resourceForURL(resourceURL))
8466 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Open link in Resources panel":"Open Link in Resources Panel"),openInResourcesPanel.bind(null,resourceURL));contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),InspectorFrontendHost.copyText.bind(InspectorFrontendHost,resourceURL));},__proto__:WebInspector.Object.prototype}
8467 WebInspector.HandlerRegistry.EventTypes={HandlersUpdated:"HandlersUpdated"}
8468 WebInspector.HandlerSelector=function(handlerRegistry)
8469 {this._handlerRegistry=handlerRegistry;this.element=document.createElement("select");this.element.addEventListener("change",this._onChange.bind(this),false);this._update();this._handlerRegistry.addEventListener(WebInspector.HandlerRegistry.EventTypes.HandlersUpdated,this._update.bind(this));}
8470 WebInspector.HandlerSelector.prototype={_update:function()
8471 {this.element.removeChildren();var names=this._handlerRegistry.handlerNames;var activeHandler=this._handlerRegistry.activeHandler;for(var i=0;i<names.length;++i){var option=document.createElement("option");option.textContent=names[i];option.selected=activeHandler===names[i];this.element.appendChild(option);}
8472 this.element.disabled=names.length<=1;},_onChange:function(event)
8473 {var value=event.target.value;this._handlerRegistry.activeHandler=value;}}
8474 WebInspector.HandlerRegistry.ContextMenuProvider=function()
8475 {}
8476 WebInspector.HandlerRegistry.ContextMenuProvider.prototype={appendApplicableItems:function(event,contextMenu,target)
8477 {WebInspector.openAnchorLocationRegistry._appendContentProviderItems(contextMenu,target);WebInspector.openAnchorLocationRegistry._appendHrefItems(contextMenu,target);}}
8478 WebInspector.HandlerRegistry.LinkHandler=function()
8479 {}
8480 WebInspector.HandlerRegistry.LinkHandler.prototype={handleLink:function(url,lineNumber)
8481 {return WebInspector.openAnchorLocationRegistry.dispatch({url:url,lineNumber:lineNumber});}}
8482 WebInspector.openAnchorLocationRegistry;WebInspector.SnippetStorage=function(settingPrefix,namePrefix)
8483 {this._snippets={};this._lastSnippetIdentifierSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets_lastIdentifier",0);this._snippetsSetting=WebInspector.settings.createSetting(settingPrefix+"Snippets",[]);this._namePrefix=namePrefix;this._loadSettings();}
8484 WebInspector.SnippetStorage.prototype={get namePrefix()
8485 {return this._namePrefix;},_saveSettings:function()
8486 {var savedSnippets=[];for(var id in this._snippets)
8487 savedSnippets.push(this._snippets[id].serializeToObject());this._snippetsSetting.set(savedSnippets);},snippets:function()
8488 {var result=[];for(var id in this._snippets)
8489 result.push(this._snippets[id]);return result;},snippetForId:function(id)
8490 {return this._snippets[id];},snippetForName:function(name)
8491 {var snippets=Object.values(this._snippets);for(var i=0;i<snippets.length;++i)
8492 if(snippets[i].name===name)
8493 return snippets[i];return null;},_loadSettings:function()
8494 {var savedSnippets=this._snippetsSetting.get();for(var i=0;i<savedSnippets.length;++i)
8495 this._snippetAdded(WebInspector.Snippet.fromObject(this,savedSnippets[i]));},deleteSnippet:function(snippet)
8496 {delete this._snippets[snippet.id];this._saveSettings();},createSnippet:function()
8497 {var nextId=this._lastSnippetIdentifierSetting.get()+1;var snippetId=String(nextId);this._lastSnippetIdentifierSetting.set(nextId);var snippet=new WebInspector.Snippet(this,snippetId);this._snippetAdded(snippet);this._saveSettings();return snippet;},_snippetAdded:function(snippet)
8498 {this._snippets[snippet.id]=snippet;},reset:function()
8499 {this._lastSnippetIdentifierSetting.set(0);this._snippetsSetting.set([]);this._snippets={};},__proto__:WebInspector.Object.prototype}
8500 WebInspector.Snippet=function(storage,id,name,content)
8501 {this._storage=storage;this._id=id;this._name=name||storage.namePrefix+id;this._content=content||"";}
8502 WebInspector.Snippet.fromObject=function(storage,serializedSnippet)
8503 {return new WebInspector.Snippet(storage,serializedSnippet.id,serializedSnippet.name,serializedSnippet.content);}
8504 WebInspector.Snippet.prototype={get id()
8505 {return this._id;},get name()
8506 {return this._name;},set name(name)
8507 {if(this._name===name)
8508 return;this._name=name;this._storage._saveSettings();},get content()
8509 {return this._content;},set content(content)
8510 {if(this._content===content)
8511 return;this._content=content;this._storage._saveSettings();},serializeToObject:function()
8512 {var serializedSnippet={};serializedSnippet.id=this.id;serializedSnippet.name=this.name;serializedSnippet.content=this.content;return serializedSnippet;},__proto__:WebInspector.Object.prototype}
8513 WebInspector.ScriptSnippetModel=function(workspace)
8514 {this._workspace=workspace;this._uiSourceCodeForScriptId={};this._scriptForUISourceCode=new Map();this._uiSourceCodeForSnippetId={};this._snippetIdForUISourceCode=new Map();this._snippetStorage=new WebInspector.SnippetStorage("script","Script snippet #");this._lastSnippetEvaluationIndexSetting=WebInspector.settings.createSetting("lastSnippetEvaluationIndex",0);this._snippetScriptMapping=new WebInspector.SnippetScriptMapping(this);this._projectDelegate=new WebInspector.SnippetsProjectDelegate(this);this._project=this._workspace.addProject(this._projectDelegate);this.reset();WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this._debuggerReset,this);}
8515 WebInspector.ScriptSnippetModel.prototype={get scriptMapping()
8516 {return this._snippetScriptMapping;},project:function()
8517 {return this._project;},_loadSnippets:function()
8518 {var snippets=this._snippetStorage.snippets();for(var i=0;i<snippets.length;++i)
8519 this._addScriptSnippet(snippets[i]);},createScriptSnippet:function(content)
8520 {var snippet=this._snippetStorage.createSnippet();snippet.content=content;return this._addScriptSnippet(snippet);},_addScriptSnippet:function(snippet)
8521 {var path=this._projectDelegate.addSnippet(snippet.name,new WebInspector.SnippetContentProvider(snippet));var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode){console.assert(uiSourceCode);return"";}
8522 var scriptFile=new WebInspector.SnippetScriptFile(this,uiSourceCode);uiSourceCode.setScriptFile(scriptFile);this._snippetIdForUISourceCode.put(uiSourceCode,snippet.id);uiSourceCode.setSourceMapping(this._snippetScriptMapping);this._uiSourceCodeForSnippetId[snippet.id]=uiSourceCode;return path;},deleteScriptSnippet:function(path)
8523 {var uiSourceCode=this._workspace.uiSourceCode(this._projectDelegate.id(),path);if(!uiSourceCode)
8524 return;var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode)||"";var snippet=this._snippetStorage.snippetForId(snippetId);this._snippetStorage.deleteSnippet(snippet);this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);delete this._uiSourceCodeForSnippetId[snippet.id];this._snippetIdForUISourceCode.remove(uiSourceCode);this._projectDelegate.removeFile(snippet.name);},renameScriptSnippet:function(name,newName,callback)
8525 {newName=newName.trim();if(!newName||newName.indexOf("/")!==-1||name===newName||this._snippetStorage.snippetForName(newName)){callback(false);return;}
8526 var snippet=this._snippetStorage.snippetForName(name);console.assert(snippet,"Snippet '"+name+"' was not found.");var uiSourceCode=this._uiSourceCodeForSnippetId[snippet.id];console.assert(uiSourceCode,"No uiSourceCode was found for snippet '"+name+"'.");var breakpointLocations=this._removeBreakpoints(uiSourceCode);snippet.name=newName;this._restoreBreakpoints(uiSourceCode,breakpointLocations);callback(true,newName);},_setScriptSnippetContent:function(name,newContent)
8527 {var snippet=this._snippetStorage.snippetForName(name);snippet.content=newContent;},_scriptSnippetEdited:function(uiSourceCode)
8528 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
8529 return;var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);var scriptUISourceCode=script.rawLocationToUILocation(0,0).uiSourceCode;if(scriptUISourceCode)
8530 this._restoreBreakpoints(scriptUISourceCode,breakpointLocations);},_nextEvaluationIndex:function(snippetId)
8531 {var evaluationIndex=this._lastSnippetEvaluationIndexSetting.get()+1;this._lastSnippetEvaluationIndexSetting.set(evaluationIndex);return evaluationIndex;},evaluateScriptSnippet:function(uiSourceCode)
8532 {var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._releaseSnippetScript(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode)||"";var evaluationIndex=this._nextEvaluationIndex(snippetId);uiSourceCode._evaluationIndex=evaluationIndex;var evaluationUrl=this._evaluationSourceURL(uiSourceCode);var expression=uiSourceCode.workingCopy();WebInspector.console.show();DebuggerAgent.compileScript(expression,evaluationUrl,compileCallback.bind(this));function compileCallback(error,scriptId,syntaxErrorMessage)
8533 {if(!uiSourceCode||uiSourceCode._evaluationIndex!==evaluationIndex)
8534 return;if(error){console.error(error);return;}
8535 if(!scriptId){var consoleMessage=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS,WebInspector.ConsoleMessage.MessageLevel.Error,syntaxErrorMessage||"");WebInspector.console.addMessage(consoleMessage);return;}
8536 var breakpointLocations=this._removeBreakpoints(uiSourceCode);this._restoreBreakpoints(uiSourceCode,breakpointLocations);this._runScript(scriptId);}},_runScript:function(scriptId)
8537 {var currentExecutionContext=WebInspector.runtimeModel.currentExecutionContext();DebuggerAgent.runScript(scriptId,currentExecutionContext?currentExecutionContext.id:undefined,"console",false,runCallback.bind(this));function runCallback(error,result,wasThrown)
8538 {if(error){console.error(error);return;}
8539 this._printRunScriptResult(result,wasThrown);}},_printRunScriptResult:function(result,wasThrown)
8540 {var level=(wasThrown?WebInspector.ConsoleMessage.MessageLevel.Error:WebInspector.ConsoleMessage.MessageLevel.Log);var message=new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS,level,"",undefined,undefined,undefined,undefined,undefined,[result]);WebInspector.console.addMessage(message);},_rawLocationToUILocation:function(rawLocation)
8541 {var uiSourceCode=this._uiSourceCodeForScriptId[rawLocation.scriptId];if(!uiSourceCode)
8542 return null;return new WebInspector.UILocation(uiSourceCode,rawLocation.lineNumber,rawLocation.columnNumber||0);},_uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8543 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
8544 return null;return WebInspector.debuggerModel.createRawLocation(script,lineNumber,columnNumber);},_addScript:function(script)
8545 {var snippetId=this._snippetIdForSourceURL(script.sourceURL);if(!snippetId)
8546 return;var uiSourceCode=this._uiSourceCodeForSnippetId[snippetId];if(!uiSourceCode||this._evaluationSourceURL(uiSourceCode)!==script.sourceURL)
8547 return;console.assert(!this._scriptForUISourceCode.get(uiSourceCode));this._uiSourceCodeForScriptId[script.scriptId]=uiSourceCode;this._scriptForUISourceCode.put(uiSourceCode,script);uiSourceCode.scriptFile().setHasDivergedFromVM(false);script.pushSourceMapping(this._snippetScriptMapping);},_removeBreakpoints:function(uiSourceCode)
8548 {var breakpointLocations=WebInspector.breakpointManager.breakpointLocationsForUISourceCode(uiSourceCode);for(var i=0;i<breakpointLocations.length;++i)
8549 breakpointLocations[i].breakpoint.remove();return breakpointLocations;},_restoreBreakpoints:function(uiSourceCode,breakpointLocations)
8550 {for(var i=0;i<breakpointLocations.length;++i){var uiLocation=breakpointLocations[i].uiLocation;var breakpoint=breakpointLocations[i].breakpoint;WebInspector.breakpointManager.setBreakpoint(uiSourceCode,uiLocation.lineNumber,uiLocation.columnNumber,breakpoint.condition(),breakpoint.enabled());}},_releaseSnippetScript:function(uiSourceCode)
8551 {var script=this._scriptForUISourceCode.get(uiSourceCode);if(!script)
8552 return null;uiSourceCode.scriptFile().setIsDivergingFromVM(true);uiSourceCode.scriptFile().setHasDivergedFromVM(true);delete this._uiSourceCodeForScriptId[script.scriptId];this._scriptForUISourceCode.remove(uiSourceCode);delete uiSourceCode._evaluationIndex;uiSourceCode.scriptFile().setIsDivergingFromVM(false);},_debuggerReset:function()
8553 {for(var snippetId in this._uiSourceCodeForSnippetId){var uiSourceCode=this._uiSourceCodeForSnippetId[snippetId];this._releaseSnippetScript(uiSourceCode);}},_evaluationSourceURL:function(uiSourceCode)
8554 {var evaluationSuffix="_"+uiSourceCode._evaluationIndex;var snippetId=this._snippetIdForUISourceCode.get(uiSourceCode);return WebInspector.Script.snippetSourceURLPrefix+snippetId+evaluationSuffix;},_snippetIdForSourceURL:function(sourceURL)
8555 {var snippetPrefix=WebInspector.Script.snippetSourceURLPrefix;if(!sourceURL.startsWith(snippetPrefix))
8556 return null;var splitURL=sourceURL.substring(snippetPrefix.length).split("_");var snippetId=splitURL[0];return snippetId;},reset:function()
8557 {this._uiSourceCodeForScriptId={};this._scriptForUISourceCode=new Map();this._uiSourceCodeForSnippetId={};this._snippetIdForUISourceCode=new Map();this._projectDelegate.reset();this._loadSnippets();},__proto__:WebInspector.Object.prototype}
8558 WebInspector.SnippetScriptFile=function(scriptSnippetModel,uiSourceCode)
8559 {WebInspector.ScriptFile.call(this);this._scriptSnippetModel=scriptSnippetModel;this._uiSourceCode=uiSourceCode;this._hasDivergedFromVM=true;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);}
8560 WebInspector.SnippetScriptFile.prototype={hasDivergedFromVM:function()
8561 {return this._hasDivergedFromVM;},setHasDivergedFromVM:function(hasDivergedFromVM)
8562 {this._hasDivergedFromVM=hasDivergedFromVM;},isDivergingFromVM:function()
8563 {return this._isDivergingFromVM;},checkMapping:function()
8564 {},isMergingToVM:function()
8565 {return false;},setIsDivergingFromVM:function(isDivergingFromVM)
8566 {this._isDivergingFromVM=isDivergingFromVM;},_workingCopyChanged:function()
8567 {this._scriptSnippetModel._scriptSnippetEdited(this._uiSourceCode);},__proto__:WebInspector.Object.prototype}
8568 WebInspector.SnippetScriptMapping=function(scriptSnippetModel)
8569 {this._scriptSnippetModel=scriptSnippetModel;}
8570 WebInspector.SnippetScriptMapping.prototype={rawLocationToUILocation:function(rawLocation)
8571 {var debuggerModelLocation=(rawLocation);return this._scriptSnippetModel._rawLocationToUILocation(debuggerModelLocation);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8572 {return this._scriptSnippetModel._uiLocationToRawLocation(uiSourceCode,lineNumber,columnNumber);},snippetIdForSourceURL:function(sourceURL)
8573 {return this._scriptSnippetModel._snippetIdForSourceURL(sourceURL);},addScript:function(script)
8574 {this._scriptSnippetModel._addScript(script);},isIdentity:function()
8575 {return false;},}
8576 WebInspector.SnippetContentProvider=function(snippet)
8577 {this._snippet=snippet;}
8578 WebInspector.SnippetContentProvider.prototype={contentURL:function()
8579 {return"";},contentType:function()
8580 {return WebInspector.resourceTypes.Script;},requestContent:function(callback)
8581 {callback(this._snippet.content);},searchInContent:function(query,caseSensitive,isRegex,callback)
8582 {function performSearch()
8583 {callback(WebInspector.ContentProvider.performSearchInContent(this._snippet.content,query,caseSensitive,isRegex));}
8584 window.setTimeout(performSearch.bind(this),0);}}
8585 WebInspector.SnippetsProjectDelegate=function(model)
8586 {WebInspector.ContentProviderBasedProjectDelegate.call(this,WebInspector.projectTypes.Snippets);this._model=model;}
8587 WebInspector.SnippetsProjectDelegate.prototype={id:function()
8588 {return WebInspector.projectTypes.Snippets+":";},addSnippet:function(name,contentProvider)
8589 {return this.addContentProvider("",name,name,contentProvider,true,false);},canSetFileContent:function()
8590 {return true;},setFileContent:function(path,newContent,callback)
8591 {this._model._setScriptSnippetContent(path,newContent);callback("");},canRename:function()
8592 {return true;},performRename:function(path,newName,callback)
8593 {this._model.renameScriptSnippet(path,newName,callback);},createFile:function(path,name,content,callback)
8594 {var filePath=this._model.createScriptSnippet(content);callback(filePath);},deleteFile:function(path)
8595 {this._model.deleteScriptSnippet(path);},__proto__:WebInspector.ContentProviderBasedProjectDelegate.prototype}
8596 WebInspector.scriptSnippetModel;WebInspector.Progress=function()
8597 {}
8598 WebInspector.Progress.Events={Canceled:"Canceled"}
8599 WebInspector.Progress.prototype={setTotalWork:function(totalWork){},setTitle:function(title){},setWorked:function(worked,title){},worked:function(worked){},done:function(){},isCanceled:function(){return false;},addEventListener:function(eventType,listener,thisObject){}}
8600 WebInspector.CompositeProgress=function(parent)
8601 {this._parent=parent;this._children=[];this._childrenDone=0;this._parent.setTotalWork(1);this._parent.setWorked(0);parent.addEventListener(WebInspector.Progress.Events.Canceled,this._parentCanceled.bind(this));}
8602 WebInspector.CompositeProgress.prototype={_childDone:function()
8603 {if(++this._childrenDone===this._children.length)
8604 this._parent.done();},_parentCanceled:function()
8605 {this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);for(var i=0;i<this._children.length;++i){this._children[i].dispatchEventToListeners(WebInspector.Progress.Events.Canceled);}},createSubProgress:function(weight)
8606 {var child=new WebInspector.SubProgress(this,weight);this._children.push(child);return child;},_update:function()
8607 {var totalWeights=0;var done=0;for(var i=0;i<this._children.length;++i){var child=this._children[i];if(child._totalWork)
8608 done+=child._weight*child._worked/child._totalWork;totalWeights+=child._weight;}
8609 this._parent.setWorked(done/totalWeights);},__proto__:WebInspector.Object.prototype}
8610 WebInspector.SubProgress=function(composite,weight)
8611 {this._composite=composite;this._weight=weight||1;this._worked=0;}
8612 WebInspector.SubProgress.prototype={isCanceled:function()
8613 {return this._composite._parent.isCanceled();},setTitle:function(title)
8614 {this._composite._parent.setTitle(title);},done:function()
8615 {this.setWorked(this._totalWork);this._composite._childDone();},setTotalWork:function(totalWork)
8616 {this._totalWork=totalWork;this._composite._update();},setWorked:function(worked,title)
8617 {this._worked=worked;if(typeof title!=="undefined")
8618 this.setTitle(title);this._composite._update();},worked:function(worked)
8619 {this.setWorked(this._worked+(worked||1));},__proto__:WebInspector.Object.prototype}
8620 WebInspector.ProgressIndicator=function()
8621 {this.element=document.createElement("div");this.element.className="progress-bar-container";this._labelElement=this.element.createChild("span");this._progressElement=this.element.createChild("progress");this._stopButton=new WebInspector.StatusBarButton(WebInspector.UIString("Cancel"),"progress-bar-stop-button");this._stopButton.addEventListener("click",this.cancel,this);this.element.appendChild(this._stopButton.element);this._isCanceled=false;this._worked=0;}
8622 WebInspector.ProgressIndicator.Events={Done:"Done"}
8623 WebInspector.ProgressIndicator.prototype={show:function(parent)
8624 {parent.appendChild(this.element);},hide:function()
8625 {var parent=this.element.parentElement;if(parent)
8626 parent.removeChild(this.element);},done:function()
8627 {if(this._isDone)
8628 return;this._isDone=true;this.hide();this.dispatchEventToListeners(WebInspector.ProgressIndicator.Events.Done);},cancel:function()
8629 {this._isCanceled=true;this.dispatchEventToListeners(WebInspector.Progress.Events.Canceled);},isCanceled:function()
8630 {return this._isCanceled;},setTitle:function(title)
8631 {this._labelElement.textContent=title;},setTotalWork:function(totalWork)
8632 {this._progressElement.max=totalWork;},setWorked:function(worked,title)
8633 {this._worked=worked;this._progressElement.value=worked;if(title)
8634 this.setTitle(title);},worked:function(worked)
8635 {this.setWorked(this._worked+(worked||1));},__proto__:WebInspector.Object.prototype}
8636 WebInspector.StylesSourceMapping=function(cssModel,workspace)
8637 {this._cssModel=cssModel;this._workspace=workspace;this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillReset,this._projectWillReset,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded,this._uiSourceCodeAddedToWorkspace,this);this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved,this._uiSourceCodeRemoved,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameCreatedOrNavigated,this._mainFrameCreatedOrNavigated,this);this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged,this._styleSheetChanged,this);this._initialize();}
8638 WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs=1000;WebInspector.StylesSourceMapping.prototype={rawLocationToUILocation:function(rawLocation)
8639 {var location=(rawLocation);var uiSourceCode=this._workspace.uiSourceCodeForURL(location.url);if(!uiSourceCode)
8640 return null;return new WebInspector.UILocation(uiSourceCode,location.lineNumber,location.columnNumber);},uiLocationToRawLocation:function(uiSourceCode,lineNumber,columnNumber)
8641 {return new WebInspector.CSSLocation(uiSourceCode.url||"",lineNumber,columnNumber);},isIdentity:function()
8642 {return true;},addHeader:function(header)
8643 {var url=header.resourceURL();if(!url)
8644 return;header.pushSourceMapping(this);var map=this._urlToHeadersByFrameId[url];if(!map){map=(new StringMap());this._urlToHeadersByFrameId[url]=map;}
8645 var headersById=map.get(header.frameId);if(!headersById){headersById=(new StringMap());map.put(header.frameId,headersById);}
8646 headersById.put(header.id,header);var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(uiSourceCode)
8647 this._bindUISourceCode(uiSourceCode,header);},removeHeader:function(header)
8648 {var url=header.resourceURL();if(!url)
8649 return;var map=this._urlToHeadersByFrameId[url];console.assert(map);var headersById=map.get(header.frameId);console.assert(headersById);headersById.remove(header.id);if(!headersById.size()){map.remove(header.frameId);if(!map.size()){delete this._urlToHeadersByFrameId[url];var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(uiSourceCode)
8650 this._unbindUISourceCode(uiSourceCode);}}},_unbindUISourceCode:function(uiSourceCode)
8651 {var styleFile=this._styleFiles.get(uiSourceCode);if(!styleFile)
8652 return;styleFile.dispose();this._styleFiles.remove(uiSourceCode);},_uiSourceCodeAddedToWorkspace:function(event)
8653 {var uiSourceCode=(event.data);var url=uiSourceCode.url;if(!url||!this._urlToHeadersByFrameId[url])
8654 return;this._bindUISourceCode(uiSourceCode,this._urlToHeadersByFrameId[url].values()[0].values()[0]);},_bindUISourceCode:function(uiSourceCode,header)
8655 {if(this._styleFiles.get(uiSourceCode)||header.isInline)
8656 return;var url=uiSourceCode.url;this._styleFiles.put(uiSourceCode,new WebInspector.StyleFile(uiSourceCode,this));header.updateLocations();},_projectWillReset:function(event)
8657 {var project=(event.data);var uiSourceCodes=project.uiSourceCodes();for(var i=0;i<uiSourceCodes.length;++i)
8658 this._unbindUISourceCode(uiSourceCodes[i]);},_uiSourceCodeRemoved:function(event)
8659 {var uiSourceCode=(event.data);this._unbindUISourceCode(uiSourceCode);},_initialize:function()
8660 {this._urlToHeadersByFrameId={};this._styleFiles=new Map();},_mainFrameCreatedOrNavigated:function(event)
8661 {for(var url in this._urlToHeadersByFrameId){var uiSourceCode=this._workspace.uiSourceCodeForURL(url);if(!uiSourceCode)
8662 continue;this._unbindUISourceCode(uiSourceCode);}
8663 this._initialize();},_setStyleContent:function(uiSourceCode,content,majorChange,userCallback)
8664 {var styleSheetIds=this._cssModel.styleSheetIdsForURL(uiSourceCode.url);if(!styleSheetIds.length){userCallback("No stylesheet found: "+uiSourceCode.url);return;}
8665 this._isSettingContent=true;function callback(error)
8666 {userCallback(error);delete this._isSettingContent;}
8667 this._cssModel.setStyleSheetText(styleSheetIds[0],content,majorChange,callback.bind(this));},_styleSheetChanged:function(event)
8668 {if(this._isSettingContent)
8669 return;if(event.data.majorChange){this._updateStyleSheetText(event.data.styleSheetId);return;}
8670 this._updateStyleSheetTextSoon(event.data.styleSheetId);},_updateStyleSheetTextSoon:function(styleSheetId)
8671 {if(this._updateStyleSheetTextTimer)
8672 clearTimeout(this._updateStyleSheetTextTimer);this._updateStyleSheetTextTimer=setTimeout(this._updateStyleSheetText.bind(this,styleSheetId),WebInspector.StylesSourceMapping.MinorChangeUpdateTimeoutMs);},_updateStyleSheetText:function(styleSheetId)
8673 {if(this._updateStyleSheetTextTimer){clearTimeout(this._updateStyleSheetTextTimer);delete this._updateStyleSheetTextTimer;}
8674 var header=this._cssModel.styleSheetHeaderForId(styleSheetId);if(!header)
8675 return;var styleSheetURL=header.resourceURL();if(!styleSheetURL)
8676 return;var uiSourceCode=this._workspace.uiSourceCodeForURL(styleSheetURL)
8677 if(!uiSourceCode)
8678 return;header.requestContent(callback.bind(this,uiSourceCode));function callback(uiSourceCode,content)
8679 {var styleFile=this._styleFiles.get(uiSourceCode);if(styleFile)
8680 styleFile.addRevision(content||"");}}}
8681 WebInspector.StyleFile=function(uiSourceCode,mapping)
8682 {this._uiSourceCode=uiSourceCode;this._mapping=mapping;this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);}
8683 WebInspector.StyleFile.updateTimeout=200;WebInspector.StyleFile.prototype={_workingCopyCommitted:function(event)
8684 {if(this._isAddingRevision)
8685 return;this._commitIncrementalEdit(true);},_workingCopyChanged:function(event)
8686 {if(this._isAddingRevision)
8687 return;if(WebInspector.StyleFile.updateTimeout>=0){this._incrementalUpdateTimer=setTimeout(this._commitIncrementalEdit.bind(this,false),WebInspector.StyleFile.updateTimeout)}else
8688 this._commitIncrementalEdit(false);},_commitIncrementalEdit:function(majorChange)
8689 {this._clearIncrementalUpdateTimer();this._mapping._setStyleContent(this._uiSourceCode,this._uiSourceCode.workingCopy(),majorChange,this._styleContentSet.bind(this));},_styleContentSet:function(error)
8690 {if(error)
8691 WebInspector.console.showErrorMessage(error);},_clearIncrementalUpdateTimer:function()
8692 {if(!this._incrementalUpdateTimer)
8693 return;clearTimeout(this._incrementalUpdateTimer);delete this._incrementalUpdateTimer;},addRevision:function(content)
8694 {this._isAddingRevision=true;this._uiSourceCode.addRevision(content);delete this._isAddingRevision;},dispose:function()
8695 {this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted,this._workingCopyCommitted,this);this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged,this._workingCopyChanged,this);}}
8696 WebInspector.NetworkUISourceCodeProvider=function(networkWorkspaceProvider,workspace)
8697 {this._networkWorkspaceProvider=networkWorkspaceProvider;this._workspace=workspace;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,this._resourceAdded,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource,this._parsedScriptSource,this);WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded,this._styleSheetAdded,this);this._processedURLs={};}
8698 WebInspector.NetworkUISourceCodeProvider.prototype={_populate:function()
8699 {function populateFrame(frame)
8700 {for(var i=0;i<frame.childFrames.length;++i)
8701 populateFrame.call(this,frame.childFrames[i]);var resources=frame.resources();for(var i=0;i<resources.length;++i)
8702 this._resourceAdded({data:resources[i]});}
8703 populateFrame.call(this,WebInspector.resourceTreeModel.mainFrame);},_parsedScriptSource:function(event)
8704 {var script=(event.data);if(!script.sourceURL||script.isInlineScript()||script.isSnippet())
8705 return;if(script.isContentScript&&!script.hasSourceURL){var parsedURL=new WebInspector.ParsedURL(script.sourceURL);if(!parsedURL.isValid)
8706 return;}
8707 this._addFile(script.sourceURL,script,script.isContentScript);},_styleSheetAdded:function(event)
8708 {var header=(event.data);if((!header.hasSourceURL||header.isInline)&&header.origin!=="inspector")
8709 return;this._addFile(header.resourceURL(),header,false);},_resourceAdded:function(event)
8710 {var resource=(event.data);this._addFile(resource.url,new WebInspector.NetworkUISourceCodeProvider.FallbackResource(resource));},_mainFrameNavigated:function(event)
8711 {this._reset();},_addFile:function(url,contentProvider,isContentScript)
8712 {if(this._workspace.hasMappingForURL(url))
8713 return;var type=contentProvider.contentType();if(type!==WebInspector.resourceTypes.Stylesheet&&type!==WebInspector.resourceTypes.Document&&type!==WebInspector.resourceTypes.Script)
8714 return;if(this._processedURLs[url])
8715 return;this._processedURLs[url]=true;var isEditable=type!==WebInspector.resourceTypes.Document;this._networkWorkspaceProvider.addFileForURL(url,contentProvider,isEditable,isContentScript);},_reset:function()
8716 {this._processedURLs={};this._networkWorkspaceProvider.reset();this._populate();}}
8717 WebInspector.NetworkUISourceCodeProvider.FallbackResource=function(resource)
8718 {this._resource=resource;}
8719 WebInspector.NetworkUISourceCodeProvider.FallbackResource.prototype={contentURL:function()
8720 {return this._resource.contentURL();},contentType:function()
8721 {return this._resource.contentType();},requestContent:function(callback)
8722 {function loadFallbackContent()
8723 {var scripts=WebInspector.debuggerModel.scriptsForSourceURL(this._resource.url);if(!scripts.length){callback(null);return;}
8724 var contentProvider;if(this._resource.type===WebInspector.resourceTypes.Document)
8725 contentProvider=new WebInspector.ConcatenatedScriptsContentProvider(scripts);else if(this._resource.type===WebInspector.resourceTypes.Script)
8726 contentProvider=scripts[0];console.assert(contentProvider,"Resource content request failed. "+this._resource.url);contentProvider.requestContent(callback);}
8727 function requestContentLoaded(content)
8728 {if(content)
8729 callback(content)
8730 else
8731 loadFallbackContent.call(this);}
8732 this._resource.requestContent(requestContentLoaded.bind(this));},searchInContent:function(query,caseSensitive,isRegex,callback)
8733 {function documentContentLoaded(content)
8734 {if(content===null){callback([]);return;}
8735 var result=WebInspector.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);callback(result);}
8736 if(this.contentType()===WebInspector.resourceTypes.Document){this.requestContent(documentContentLoaded);return;}
8737 this._resource.searchInContent(query,caseSensitive,isRegex,callback);}}
8738 WebInspector.networkWorkspaceProvider;WebInspector.CPUProfilerModel=function()
8739 {this._delegate=null;this._isRecording=false;InspectorBackend.registerProfilerDispatcher(this);ProfilerAgent.enable();}
8740 WebInspector.CPUProfilerModel.EventTypes={ProfileStarted:"profile-started",ProfileStopped:"profile-stopped"};WebInspector.CPUProfilerModel.prototype={setDelegate:function(delegate)
8741 {this._delegate=delegate;},consoleProfileFinished:function(id,scriptLocation,cpuProfile,title)
8742 {WebInspector.moduleManager.loadModule("profiles");this._delegate.consoleProfileFinished(id,scriptLocation,cpuProfile,title);},consoleProfileStarted:function(id,scriptLocation,title)
8743 {WebInspector.moduleManager.loadModule("profiles");this._delegate.consoleProfileStarted(id,scriptLocation,title);},setRecording:function(isRecording)
8744 {this._isRecording=isRecording;this.dispatchEventToListeners(isRecording?WebInspector.CPUProfilerModel.EventTypes.ProfileStarted:WebInspector.CPUProfilerModel.EventTypes.ProfileStopped);},isRecordingProfile:function()
8745 {return this._isRecording;},__proto__:WebInspector.Object.prototype}
8746 WebInspector.CPUProfilerModel.Delegate=function(){};WebInspector.CPUProfilerModel.Delegate.prototype={consoleProfileStarted:function(protocolId,scriptLocation,title){},consoleProfileFinished:function(protocolId,scriptLocation,cpuProfile,title){}}
8747 WebInspector.cpuProfilerModel;WebInspector.DockController=function(canDock)
8748 {this._canDock=canDock;if(!canDock){this._dockSide=WebInspector.DockController.State.Undocked;this._updateUI();return;}
8749 WebInspector.settings.currentDockState=WebInspector.settings.createSetting("currentDockState","");WebInspector.settings.lastDockState=WebInspector.settings.createSetting("lastDockState","");var states=[WebInspector.DockController.State.DockedToBottom,WebInspector.DockController.State.Undocked,WebInspector.DockController.State.DockedToRight];var titles=[WebInspector.UIString("Dock to main window."),WebInspector.UIString("Undock into separate window."),WebInspector.UIString("Dock to main window.")];if(WebInspector.experimentsSettings.dockToLeft.isEnabled()){states.push(WebInspector.DockController.State.DockedToLeft);titles.push(WebInspector.UIString("Dock to main window."));}
8750 this._dockToggleButton=new WebInspector.StatusBarStatesSettingButton("dock-status-bar-item",states,titles,WebInspector.settings.currentDockState,WebInspector.settings.lastDockState,this._dockSideChanged.bind(this));}
8751 WebInspector.DockController.State={DockedToBottom:"bottom",DockedToRight:"right",DockedToLeft:"left",Undocked:"undocked"}
8752 WebInspector.DockController.Events={DockSideChanged:"DockSideChanged"}
8753 WebInspector.DockController.prototype={get element()
8754 {return this._canDock?this._dockToggleButton.element:null;},dockSide:function()
8755 {return this._dockSide;},canDock:function()
8756 {return this._canDock;},isVertical:function()
8757 {return this._dockSide===WebInspector.DockController.State.DockedToRight||this._dockSide===WebInspector.DockController.State.DockedToLeft;},_dockSideChanged:function(dockSide)
8758 {if(this._dockSide===dockSide)
8759 return;this._dockSide=dockSide;this._updateUI();this.dispatchEventToListeners(WebInspector.DockController.Events.DockSideChanged,this._dockSide);if(this._canDock)
8760 InspectorFrontendHost.setIsDocked(dockSide!==WebInspector.DockController.State.Undocked);},_updateUI:function()
8761 {var body=document.body;switch(this._dockSide){case WebInspector.DockController.State.DockedToBottom:body.classList.remove("undocked");body.classList.remove("dock-to-right");body.classList.remove("dock-to-left");body.classList.add("dock-to-bottom");break;case WebInspector.DockController.State.DockedToRight:body.classList.remove("undocked");body.classList.add("dock-to-right");body.classList.remove("dock-to-left");body.classList.remove("dock-to-bottom");break;case WebInspector.DockController.State.DockedToLeft:body.classList.remove("undocked");body.classList.remove("dock-to-right");body.classList.add("dock-to-left");body.classList.remove("dock-to-bottom");break;case WebInspector.DockController.State.Undocked:body.classList.add("undocked");body.classList.remove("dock-to-right");body.classList.remove("dock-to-left");body.classList.remove("dock-to-bottom");break;}},__proto__:WebInspector.Object.prototype}
8762 WebInspector.dockController;WebInspector.TracingAgent=function()
8763 {this._active=false;InspectorBackend.registerTracingDispatcher(new WebInspector.TracingDispatcher(this));}
8764 WebInspector.TracingAgent.prototype={start:function(categoryPatterns,options,callback)
8765 {TracingAgent.start(categoryPatterns,options,callback);this._active=true;this._events=[];},stop:function(callback)
8766 {if(!this._active){callback();return;}
8767 this._pendingStopCallback=callback;TracingAgent.end();},events:function()
8768 {return this._events;},_eventsCollected:function(events)
8769 {Array.prototype.push.apply(this._events,events);},_tracingComplete:function()
8770 {this._active=false;if(this._pendingStopCallback){this._pendingStopCallback();this._pendingStopCallback=null;}}}
8771 WebInspector.TracingDispatcher=function(tracingAgent)
8772 {this._tracingAgent=tracingAgent;}
8773 WebInspector.TracingDispatcher.prototype={dataCollected:function(data)
8774 {this._tracingAgent._eventsCollected(data);},tracingComplete:function()
8775 {this._tracingAgent._tracingComplete();}}
8776 WebInspector.tracingAgent;WebInspector.ScreencastView=function()
8777 {WebInspector.VBox.call(this);this.setMinimumSize(150,150);this.registerRequiredCSS("screencastView.css");};WebInspector.ScreencastView._bordersSize=40;WebInspector.ScreencastView._navBarHeight=29;WebInspector.ScreencastView._HttpRegex=/^https?:\/\/(.+)/;WebInspector.ScreencastView.prototype={initialize:function()
8778 {this.element.classList.add("screencast");this._createNavigationBar();this._viewportElement=this.element.createChild("div","screencast-viewport hidden");this._glassPaneElement=this.element.createChild("div","screencast-glasspane hidden");this._canvasElement=this._viewportElement.createChild("canvas");this._canvasElement.tabIndex=1;this._canvasElement.addEventListener("mousedown",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mouseup",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mousemove",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("mousewheel",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("click",this._handleMouseEvent.bind(this),false);this._canvasElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);this._canvasElement.addEventListener("keydown",this._handleKeyEvent.bind(this),false);this._canvasElement.addEventListener("keyup",this._handleKeyEvent.bind(this),false);this._canvasElement.addEventListener("keypress",this._handleKeyEvent.bind(this),false);this._titleElement=this._viewportElement.createChild("div","screencast-element-title monospace hidden");this._tagNameElement=this._titleElement.createChild("span","screencast-tag-name");this._nodeIdElement=this._titleElement.createChild("span","screencast-node-id");this._classNameElement=this._titleElement.createChild("span","screencast-class-name");this._titleElement.appendChild(document.createTextNode(" "));this._nodeWidthElement=this._titleElement.createChild("span");this._titleElement.createChild("span","screencast-px").textContent="px";this._titleElement.appendChild(document.createTextNode(" \u00D7 "));this._nodeHeightElement=this._titleElement.createChild("span");this._titleElement.createChild("span","screencast-px").textContent="px";this._imageElement=new Image();this._isCasting=false;this._context=this._canvasElement.getContext("2d");this._checkerboardPattern=this._createCheckerboardPattern(this._context);this._shortcuts=({});this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l",WebInspector.KeyboardShortcut.Modifiers.Ctrl)]=this._focusNavigationBar.bind(this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame,this._screencastFrame,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged,this._screencastVisibilityChanged,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted,this._onTimeline.bind(this,true),this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStopped,this._onTimeline.bind(this,false),this);this._timelineActive=WebInspector.timelineManager.isStarted();WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerModel.EventTypes.ProfileStarted,this._onProfiler.bind(this,true),this);WebInspector.cpuProfilerModel.addEventListener(WebInspector.CPUProfilerModel.EventTypes.ProfileStopped,this._onProfiler.bind(this,false),this);this._profilerActive=WebInspector.cpuProfilerModel.isRecordingProfile();this._updateGlasspane();},wasShown:function()
8779 {this._startCasting();},willHide:function()
8780 {this._stopCasting();},_startCasting:function()
8781 {if(this._timelineActive||this._profilerActive)
8782 return;if(this._isCasting)
8783 return;this._isCasting=true;const maxImageDimension=1024;var dimensions=this._viewportDimensions();if(dimensions.width<0||dimensions.height<0){this._isCasting=false;return;}
8784 dimensions.width*=WebInspector.zoomManager.zoomFactor();dimensions.height*=WebInspector.zoomManager.zoomFactor();PageAgent.startScreencast("jpeg",80,Math.min(maxImageDimension,dimensions.width),Math.min(maxImageDimension,dimensions.height));WebInspector.domModel.setHighlighter(this);},_stopCasting:function()
8785 {if(!this._isCasting)
8786 return;this._isCasting=false;PageAgent.stopScreencast();WebInspector.domModel.setHighlighter(null);},_screencastFrame:function(event)
8787 {var metadata=(event.data.metadata);if(!metadata.deviceScaleFactor){console.log(event.data.data);return;}
8788 var base64Data=(event.data.data);this._imageElement.src="data:image/jpg;base64,"+base64Data;this._deviceScaleFactor=metadata.deviceScaleFactor;this._pageScaleFactor=metadata.pageScaleFactor;this._viewport=metadata.viewport;if(!this._viewport)
8789 return;var offsetTop=metadata.offsetTop||0;var offsetBottom=metadata.offsetBottom||0;var screenWidthDIP=this._viewport.width*this._pageScaleFactor;var screenHeightDIP=this._viewport.height*this._pageScaleFactor+offsetTop+offsetBottom;this._screenOffsetTop=offsetTop;this._resizeViewport(screenWidthDIP,screenHeightDIP);this._imageZoom=this._imageElement.naturalWidth?this._canvasElement.offsetWidth/this._imageElement.naturalWidth:1;this.highlightDOMNode(this._highlightNodeId,this._highlightConfig);},_isGlassPaneActive:function()
8790 {return!this._glassPaneElement.classList.contains("hidden");},_screencastVisibilityChanged:function(event)
8791 {this._targetInactive=!event.data.visible;this._updateGlasspane();},_onTimeline:function(on)
8792 {this._timelineActive=on;if(this._timelineActive)
8793 this._stopCasting();else
8794 this._startCasting();this._updateGlasspane();},_onProfiler:function(on,event){this._profilerActive=on;if(this._profilerActive)
8795 this._stopCasting();else
8796 this._startCasting();this._updateGlasspane();},_updateGlasspane:function()
8797 {if(this._targetInactive){this._glassPaneElement.textContent=WebInspector.UIString("The tab is inactive");this._glassPaneElement.classList.remove("hidden");}else if(this._timelineActive){this._glassPaneElement.textContent=WebInspector.UIString("Timeline is active");this._glassPaneElement.classList.remove("hidden");}else if(this._profilerActive){this._glassPaneElement.textContent=WebInspector.UIString("CPU profiler is active");this._glassPaneElement.classList.remove("hidden");}else{this._glassPaneElement.classList.add("hidden");}},_resizeViewport:function(screenWidthDIP,screenHeightDIP)
8798 {var dimensions=this._viewportDimensions();this._screenZoom=Math.min(dimensions.width/screenWidthDIP,dimensions.height/screenHeightDIP);var bordersSize=WebInspector.ScreencastView._bordersSize;this._viewportElement.classList.remove("hidden");this._viewportElement.style.width=screenWidthDIP*this._screenZoom+bordersSize+"px";this._viewportElement.style.height=screenHeightDIP*this._screenZoom+bordersSize+"px";},_handleMouseEvent:function(event)
8799 {if(this._isGlassPaneActive()){event.consume();return;}
8800 if(!this._viewport)
8801 return;if(!this._inspectModeConfig||event.type==="mousewheel"){this._simulateTouchGestureForMouseEvent(event);event.preventDefault();if(event.type==="mousedown")
8802 this._canvasElement.focus();return;}
8803 var position=this._convertIntoScreenSpace(event);DOMAgent.getNodeForLocation(position.x/this._pageScaleFactor,position.y/this._pageScaleFactor,callback.bind(this));function callback(error,nodeId)
8804 {if(error)
8805 return;if(event.type==="mousemove")
8806 this.highlightDOMNode(nodeId,this._inspectModeConfig);else if(event.type==="click")
8807 WebInspector.Revealer.reveal(WebInspector.domModel.nodeForId(nodeId));}},_handleKeyEvent:function(event)
8808 {if(this._isGlassPaneActive()){event.consume();return;}
8809 var shortcutKey=WebInspector.KeyboardShortcut.makeKeyFromEvent(event);var handler=this._shortcuts[shortcutKey];if(handler&&handler(event)){event.consume();return;}
8810 var type;switch(event.type){case"keydown":type="keyDown";break;case"keyup":type="keyUp";break;case"keypress":type="char";break;default:return;}
8811 var text=event.type==="keypress"?String.fromCharCode(event.charCode):undefined;InputAgent.dispatchKeyEvent(type,this._modifiersForEvent(event),event.timeStamp/1000,text,text?text.toLowerCase():undefined,event.keyIdentifier,event.keyCode,event.keyCode,undefined,false,false,false);event.consume();this._canvasElement.focus();},_handleContextMenuEvent:function(event)
8812 {event.consume(true);},_simulateTouchGestureForMouseEvent:function(event)
8813 {var position=this._convertIntoScreenSpace(event);var timeStamp=event.timeStamp/1000;var x=position.x;var y=position.y;switch(event.which){case 1:if(event.type==="mousedown"){InputAgent.dispatchGestureEvent("scrollBegin",x,y,timeStamp);}else if(event.type==="mousemove"){var dx=this._lastScrollPosition?position.x-this._lastScrollPosition.x:0;var dy=this._lastScrollPosition?position.y-this._lastScrollPosition.y:0;if(dx||dy)
8814 InputAgent.dispatchGestureEvent("scrollUpdate",x,y,timeStamp,dx,dy);}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("scrollEnd",x,y,timeStamp);}else if(event.type==="mousewheel"){if(event.altKey){var factor=1.1;var scale=event.wheelDeltaY<0?1/factor:factor;InputAgent.dispatchGestureEvent("pinchBegin",x,y,timeStamp);InputAgent.dispatchGestureEvent("pinchUpdate",x,y,timeStamp,0,0,scale);InputAgent.dispatchGestureEvent("pinchEnd",x,y,timeStamp);}else{InputAgent.dispatchGestureEvent("scrollBegin",x,y,timeStamp);InputAgent.dispatchGestureEvent("scrollUpdate",x,y,timeStamp,event.wheelDeltaX,event.wheelDeltaY);InputAgent.dispatchGestureEvent("scrollEnd",x,y,timeStamp);}}else if(event.type==="click"){InputAgent.dispatchMouseEvent("mousePressed",x,y,0,timeStamp,"left",1,true);InputAgent.dispatchMouseEvent("mouseReleased",x,y,0,timeStamp,"left",1,true);}
8815 this._lastScrollPosition=position;break;case 2:if(event.type==="mousedown"){InputAgent.dispatchGestureEvent("tapDown",x,y,timeStamp);}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("tap",x,y,timeStamp);}
8816 break;case 3:if(event.type==="mousedown"){this._pinchStart=position;InputAgent.dispatchGestureEvent("pinchBegin",x,y,timeStamp);}else if(event.type==="mousemove"){var dx=this._pinchStart?position.x-this._pinchStart.x:0;var dy=this._pinchStart?position.y-this._pinchStart.y:0;if(dx||dy){var scale=Math.pow(dy<0?0.999:1.001,Math.abs(dy));InputAgent.dispatchGestureEvent("pinchUpdate",this._pinchStart.x,this._pinchStart.y,timeStamp,0,0,scale);}}else if(event.type==="mouseup"){InputAgent.dispatchGestureEvent("pinchEnd",x,y,timeStamp);}
8817 break;case 0:default:}},_convertIntoScreenSpace:function(event)
8818 {var zoom=this._canvasElement.offsetWidth/this._viewport.width/this._pageScaleFactor;var position={};position.x=Math.round(event.offsetX/zoom);position.y=Math.round(event.offsetY/zoom-this._screenOffsetTop);return position;},_modifiersForEvent:function(event)
8819 {var modifiers=0;if(event.altKey)
8820 modifiers=1;if(event.ctrlKey)
8821 modifiers+=2;if(event.metaKey)
8822 modifiers+=4;if(event.shiftKey)
8823 modifiers+=8;return modifiers;},onResize:function()
8824 {if(this._deferredCasting){clearTimeout(this._deferredCasting);delete this._deferredCasting;}
8825 this._stopCasting();this._deferredCasting=setTimeout(this._startCasting.bind(this),100);},highlightDOMNode:function(nodeId,config,objectId)
8826 {this._highlightNodeId=nodeId;this._highlightConfig=config;if(!nodeId){this._model=null;this._config=null;this._node=null;this._titleElement.classList.add("hidden");this._repaint();return;}
8827 this._node=WebInspector.domModel.nodeForId(nodeId);DOMAgent.getBoxModel(nodeId,callback.bind(this));function callback(error,model)
8828 {if(error){this._repaint();return;}
8829 this._model=this._scaleModel(model);this._config=config;this._repaint();}},_scaleModel:function(model)
8830 {var scale=this._canvasElement.offsetWidth/this._viewport.width;function scaleQuad(quad)
8831 {for(var i=0;i<quad.length;i+=2){quad[i]=(quad[i]-this._viewport.x)*scale;quad[i+1]=(quad[i+1]-this._viewport.y)*scale+this._screenOffsetTop*this._screenZoom;}}
8832 scaleQuad.call(this,model.content);scaleQuad.call(this,model.padding);scaleQuad.call(this,model.border);scaleQuad.call(this,model.margin);return model;},_repaint:function()
8833 {var model=this._model;var config=this._config;this._canvasElement.width=window.devicePixelRatio*this._canvasElement.offsetWidth;this._canvasElement.height=window.devicePixelRatio*this._canvasElement.offsetHeight;this._context.save();this._context.scale(window.devicePixelRatio,window.devicePixelRatio);this._context.save();this._context.fillStyle=this._checkerboardPattern;this._context.fillRect(0,0,this._canvasElement.offsetWidth,this._screenOffsetTop*this._screenZoom);this._context.fillRect(0,this._screenOffsetTop*this._screenZoom+this._imageElement.naturalHeight*this._imageZoom,this._canvasElement.offsetWidth,this._canvasElement.offsetHeight);this._context.restore();if(model&&config){this._context.save();const transparentColor="rgba(0, 0, 0, 0)";var hasContent=model.content&&config.contentColor!==transparentColor;var hasPadding=model.padding&&config.paddingColor!==transparentColor;var hasBorder=model.border&&config.borderColor!==transparentColor;var hasMargin=model.margin&&config.marginColor!==transparentColor;var clipQuad;if(hasMargin&&(!hasBorder||!this._quadsAreEqual(model.margin,model.border))){this._drawOutlinedQuadWithClip(model.margin,model.border,config.marginColor);clipQuad=model.border;}
8834 if(hasBorder&&(!hasPadding||!this._quadsAreEqual(model.border,model.padding))){this._drawOutlinedQuadWithClip(model.border,model.padding,config.borderColor);clipQuad=model.padding;}
8835 if(hasPadding&&(!hasContent||!this._quadsAreEqual(model.padding,model.content))){this._drawOutlinedQuadWithClip(model.padding,model.content,config.paddingColor);clipQuad=model.content;}
8836 if(hasContent)
8837 this._drawOutlinedQuad(model.content,config.contentColor);this._context.restore();this._drawElementTitle();this._context.globalCompositeOperation="destination-over";}
8838 this._context.drawImage(this._imageElement,0,this._screenOffsetTop*this._screenZoom,this._imageElement.naturalWidth*this._imageZoom,this._imageElement.naturalHeight*this._imageZoom);this._context.restore();},_quadsAreEqual:function(quad1,quad2)
8839 {for(var i=0;i<quad1.length;++i){if(quad1[i]!==quad2[i])
8840 return false;}
8841 return true;},_cssColor:function(color)
8842 {if(!color)
8843 return"transparent";return WebInspector.Color.fromRGBA([color.r,color.g,color.b,color.a]).toString(WebInspector.Color.Format.RGBA)||"";},_quadToPath:function(quad)
8844 {this._context.beginPath();this._context.moveTo(quad[0],quad[1]);this._context.lineTo(quad[2],quad[3]);this._context.lineTo(quad[4],quad[5]);this._context.lineTo(quad[6],quad[7]);this._context.closePath();return this._context;},_drawOutlinedQuad:function(quad,fillColor)
8845 {this._context.save();this._context.lineWidth=2;this._quadToPath(quad).clip();this._context.fillStyle=this._cssColor(fillColor);this._context.fill();this._context.restore();},_drawOutlinedQuadWithClip:function(quad,clipQuad,fillColor)
8846 {this._context.fillStyle=this._cssColor(fillColor);this._context.save();this._context.lineWidth=0;this._quadToPath(quad).fill();this._context.globalCompositeOperation="destination-out";this._context.fillStyle="red";this._quadToPath(clipQuad).fill();this._context.restore();},_drawElementTitle:function()
8847 {if(!this._node)
8848 return;var canvasWidth=this._canvasElement.offsetWidth;var canvasHeight=this._canvasElement.offsetHeight;var lowerCaseName=this._node.localName()||this._node.nodeName().toLowerCase();this._tagNameElement.textContent=lowerCaseName;this._nodeIdElement.textContent=this._node.getAttribute("id")?"#"+this._node.getAttribute("id"):"";this._nodeIdElement.textContent=this._node.getAttribute("id")?"#"+this._node.getAttribute("id"):"";var className=this._node.getAttribute("class");if(className&&className.length>50)
8849 className=className.substring(0,50)+"\u2026";this._classNameElement.textContent=className||"";this._nodeWidthElement.textContent=this._model.width;this._nodeHeightElement.textContent=this._model.height;var marginQuad=this._model.margin;var titleWidth=this._titleElement.offsetWidth+6;var titleHeight=this._titleElement.offsetHeight+4;var anchorTop=this._model.margin[1];var anchorBottom=this._model.margin[7];const arrowHeight=7;var renderArrowUp=false;var renderArrowDown=false;var boxX=Math.max(2,this._model.margin[0]);if(boxX+titleWidth>canvasWidth)
8850 boxX=canvasWidth-titleWidth-2;var boxY;if(anchorTop>canvasHeight){boxY=canvasHeight-titleHeight-arrowHeight;renderArrowDown=true;}else if(anchorBottom<0){boxY=arrowHeight;renderArrowUp=true;}else if(anchorBottom+titleHeight+arrowHeight<canvasHeight){boxY=anchorBottom+arrowHeight-4;renderArrowUp=true;}else if(anchorTop-titleHeight-arrowHeight>0){boxY=anchorTop-titleHeight-arrowHeight+3;renderArrowDown=true;}else
8851 boxY=arrowHeight;this._context.save();this._context.translate(0.5,0.5);this._context.beginPath();this._context.moveTo(boxX,boxY);if(renderArrowUp){this._context.lineTo(boxX+2*arrowHeight,boxY);this._context.lineTo(boxX+3*arrowHeight,boxY-arrowHeight);this._context.lineTo(boxX+4*arrowHeight,boxY);}
8852 this._context.lineTo(boxX+titleWidth,boxY);this._context.lineTo(boxX+titleWidth,boxY+titleHeight);if(renderArrowDown){this._context.lineTo(boxX+4*arrowHeight,boxY+titleHeight);this._context.lineTo(boxX+3*arrowHeight,boxY+titleHeight+arrowHeight);this._context.lineTo(boxX+2*arrowHeight,boxY+titleHeight);}
8853 this._context.lineTo(boxX,boxY+titleHeight);this._context.closePath();this._context.fillStyle="rgb(255, 255, 194)";this._context.fill();this._context.strokeStyle="rgb(128, 128, 128)";this._context.stroke();this._context.restore();this._titleElement.classList.remove("hidden");this._titleElement.style.top=(boxY+3)+"px";this._titleElement.style.left=(boxX+3)+"px";},_viewportDimensions:function()
8854 {const gutterSize=30;const bordersSize=WebInspector.ScreencastView._bordersSize;return{width:this.element.offsetWidth-bordersSize-gutterSize,height:this.element.offsetHeight-bordersSize-gutterSize-WebInspector.ScreencastView._navBarHeight};},setInspectModeEnabled:function(enabled,inspectUAShadowDOM,config,callback)
8855 {this._inspectModeConfig=enabled?config:null;if(callback)
8856 callback(null);},_createCheckerboardPattern:function(context)
8857 {var pattern=(document.createElement("canvas"));const size=32;pattern.width=size*2;pattern.height=size*2;var pctx=pattern.getContext("2d");pctx.fillStyle="rgb(195, 195, 195)";pctx.fillRect(0,0,size*2,size*2);pctx.fillStyle="rgb(225, 225, 225)";pctx.fillRect(0,0,size,size);pctx.fillRect(size,size,size,size);return context.createPattern(pattern,"repeat");},_createNavigationBar:function()
8858 {this._navigationBar=this.element.createChild("div","toolbar-background screencast-navigation");this._navigationBack=this._navigationBar.createChild("button","back");this._navigationBack.disabled=true;this._navigationBack.addEventListener("click",this._navigateToHistoryEntry.bind(this,-1),false);this._navigationForward=this._navigationBar.createChild("button","forward");this._navigationForward.disabled=true;this._navigationForward.addEventListener("click",this._navigateToHistoryEntry.bind(this,1),false);this._navigationReload=this._navigationBar.createChild("button","reload");this._navigationReload.addEventListener("click",this._navigateReload.bind(this),false);this._navigationUrl=this._navigationBar.createChild("input");this._navigationUrl.type="text";this._navigationUrl.addEventListener('keyup',this._navigationUrlKeyUp.bind(this),true);this._navigationProgressBar=new WebInspector.ScreencastView.ProgressTracker(this._navigationBar.createChild("div","progress"));this._requestNavigationHistory();WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.InspectedURLChanged,this._requestNavigationHistory,this);},_navigateToHistoryEntry:function(offset)
8859 {var newIndex=this._historyIndex+offset;if(newIndex<0||newIndex>=this._historyEntries.length)
8860 return;PageAgent.navigateToHistoryEntry(this._historyEntries[newIndex].id);this._requestNavigationHistory();},_navigateReload:function()
8861 {WebInspector.resourceTreeModel.reloadPage();},_navigationUrlKeyUp:function(event)
8862 {if(event.keyIdentifier!='Enter')
8863 return;var url=this._navigationUrl.value;if(!url)
8864 return;if(!url.match(WebInspector.ScreencastView._HttpRegex))
8865 url="http://"+url;PageAgent.navigate(url);this._canvasElement.focus();},_requestNavigationHistory:function()
8866 {PageAgent.getNavigationHistory(this._onNavigationHistory.bind(this));},_onNavigationHistory:function(error,currentIndex,entries)
8867 {if(error)
8868 return;this._historyIndex=currentIndex;this._historyEntries=entries;this._navigationBack.disabled=currentIndex==0;this._navigationForward.disabled=currentIndex==(entries.length-1);var url=entries[currentIndex].url;var match=url.match(WebInspector.ScreencastView._HttpRegex);if(match)
8869 url=match[1];this._navigationUrl.value=url;},_focusNavigationBar:function()
8870 {this._navigationUrl.focus();this._navigationUrl.select();return true;},__proto__:WebInspector.VBox.prototype}
8871 WebInspector.ScreencastView.ProgressTracker=function(element){this._element=element;WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._onMainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._onLoad,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestFinished,this);};WebInspector.ScreencastView.ProgressTracker.prototype={_onMainFrameNavigated:function()
8872 {this._requestIds={};this._startedRequests=0;this._finishedRequests=0;this._maxDisplayedProgress=0;this._updateProgress(0.1);},_onLoad:function()
8873 {delete this._requestIds;this._updateProgress(1);setTimeout(function(){if(!this._navigationProgressVisible())
8874 this._displayProgress(0);}.bind(this),500);},_navigationProgressVisible:function()
8875 {return!!this._requestIds;},_onRequestStarted:function(event)
8876 {if(!this._navigationProgressVisible())
8877 return;var request=(event.data);if(request.type===WebInspector.resourceTypes.WebSocket)
8878 return;this._requestIds[request.requestId]=request;++this._startedRequests;},_onRequestFinished:function(event)
8879 {if(!this._navigationProgressVisible())
8880 return;var request=(event.data);if(!(request.requestId in this._requestIds))
8881 return;++this._finishedRequests;setTimeout(function(){this._updateProgress(this._finishedRequests/this._startedRequests*0.9);}.bind(this),500);},_updateProgress:function(progress)
8882 {if(!this._navigationProgressVisible())
8883 return;if(this._maxDisplayedProgress>=progress)
8884 return;this._maxDisplayedProgress=progress;this._displayProgress(progress);},_displayProgress:function(progress)
8885 {this._element.style.width=(100*progress)+"%";}};WebInspector.ScreencastController=function()
8886 {var rootView=new WebInspector.RootView();this._rootSplitView=new WebInspector.SplitView(false,true,"InspectorView.screencastSplitViewState",300,300);this._rootSplitView.show(rootView.element);WebInspector.inspectorView.show(this._rootSplitView.sidebarElement());this._screencastView=new WebInspector.ScreencastView();this._screencastView.show(this._rootSplitView.mainElement());this._onStatusBarButtonStateChanged("disabled");rootView.attachToBody();this._initialized=false;};WebInspector.ScreencastController.prototype={_onStatusBarButtonStateChanged:function(state)
8887 {if(state==="disabled"){this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(),false);this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResizerElement(),false);this._rootSplitView.hideMain();return;}
8888 this._rootSplitView.setVertical(state==="left");this._rootSplitView.setSecondIsSidebar(true);this._rootSplitView.toggleResizer(this._rootSplitView.resizerElement(),true);this._rootSplitView.toggleResizer(WebInspector.inspectorView.topResizerElement(),state==="top");this._rootSplitView.showBoth();},initialize:function()
8889 {this._screencastView.initialize();this._currentScreencastState=WebInspector.settings.createSetting("currentScreencastState","");this._lastScreencastState=WebInspector.settings.createSetting("lastScreencastState","");this._toggleScreencastButton=new WebInspector.StatusBarStatesSettingButton("screencast-status-bar-item",["disabled","left","top"],[WebInspector.UIString("Disable screencast."),WebInspector.UIString("Switch to portrait screencast."),WebInspector.UIString("Switch to landscape screencast.")],this._currentScreencastState,this._lastScreencastState,this._onStatusBarButtonStateChanged.bind(this));if(this._statusBarPlaceholder){this._statusBarPlaceholder.parentElement.insertBefore(this._toggleScreencastButton.element,this._statusBarPlaceholder);this._statusBarPlaceholder.parentElement.removeChild(this._statusBarPlaceholder);delete this._statusBarPlaceholder;}
8890 this._initialized=true;},statusBarItem:function()
8891 {if(this._initialized)
8892 return this._toggleScreencastButton.element;this._statusBarPlaceholder=document.createElement("div");return this._statusBarPlaceholder;}};if(window.domAutomationController){var ___interactiveUiTestsMode=true;TestSuite=function()
8893 {this.controlTaken_=false;this.timerId_=-1;};TestSuite.prototype.fail=function(message)
8894 {if(this.controlTaken_)
8895 this.reportFailure_(message);else
8896 throw message;};TestSuite.prototype.assertEquals=function(expected,actual,opt_message)
8897 {if(expected!==actual){var message="Expected: '"+expected+"', but was '"+actual+"'";if(opt_message)
8898 message=opt_message+"("+message+")";this.fail(message);}};TestSuite.prototype.assertTrue=function(value,opt_message)
8899 {this.assertEquals(true,!!value,opt_message);};TestSuite.prototype.assertHasKey=function(object,key)
8900 {if(!object.hasOwnProperty(key))
8901 this.fail("Expected object to contain key '"+key+"'");};TestSuite.prototype.assertContains=function(string,substring)
8902 {if(string.indexOf(substring)===-1)
8903 this.fail("Expected to: '"+string+"' to contain '"+substring+"'");};TestSuite.prototype.takeControl=function()
8904 {this.controlTaken_=true;var self=this;this.timerId_=setTimeout(function(){self.reportFailure_("Timeout exceeded: 20 sec");},20000);};TestSuite.prototype.releaseControl=function()
8905 {if(this.timerId_!==-1){clearTimeout(this.timerId_);this.timerId_=-1;}
8906 this.reportOk_();};TestSuite.prototype.reportOk_=function()
8907 {window.domAutomationController.send("[OK]");};TestSuite.prototype.reportFailure_=function(error)
8908 {if(this.timerId_!==-1){clearTimeout(this.timerId_);this.timerId_=-1;}
8909 window.domAutomationController.send("[FAILED] "+error);};TestSuite.prototype.runTest=function(testName)
8910 {try{this[testName]();if(!this.controlTaken_)
8911 this.reportOk_();}catch(e){this.reportFailure_(e);}};TestSuite.prototype.showPanel=function(panelName)
8912 {var button=document.getElementById("tab-"+panelName);button.selectTabForTest();this.assertEquals(WebInspector.panels[panelName],WebInspector.inspectorView.currentPanel());};TestSuite.prototype.addSniffer=function(receiver,methodName,override,opt_sticky)
8913 {var orig=receiver[methodName];if(typeof orig!=="function")
8914 this.fail("Cannot find method to override: "+methodName);var test=this;receiver[methodName]=function(var_args){try{var result=orig.apply(this,arguments);}finally{if(!opt_sticky)
8915 receiver[methodName]=orig;}
8916 try{override.apply(this,arguments);}catch(e){test.fail("Exception in overriden method '"+methodName+"': "+e);}
8917 return result;};};TestSuite.prototype.testShowScriptsTab=function()
8918 {this.showPanel("sources");var test=this;this._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){test.releaseControl();});this.takeControl();};TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh=function()
8919 {var test=this;this.assertEquals(WebInspector.panels.elements,WebInspector.inspectorView.currentPanel(),"Elements panel should be current one.");WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,waitUntilScriptIsParsed);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});function waitUntilScriptIsParsed()
8920 {WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,waitUntilScriptIsParsed);test.showPanel("sources");test._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){test.releaseControl();});}
8921 this.takeControl();};TestSuite.prototype.testContentScriptIsPresent=function()
8922 {this.showPanel("sources");var test=this;test._waitUntilScriptsAreParsed(["page_with_content_script.html","simple_content_script.js"],function(){test.releaseControl();});this.takeControl();};TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch=function()
8923 {var test=this;var expectedScriptsCount=2;var parsedScripts=[];this.showPanel("sources");function switchToElementsTab(){test.showPanel("elements");setTimeout(switchToScriptsTab,0);}
8924 function switchToScriptsTab(){test.showPanel("sources");setTimeout(checkScriptsPanel,0);}
8925 function checkScriptsPanel(){test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]),"Some scripts are missing.");checkNoDuplicates();test.releaseControl();}
8926 function checkNoDuplicates(){var uiSourceCodes=test.nonAnonymousUISourceCodes_();for(var i=0;i<uiSourceCodes.length;i++){var scriptName=uiSourceCodes[i].url;for(var j=i+1;j<uiSourceCodes.length;j++)
8927 test.assertTrue(scriptName!==uiSourceCodes[j].url,"Found script duplicates: "+test.uiSourceCodesToString_(uiSourceCodes));}}
8928 test._waitUntilScriptsAreParsed(["debugger_test_page.html"],function(){checkNoDuplicates();setTimeout(switchToElementsTab,0);});this.takeControl();};TestSuite.prototype.testPauseWhenLoadingDevTools=function()
8929 {this.showPanel("sources");if(WebInspector.debuggerModel.debuggerPausedDetails)
8930 return;this._waitForScriptPause(this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testPauseWhenScriptIsRunning=function()
8931 {this.showPanel("sources");this.evaluateInConsole_('setTimeout("handleClick()" , 0)',didEvaluateInConsole.bind(this));function didEvaluateInConsole(resultText){this.assertTrue(!isNaN(resultText),"Failed to get timer id: "+resultText);setTimeout(testScriptPause.bind(this),300);}
8932 function testScriptPause(){WebInspector.panels.sources._pauseButton.element.click();this._waitForScriptPause(this.releaseControl.bind(this));}
8933 this.takeControl();};TestSuite.prototype.testNetworkSize=function()
8934 {var test=this;function finishResource(resource,finishTime)
8935 {test.assertEquals(219,resource.transferSize,"Incorrect total encoded data length");test.assertEquals(25,resource.resourceSize,"Incorrect total data length");test.releaseControl();}
8936 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testNetworkSyncSize=function()
8937 {var test=this;function finishResource(resource,finishTime)
8938 {test.assertEquals(219,resource.transferSize,"Incorrect total encoded data length");test.assertEquals(25,resource.resourceSize,"Incorrect total data length");test.releaseControl();}
8939 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("var xhr = new XMLHttpRequest(); xhr.open(\"GET\", \"chunked\", false); xhr.send(null);",function(){});this.takeControl();};TestSuite.prototype.testNetworkRawHeadersText=function()
8940 {var test=this;function finishResource(resource,finishTime)
8941 {if(!resource.responseHeadersText)
8942 test.fail("Failure: resource does not have response headers text");test.assertEquals(164,resource.responseHeadersText.length,"Incorrect response headers text length");test.releaseControl();}
8943 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testNetworkTiming=function()
8944 {var test=this;function finishResource(resource,finishTime)
8945 {test.assertTrue(resource.timing.receiveHeadersEnd-resource.timing.connectStart>=70,"Time between receiveHeadersEnd and connectStart should be >=70ms, but was "+"receiveHeadersEnd="+resource.timing.receiveHeadersEnd+", connectStart="+resource.timing.connectStart+".");test.assertTrue(resource.responseReceivedTime-resource.startTime>=0.07,"Time between responseReceivedTime and startTime should be >=0.07s, but was "+"responseReceivedTime="+resource.responseReceivedTime+", startTime="+resource.startTime+".");test.assertTrue(resource.endTime-resource.startTime>=0.14,"Time between endTime and startTime should be >=0.14s, but was "+"endtime="+resource.endTime+", startTime="+resource.startTime+".");test.releaseControl();}
8946 this.addSniffer(WebInspector.NetworkDispatcher.prototype,"_finishNetworkRequest",finishResource);test.evaluateInConsole_("window.location.reload(true);",function(resultText){});this.takeControl();};TestSuite.prototype.testConsoleOnNavigateBack=function()
8947 {if(WebInspector.console.messages.length===1)
8948 firstConsoleMessageReceived.call(this);else
8949 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,firstConsoleMessageReceived,this);function firstConsoleMessageReceived(){WebInspector.console.removeEventListener(WebInspector.ConsoleModel.Events.MessageAdded,firstConsoleMessageReceived,this);this.evaluateInConsole_("clickLink();",didClickLink.bind(this));}
8950 function didClickLink(){this.assertEquals(3,WebInspector.console.messages.length);this.evaluateInConsole_("history.back();",didNavigateBack.bind(this));}
8951 function didNavigateBack()
8952 {this.evaluateInConsole_("void 0;",didCompleteNavigation.bind(this));}
8953 function didCompleteNavigation(){this.assertEquals(7,WebInspector.console.messages.length);this.releaseControl();}
8954 this.takeControl();};TestSuite.prototype.testReattachAfterCrash=function()
8955 {this.evaluateInConsole_("1+1;",this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testSharedWorker=function()
8956 {function didEvaluateInConsole(resultText){this.assertEquals("2011",resultText);this.releaseControl();}
8957 this.evaluateInConsole_("globalVar",didEvaluateInConsole.bind(this));this.takeControl();};TestSuite.prototype.testPauseInSharedWorkerInitialization=function()
8958 {if(WebInspector.debuggerModel.debuggerPausedDetails)
8959 return;this._waitForScriptPause(this.releaseControl.bind(this));this.takeControl();};TestSuite.prototype.testTimelineFrames=function()
8960 {var test=this;function step1()
8961 {test.recordTimeline(onTimelineRecorded);test.evaluateInConsole_("runTest()",function(){});}
8962 function onTimelineRecorded(records)
8963 {var frameCount=0;var recordsInFrame={};for(var i=0;i<records.length;++i){var record=records[i];if(record.type!=="BeginFrame"){recordsInFrame[record.type]=(recordsInFrame[record.type]||0)+1;continue;}
8964 if(!frameCount++)
8965 continue;test.assertHasKey(recordsInFrame,"FireAnimationFrame");test.assertHasKey(recordsInFrame,"Layout");test.assertHasKey(recordsInFrame,"RecalculateStyles");test.assertHasKey(recordsInFrame,"Paint");recordsInFrame={};}
8966 test.assertTrue(frameCount>=5,"Not enough frames");test.releaseControl();}
8967 step1();test.takeControl();}
8968 TestSuite.prototype.testPageOverlayUpdate=function()
8969 {var test=this;WebInspector.inspectorView.panel("elements");function populatePage()
8970 {var div1=document.createElement("div");div1.id="div1";div1.style.webkitTransform="translateZ(0)";document.body.appendChild(div1);var div2=document.createElement("div");div2.id="div2";document.body.appendChild(div2);}
8971 function step1()
8972 {test.evaluateInConsole_(populatePage.toString()+"; populatePage();"+"inspect(document.getElementById('div1'))",function(){});WebInspector.notifications.addEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged,step2);}
8973 function step2()
8974 {WebInspector.notifications.removeEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged,step2);test.recordTimeline(onTimelineRecorded);setTimeout(step3,500);}
8975 function step3()
8976 {test.evaluateInConsole_("inspect(document.getElementById('div2'))",function(){});WebInspector.notifications.addEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged,step4);}
8977 function step4()
8978 {WebInspector.notifications.removeEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged,step4);test.stopTimeline();}
8979 function onTimelineRecorded(records)
8980 {var types={};for(var i=0;i<records.length;++i)
8981 types[records[i].type]=(types[records[i].type]||0)+1;var frameCount=types["BeginFrame"];test.assertTrue(frameCount>=2,"Not enough DevTools overlay updates");test.assertTrue(frameCount<6,"Too many updates caused by DevTools overlay");test.releaseControl();}
8982 step1();this.takeControl();}
8983 TestSuite.prototype.recordTimeline=function(callback)
8984 {var records=[];var dispatchOnRecordType={}
8985 WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,addRecord);WebInspector.timelineManager.start();function addRecord(event)
8986 {innerAddRecord(event.data);}
8987 function innerAddRecord(record)
8988 {records.push(record);if(record.type==="TimeStamp"&&record.data.message==="ready")
8989 done();if(record.children)
8990 record.children.forEach(innerAddRecord);}
8991 function done()
8992 {WebInspector.timelineManager.stop();WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded,addRecord);callback(records);}}
8993 TestSuite.prototype.stopTimeline=function()
8994 {this.evaluateInConsole_("console.timeStamp('ready')",function(){});}
8995 TestSuite.prototype.waitForTestResultsInConsole=function()
8996 {var messages=WebInspector.console.messages;for(var i=0;i<messages.length;++i){var text=messages[i].messageText;if(text==="PASS")
8997 return;else if(/^FAIL/.test(text))
8998 this.fail(text);}
8999 function onConsoleMessage(event)
9000 {var text=event.data.messageText;if(text==="PASS")
9001 this.releaseControl();else if(/^FAIL/.test(text))
9002 this.fail(text);}
9003 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,onConsoleMessage,this);this.takeControl();};TestSuite.prototype.checkLogAndErrorMessages=function()
9004 {var messages=WebInspector.console.messages;var matchesCount=0;function validMessage(message)
9005 {if(message.text==="log"&&message.level===WebInspector.ConsoleMessage.MessageLevel.Log){++matchesCount;return true;}
9006 if(message.text==="error"&&message.level===WebInspector.ConsoleMessage.MessageLevel.Error){++matchesCount;return true;}
9007 return false;}
9008 for(var i=0;i<messages.length;++i){if(validMessage(messages[i]))
9009 continue;this.fail(messages[i].text+":"+messages[i].level);}
9010 if(matchesCount===2)
9011 return;function onConsoleMessage(event)
9012 {var message=event.data;if(validMessage(message)){if(matchesCount===2){this.releaseControl();return;}}else
9013 this.fail(message.text+":"+messages[i].level);}
9014 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded,onConsoleMessage,this);this.takeControl();};TestSuite.prototype.uiSourceCodesToString_=function(uiSourceCodes)
9015 {var names=[];for(var i=0;i<uiSourceCodes.length;i++)
9016 names.push('"'+uiSourceCodes[i].url+'"');return names.join(",");};TestSuite.prototype.nonAnonymousUISourceCodes_=function()
9017 {function filterOutAnonymous(uiSourceCode)
9018 {return!!uiSourceCode.url;}
9019 function filterOutService(uiSourceCode)
9020 {return!uiSourceCode.project().isServiceProject();}
9021 var uiSourceCodes=WebInspector.workspace.uiSourceCodes();uiSourceCodes=uiSourceCodes.filter(filterOutService);return uiSourceCodes.filter(filterOutAnonymous);};TestSuite.prototype.evaluateInConsole_=function(code,callback)
9022 {WebInspector.console.show();var consoleView=WebInspector.ConsolePanel._view();consoleView.prompt.text=code;consoleView.promptElement.dispatchEvent(TestSuite.createKeyEvent("Enter"));this.addSniffer(WebInspector.ConsoleView.prototype,"_showConsoleMessage",function(viewMessage){callback(viewMessage.toMessageElement().textContent);}.bind(this));};TestSuite.prototype._scriptsAreParsed=function(expected)
9023 {var uiSourceCodes=this.nonAnonymousUISourceCodes_();var missing=expected.slice(0);for(var i=0;i<uiSourceCodes.length;++i){for(var j=0;j<missing.length;++j){if(uiSourceCodes[i].name().search(missing[j])!==-1){missing.splice(j,1);break;}}}
9024 return missing.length===0;};TestSuite.prototype._waitForScriptPause=function(callback)
9025 {function pauseListener(event){WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,pauseListener,this);callback();}
9026 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused,pauseListener,this);};TestSuite.prototype._executeCodeWhenScriptsAreParsed=function(code,expectedScripts)
9027 {var test=this;function executeFunctionInInspectedPage(){test.evaluateInConsole_('setTimeout("'+code+'" , 0)',function(resultText){test.assertTrue(!isNaN(resultText),"Failed to get timer id: "+resultText+". Code: "+code);});}
9028 test._waitUntilScriptsAreParsed(expectedScripts,executeFunctionInInspectedPage);};TestSuite.prototype._waitUntilScriptsAreParsed=function(expectedScripts,callback)
9029 {var test=this;function waitForAllScripts(){if(test._scriptsAreParsed(expectedScripts))
9030 callback();else
9031 test.addSniffer(WebInspector.panels.sources.sourcesView(),"_addUISourceCode",waitForAllScripts);}
9032 waitForAllScripts();};TestSuite.createKeyEvent=function(keyIdentifier)
9033 {var evt=document.createEvent("KeyboardEvent");evt.initKeyboardEvent("keydown",true,true,null,keyIdentifier,"");return evt;};var uiTests={};uiTests.runAllTests=function()
9034 {for(var name in TestSuite.prototype){if(name.substring(0,4)==="test"&&typeof TestSuite.prototype[name]==="function")
9035 uiTests.runTest(name);}};uiTests.runTest=function(name)
9036 {if(uiTests._populatedInterface)
9037 new TestSuite().runTest(name);else
9038 uiTests._pendingTestName=name;};(function(){function runTests()
9039 {uiTests._populatedInterface=true;var name=uiTests._pendingTestName;delete uiTests._pendingTestName;if(name)
9040 new TestSuite().runTest(name);}
9041 var oldLoadCompleted=InspectorFrontendAPI.loadCompleted;InspectorFrontendAPI.loadCompleted=function()
9042 {oldLoadCompleted.call(InspectorFrontendAPI);runTests();}})();}
9043 WebInspector.FlameChartDelegate=function(){}
9044 WebInspector.FlameChartDelegate.prototype={requestWindowTimes:function(startTime,endTime){},}
9045 WebInspector.FlameChart=function(dataProvider,flameChartDelegate,isTopDown,timeBasedWindow)
9046 {WebInspector.HBox.call(this);this.element.classList.add("flame-chart-main-pane");this._flameChartDelegate=flameChartDelegate;this._isTopDown=isTopDown;this._timeBasedWindow=timeBasedWindow;this._calculator=new WebInspector.FlameChart.Calculator();this._canvas=this.element.createChild("canvas");this._canvas.addEventListener("mousemove",this._onMouseMove.bind(this));this._canvas.addEventListener("mousewheel",this._onMouseWheel.bind(this),false);this._canvas.addEventListener("click",this._onClick.bind(this),false);WebInspector.installDragHandle(this._canvas,this._startCanvasDragging.bind(this),this._canvasDragging.bind(this),this._endCanvasDragging.bind(this),"move",null);this._vScrollElement=this.element.createChild("div","flame-chart-v-scroll");this._vScrollContent=this._vScrollElement.createChild("div");this._vScrollElement.addEventListener("scroll",this._scheduleUpdate.bind(this),false);this._entryInfo=this.element.createChild("div","profile-entry-info");this._highlightElement=this.element.createChild("div","flame-chart-highlight-element");this._selectedElement=this.element.createChild("div","flame-chart-selected-element");this._dataProvider=dataProvider;this._windowLeft=0.0;this._windowRight=1.0;this._windowWidth=1.0;this._timeWindowLeft=0;this._timeWindowRight=Infinity;this._barHeight=dataProvider.barHeight();this._barHeightDelta=this._isTopDown?-this._barHeight:this._barHeight;this._minWidth=1;this._paddingLeft=this._dataProvider.paddingLeft();this._highlightedEntryIndex=-1;this._selectedEntryIndex=-1;this._textWidth={};}
9047 WebInspector.FlameChart.DividersBarHeight=20;WebInspector.FlameChartDataProvider=function()
9048 {}
9049 WebInspector.FlameChart.TimelineData;WebInspector.FlameChartDataProvider.prototype={barHeight:function(){},dividerOffsets:function(startTime,endTime){},zeroTime:function(){},totalTime:function(){},maxStackDepth:function(){},timelineData:function(){},prepareHighlightedEntryInfo:function(entryIndex){},canJumpToEntry:function(entryIndex){},entryTitle:function(entryIndex){},entryFont:function(entryIndex){},entryColor:function(entryIndex){},decorateEntry:function(entryIndex,context,text,barX,barY,barWidth,barHeight,offsetToPosition){},forceDecoration:function(entryIndex){},textColor:function(entryIndex){},textBaseline:function(){},textPadding:function(){},highlightTimeRange:function(entryIndex){},paddingLeft:function(){}}
9050 WebInspector.FlameChart.Events={EntrySelected:"EntrySelected"}
9051 WebInspector.FlameChart.Calculator=function()
9052 {this._paddingLeft=0;}
9053 WebInspector.FlameChart.Calculator.prototype={paddingLeft:function()
9054 {return this._paddingLeft;},_updateBoundaries:function(mainPane)
9055 {this._totalTime=mainPane._dataProvider.totalTime();this._zeroTime=mainPane._dataProvider.zeroTime();this._minimumBoundaries=this._zeroTime+mainPane._windowLeft*this._totalTime;this._maximumBoundaries=this._zeroTime+mainPane._windowRight*this._totalTime;this._paddingLeft=mainPane._paddingLeft;this._width=mainPane._canvas.width/window.devicePixelRatio-this._paddingLeft;this._timeToPixel=this._width/this.boundarySpan();},computePosition:function(time)
9056 {return Math.round((time-this._minimumBoundaries)*this._timeToPixel+this._paddingLeft);},formatTime:function(value,precision)
9057 {return Number.preciseMillisToString(value-this._zeroTime,precision);},maximumBoundary:function()
9058 {return this._maximumBoundaries;},minimumBoundary:function()
9059 {return this._minimumBoundaries;},zeroTime:function()
9060 {return this._zeroTime;},boundarySpan:function()
9061 {return this._maximumBoundaries-this._minimumBoundaries;}}
9062 WebInspector.FlameChart.prototype={_resetCanvas:function()
9063 {var ratio=window.devicePixelRatio;this._canvas.width=this._offsetWidth*ratio;this._canvas.height=this._offsetHeight*ratio;},_timelineData:function()
9064 {return this._dataProvider.timelineData();},changeWindow:function(windowLeft,windowRight)
9065 {console.assert(!this._timeBasedWindow);this._windowLeft=windowLeft;this._windowRight=windowRight;this._windowWidth=this._windowRight-this._windowLeft;this._scheduleUpdate();},setWindowTimes:function(startTime,endTime)
9066 {console.assert(this._timeBasedWindow);this._timeWindowLeft=startTime;this._timeWindowRight=endTime;this._scheduleUpdate();},_startCanvasDragging:function(event)
9067 {if(!this._timelineData())
9068 return false;this._isDragging=true;this._maxDragOffset=0;this._dragStartPointX=event.pageX;this._dragStartPointY=event.pageY;this._dragStartScrollTop=this._vScrollElement.scrollTop;this._dragStartWindowLeft=this._timeWindowLeft;this._dragStartWindowRight=this._timeWindowRight;this._canvas.style.cursor="";return true;},_canvasDragging:function(event)
9069 {var pixelShift=this._dragStartPointX-event.pageX;var pixelScroll=this._dragStartPointY-event.pageY;this._vScrollElement.scrollTop=this._dragStartScrollTop+pixelScroll;var windowShift=pixelShift/this._totalPixels;var windowTime=this._windowWidth*this._totalTime;var timeShift=windowTime*pixelShift/this._pixelWindowWidth;timeShift=Number.constrain(timeShift,this._zeroTime-this._dragStartWindowLeft,this._zeroTime+this._totalTime-this._dragStartWindowRight);var windowLeft=this._dragStartWindowLeft+timeShift;var windowRight=this._dragStartWindowRight+timeShift;this._flameChartDelegate.requestWindowTimes(windowLeft,windowRight);this._maxDragOffset=Math.max(this._maxDragOffset,Math.abs(pixelShift));},_endCanvasDragging:function()
9070 {this._isDragging=false;},_onMouseMove:function(event)
9071 {if(this._isDragging)
9072 return;var entryIndex=this._coordinatesToEntryIndex(event.offsetX,event.offsetY);if(this._highlightedEntryIndex===entryIndex)
9073 return;if(entryIndex===-1||!this._dataProvider.canJumpToEntry(entryIndex))
9074 this._canvas.style.cursor="default";else
9075 this._canvas.style.cursor="pointer";this._highlightedEntryIndex=entryIndex;this._updateElementPosition(this._highlightElement,this._highlightedEntryIndex);this._entryInfo.removeChildren();if(this._highlightedEntryIndex===-1)
9076 return;if(!this._isDragging){var entryInfo=this._dataProvider.prepareHighlightedEntryInfo(this._highlightedEntryIndex);if(entryInfo)
9077 this._entryInfo.appendChild(this._buildEntryInfo(entryInfo));}},_onClick:function()
9078 {const clickThreshold=5;if(this._maxDragOffset>clickThreshold)
9079 return;if(this._highlightedEntryIndex===-1)
9080 return;this.dispatchEventToListeners(WebInspector.FlameChart.Events.EntrySelected,this._highlightedEntryIndex);},_onMouseWheel:function(e)
9081 {var windowLeft=this._timeWindowLeft?this._timeWindowLeft:this._dataProvider.zeroTime();var windowRight=this._timeWindowRight!==Infinity?this._timeWindowRight:this._dataProvider.zeroTime()+this._dataProvider.totalTime();if(e.wheelDeltaY){if(!e.altKey){const mouseWheelZoomSpeed=1/120;var zoom=Math.pow(1.2,-e.wheelDeltaY*mouseWheelZoomSpeed)-1;var cursorTime=this._cursorTime(e.offsetX);windowLeft+=(windowLeft-cursorTime)*zoom;windowRight+=(windowRight-cursorTime)*zoom;}else{this._vScrollElement.scrollTop-=e.wheelDeltaY/120*this._offsetHeight/8;}}else{var shift=e.wheelDeltaX*this._pixelToTime;shift=Number.constrain(shift,this._zeroTime-windowLeft,this._totalTime+this._zeroTime-windowRight);windowLeft+=shift;windowRight+=shift;}
9082 windowLeft=Number.constrain(windowLeft,this._zeroTime,this._totalTime+this._zeroTime);windowRight=Number.constrain(windowRight,this._zeroTime,this._totalTime+this._zeroTime);this._flameChartDelegate.requestWindowTimes(windowLeft,windowRight);},_cursorTime:function(x)
9083 {return(x+this._pixelWindowLeft-this._paddingLeft)*this._pixelToTime+this._zeroTime;},_coordinatesToEntryIndex:function(x,y)
9084 {y+=this._scrollTop;var timelineData=this._timelineData();if(!timelineData)
9085 return-1;var cursorTimeOffset=this._cursorTime(x)-this._zeroTime;var cursorLevel=this._isTopDown?Math.floor((y-WebInspector.FlameChart.DividersBarHeight)/this._barHeight):Math.floor((this._canvas.height/window.devicePixelRatio-y)/this._barHeight);var entryOffsets=timelineData.entryOffsets;var entryTotalTimes=timelineData.entryTotalTimes;var entryLevels=timelineData.entryLevels;var length=entryOffsets.length;for(var i=0;i<length;++i){var entryLevel=entryLevels[i];if(cursorLevel!==entryLevel)
9086 continue;if(cursorTimeOffset<entryOffsets[i])
9087 return-1;if(cursorTimeOffset<(entryOffsets[i]+entryTotalTimes[i]))
9088 return i;}
9089 return-1;},draw:function(width,height)
9090 {var timelineData=this._timelineData();if(!timelineData)
9091 return;var context=this._canvas.getContext("2d");context.save();var ratio=window.devicePixelRatio;context.scale(ratio,ratio);var timeWindowRight=this._timeWindowRight-this._zeroTime;var timeWindowLeft=this._timeWindowLeft-this._zeroTime;var timeToPixel=this._timeToPixel;var pixelWindowLeft=this._pixelWindowLeft;var paddingLeft=this._paddingLeft;var minWidth=this._minWidth;var entryTotalTimes=timelineData.entryTotalTimes;var entryOffsets=timelineData.entryOffsets;var entryLevels=timelineData.entryLevels;var titleIndexes=new Uint32Array(timelineData.entryTotalTimes);var lastTitleIndex=0;var textPadding=this._dataProvider.textPadding();this._minTextWidth=2*textPadding+this._measureWidth(context,"\u2026");var minTextWidth=this._minTextWidth;var lastDrawOffset=new Int32Array(this._dataProvider.maxStackDepth());for(var i=0;i<lastDrawOffset.length;++i)
9092 lastDrawOffset[i]=-1;var barHeight=this._barHeight;var offsetToPosition=this._offsetToPosition.bind(this);var textBaseHeight=this._baseHeight+barHeight-this._dataProvider.textBaseline();var colorBuckets={};var minVisibleBarLevel=Math.max(0,Math.floor((this._scrollTop-this._baseHeight)/barHeight));var maxVisibleBarLevel=Math.min(this._dataProvider.maxStackDepth(),Math.ceil((height+this._scrollTop)/barHeight));var visibleBarsCount=maxVisibleBarLevel-minVisibleBarLevel+1;context.translate(0,-this._scrollTop);var levelsCompleted=0;var lastEntryOnLevelPainted=[];for(var i=0;i<visibleBarsCount;++i)
9093 lastEntryOnLevelPainted[i]=false;for(var entryIndex=0;levelsCompleted<visibleBarsCount&&entryIndex<entryOffsets.length;++entryIndex){var barLevel=entryLevels[entryIndex];if(barLevel<minVisibleBarLevel||barLevel>maxVisibleBarLevel||lastEntryOnLevelPainted[barLevel-minVisibleBarLevel])
9094 continue;var entryOffset=entryOffsets[entryIndex];if(entryOffset>timeWindowRight){lastEntryOnLevelPainted[barLevel-minVisibleBarLevel]=true;levelsCompleted++;continue;}
9095 var entryOffsetRight=entryOffset+entryTotalTimes[entryIndex];if(entryOffsetRight<timeWindowLeft)
9096 continue;var barRight=this._offsetToPosition(entryOffsetRight);if(barRight<=lastDrawOffset[barLevel])
9097 continue;var barX=Math.max(this._offsetToPosition(entryOffset),lastDrawOffset[barLevel]);lastDrawOffset[barLevel]=barRight;var barWidth=barRight-barX;var color=this._dataProvider.entryColor(entryIndex);var bucket=colorBuckets[color];if(!bucket){bucket=[];colorBuckets[color]=bucket;}
9098 bucket.push(entryIndex);}
9099 var colors=Object.keys(colorBuckets);for(var c=0;c<colors.length;++c){var color=colors[c];context.fillStyle=color;context.strokeStyle=color;var indexes=colorBuckets[color];context.beginPath();for(i=0;i<indexes.length;++i){var entryIndex=indexes[i];var entryOffset=entryOffsets[entryIndex];var barX=this._offsetToPosition(entryOffset);var barRight=this._offsetToPosition(entryOffset+entryTotalTimes[entryIndex]);var barWidth=Math.max(barRight-barX,minWidth);var barLevel=entryLevels[entryIndex];var barY=this._levelToHeight(barLevel);context.rect(barX,barY,barWidth,barHeight);if(barWidth>minTextWidth||this._dataProvider.forceDecoration(entryIndex))
9100 titleIndexes[lastTitleIndex++]=entryIndex;}
9101 context.fill();}
9102 context.textBaseline="alphabetic";for(var i=0;i<lastTitleIndex;++i){var entryIndex=titleIndexes[i];var entryOffset=entryOffsets[entryIndex];var barX=this._offsetToPosition(entryOffset);var barRight=this._offsetToPosition(entryOffset+entryTotalTimes[entryIndex]);var barWidth=Math.max(barRight-barX,minWidth);var barLevel=entryLevels[entryIndex];var barY=this._levelToHeight(barLevel);var text=this._dataProvider.entryTitle(entryIndex);if(text&&text.length)
9103 text=this._prepareText(context,text,barWidth-2*textPadding);if(this._dataProvider.decorateEntry(entryIndex,context,text,barX,barY,barWidth,barHeight,offsetToPosition))
9104 continue;if(!text||!text.length)
9105 continue;context.font=this._dataProvider.entryFont(entryIndex);context.fillStyle=this._dataProvider.textColor(entryIndex);context.fillText(text,barX+textPadding,textBaseHeight-barLevel*this._barHeightDelta);}
9106 context.restore();var offsets=this._dataProvider.dividerOffsets(this._calculator.minimumBoundary(),this._calculator.maximumBoundary());if(timelineData.entryOffsets.length)
9107 WebInspector.TimelineGrid.drawCanvasGrid(this._canvas,this._calculator,offsets);this._updateElementPosition(this._highlightElement,this._highlightedEntryIndex);this._updateElementPosition(this._selectedElement,this._selectedEntryIndex);},setSelectedEntry:function(entryIndex)
9108 {this._selectedEntryIndex=entryIndex;this._updateElementPosition(this._selectedElement,this._selectedEntryIndex);},_updateElementPosition:function(element,entryIndex)
9109 {if(element.parentElement)
9110 element.remove();if(entryIndex===-1)
9111 return;var timeRange=this._dataProvider.highlightTimeRange(entryIndex);if(!timeRange)
9112 return;var timelineData=this._timelineData();var barX=this._offsetToPosition(timeRange.startTimeOffset);var barRight=this._offsetToPosition(timeRange.endTimeOffset);if(barRight===0||barX===this._canvas.width)
9113 return;var barWidth=Math.max(barRight-barX,this._minWidth);var barY=this._levelToHeight(timelineData.entryLevels[entryIndex])-this._scrollTop;var style=element.style;style.left=barX+"px";style.top=barY+"px";style.width=barWidth+"px";style.height=this._barHeight+"px";this.element.appendChild(element);},_offsetToPosition:function(offset)
9114 {var value=Math.floor(offset*this._timeToPixel)-this._pixelWindowLeft+this._paddingLeft;return Math.min(this._canvas.width,Math.max(0,value));},_levelToHeight:function(level)
9115 {return this._baseHeight-level*this._barHeightDelta;},_buildEntryInfo:function(entryInfo)
9116 {var infoTable=document.createElement("table");infoTable.className="info-table";for(var i=0;i<entryInfo.length;++i){var row=infoTable.createChild("tr");var titleCell=row.createChild("td");titleCell.textContent=entryInfo[i].title;titleCell.className="title";var textCell=row.createChild("td");textCell.textContent=entryInfo[i].text;}
9117 return infoTable;},_prepareText:function(context,title,maxSize)
9118 {var titleWidth=this._measureWidth(context,title);if(maxSize>titleWidth)
9119 return title;var l=3;var r=title.length;while(l<r){var m=(l+r)>>1;if(this._measureWidth(context,title.trimMiddle(m))<maxSize)
9120 l=m+1;else
9121 r=m;}
9122 title=title.trimMiddle(r-1);titleWidth=this._measureWidth(context,title);if(titleWidth<=maxSize)
9123 return title;if(maxSize>this._measureWidth(context,"\u2026"))
9124 return"\u2026";return"";},_measureWidth:function(context,text)
9125 {if(text.length>20)
9126 return context.measureText(text).width;var width=this._textWidth[text];if(!width){width=context.measureText(text).width;this._textWidth[text]=width;}
9127 return width;},_updateBoundaries:function()
9128 {this._totalTime=this._dataProvider.totalTime();this._zeroTime=this._dataProvider.zeroTime();if(this._timeBasedWindow){if(this._timeWindowRight!==Infinity){this._windowLeft=(this._timeWindowLeft-this._zeroTime)/this._totalTime;this._windowRight=(this._timeWindowRight-this._zeroTime)/this._totalTime;this._windowWidth=this._windowRight-this._windowLeft;}else{this._windowLeft=0;this._windowRight=1;this._windowWidth=1;}}else{this._timeWindowLeft=this._windowLeft*this._totalTime;this._timeWindowRight=this._windowRight*this._totalTime;}
9129 this._pixelWindowWidth=this._offsetWidth-this._paddingLeft;this._totalPixels=Math.floor(this._pixelWindowWidth/this._windowWidth);this._pixelWindowLeft=Math.floor(this._totalPixels*this._windowLeft);this._pixelWindowRight=Math.floor(this._totalPixels*this._windowRight);this._timeToPixel=this._totalPixels/this._totalTime;this._pixelToTime=this._totalTime/this._totalPixels;this._paddingLeftTime=this._paddingLeft/this._timeToPixel;this._baseHeight=this._isTopDown?WebInspector.FlameChart.DividersBarHeight:this._offsetHeight-this._barHeight;var totalHeight=this._levelToHeight(this._dataProvider.maxStackDepth());this._vScrollContent.style.height=totalHeight+"px";this._scrollTop=this._vScrollElement.scrollTop;},onResize:function()
9130 {this._offsetWidth=this.element.offsetWidth-this._vScrollElement.offsetWidth;this._offsetHeight=this.element.offsetHeight;this._canvas.style.width=this._offsetWidth+"px";this._canvas.style.height=this._offsetHeight+"px";this._scheduleUpdate();},_scheduleUpdate:function()
9131 {if(this._updateTimerId)
9132 return;this._updateTimerId=requestAnimationFrame(this.update.bind(this));},update:function()
9133 {this._updateTimerId=0;if(!this._timelineData())
9134 return;this._resetCanvas();this._updateBoundaries();this._calculator._updateBoundaries(this);this.draw(this._offsetWidth,this._offsetHeight);},reset:function()
9135 {this._highlightedEntryIndex=-1;this._selectedEntryIndex=-1;this._textWidth={};this.update();},__proto__:WebInspector.HBox.prototype}
9136 WebInspector.PaintProfilerSnapshot=function(snapshotId)
9137 {this._id=snapshotId;}
9138 WebInspector.PaintProfilerSnapshot.prototype={dispose:function()
9139 {LayerTreeAgent.releaseSnapshot(this._id);},requestImage:function(firstStep,lastStep,callback)
9140 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.replaySnapshot(): ");LayerTreeAgent.replaySnapshot(this._id,firstStep||undefined,lastStep||undefined,wrappedCallback);},profile:function(callback)
9141 {var wrappedCallback=InspectorBackend.wrapClientCallback(callback,"LayerTreeAgent.profileSnapshot(): ");LayerTreeAgent.profileSnapshot(this._id,5,1,wrappedCallback);}};WebInspector.HelpScreenUntilReload=function(title,message)
9142 {WebInspector.HelpScreen.call(this,title);var p=this.contentElement.createChild("p");p.classList.add("help-section");p.textContent=message;WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this.hide,this);}
9143 WebInspector.HelpScreenUntilReload.prototype={willHide:function()
9144 {WebInspector.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared,this.hide,this);WebInspector.HelpScreen.prototype.willHide.call(this);},__proto__:WebInspector.HelpScreen.prototype}
9145 WebInspector.ZoomManager=function()
9146 {this._zoomFactor=InspectorFrontendHost.zoomFactor();window.addEventListener("resize",this._onWindowResize.bind(this),true);};WebInspector.ZoomManager.Events={ZoomChanged:"ZoomChanged"};WebInspector.ZoomManager.prototype={zoomFactor:function()
9147 {return this._zoomFactor;},_onWindowResize:function()
9148 {var oldZoomFactor=this._zoomFactor;this._zoomFactor=InspectorFrontendHost.zoomFactor();if(oldZoomFactor!==this._zoomFactor)
9149 this.dispatchEventToListeners(WebInspector.ZoomManager.Events.ZoomChanged,{from:oldZoomFactor,to:this._zoomFactor});},__proto__:WebInspector.Object.prototype};WebInspector.zoomManager;