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)
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.
Comment 1•7 years ago
|
||
I guess it's problem in somewhere near here
https://dxr.mozilla.org/mozilla-central/rev/7ff4c2f1fe11f6b98686f783294692893b1e1e8b/dom/bindings/BindingUtils.cpp#1064-1083
Component: Untriaged → DOM
Product: Firefox → Core
Comment 2•7 years ago
|
||
Peter, is this expected to work? mccr8 was speculating that maybe the SVG stuff is on the old bindings ...
Flags: needinfo?(peterv)
Priority: -- → P3
Comment 3•7 years ago
|
||
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)
Updated•6 years ago
|
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.
Description
•