[Pkg-mozext-commits] [firebug] 32/56: Fix command line API and Net panel $p breakage resulting from bug 1065186

David Prévot taffit at moszumanska.debian.org
Wed Nov 19 21:01:44 UTC 2014


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

taffit pushed a commit to branch master
in repository firebug.

commit c18f0e31f2402a0be55f62bbce1fb8787fd0358a
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date:   Thu Oct 23 13:00:10 2014 +0200

    Fix command line API and Net panel $p breakage resulting from bug 1065186
    
    Related to issue 7687.
---
 extension/content/firebug/console/commandLineAPI.js | 15 ++++++++++-----
 extension/content/firebug/net/netUtils.js           |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/extension/content/firebug/console/commandLineAPI.js b/extension/content/firebug/console/commandLineAPI.js
index d8afe5d..1c91ff2 100644
--- a/extension/content/firebug/console/commandLineAPI.js
+++ b/extension/content/firebug/console/commandLineAPI.js
@@ -28,6 +28,10 @@ var CommandLineAPI = {};
 CommandLineAPI.getCommandLineAPI = function(context)
 {
     var commands = Object.create(null);
+    var clone = function(object)
+    {
+        return Wrapper.cloneIntoContentScope(context.baseWindow, object);
+    };
 
     // returns unwrapped elements from the page
     commands.$ = function(selector, start)
@@ -60,7 +64,7 @@ CommandLineAPI.getCommandLineAPI = function(context)
             result = context.baseWindow.document.querySelectorAll(selector);
         }
 
-        return Arr.cloneArray(result);
+        return clone(Arr.cloneArray(result));
     };
 
     // returns unwrapped elements from the page
@@ -91,10 +95,11 @@ CommandLineAPI.getCommandLineAPI = function(context)
                 break;
         }
 
-        var doc = Wrapper.unwrapObject(context.baseWindow.document);
         try
         {
-            return Xpath.evaluateXPath(doc, xpath, contextNode, XPathResultType);
+            var doc = context.baseWindow.document;
+            var res = Xpath.evaluateXPath(doc, xpath, contextNode, XPathResultType);
+            return (Array.isArray(res) ? clone(res) : res);
         }
         catch(ex)
         {
@@ -154,13 +159,13 @@ CommandLineAPI.getCommandLineAPI = function(context)
     commands.keys = function(o)
     {
         // the object is from the page, unwrapped
-        return Arr.keys(o);
+        return clone(Arr.keys(o));
     };
 
     commands.values = function(o)
     {
         // the object is from the page, unwrapped
-        return Arr.values(o);
+        return clone(Arr.values(o));
     };
 
     commands.traceAll = function()
diff --git a/extension/content/firebug/net/netUtils.js b/extension/content/firebug/net/netUtils.js
index 33dc83a..eba7eb1 100644
--- a/extension/content/firebug/net/netUtils.js
+++ b/extension/content/firebug/net/netUtils.js
@@ -538,7 +538,7 @@ var NetUtils =
 
         function cloneHeaders(headers)
         {
-            var newHeaders = [];
+            var newHeaders = new global.Array();
             for (var i=0; headers && i<headers.length; i++)
             {
                 var header = {name: headers[i].name, value: headers[i].value};

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



More information about the Pkg-mozext-commits mailing list