[Pkg-mozext-commits] [firexpath] 03/06: Issue31: Apply the patch from David Rees with a few small changes.

David Prévot taffit at moszumanska.debian.org
Sat Mar 26 19:35:57 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 7d78549ad50908b389437115f38ef244d166cc40
Author: pierre.tholence <pierre.tholence at gmail.com>
Date:   Sat Aug 6 16:29:34 2011 +0000

    Issue31: Apply the patch from David Rees with a few small changes.
---
 content/bindings.xml | 32 ++++++++++++++++++++++++--------
 content/sizzle.js    |  2 +-
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/content/bindings.xml b/content/bindings.xml
index 519c21f..5995631 100644
--- a/content/bindings.xml
+++ b/content/bindings.xml
@@ -394,22 +394,38 @@
 				<body><![CDATA[
 					var win = this.FirePathPanel.location,
 					doc = win.document;
-					if (!win.wrappedJSObject._firePathSizzle) {
+					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);
+						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);
+						addedElement.parentNode.removeChild(addedElement); 
+
+						firePathSizzle = win.firePathSizzle;
 					}
 					if (evaluateParent) {
-						win.wrappedJSObject._firePathContext = win.wrappedJSObject._firePathSizzle(selector);
-						return win.wrappedJSObject._firePathContext;
+						win.firePathContext = firePathSizzle(selector);
+						return win.firePathContext;
 					} else if(contextNode) {
-						return win.wrappedJSObject._firePathSizzle(selector, 
-							win.wrappedJSObject._firePathContext[this.parentNodeNumber.value - 1]);
+						return firePathSizzle(selector,
+							win.firePathContext[this.parentNodeNumber.value - 1]);
 					} else {
-						return win.wrappedJSObject._firePathSizzle(selector);
+						return firePathSizzle(selector);
 					}
 				]]></body>
 			</method>
diff --git a/content/sizzle.js b/content/sizzle.js
index 7a9dc4c..b2f5496 100755
--- a/content/sizzle.js
+++ b/content/sizzle.js
@@ -1381,6 +1381,6 @@ var posProcess = function( selector, context ) {
 
 // EXPOSE
 
-window._firePathSizzle = Sizzle;
+window.Sizzle = Sizzle;
 
 })();

-- 
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