Closed Bug 1391116 Opened 7 years ago Closed 6 years ago

WeakMap does not accept an instance of SVGAnimatedLength as a key

Categories

(Core :: DOM: Bindings (WebIDL), defect, P3)

55 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1351501

People

(Reporter: ravi.jayaramappa, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8 Steps to reproduce: var mySvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); console.log(typeof mySvg.width); // Will log as object var map = new WeakMap(); map.set(mySvg.width, "foo"); //Fails in Firefox with this error "TypeError: cannot use the given object as a weak map key" Actual results: Throws a TypeError with the following message "TypeError: cannot use the given object as a weak map key" Same works as expected on Google Chrome and Safari Expected results: Should have added the SVGAnimatedLength instance to weakmap.
Component: Untriaged → DOM
Product: Firefox → Core
Peter, is this expected to work? mccr8 was speculating that maybe the SVG stuff is on the old bindings ...
Flags: needinfo?(peterv)
Priority: -- → P3
It's on the new bindings, it's wrappercached but it's not derived from nsISupports. As explained in TryPreserveWrapper, we don't have a way to know if it's wrappercached, because it's not derived from nsISupports. So we can't preserve the wrapper and the weakmap code relies on preserving the wrapper. We could fix this by having a generated hook that casts the native object to nsWrapperCache.
Flags: needinfo?(peterv)
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Component: DOM → DOM: Bindings (WebIDL)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.