[Pkg-mozext-commits] [firebug] 19/30: Cope with X-rays to objects and arrays (related to issue 7535)

David Prévot taffit at moszumanska.debian.org
Fri Jun 20 22:34:25 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 72a75e464efd3f74ff55c8f291917550ecb5270e
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date:   Wed Jun 18 01:42:20 2014 +0200

    Cope with X-rays to objects and arrays (related to issue 7535)
---
 extension/content/firebug/chrome/reps.js           | 16 ++++++++++------
 extension/content/firebug/console/autoCompleter.js |  1 +
 extension/content/firebug/editor/sourceEditor.js   | 14 ++------------
 extension/content/firebug/lib/wrapper.js           |  1 +
 4 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/extension/content/firebug/chrome/reps.js b/extension/content/firebug/chrome/reps.js
index a112a37..d577f81 100644
--- a/extension/content/firebug/chrome/reps.js
+++ b/extension/content/firebug/chrome/reps.js
@@ -427,6 +427,8 @@ FirebugReps.Obj = domplate(Rep,
 
     propIterator: function (object, max)
     {
+        var obj = Wrapper.unwrapObject(object);
+
         function isInterestingProp(t, value)
         {
             return (t == "boolean" || t == "number" || (t == "string" && value) ||
@@ -434,20 +436,20 @@ FirebugReps.Obj = domplate(Rep,
         }
 
         // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=945377
-        if (Object.prototype.toString.call(object) === "[object Generator]")
-            object = Object.getPrototypeOf(object);
+        if (Object.prototype.toString.call(obj) === "[object Generator]")
+            obj = Object.getPrototypeOf(obj);
 
         // Object members with non-empty values are preferred since it gives the
         // user a better overview of the object.
         var props = [];
-        this.getProps(props, object, max, isInterestingProp);
+        this.getProps(props, obj, max, isInterestingProp);
 
         if (props.length <= max)
         {
             // There are not enough props yet (or at least, not enough props to
             // be able to know whether we should print "more..." or not).
             // Let's display also empty members and functions.
-            this.getProps(props, object, max, function(t, value)
+            this.getProps(props, obj, max, function(t, value)
             {
                 return !isInterestingProp(t, value);
             });
@@ -680,7 +682,8 @@ FirebugReps.ArrBase = domplate(FirebugReps.Obj,
         }
 
         var n = 0;
-        var props = Object.getOwnPropertyNames(array);
+        var obj = Wrapper.unwrapObject(array);
+        var props = Object.getOwnPropertyNames(obj);
         for (var i=0; i<props.length; i++)
         {
             var p = props[i];
@@ -706,11 +709,12 @@ FirebugReps.ArrBase = domplate(FirebugReps.Obj,
 
             Css.toggleClass(target, "opened");
 
+            var obj = Wrapper.unwrapObject(target.repObject);
             var propBox = target.getElementsByClassName("arrayProperties").item(0);
             if (Css.hasClass(target, "opened"))
             {
                 Firebug.DOMPanel.DirTable.tag.replace(
-                    {object: target.repObject, toggles: this.toggles}, propBox);
+                    {object: obj, toggles: this.toggles}, propBox);
             }
             else
             {
diff --git a/extension/content/firebug/console/autoCompleter.js b/extension/content/firebug/console/autoCompleter.js
index 539fde1..9eff2d6 100644
--- a/extension/content/firebug/console/autoCompleter.js
+++ b/extension/content/firebug/console/autoCompleter.js
@@ -1069,6 +1069,7 @@ function codeMirrorAutoComplete(context, allowGlobal, attemptedCompletionOut, so
 
     var applyCompletion = function(cm, data, completion)
     {
+        cm = Wrapper.unwrapObject(cm);
         completer.completions.index = completion.index;
         var startOfLine = completer.getCompletionValue();
         cm.setLine(line, startOfLine + wholeLine.substr(offset));
diff --git a/extension/content/firebug/editor/sourceEditor.js b/extension/content/firebug/editor/sourceEditor.js
index b725072..546c948 100644
--- a/extension/content/firebug/editor/sourceEditor.js
+++ b/extension/content/firebug/editor/sourceEditor.js
@@ -184,18 +184,7 @@ SourceEditor.prototype =
         // cannot use plain cloneIntoCMScope).
         var newConfig = new this.win.Object();
         for (var prop in config)
-        {
-            try
-            {
-                newConfig[prop] = Wrapper.cloneIntoContentScope(
-                    this.win, config[prop]);
-            }
-            catch (err)
-            {
-                TraceError.sysout("sourceEditor.onInit; EXCEPTION when " +
-                    "cloning " + prop + ", ERROR: " + err, err);
-            }
-        }
+            newConfig[prop] = Wrapper.cloneIntoContentScope(this.win, config[prop]);
 
         Cu.makeObjectPropsNormal(newConfig);
 
@@ -652,6 +641,7 @@ SourceEditor.prototype =
         var self = this;
         var contentHintFunction = function(editor)
         {
+            editor = Wrapper.unwrapObject(editor);
             var ret = hintFunction(self, editor);
             if (!ret)
                 return;
diff --git a/extension/content/firebug/lib/wrapper.js b/extension/content/firebug/lib/wrapper.js
index 0ee6be6..0452c39 100644
--- a/extension/content/firebug/lib/wrapper.js
+++ b/extension/content/firebug/lib/wrapper.js
@@ -66,6 +66,7 @@ Wrapper.cloneIntoContentScope = function(global, obj)
         return obj;
     global = Wrapper.wrapObject(global);
     var newObj = (Array.isArray(obj) ? new global.Array() : new global.Object());
+    newObj = XPCNativeWrapper.unwrap(newObj);
     for (var prop in obj)
     {
         var desc = Object.getOwnPropertyDescriptor(obj, prop);

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