On Feb 25, 5:27 pm, RodMcguire <[email protected]> wrote:
> Bad display for XPCNativeWrapper and Event
>
> The display code in the Console and DOM tabs doesn’t know how to
> display an XPCNativeWrapper.
>
> Test Case (in Console):
>
> >xBody = new XPCNativeWrapper(document.body)
>
> Displays the same as
>
> >xBody.wrappedJSObject; // == document.body
>
> With no indication that one is wrapped and the other is not and with
> no way to inspect what is inside the wrapper.
>
> Some might consider this a feature but I have found it a bug because
> sometimes XPCNativeWrapper does automagical propagation of properties
> between the wrapper and the wrapped object and sometimes it doesn’t -
> I.e. setting a ‘.foo’ property on the wrapper may or may not set the
> ‘.foo’ property on the wrapped object, and getting the ‘.foo’ property
> from a wrapper may or may not get the ’.foo’ property on the wrapped
> object.
Once you figure out how the wrappers work you can help us figure out
how to display them. In the meantime you may wish to take our
approach: never set a property on Web page (content document) object
in extension (chrome) code, wrapper or no wrapper. In my experience,
the result will by numerous paragraphs like the one above.
>
> I ran into this when I tried creating simple ‘custom events’ as
> illustrated below.
>
> EVENT DISPLAY PROBLEMS
>
> In the Console:
>
> >ev = document.createEvent('Events') // -> blank
>
> Works but returns nothing that can be inspected.
That looks like a bug: the 'short' tag for the object is empty. If
you open a bug report on
http://code.google.com/p/fbug/issues/list we will fix it.
>
> >ev.initEvent('funky', null, null) // -> blank
>
> Works such that
>
> >ev // -> funky
>
> Returns the label ‘funky’ which is the event and can be inspected
>
> >ev.tut = 'funky tut'
>
> Works but
>
> >ev
>
> Still only displays as ‘funky’.
more of the same bug.
>
> Maybe Firebug should display Events as something like
> ‘Event:’+’e.type’ for the case where e.type is not defined so that
> something of the returned value will be displayed that can be
> inspected.
If you would like to contribute a Firebug.Rep for Events please do.
You maybe interested in eventbug
http://www.softwareishard.com/blog/firebug/eventbug-alpha-released/
>
> THE INTERACTION
>
> >wEv = new XPCNativeWrapper(ev) // -> blank
>
> Works but displays nothing that can be inspected, Also the ’.tut’
> property exists only on the wrapped object and not the wrapper:
>
> >wEv.tut // -> blank (I.e. undefined)
> >wEv.wrappedJSObject.tut // -> “funky tut”
>
> I presume somewhere in an XPCNativeWrapper there is some information
> about which properties are automagical but if Firebug doesn’t allow
> you to inspect one directly you can’t see where the information is.
>
> If you create a wrapper yourself, you can tell the creation about
> automagical properties[1]
>
> >wEv2 = new XPCNativeWrapper(ev, ‘type‘, ‘tut‘) // -> blank
>
> Works but still displays as a blank even though
>
> >wEv2.type // -> "funky"
> >wEv2.tut // -> “funky tut”
>
> Which means that even if I create a wrapped event as what I guess is
> ‘correctly’ it still doesn’t display in a form that is inspectable.
>
> However I ran into this problem working with Greasemonkey/Sandboxing
> which automagically creates XPCNativeWrappers where I have no control
> over their auto magical properties.
Unless you are messing with jsdIDebuggerService, then you should not
need to create XPCNativeWrappers.
jjb
>
> I’ve looked in fbug but I don’t see anywhere where these problems are
> mentioned. [2][3]
>
> [1]http://kb.mozillazine.org/XPCNativeWrapper
> [2]http://code.google.com/p/fbug/issues/list?can=1&q=XPCNativeWrapper&co...
> [3]http://code.google.com/p/fbug/issues/list?can=1&q=event+display&colsp...
--
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/firebug?hl=en.