• Paul Jolly's avatar
    misc/wasm: use single map for string, symbol and object id mapping. · abaf53fb
    Paul Jolly authored
    Currently we use a globally unique symbol property on objects that get
    passed from JavaScript to Go to store a unique ID that Go then uses when
    referring back to the JavaScript object (via js.Value.ref). This
    approach fails however when a JavaScript object cannot be modified, i.e.
    cannot have new properties added or is frozen. The test that is added as
    part of this commit currently fails with:
    
      Cannot add property Symbol(), object is not extensible
    
    Instead we consolidate the string, symbol and object unique ID mapping
    into a single map. Map key equality is determined via strict equality,
    which is the semantic we want in this situation.
    
    Change-Id: Ieb2b50fc36d3c30e148aa7a41557f3c59cd33766
    Reviewed-on: https://go-review.googlesource.com/121799
    Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarRichard Musiol <neelance@gmail.com>
    abaf53fb
wasm_exec.js 10.5 KB