Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall/js: js.Global() will become a different object through the identity function #38899

Closed
hajimehoshi opened this issue May 6, 2020 · 4 comments
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@hajimehoshi
Copy link
Member

What version of Go are you using (go version)?

$ go version
go version go1.14.1 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOENV="/Users/hajimehoshi/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hajimehoshi/test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ht/ky_bwgzs4bd5z1hh02k34x_h0000gn/T/go-build393765834=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Run this code:

package main

import (
        "syscall/js"
)

func main() {
        ident := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
                return args[0]
        })
        defer ident.Release()
        println(ident.Invoke(js.Global()).Equal(js.Global()))
}

What did you expect to see?

true is printed

What did you see instead?

false is printed

@hajimehoshi
Copy link
Member Author

CC @neelance

@hajimehoshi hajimehoshi changed the title syscall/js: js.Global() will become a different object through the identify function syscall/js: js.Global() will become a different object through the identity function May 6, 2020
@hajimehoshi
Copy link
Member Author

My guess is that _ids has to be initialized with the preset values and their ids.

@hajimehoshi
Copy link
Member Author

I'll send a CL soon.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/232518 mentions this issue: misc/wasm: prepare IDs for the preset objects

@dmitshur dmitshur added arch-wasm WebAssembly issues NeedsFix The path to resolution is known, but the work has not been done. labels May 6, 2020
@dmitshur dmitshur added this to the Go1.15 milestone May 6, 2020
@golang golang locked and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants