Bug 1995694 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

On XXX , 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
```js
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
```js
/**
 * 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
```js
/**
 * 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
```js
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
```js
async #getContentFromCache() {
```

---

Bomsy, it looks like this might have come from Bug 1830230, can you check?
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
```js
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
```js
/**
 * 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
```js
/**
 * 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
```js
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
```js
async #getContentFromCache() {
```

---

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

Back to Bug 1995694 Comment 0