This file is indexed.

/usr/share/xul-ext/firexpath/content/bindings.xml is in xul-ext-firexpath 0.9.7-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
<?xml version="1.0"?>
<!DOCTYPE bindings SYSTEM "chrome://firepath/locale/FirePath.dtd">
<!--
	Copyright (C) 2009 - 2010 Pierre Tholence
	
	This file is part of FirePath
	
	FirePath is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.
	
	FirePath is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with FirePath.  If not, see <http://www.gnu.org/licenses/>.
-->
<bindings xmlns="http://www.mozilla.org/xbl"
	xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
	
	<binding id="FirePath-textbox" extends="chrome://global/content/bindings/textbox.xml#textbox">
		<implementation>
			
			<field name="_firePathBar">null</field>
			<property name="firePathBar" readonly="true">
				<getter><![CDATA[
					return this._firePathBar ?
					this._firePathBar : this._firePathBar = document.getBindingParent(this);
				]]></getter>
			</property>
			
			<method name="setStatus">
				<parameter name="status"/>
				<parameter name="info"/>
				<body><![CDATA[
					if(status)
						this.setAttribute("status", status);
					else
						this.removeAttribute("status");
					this.tooltipText = info || "";
				]]></body>
			</method>
			
			<method name="checkSyntax">
				<body><![CDATA[
					if (this.value === "" || this.firePathBar.isValidSelector(this.value)) {
						this.setStatus();
					} else {
						this.setStatus("error", FBL.$STR_XP("invalidSelectorError-" + this.firePathBar.evaluationMode));
					}
				]]></body>
			</method>
			
			<method name="setValue">
				<parameter name="value"/>
				<body><![CDATA[
					this.value = value;
					this.checkSyntax();
				]]></body>
			</method>
		</implementation>
		<handlers>
			<handler event="input"><![CDATA[
				this.checkSyntax();
				this.firePathBar.autoCompleter.reset();
			]]></handler>
			<handler event="keypress"><![CDATA[
				switch (event.keyCode) {
					case KeyEvent.DOM_VK_RETURN:
						this.firePathBar.evaluate();
						break;
					case KeyEvent.DOM_VK_UP:
						this.firePathBar.autoCompleter.complete(Firebug.currentContext, this, true, true);
						this.checkSyntax();
						break;
					case KeyEvent.DOM_VK_TAB:
						event.preventDefault();
					case KeyEvent.DOM_VK_DOWN:
						this.firePathBar.autoCompleter.complete(Firebug.currentContext, this, true, false);
						this.checkSyntax();
						break;
				}
			]]></handler>
		</handlers>
	</binding>
	
	<binding id="FirePathBar" extends="xul:hbox">
		<content>
			<xul:toolbarseparator/>
			<xul:toolbaritem align="center" flex="6">
				<xul:toolbarbutton anonid="mode-selector-button" accesskey="&FirePath.xPath.key;" type="menu" oncommand="document.getBindingParent(this).changeMode(event)">
					<xul:menupopup>
						<xul:menuitem mode="xpath" label="&FirePath.xPath.label;" accesskey="&FirePath.xPath.key;" />
						<xul:menuitem mode="css" label="&FirePath.CSS.label;" accesskey="&FirePath.CSS.key;"/>
						<xul:menuitem mode="sizzle" label="&FirePath.Sizzle.label;" accesskey="&FirePath.Sizzle.key;"/>
					</xul:menupopup>
				</xul:toolbarbutton>
				<xul:hbox class="firepath-field-container" flex="1">
					<xul:textbox anonid="firepath-textbox" id="firePathBar-firepath-textbox" class="firepath-textbox" minwidth="100" flex="1"/>
				</xul:hbox>
			</xul:toolbaritem>
			<xul:toolbaritem anonid="firepath-context-toolbar" align="center" flex="1">
				<xul:label value="&FirePath.context.label;" control="firePathBar-parent-textbox" accesskey="&FirePath.context.key;"/>
				<xul:hbox class="firepath-field-container" flex="1">
					<xul:textbox anonid="parent-textbox" id="firePathBar-parent-textbox" class="firepath-textbox" flex="1"/>
				</xul:hbox>
				<xul:textbox anonid="parent-node-number-textbox"
					type="number"
					size="1"
					min="1"
					onchange="document.getBindingParent(this).evaluate();"
					collapsed="true"
					increment="1"/>
			</xul:toolbaritem>
			<xul:toolbarbutton label="&FirePath.eval.button;" oncommand="document.getBindingParent(this).evaluate();">
			</xul:toolbarbutton>
		</content>
		<implementation>
			
			<!--******************************************************************************************************
				fields and properties
			-->
			
			<field name="NSResolver">null</field>
			<field name="parentNodes">null</field>
			<field name="lastSelector">null</field>
			<field name="lastParent">null</field>
			<field name="lastParentSelector">null</field>
			<field name="_evaluator">null</field>
			
			<property name="autoCompleter" readonly="true">
				<getter><![CDATA[
					if(this.evaluationMode === 'xpath'){
						return this._autoCompleter ?
						this._autoCompleter : this._autoCompleter = new Firebug.FirePathPanel.xPathAutoCompleter(this);
					} else {
						return {
							complete: function(){
								return [];
							},
							reset: function(){}
						};
					}
				]]></getter>
			</property>
			
			<property name="xPathEvaluator" readonly="true">
				<getter><![CDATA[
					return this._evaluator ?
					this._evaluator : this._evaluator = new XPathEvaluator();
				]]></getter>
			</property>
			
			<property name="selector">
				<getter><![CDATA[
					return this.getElement("firepath-textbox").value;
				]]></getter>
				<setter><![CDATA[
					this.getElement("firepath-textbox").setValue(val);
					return val;
				]]></setter>
			</property>
			
			<property name="parentSelector">
				<getter><![CDATA[
					var textbox = this.getElement("parent-textbox");
					if(this.evaluationMode === 'xpath' && textbox.value == "")
						textbox.value = "/";
					return textbox.value;
				]]></getter>
				<setter><![CDATA[
					this.getElement("parent-textbox").setValue(val);
					return val;
				]]></setter>
			</property>
			
			<property name="parentNodeNumber" readonly="true">
				<getter><![CDATA[
					return this.getElement("parent-node-number-textbox");
				]]></getter>
			</property>
			
			<property name="parentToolbar" readonly="true">
				<getter><![CDATA[
					return this.getElement("firepath-context-toolbar");
				]]></getter>
			</property>
			
			<property name="highlightButton" readonly="true">
				<getter><![CDATA[
					return this.getElement("highlight-button");
				]]></getter>
			</property>
			
			<property name="FirePathPanel" readonly="true">
				<getter><![CDATA[	
					return Firebug.currentContext.getPanel(Firebug.FirePathPanel.prototype.name);
				]]></getter>
			</property>
			
			<property name="selectorGenerator" readonly="true">
				<getter><![CDATA[
					// Sizzle is more CSS than XPath, so let it get grouped with css
					return this.evaluationMode === 'xpath'?
							FBL.getXPathFromNode: FBL.getCssSelectorFromNode;
				]]></getter>
			</property>
			
			<!--******************************************************************************************************
				Constructor
			-->
			
			<constructor><![CDATA[
				this.initialize()
			]]></constructor>
			
			<!--******************************************************************************************************
				State management method
			-->
			
			<method name="initialize">
				<body><![CDATA[
					if(Firebug) {
						this.parentToolbar.collapsed = !Firebug.getPref(Firebug.prefDomain, "firepath.showParentToolbar");
						this.setEvaluationMode();
					}
				]]></body>
			</method>
			
			<method name="init">
				<parameter name="context"/>
				<body><![CDATA[
					this.NSResolver = this.createNSResolver(context.window.document);
					this.selector = "";
					this.parentSelector = this.evalutationMode === 'xpath'? "/": "";
					this.parentNodeNumber.collapsed = true;
					this.parentNodes = null;
					this.lastSelector = "";
					this.lastParent = null;
					context.firePathBarInit = true;
				]]></body>
			</method>

			<method name="show">
				<parameter name="context"/>
				<parameter name="show"/>
				<body><![CDATA[
					this.collapsed = !show;
					if(show) {
						this.currentContext = context; 
						if(!context.firePathBarInit)
							this.init(context);
						else
							this.restore(context);
						var that = this
						setTimeout(function() {
							that.getElement("firepath-textbox").focus();
						},10)
					} else {
						if(context == this.currentContext)
							this.persiste(context);
					}
				]]></body>
			</method>
			
			<method name="persiste">
				<parameter name="state"/>
				<body><![CDATA[
					if(!state.firePathBarState) state.firePathBarState = {};
					this.copyState(this, state.firePathBarState);
				]]></body>
			</method>
			
			<method name="restore">
				<parameter name="state"/>
				<body><![CDATA[
					if(state.firePathBarState) {
						this.copyState(state.firePathBarState, this)
					}
				]]></body>
			</method>
			
			<method name="copyState">
				<parameter name="from"/>
				<parameter name="to"/>
				<body><![CDATA[
					to.selector = from.selector;
					to.parentSelector = from.parentSelector;
					if(!to.parentNodeNumber) to.parentNodeNumber = {};
					to.parentNodeNumber.value = from.parentNodeNumber.value;
					to.parentNodeNumber.max = from.parentNodeNumber.max;
					to.parentNodeNumber.collapsed = from.parentNodeNumber.collapsed;
					to.parentNodes = from.parentNodes;
					to.NSResolver = from.NSResolver;
					to.lastSelector = from.lastSelector;
					to.lastParent = from.lastParent;
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				Selector Evaluation methods
			-->
			
			<method name="evaluate">
				<parameter name="reevaluate"/>
				<body><![CDATA[
					var selector = this.selector;
					if(reevaluate)
						selector = this.lastSelector;
					
					var context = this.getContextNode(reevaluate);
					if(selector != "") {
							
						var contextTextbox = this.getElement("parent-textbox");
						if(context) {
							contextTextbox.setStatus();
							if(this.evaluationMode === 'xpath' && FBL.trimLeft(this.selector).indexOf("/") == 0 && FBL.trimLeft(this.parentSelector) != "/") {
								context = null;
								contextTextbox.setStatus("warning", FBL.$STR_XP("unusedParentNode"));
							}
						}
						
						var result = this._evaluateExpression(this.selector, context);
						this.lastSelector = this.selector;
						this.lastParent = context;
						this.FirePathPanel.setResult(context, result);
					} else {
						this.lastSelector = "";
						this.FirePathPanel.setResult(context, null);
					}
				]]></body>
			</method>
			
			<method name="getXPathExpression">
				<parameter name="xPath"/>
				<body><![CDATA[
					try {
						if (xPath && FBL.isHtmlDocument(this.FirePathPanel.location.document)) {
							// we want to lower case the XPath expression but not the literal inside.
							//  eg: //DIV[@id='TEST'] should become //div[@id='TEST']
							xPath = xPath.replace(/([^'"]*)('[^']+'|"[^"]+")?/g, 
								function(str, expression, literal){return expression.toLowerCase() + literal;});
						}
						return this.xPathEvaluator.createExpression(xPath, this.NSResolver);
					} catch (e) {
						return null;
					}
				]]></body>
			</method>
			
			<method name="_evaluateExpression">
				<parameter name="selector"/>
				<parameter name="contextNode"/>
				<parameter name="evaluateParent"/>
				<body><![CDATA[
						Firebug.FirePathPanel.ResultHighlightModule.clear(this.FirePathPanel.location.document);
						try {
							if (this.evaluationMode === 'xpath') {
								var xPathExpression = this.getXPathExpression(selector);
								if (!xPathExpression) return new Error("invalidSelectorError-"+this.evaluationMode);
								return this.processResult(xPathExpression.evaluate(contextNode || this.FirePathPanel.location.document, XPathResult.ANY_TYPE, null));
							} else {
								var nodeList;
								if (this.evaluationMode === 'sizzle') {
									nodeList = this.evaluateWithSizzle(selector, contextNode, evaluateParent);
								} else {
									nodeList = (contextNode || this.FirePathPanel.location.document).querySelectorAll(selector);
								}
								var result = [];
								for (var i = 0, l = nodeList.length; i < l; i++) {
									var node = nodeList[i];
									if (node.firebugIgnore ||
											(node.ownerElement && node.ownerElement.firebugIgnore) ||
											(node.parentNode && node.parentNode.firebugIgnore) ||
											node.id == "_firebugConsole")
										continue;
									result.push(node);
								}
								return result;
							}
						} catch(ex) {
							return new Error("invalidSelectorError-" + this.evaluationMode);
						}
					]]></body>
			</method>

			<method name="evaluateWithSizzle">
				<parameter name="selector"/>
				<parameter name="contextNode"/>
				<parameter name="evaluateParent"/>
				<body><![CDATA[
					var win = this.FirePathPanel.location,
					doc = win.document;
					var firePathSizzle = win.firePathSizzle;
					if (!firePathSizzle) {
						// Inject Sizzle.js into the page.

						// Store target window's original Sizzle, if any
						var originalSizzle = win.wrappedJSObject.Sizzle; 							
						var scriptSource = FBL.getResource("chrome://firepath/content/sizzle.js");
						var addedElement = FBL.addScript(doc, "firePathSizzle", scriptSource);

						// Store the newly created Sizzle on the wrapper
						win.firePathSizzle = win.wrappedJSObject.Sizzle;

						// Restore the original target's Sizzle, if any
						if (originalSizzle) {
							win.wrappedJSObject.Sizzle = originalSizzle;
						} else {
							delete win.wrappedJSObject.Sizzle;
						}

						// take the script tag back out now that the script is loaded
						addedElement.parentNode.removeChild(addedElement); 

						firePathSizzle = win.firePathSizzle;
					}
					if (evaluateParent) {
						win.firePathContext = firePathSizzle(selector);
						return win.firePathContext;
					} else if(contextNode) {
						return firePathSizzle(selector,
							win.firePathContext[this.parentNodeNumber.value - 1]);
					} else {
						return firePathSizzle(selector);
					}
				]]></body>
			</method>
			
			<method name="createNSResolver">
				<parameter name="doc"/>
				<body><![CDATA[
					var prefixToNS = this.getMappingPrefixNS(doc);
					return function(prefix) {
						return prefixToNS[prefix] || null;
					}
				]]></body>
			</method>
			
			<method name="getMappingPrefixNS">
				<parameter name="doc"/>
				<body><![CDATA[
					var result = doc.evaluate("//*[namespace-uri() != '']", doc, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
					var nsToPrefix = {};
					var prefixToNS = {};
					for ( var i=0, L=result.snapshotLength ; i < L; i++ ) {
						var node = result.snapshotItem(i);
						var ns = node.namespaceURI;
						if(ns) {
							var prefix = node.lookupPrefix(ns);
							if(!prefix) {
								if(!(ns in nsToPrefix)) {
									nsToPrefix[ns] = FBL.getPrefixFromNS(ns);
								}
								prefix = nsToPrefix[ns];
							}
							if(!(prefix in prefixToNS))
								prefixToNS[prefix] = ns;
						}
					}
					return prefixToNS;
				]]></body>
			</method>
			
			<method name="getContextNode" readonly="true">
				<parameter name="reevaluate"/>
				<body><![CDATA[
					if(this.parentToolbar.collapsed)
						return null;
					if(!reevaluate && this.parentNodes && this.lastParentSelector == this.parentSelector)
						return this.parentNodes[this.parentNodeNumber.value - 1];
					else {
						var nodes = this._evaluateExpression(this.parentSelector, null, true);
						
						this.lastParentSelector = this.parentSelector;
						
						if(FBL.isArray(nodes) && nodes.length > 0) {
							if(!reevaluate) {
								this.parentNodeNumber.collapsed = (nodes.length == 1);
								this.parentNodeNumber.max = nodes.length;
								this.parentNodeNumber.value = 1;
								this.parentNodes = nodes;
								this.getElement("parent-textbox").setStatus();
								return nodes[0];
							} else {
								this.parentNodes = nodes;
								return nodes[this.parentNodeNumber.value - 1];
							}
						} else {
							this.parentNodeNumber.collapsed = true;
							this.parentNodeNumber.value = 1;
							this.parentNodes = [null];
							if(!(nodes instanceof Error))
								this.getElement("parent-textbox").setStatus("warning", FBL.$STR_XP("noParentNodeSelected"));
							return null;
						}
					}
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				methods to manage the mode
			-->
			
			<method name="changeMode">
				<parameter name="event"/>
				<body><![CDATA[
					if(event.target == this.getElement("mode-selector-button"))
						this.getElement("firepath-textbox").focus();
					this.setEvaluationMode(event.target.getAttribute("mode"));
					this.getElement("firepath-textbox").checkSyntax();
					this.reset(),
					this.evaluate();
				]]></body>
			</method>
			
			<method name="setEvaluationMode">
				<parameter name="mode"/>
				<body><![CDATA[
					var evaluationMode;
					if(!mode)
						evaluationMode = Firebug.getPref(Firebug.prefDomain, "firepath.evaluationMode");
					else
						evaluationMode = mode;

					var button = this.getElement("mode-selector-button");
					this.evaluationMode = evaluationMode;
					var menuitem = document.getAnonymousElementByAttribute(button, "mode", evaluationMode);
					button.label = menuitem.label;
					
					Firebug.setPref(Firebug.prefDomain, "firepath.evaluationMode", evaluationMode);
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				public methods, used by the panel
			-->
			
			<method name="setNode">
				<parameter name="node"/>
				<parameter name="noEval"/>
				<body><![CDATA[
					this.selector = this.selectorGenerator(node, this.getContextNode());
					if(!noEval) {
						this.evaluate();
					}
				]]></body>
			</method>
			
			<method name="setContextNode">
				<parameter name="node"/>
				<body><![CDATA[
					this.parentSelector = this.selectorGenerator(node);
					this.evaluate();
				]]></body>
			</method>
			
			<method name="updateLocation">
				<parameter name="location"/>
				<body><![CDATA[
					this.NSResolver = this.createNSResolver(location.document);
					this.reset();
				]]></body>
			</method>
			
			<method name="reset">
				<body><![CDATA[
					delete this.lastSelector;
					delete this.lastParent;
					delete this.lastParentSelector;
				]]></body>
			</method>
			
			<method name="showParentToolbar">
				<parameter name="show"/>
				<body><![CDATA[
					this.parentToolbar.collapsed = !show;
					this.reset();
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				public methods, used by the xpath autoCompleter
			-->
			
			<method name="hasResult">
				<parameter name="xPath"/>
				<body><![CDATA[
					var xPathExpression = this.getXPathExpression(xPath);
					if(!xPathExpression) return false;
					
					var result;
					try{
						result = xPathExpression.evaluate(this.getContextNode() || this.FirePathPanel.location.document, XPathResult.ANY_UNORDERED_NODE_TYPE, null);
					} catch(e) {
						return false;
					}
					return result.singleNodeValue != null;
				]]></body>
			</method>
			
			<method name="evaluateExpression">
				<parameter name="xPath"/>
				<body><![CDATA[
					var xPathExpression = this.getXPathExpression(xPath);
					if(!xPathExpression) return null;
					
					var result;
					try{
						result = xPathExpression.evaluate(this.getContextNode() || this.FirePathPanel.location.document, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
					} catch(e) {
						return null;
					}
					return this.processResult(result);
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				Helper Methods
			-->
				
			<method name="getElement">
				<parameter name="aAnonymousID"/>
				<body><![CDATA[
					return document.getAnonymousElementByAttribute(this, "anonid", aAnonymousID);
				]]></body>
			</method>
			
			<method name="isValidSelector">
				<parameter name="value"/>
				<body><![CDATA[
					if (this.evaluationMode === "xpath") {
						return this.getXPathExpression(value) != null;
					} else {
						try {
							if (this.evaluationMode === "sizzle") {
								this.evaluateWithSizzle(value);
							} else {
								this.FirePathPanel.location.document.querySelector(value);
							}
						} catch (e) {
							return false;
						}
						return true
					}
				]]></body>
			</method>
			
			<method name="processResult">
				<parameter name="evaluationResult"/>
				<body><![CDATA[
				switch(evaluationResult.resultType) {
					case XPathResult.NUMBER_TYPE:
						return evaluationResult.numberValue;
					case XPathResult.STRING_TYPE:
						return evaluationResult.stringValue;
					case XPathResult.BOOLEAN_TYPE:
						return evaluationResult.booleanValue;
					default:
						var result = [];
						var node;
						while (node = evaluationResult.iterateNext()) {
							//make sure it is not a node created by firebug
							if(node.firebugIgnore ||
								(node.ownerElement && node.ownerElement.firebugIgnore) ||
								(node.parentNode && node.parentNode.firebugIgnore) ||
								node.id == "_firebugConsole")
									continue; 
							result.push(node);
						}
						return result;
				}
				]]></body>
			</method>
		</implementation>
	</binding>
	
	<binding id="FirePathStatusBar" extends="xul:hbox">
		<content>
			<xul:statusbarpanel flex="1" align="center" pack="left">
				<xul:image anonid="firepath-result-icon" class="firepath-result-icon"/>
				<xul:label  anonid="firepath-result-info" value=""/>
			</xul:statusbarpanel>
			<xul:statusbarpanel anonid="firepath-result-progressmeter-container" collapsed="true">
				<xul:image src="chrome://firebug/skin/errorIcon.png" 
					onmousedown="document.getBindingParent(this).cancelLoading(Firebug.currentContext)" 
					class="firepath-cancel-result-loading-button"/>
				<xul:progressmeter anonid="firepath-result-progressmeter"/>
			</xul:statusbarpanel>
		</content>
		<implementation>
			
			<!--******************************************************************************************************
				fields and properties
			-->
			
			<property name="progressMeter" readonly="true">
				<getter><![CDATA[
					return this.getElement("firepath-result-progressmeter");
				]]></getter>
			</property>
			
			<property name="progressMeterContainer" readonly="true">
				<getter><![CDATA[
					return this.getElement("firepath-result-progressmeter-container");
				]]></getter>
			</property>
			
			<property name="resultInfo">
				<getter><![CDATA[
					return this.getElement("firepath-result-info").value;
				]]></getter>
				<setter><![CDATA[
					this.getElement("firepath-result-info").value = val;
					return val;
				]]></setter>
			</property>
			
			<property name="resultIcon">
				<getter><![CDATA[
					return this.getElement("firepath-result-icon").getAttribute("status");
				]]></getter>
				<setter><![CDATA[
					this.getElement("firepath-result-icon").setAttribute("status", val);
					return val;
				]]></setter>
			</property>
			
			<!--******************************************************************************************************
				ProgressMeter management
			-->
			
			<method name="startLoading">
				<parameter name="context"/>
				<parameter name="stepNumber"/>
				<body><![CDATA[
					context.FirePathStatusBar.loading = true;
					context.FirePathStatusBar.stepNumber = stepNumber;
					context.FirePathStatusBar.currentStep = 0;
					this.progressMeter.value = 0;
					this.progressMeterContainer.collapsed = false;
				]]></body>
			</method>
			
			<method name="increaseLoading">
				<parameter name="context"/>
				<body><![CDATA[
					context.FirePathStatusBar.currentStep += 1;
					if(context.FirePathStatusBar.shown)
						this.progressMeter.value = context.FirePathStatusBar.currentStep / context.FirePathStatusBar.stepNumber * 100;
				]]></body>
			</method>
			
			<method name="stopLoading">
				<parameter name="context"/>
				<body><![CDATA[
					delete context.FirePathStatusBar.loading;
					this.progressMeterContainer.collapsed = true;
				]]></body>
			</method>
			
			<method name="cancelLoading">
				<parameter name="context"/>
				<body><![CDATA[
					var panel = context.getPanel(Firebug.FirePathPanel.prototype.name);
					panel.stopLoading();
					panel.firePathBar.reset();
					this.resultInfo = this.resultInfo + " (" + FBL.$STR_XP("nodeSelectedMessage", context.FirePathStatusBar.currentStep) + ")";
					context.FirePathStatusBar.resultInfo = this.resultInfo;
				]]></body>
			</method>
			
			
			
			<!--******************************************************************************************************
				Result info management
			-->
			
			<method name="setResultInfo">
				<parameter name="context"/>
				<parameter name="status"/>
				<parameter name="info"/>
				<body><![CDATA[
					context.FirePathStatusBar.resultInfo = info;
					this.resultInfo = info;
					context.FirePathStatusBar.resultIcon = status;
					this.resultIcon = status;
				]]></body>
			</method>
			
			<method name="clearResultInfo">
				<parameter name="context"/>
				<body><![CDATA[
					delete context.FirePathStatusBar.resultInfo;
					this.resultInfo = "";
					delete context.FirePathStatusBar.resultIcon;
					this.resultIcon = "";
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				other public methods
			-->

			<method name="show">
				<parameter name="context"/>
				<parameter name="show"/>
				<body><![CDATA[
					if(!context.FirePathStatusBar)
						context.FirePathStatusBar = {};
					if(show) {
						this.resultInfo = context.FirePathStatusBar.resultInfo || "";
						this.resultIcon = context.FirePathStatusBar.resultIcon || "";
						this.progressMeterContainer.collapsed = !context.FirePathStatusBar.loading;
					}
					context.FirePathStatusBar.shown = show;
					this.collapsed = !show;
				]]></body>
			</method>
			
			<method name="reset">
				<parameter name="context"/>
				<body><![CDATA[
					this.clearResultInfo(context);
				]]></body>
			</method>
			
			<!--******************************************************************************************************
				Helper Methods
			-->
				
			<method name="getElement">
				<parameter name="aAnonymousID"/>
				<body><![CDATA[
					return document.getAnonymousElementByAttribute(this, "anonid", aAnonymousID);
				]]></body>
			</method>

		</implementation>
	</binding>
</bindings>