Closed Bug 1935431 Opened 10 months ago Closed 7 months ago

Support showing the trusted types string in the developer console

Categories

(DevTools :: Console, enhancement, P2)

enhancement

Tracking

(firefox138 fixed)

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: mbrodesser, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

STR:

  1. Set the "dom.security.trusted_types.enabled" pref to true.
  2. Open https://jsfiddle.net/c9mg4zqp/ and check the developer console.

Expected: "TrustedHTML {vv}" is logged
Actual: "TrustedHTML { }" is logged

Chrome behaves as expected.

Type: defect → enhancement
Component: DOM: Security → Console
Product: Core → DevTools

Agreed, this would be great to get in. Reminds me of bug 1652671 ;-)

Could also be nice to add a link to the createHTML function used by the TrustedHTML.
Since TrustedHTML is being worked on in Firefox at the moment, it would be nice to work on this soon-ish.

Priority: -- → P2
See Also: → 1840326

Mirko, it seems that what you want is something similar than in Chrome, where they show the result of toString() I guess ?
Is there anything else we could show somehow? As Julian said, we discussed in triage and thought it could be nice to somehow print the createHTML function from the TrustedTypePolicy. Do you think we could expose a ChromeOnly policy getter on TrustedHTML ?
Also should we think of handling TrustedScript and TrustedScriptURL as well?

Thanks!

Flags: needinfo?(mbrodesser)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #3)

Mirko, it seems that what you want is something similar than in Chrome, where they show the result of toString() I guess ?

Yes.

Is there anything else we could show somehow?

That might be superfluous.

As Julian said, we discussed in triage and thought it could be nice to somehow print the createHTML function from the TrustedTypePolicy. Do you think we could expose a ChromeOnly policy getter on TrustedHTML ?
Also should we think of handling TrustedScript and TrustedScriptURL as well?

Yes, TrustedScript* should be handled too.

Thanks!

Flags: needinfo?(mbrodesser)

CC Fred, since he took over the work on Trusted Types from me.

Flags: needinfo?(fwang)

This is needed to add meaningful previews for instances of those classes in
the console.
Tests are added in next patch.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Are you sure that my review request is correct? I am not a peer of this module so can't review patches.

(In reply to Gabriele Svelto [:gsvelto] from comment #8)

Are you sure that my review request is correct? I am not a peer of this module so can't review patches.

last time I made changes to the Sandbox.cpp file, smaug asked you to review the patch, so I thought it would be the same here :)
I'll ask smaug as well

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5cdfde163954 Expose TrustedHTML, TrustedScript and TrustedScriptURL in DevTools sandbox. r=devtools-reviewers,smaug. https://hg.mozilla.org/integration/autoland/rev/d0045739b9f8 [devtools] Add specific previewers for TrustedHTML, TrustedScript and TrustedScriptURL objects. r=devtools-reviewers,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch

I think others already replied. I don't have strong opinions on this, but whatever facilitate debugging for web developers sounds good. And yes, TrustedScript/TrustedScriptURL should always be handled the same as TrustedHTML.

Flags: needinfo?(fwang)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: