[Pkg-mozext-commits] [firexpath] 01/06: Issue29: Make FirePath compatible with Firebug1.8.

David Prévot taffit at moszumanska.debian.org
Sat Mar 26 19:35:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag FirePath-0.9.7
in repository firexpath.

commit 8ce57ac8e0d14be82d44327c515c59eaee292129
Author: pierre.tholence <pierre.tholence at gmail.com>
Date:   Sat Aug 6 14:44:52 2011 +0000

    Issue29: Make FirePath compatible with Firebug1.8.
---
 content/FirePathPanel.js   | 207 +++++++++++----------------------------------
 content/bindings.xml       |   8 +-
 content/firebugOverlay.xul |   6 +-
 install.rdf                |   6 +-
 4 files changed, 61 insertions(+), 166 deletions(-)

diff --git a/content/FirePathPanel.js b/content/FirePathPanel.js
index 271acc9..f8cb5ce 100644
--- a/content/FirePathPanel.js
+++ b/content/FirePathPanel.js
@@ -18,7 +18,6 @@
  */
 
 FBL.ns(function() { with (FBL) {
-
 // ************************************************************************************************
 // Constants
 
@@ -120,26 +119,24 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 	name: panelName,
 	title: "FirePath",
 
-	initialize: function() {
-		Firebug.Panel.initialize.apply(this, arguments);
-		this.addStyleSheet(this.document);
-		this.location = this.getDefaultLocation(this.context);
-		this.firePathBar = (this.context.chrome?this.context.chrome.$("FirePathBar"): $("FirePathBar"));
+	initialize: function(context, doc) {
+		this.addStyleSheet(doc);
+		this.location = this.getDefaultLocation(context);
+		this.firePathBar = Firebug.chrome.$('FirePathBar');
 		this.firePathBar.initialize();
-		this.firePathStatusBar = (this.context.chrome?this.context.chrome.$("FirePathStatusBar"): $("FirePathStatusBar"));
-		
-		this.ioBoxContainer = this.document.createElement("div");
-		setClass(this.ioBoxContainer, "io-box-container");
-		this.panelNode.appendChild(this.ioBoxContainer);
+		this.firePathStatusBar = Firebug.chrome.$("FirePathStatusBar");
 		
 		this.onMouseDown = bind(this.onMouseDown, this);
 		
 		this.inspecting = false;
+		Firebug.Panel.initialize.apply(this, arguments);
 	},
 	
 	destroy: function(state) {
 		state.persistedLocation = this.persisteLocation();
-		this.firePathBar.persiste(state);
+		if (this.firePathBar) {
+			this.firePathBar.persiste(state);
+		}
 		this.stopLoading();
 		
 		if (this.ioBox) {
@@ -151,25 +148,32 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 	
 	initializeNode: function(oldPanelNode) {
 		this.panelNode.addEventListener("mousedown", this.onMouseDown, false);
+
+		this.ioBoxContainer = this.document.createElement("div");
+		setClass(this.ioBoxContainer, "io-box-container");
+		this.panelNode.appendChild(this.ioBoxContainer);
+		
+		if(!this.ioBox) {
+			this.ioBox = new InsideOutBox(this, this.ioBoxContainer);
+		}
+		Firebug.Panel.initializeNode.apply(this, arguments);
 	},
 
 	destroyNode: function() {
 		this.panelNode.removeEventListener("mousedown", this.onMouseDown, false);
+		Firebug.Panel.destroyNode.apply(this, arguments);
 	},
 	
 	show: function(state) {
 		if (this.context.loaded) {
 			this.showModules(true);
-			
-			if(!this.ioBox) {
-				this.ioBox = new InsideOutBox(this, this.ioBoxContainer);
-				if(state) {
-					this.restoreLocation(state.persistedLocation);
-					this.firePathBar.restore(state);
-					this.firePathBar.evaluate(true);
-				} else {
-					this.ioBox.createObjectBox(this.rootElement || this.location.document);
-				}
+
+			if(state) {
+				this.restoreLocation(state.persistedLocation);
+				this.firePathBar.restore(state);
+				this.firePathBar.evaluate(true);
+			} else {
+				this.ioBox.createObjectBox(this.rootElement || this.location.document);
 			}
 		}
 	},
@@ -184,9 +188,7 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 			this.firePathStatusBar.show(this.context, show);
 		} catch (e) {}
 		
-		var $ = FBL.$;
-		if(this.context.chrome)
-			$ = this.context.chrome.$;
+		var $ = Firebug.chrome.getElementById;
 		
 		// when there is a visibility: hidden style the collapsed attribute doesn't work correctly
 		$("fbPanelStatus").removeAttribute("style");
@@ -196,17 +198,17 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 	
 	detach: function(oldChrome, newChrome) {
 		Firebug.Panel.detach.apply(this, arguments);
-		if(this.context == FirebugContext) {
+		if(this.context == Firebug.currentContext) {
 			this.firePathBar.persiste(this.context);
 		}
 		this.firePathBar = newChrome.$("FirePathBar");
 		this.firePathBar.initialize();
 		this.firePathStatusBar = newChrome.$("FirePathStatusBar");
-		if(this.context == FirebugContext) {
+		if(this.context == Firebug.currentContext) {
 			this.firePathBar.restore(this.context);
 			this.firePathBar.currentContext = this.context;
 		}
-		if(this.context.browser.detached || (newChrome != Firebug.originalChrome && this.context == FirebugContext)) {
+		if(this.context.browser.detached || (newChrome != Firebug.originalChrome && this.context == Firebug.currentContext)) {
 			Firebug.FirePathPanel.LocationHighlightModule.addLocationListener(newChrome);
 		} else {
 			Firebug.FirePathPanel.LocationHighlightModule.removeLocationListener(oldChrome);
@@ -225,8 +227,7 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 				object instanceof Text ||
 				object instanceof Attr ||
 				object instanceof Comment ||
-				object instanceof Document ||
-				object instanceof SourceText )
+				object instanceof Document )
 			return 1;
 		else
 			return 0;
@@ -437,9 +438,6 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 	},
 
 	getParentObject: function(node) {
-		if (node instanceof SourceText)
-			return node.owner;
-
 		if (this.rootElement && node == this.rootElement)
 			return null;
 
@@ -543,7 +541,7 @@ Firebug.FirePathPanel.prototype = extend(Firebug.Panel,
 			
 			Firebug.Inspector.highlightObject(null);
 			element.scrollIntoView();
-			Firebug.Inspector.highlightObject(element, FirebugContext);
+			Firebug.Inspector.highlightObject(element, Firebug.currentContext);
 		}
 	},
 	
@@ -641,7 +639,7 @@ function overwriteMethodForPanel(object, methodName, panelName, newMethod ) {
 	if(object[methodName] && object[methodName] instanceof Function)
 		object["default" + methodName] = object[methodName];
 	object[methodName] = function () {
-		var selectedPanelName = FirebugContext.panelName;
+		var selectedPanelName = Firebug.currentContext.panelName;
 
 		if(selectedPanelName != panelName) {
 			if(object["default" + methodName])
@@ -1660,11 +1658,11 @@ Firebug.FirePathPanel.LocationHighlightModule = extend(Firebug.Module,
 {
 	// add event listener
 	initializeUI: function(detachArgs) {
-		this.addLocationListener(FirebugChrome);
+		this.addLocationListener(Firebug.chrome);
 	},
 	
 	shutdown: function() {
-		this.removeLocationListener(FirebugChrome);
+		this.removeLocationListener(Firebug.chrome);
 	},
 	
 	addLocationListener: function(chrome) {
@@ -1678,12 +1676,12 @@ Firebug.FirePathPanel.LocationHighlightModule = extend(Firebug.Module,
 	},
 	
 	onLocationMouseOver: function(event) {
-		var panel = FirebugContext.browser.chrome.getSelectedPanel();
+		var panel = Firebug.chrome.getSelectedPanel();
 	
 		if(panel.name == panelName) {
 			var repObject = event.originalTarget.repObject;
 			if(repObject && repObject.frameElement) {
-				Firebug.Inspector.highlightObject(repObject.frameElement, FirebugContext);
+				Firebug.Inspector.highlightObject(repObject.frameElement, Firebug.currentContext);
 			}
 		}
 	},
@@ -1714,11 +1712,11 @@ Firebug.FirePathPanel.ResultHighlightModule = extend(Firebug.Module,
 	},
 	
 	reattachContext: function(browser, context) {
-		this.highlightButton = browser.chrome.$("FirePathBarHighlightButton");
+		this.highlightButton = Firebug.chrome.$("FirePathBarHighlightButton");
 	},
 	
 	showContext: function(browser, context) {
-		this.highlightButton = browser.chrome.$("FirePathBarHighlightButton");
+		this.highlightButton = Firebug.chrome.$("FirePathBarHighlightButton");
 		this.refreshHighlightButton(context.getPanel(panelName));
 	},
 	
@@ -1727,13 +1725,15 @@ Firebug.FirePathPanel.ResultHighlightModule = extend(Firebug.Module,
 	},
 	
 	showPanel: function(browser, panel) {
-		if(panel.name == panelName) {
-			this.highlightButton.collapsed = false;
-			if(!panel.context.firePathResultNotHighlighted)
-				this.highlight(panel.context);
-		} else {
-			this.highlightButton.collapsed = true;
-			this.clear();
+		if(panel) {
+			if(panel.name == panelName) {
+				this.highlightButton.collapsed = false;
+				if(!panel.context.firePathResultNotHighlighted)
+					this.highlight(panel.context);
+			} else {
+				this.highlightButton.collapsed = true;
+				this.clear();
+			}
 		}
 	},
 	
@@ -1758,7 +1758,8 @@ Firebug.FirePathPanel.ResultHighlightModule = extend(Firebug.Module,
 		}
 	},
 	
-	toggleHighlight: function(context) {
+	toggleHighlight: function() {
+		var context = Firebug.currentContext;
 		if(!context.firePathResultNotHighlighted) {
 			this.clear();
 		} else {
@@ -1837,113 +1838,7 @@ Firebug.FirePathPanel.ResultHighlightModule = extend(Firebug.Module,
 	}
 })
 
-// ************************************************************************************************
-// Overwrite inspector to make sure it stay on the FirePath tab (instead of going to the HTML tab)
-
-// Firebug 1.7 allow to have inspectable panel so this is no longuer needed.
-if (!Firebug.Inspector._resolveInspectingPanelName) {
-	overwriteMethodForPanel(
-		Firebug.Inspector, 
-		"startInspecting", 
-		panelName, 
-		function (context) {
-			if (this.inspecting || !context || !context.loaded)
-				return;
-
-			this.inspecting = true;
-			this.inspectingContext = context;
-
-			context.chrome.setGlobalAttribute("cmd_toggleInspecting", "checked", "true");
-			this.attachInspectListeners(context);
-
-			// Remember the previous panel and bar state so we can revert if the user cancels
-			this.previousPanelName = context.panelName;
-			this.previousSidePanelName = context.sidePanelName;
-			this.previouslyCollapsed = $("fbContentBox").collapsed;
-			this.previouslyFocused = context.detached && context.chrome.isFocused();
-
-			var panel;
-			if(this.previouslyCollapsed) {
-				panel = context.chrome.selectPanel("html");
-				this.previousObject = panel.selection;
-			} else {
-				panel = context.getPanel(panelName);
-			}
-
-			if (context.detached)
-				FirebugChrome.focus();
-			else
-				Firebug.showBar(true);
-
-			panel.panelNode.focus();
-			panel.startInspecting();
-
-			if (context.hoverNode)
-				this.inspectNode(context.hoverNode);
-		}
-	);
-
-	overwriteMethodForPanel(
-		Firebug.Inspector, 
-		"stopInspecting", 
-		panelName, 
-		function(cancelled, waitForClick){
-			if (!this.inspecting) 
-				return;
-			
-			var context = this.inspectingContext;
-			
-			if (this.inspectTimeout) {
-				context.clearTimeout(this.inspectTimeout);
-				delete this.inspectTimeout;
-			}
-			
-			this.detachInspectListeners(context);
-			if (!waitForClick) 
-				this.detachClickInspectListeners(context.window);
-			
-			context.chrome.setGlobalAttribute("cmd_toggleInspecting", "checked", "false");
-			
-			this.inspecting = false;
-			
-			var htmlPanel = context.getPanel("html");
-			var firePathPanel = context.getPanel(panelName);
-			
-			if (this.previouslyFocused) 
-				context.chrome.focus();
-			
-			if (cancelled) {
-				if (this.previouslyCollapsed) 
-					Firebug.showBar(false);
-				
-				if (this.previousPanelName == "html") 
-					context.chrome.select(this.previousObject);
-				else 
-					context.chrome.selectPanel(this.previousPanelName, this.previousSidePanelName);
-			}
-			else {
-				if(this.previouslyCollapsed) {
-					context.chrome.select(htmlPanel.selection);
-					context.chrome.getSelectedPanel().panelNode.focus();
-				}
-			}
-			
-			if(this.previouslyCollapsed)
-				htmlPanel.stopInspecting(htmlPanel.selection, cancelled);
-			else
-				firePathPanel.stopInspecting(cancelled);
-			
-			this.inspectNode(null);
-			
-			delete this.previousObject;
-			delete this.previousPanelName;
-			delete this.previousSidePanelName;
-			delete this.inspectingContext;
-		}
-	);
-}
-
 Firebug.registerPanel(Firebug.FirePathPanel);
 Firebug.registerModule(Firebug.FirePathPanel.LocationHighlightModule, Firebug.FirePathPanel.ResultHighlightModule);
-if(Firebug.registerUIListener) Firebug.registerUIListener(Firebug.FirePathPanel.ResultHighlightModule);
+Firebug.registerUIListener(Firebug.FirePathPanel.ResultHighlightModule);
 }});
diff --git a/content/bindings.xml b/content/bindings.xml
index cac768e..10771f3 100644
--- a/content/bindings.xml
+++ b/content/bindings.xml
@@ -73,13 +73,13 @@
 						this.firePathBar.evaluate();
 						break;
 					case KeyEvent.DOM_VK_UP:
-						this.firePathBar.autoCompleter.complete(FirebugContext, this, true, true);
+						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(FirebugContext, this, true, false);
+						this.firePathBar.autoCompleter.complete(Firebug.currentContext, this, true, false);
 						this.checkSyntax();
 						break;
 				}
@@ -197,7 +197,7 @@
 			
 			<property name="FirePathPanel" readonly="true">
 				<getter><![CDATA[	
-					return FirebugContext.getPanel(Firebug.FirePathPanel.prototype.name);
+					return Firebug.currentContext.getPanel(Firebug.FirePathPanel.prototype.name);
 				]]></getter>
 			</property>
 			
@@ -670,7 +670,7 @@
 			</xul:statusbarpanel>
 			<xul:statusbarpanel anonid="firepath-result-progressmeter-container" collapsed="true">
 				<xul:image src="chrome://firebug/skin/errorIcon.png" 
-					onmousedown="document.getBindingParent(this).cancelLoading(FirebugContext)" 
+					onmousedown="document.getBindingParent(this).cancelLoading(Firebug.currentContext)" 
 					class="firepath-cancel-result-loading-button"/>
 				<xul:progressmeter anonid="firepath-result-progressmeter"/>
 			</xul:statusbarpanel>
diff --git a/content/firebugOverlay.xul b/content/firebugOverlay.xul
index ae0a42d..a4ace75 100644
--- a/content/firebugOverlay.xul
+++ b/content/firebugOverlay.xul
@@ -13,13 +13,13 @@
 	<popup id="contentAreaContextMenu">
 		<menuitem id="menu_fpShow" label="&FirePath.context.show.label;"
 			insertafter="context-viewpartialsource-selection"
-			oncommand="Firebug.toggleBar(true); FirebugChrome.selectPanel('firepath').updateSelection(document.popupNode)"
+			oncommand="Firebug.toggleBar(true); Firebug.chrome.selectPanel('firepath').updateSelection(document.popupNode)"
 			accesskey="&FirePath.context.show.key;"/>
 	</popup>
 
 	<hbox id="fbToolbarInner">
 		<toolbarbutton id="FirePathBarHighlightButton" collapsed="true" label="&FirePath.highlight.button;" class="toolbar-text-button"
-			oncommand="Firebug.FirePathPanel.ResultHighlightModule.toggleHighlight(FirebugContext);"
+			oncommand="Firebug.FirePathPanel.ResultHighlightModule.toggleHighlight();"
 			checked="false" disabled="true" insertafter="fbLocationList"/>
 		<firepathbar id="FirePathBar" flex="1"  collapsed="true" insertafter="fbLocationList"/>
 	</hbox>
@@ -28,4 +28,4 @@
 		<firepathstatusbar id="FirePathStatusBar" insertafter="fbCommandBox" collapsed="true"/>
 	</vbox>
 
-</overlay>
\ No newline at end of file
+</overlay>
diff --git a/install.rdf b/install.rdf
index 64859a6..ff1d2b3 100644
--- a/install.rdf
+++ b/install.rdf
@@ -3,14 +3,14 @@
  xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>FireXPath at pierre.tholence.com</em:id>
-    <em:version>0.9.6.1</em:version>
+    <em:version>0.9.7</em:version>
     
     <!-- Firefox -->
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
-        <em:minVersion>3.5</em:minVersion>
-        <em:maxVersion>4.0.*</em:maxVersion>
+        <em:minVersion>4.0</em:minVersion>
+        <em:maxVersion>7.*</em:maxVersion>
       </Description>
     </em:targetApplication>
     

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firexpath.git



More information about the Pkg-mozext-commits mailing list