EventListenerInfo.toSource() returns null or "({})" sometimes

RESOLVED INVALID

Status

()

Core
DOM
RESOLVED INVALID
6 years ago
6 years ago

People

(Reporter: teramako, Unassigned)

Tracking

13 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 636649 [details]
results of EventListenerInfo.toSource()

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1
Build ID: 20120614114901

Steps to reproduce:

1. open Scratchpad
2. switch environment to browser
3. input:

Cc["@mozilla.org/eventlistenerservice;1"]
  .getService(Ci.nsIEventListenerService)
  .getListenerInfoFor(gBrowser)
  .map(function(info) info.toSource())

4. execute "Inspect"




Actual results:

Sometimes, each elements becomes null or "({})"

Comment 1

6 years ago
toSource() returns null if the listener is implemented in C++. (The documentation about
nsIEventListenerInfo::toSource() is pretty clear about this.)
And ({}) is valid case too, if someone has just passed empty object as listener.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

6 years ago
(In reply to Olli Pettay [:smaug] from comment #1)
> toSource() returns null if the listener is implemented in C++. (The
> documentation about
> nsIEventListenerInfo::toSource() is pretty clear about this.)
> And ({}) is valid case too, if someone has just passed empty object as
> listener.

hmmm, my example's results are all coded C++ ? I cannot believe.

more example:

gBrowser.addEventListener("click", function(aEvent) {
  gBrowser.removeEventListener("click", arguments.callee, false);
  Services.console.logStringMessage("type: " + aEvent.type);
}, false);

var infos = Cc["@mozilla.org/eventlistenerservice;1"]
    .getService(Ci.nsIEventListenerService)
    .getListenerInfoFor(gBrowser)
    .map(function(info) [info.type, info.toSource()]);

infos.filter(function(info) info[0] === "click");

and execute "Inspect" and "Update" several times, all results are null.

Comment 3

6 years ago
If I copy-paste that to Scratchpad and run Inspect, I get two click event listeners, neither one
is null.
You need to log in before you can comment on or make changes to this bug.