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

cmd/trace: requires HTML imports, a deprecated feature that only works on Chrome #34374

mvdan opened this issue Sep 18, 2019 · 0 comments


Copy link

commented Sep 18, 2019

go version devel +d3595f7171 Wed Sep 18 07:29:33 2019 +0000 linux/amd64

This affects "View trace" on the web UI when running go tool trace. It doesn't matter what the contents of the trace are; they can be from any test, for example via go test -trace=trace.out.

On Chromium 77.0.3865.75 it works, although with some warnings:

[Deprecation] HTML Imports is deprecated and will be removed in M80, around February 2020. Please use ES modules instead. See and for more details.
trace_viewer_html:3455 [Deprecation] document.registerElement is deprecated and will be removed in M80, around February 2020. Please use window.customElements.define instead. See and for more details.
(anonymous) @ trace_viewer_html:3455
(anonymous) @ trace_viewer_html:3455
trace_viewer_html:3635 [Deprecation] Element.createShadowRoot is deprecated and will be removed in M80, around February 2020. Please use Element.attachShadow instead. See and for more details.
_createLocalRoot @ trace_viewer_html:3635
_setupRoot @ trace_viewer_html:3607
_ready @ trace_viewer_html:3487
_tryReady @ trace_viewer_html:3487
_initFeatures @ trace_viewer_html:3930
__initialize @ trace_viewer_html:3438
createdCallback @ trace_viewer_html:3435
(anonymous) @ trace:94

On Firefox 69.0, it simply doesn't work at all. http://localhost:$PORT/trace appears as a blank page. The log shows why:

ReferenceError: tr is not defined trace:59:5
    onResult http://[::]:8080/trace:59
    onreadystatechange http://[::]:8080/trace:43

The underying cause is that FireFox, as well as many other browsers, don't support HTML imports. I'm not sure if they were ever widespread, but they're clearly deprecated and non-portable at the moment. See and

I realise that the docs say:

Note that while the various profiles available when launching 'go tool trace' work on every browser, the trace viewer itself (the 'view trace' page) comes from the Chrome/Chromium project and is only actively tested on that browser.

However, I don't find that to be a good long-term plan. The tool shouldn't depend on deprecated non-portable features, and it should work on all major browsers.

I've been recommending that Go developers make use of go tool trace alongside go tool pprof, but it feels much less useful if it needs a "only works on Chrome" footnote :)

/cc @hyangah

@mvdan mvdan added the DevExp label Sep 18, 2019
@toothrot toothrot added this to the Go1.14 milestone Sep 18, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.