My solution was to modify the stopInspecting()
function of FirePath. Here's the related code:
stopInspecting: function(inspectingNode, cancelled) {
this.inspecting = false;
var latestXpath = getXPathFromNode(inspectingNode); // getting xpath
// in Firebug 1.7 the signature of this method changed
// before there was only on arg: cancelled.
if (!Firebug.Inspector._resolveInspectingPanelName) {
cancelled = inspectingNode;
}
if(cancelled) {
this.navigate(this.previousLocation);
this.fireSIMSBar.selector = this.previousSelector;
delete this.previousLocation;
delete this.previousSelector;
}
this.fireSIMSBar.reset();
this.fireSIMSBar.evaluate();
// Passing xpath to javascript function
var doc = Application.activeWindow.activeTab.document;
var win = doc.defaultView;
win.wrappedJSObject.myFunction(latestXpath);
}
},