Open Bug 1947854 Opened 25 days ago Updated 18 days ago

Debugger pretty print randomly fails on https://unsplash.com/s/photos/renaissance

Categories

(DevTools :: Debugger, defect)

defect

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned, NeedInfo)

References

Details

Follow up to Bug 1932023.

STRs:

ER: should always work
AR: will sometimes show an error in the editor instead of the prettified source

Error varies from time to time, I've seen: Invalid regular expression flag (11:2), Unterminated regular expression (2:2) and some others ... maybe the content of renaissance changes.

Need to capture the failing script.

Managed to repro on central, thanks to the error now logged on pretty print failures, here's the string we failed to prettify:

unction(){"use strict";const e=3456e4,t="consent_uid",o=e=>document.cookie.split("; ").find((t=>t.startsWith(${e}=)))?.split("=")?.[1],s=(e,t,o)=>{document.cookie=[[e,t],...void 0!==o?[["max-age",o.toString()]]:[],["path","/"]].map((e=>e.join("="))\u2026;const f=(e,t)=>()=>{s.setConsent(e,t)};y.addEventListener("click",f("accepted-cookie-consent",!0)),.addEventListener("click",f("closed-cookie-consent",!0)),p.addEventListener("click",f("rejected-cookie-consent",!1)),b.show()}var n})(d,,u)))}();\n</

It most likely relate to the unreliability of HTML page sources retrieval from the html parser (bug 1538056),
where we sometimes only receive parts of the HTML page.
You may be seeing this issue when opening the HTML source in CodeMirror, it may be incomplete (before pretty printing).

I was originaly seeing this issue when investigating bug 1932023.

Overall the behavior seems very inconsistent, again I can't reproduce the original issue anymore, but I'm getting issues earlier with the Debugger unable to even display the source.

Regarding the error I commented about in Comment 1, it might be related to Bug 1824979, because adding some more logs I could also see that right before we prettified the faulty string pasted in the previous comment, we already pretty printed the same string, but with a correct offset (starting with !function instead of unction).

For reference, now I am almost always getting Error: Incorrect contents fetched, please reload. when trying to open the file in the debugger, without any pretty printing

Try to reproduce in a test which GCs inline scripts.

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