Closed Bug 964507 Opened 6 years ago Closed 6 years ago

There are no tests for Firefox's support for Debugger.Source.prototype.element and .elementAttributeName

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: jimb, Assigned: jimb)

References

Details

Attachments

(1 file, 2 obsolete files)

Bug 941876 made Firefox tell SpiderMonkey which DOM elements, and which attributes of those elements, bits of JavaScript code belong to. The landed patch didn't include any tests; while the functionality is pretty straightforward, it would be nice to have some tests that exercise it.
(I have a patch in progress for this.)
Boris, if you can think of any other cases to test (I think you mentioned some oddities around <body> tags?), let me know.
Assignee: nobody → jimb
Status: NEW → ASSIGNED
Attachment #8366442 - Flags: review?(bzbarsky)
Comment on attachment 8366442 [details] [diff] [review]
Add mochitests for Debugger.Source.protoype.element and .elementAttributeName.

The only other things are <body onfoo> (which adds an event listener on the _window_ but we want to associate it with the body) and the SVG cases where the name of the attribute doesn't match the name of the event....
Attachment #8366442 - Flags: review?(bzbarsky) → review+
Okay, this exercises the <body> vs. window case.

Can you give me an example a case where the SVG attribute and event names are different?
Attachment #8366442 - Attachment is obsolete: true
Flags: needinfo?(bzbarsky)
> Can you give me an example a case where the SVG attribute and event names are different?

Sure thing.  Here's an example:

  <!DOCTYPE html>
  <script>
    var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
    svg.setAttribute("onload", "alert('called: '+call)");
    var call = "load"
    svg.dispatchEvent(new Event("load"));
    call = "SVGLoad"
    svg.dispatchEvent(new Event("SVGLoad"));
  </script>

so in this case the event name is "SVGLoad" but the attribute name is "load".
Flags: needinfo?(bzbarsky)
Oh, and the full list is basically at http://hg.mozilla.org/mozilla-central/annotate/0eb2ba65a702/dom/events/nsEventListenerManager.cpp#l816 : the event name is the RHS of the if condition with the "on" removed and the attr name is what gets assigned to attrName, with the "on" removed.  Might be simpler to use something other than load/SVGLoad that would just not fire unless you trigger it manually.
Okay, I've got both <body> and SVG tests in this one; the rest is unchanged. Boris, could you give it a quick look to ensure that it's actually testing for the correct behavior?

Then I think this is done.
Attachment #8366834 - Attachment is obsolete: true
Attachment #8367494 - Flags: review?(bzbarsky)
Comment on attachment 8367494 [details] [diff] [review]
Add mochitests for Debugger.Source.protoype.element and .elementAttributeName.

Looks great!  r=me
Attachment #8367494 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/1e9ac0371578
Flags: in-testsuite+
Target Milestone: --- → mozilla29
https://hg.mozilla.org/mozilla-central/rev/1e9ac0371578
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.