Closed Bug 1995694 Opened 1 month ago Closed 18 days ago

LongStringActor created with a Promise (not a string) causes exception when reloading page (this.str.substring is not a function)

Categories

(DevTools :: Netmonitor, defect, P2)

defect

Tracking

(firefox-esr115 unaffected, firefox-esr140 unaffected, firefox144 wontfix, firefox145 fixed, firefox146 fixed)

RESOLVED FIXED
146 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox144 --- wontfix
firefox145 --- fixed
firefox146 --- fixed

People

(Reporter: nchevobbe, Assigned: bomsy)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

On https://simple-vt-demos.jakearchibald.com/bounce/ , with DevTools opened, if I reload the page, I'm getting an exception from https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/devtools/server/actors/string.js#36

initial: this.str.substring(0, DevToolsServer.LONG_STRING_INITIAL_LENGTH),

exception: this.str.substring is not a function
this is because this.str is a Promise, not a string

The stacktrace points to https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/devtools/server/actors/network-monitor/network-event-actor.js#661-667,674

/**
 * Add network response content.
 *
 * @param object content
 *        The response content.
 */
addResponseContent(content) {
...
  content.text = new LongStringActor(this.conn, content.text);

Here, content.text is a Promise
it's build from https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/devtools/shared/network-observer/NetworkResponseListener.sys.mjs#564-567,630,633

/**
 * Create the response object and send it to the client.
 */
#getResponseContent(data) {
...
    response.text = text;
...
  this.#httpActivity.owner.addResponseContent(response);

where data is the Promise
it comes from https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/devtools/shared/network-observer/NetworkResponseListener.sys.mjs#346,375-377

onStartRequest(request) {
...
  if (isOptimizedContent) {
    const data = this.#getContentFromCache();
    this.#getResponseContent(data);

and indeed #getContentFromCache is async https://searchfox.org/firefox-main/rev/a5316cedc669bcec09efae23521e0af6b9d3d257/devtools/shared/network-observer/NetworkResponseListener.sys.mjs#656

async #getContentFromCache() {

Bomsy, it looks like this might have come from Bug 1830230, can you check?

Flags: needinfo?(hmanilla)

Thanks Nicholas,
Yes indeed this was likely introduced by the refactoring i did in Bug 1830230.

I was not able to reproduce on the page provided , but was able to reproduce by just refreshing on https://nchevobbe.github.io/demo/console-test-app.html

Flags: needinfo?(hmanilla)
Assignee: nobody → hmanilla
Attachment #9522473 - Attachment description: WIP: Bug 1995694 - [devtools] Wait for the value from the promise returned from #getContentFromCache → Bug 1995694 - [devtools] Wait for the actual value of the promise returned from getContentFromCache r=#devtools
Status: NEW → ASSIGNED
Blocks: 1995746
Severity: -- → S3
Priority: -- → P2
Duplicate of this bug: 1995746
Keywords: regression
Regressed by: 1830230
Duplicate of this bug: 1997032

Set release status flags based on info from the regressing bug 1830230

Pushed by hmanilla@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/642917788c4f https://hg.mozilla.org/integration/autoland/rev/0b4cfff1ae81 [devtools] Wait for the actual value of the promise returned from getContentFromCache r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 18 days ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch

The patch landed in nightly and beta is affected.
:bomsy, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(hmanilla)

firefox-beta Uplift Approval Request

  • User impact if declined: Will impact users ability to copy all or save all requests as har
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: Small js fix
  • String changes made/needed: none
  • Is Android affected?: no
Attachment #9525250 - Flags: approval-mozilla-beta?
Flags: needinfo?(hmanilla)
Regressions: 1991020
Flags: in-testsuite+
Attachment #9525250 - Flags: approval-mozilla-beta? → approval-mozilla-release?

(if this gets uplifted to release, we should take Bug 1991020 as well to avoid frequent test failures)

Attachment #9525250 - Flags: approval-mozilla-release? → approval-mozilla-release+
Duplicate of this bug: 2000768
No longer blocks: 1995746
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: