Closed Bug 1856481 Opened 2 years ago Closed 1 year ago

Seeing a "destroyed actor" error message while remote debugging Android WebExtensions

Categories

(DevTools :: about:debugging, defect, P2)

Firefox 120
All
Android
defect

Tracking

(firefox131 fixed)

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: dotproto, Assigned: jdescottes)

References

Details

(Whiteboard: [addons-jira])

Attachments

(2 files, 1 obsolete file)

Attached file test-case.zip

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/120.0

Steps to reproduce:

Before beginning, you will need to download the attached extension and install it on a USB-tethered Android device using the instructions provided at https://extensionworkshop.com/documentation/develop/developing-extensions-for-firefox-for-android/

  1. Used web-ext to load the extension as described here: https://extensionworkshop.com/documentation/develop/developing-extensions-for-firefox-for-android/#install-and-run-your-extension-in-firefox-for-android
  2. Open about:debugging#/runtime/this-firefox and connect to the tetherd Android device.
  3. Click the "Inspect" button on the "Test case" extension.
  4. Give the developer tools tab ~10 seconds load resources, then close the tab.
  5. Back on the about:debugging tab click the "Reload" button in the Test Extension UI.

Attempted to write a response containing a destroyed actor from: root

Actual results:

An error will appear for the extension that says "Protocol error (Error): Attempted to write a response containing a destroyed actor from: root (resource://devtools/shared/protocol/types.js:358:17)".

In this case, you can clear the error by disconnecting from the device and re-connecting. In other cases it seems that the only way to restore the extension to working order is to kill and re-run web-ext.
Depending on the nature of the error that caused this message to appear,

Expected results:

The extension should reload as expected without producing an error message.

I am getting this error from time to time, too.

:jdescottes could you please take a look? Thanks!

Component: WebExtensions → about:debugging
Flags: needinfo?(jdescottes)
Product: Fenix → DevTools
Status: UNCONFIRMED → NEW
Ever confirmed: true

Hi Julian,
I manage to reproduce this locally with some additional debug log added in a custom build I did locally and it seems that we are hitting this when webextensions descriptor onDestroy method is being called twice, there are the stack traces related to the two calls (the logs that starts with CANARY are the debugging logs I added in my local build):

10-12 06:08:01.441  9590  9613 I Gecko   : console.trace: "CANARY webextensions descriptor destroy" "server0.conn1.child23/webExtensionTarget2" "f9ec61cd157494e9efde350137f21871ddc3203f@temporary-addon"
10-12 06:08:01.441  9590  9613 I Gecko   : resource://devtools/server/actors/descriptors/webextension.js 311 destroy
10-12 06:08:01.441  9590  9613 I Gecko   : resource://devtools/server/actors/descriptors/webextension.js 289 _onChildExit
10-12 06:08:01.442  9590  9613 I Gecko   : console.error: (new TypeError("can't access property \"indexOf\", aSourceURL is undefined", "resource://gre/modules/GeckoViewConsole.sys.mjs", 165))
10-12 06:08:01.442  9590  9613 E GeckoConsole: [JavaScript Error: "TypeError: can't access property "indexOf", aSourceURL is undefined"]
10-12 06:08:01.447  9590  9613 I Gecko   : console.trace: "CANARY webextensions descriptor destroy" null "f9ec61cd157494e9efde350137f21871ddc3203f@temporary-addon"
10-12 06:08:01.447  9590  9613 I Gecko   : resource://devtools/server/actors/descriptors/webextension.js 311 destroy
10-12 06:08:01.447  9590  9613 I Gecko   : resource://devtools/server/connectors/frame-connector.js 119 connectToFrame/</destroy<
10-12 06:08:01.447  9590  9613 I Gecko   : resource://devtools/shared/ThreadSafeDevToolsUtils.js 103 exports.makeInfallible/<
10-12 06:08:01.447  9590  9613 I Gecko   : resource://devtools/server/connectors/frame-connector.js 154 onMessageManagerClose
10-12 06:08:01.447  9590  9613 I Gecko   : resource://gre/modules/ExtensionParent.sys.mjs 1755 releaseExtensionProcessBrowser/<
10-12 06:08:01.447  9590  9613 I Gecko   : resource://gre/modules/ExtensionParent.sys.mjs 1755 releaseExtensionProcessBrowser
10-12 06:08:01.447  9590  9613 I Gecko   : resource://devtools/server/actors/descriptors/webextension.js 325 destroy
Whiteboard: [addons-jira]

I think the root cause of the issue is that the WebExtension descriptor actor is destroyed when its Target actor is destroyed.
This is probably a leftover from the descriptor migration done in Bug 1575557.

For remote debugging, we reuse the same client for the about:debugging UI and for the about:debugging toolboxes. So descriptors should not be destroyed unless the underlying target is really destroyed (eg addon uninstall here).

I see two options: either we strop destroying the descriptor from the target actor's destroy, or we make listAddons a bit safer by checking is actor.isDestroyed() when retrieving the addon's list (and if true -> recreate the descriptor).

Flags: needinfo?(jdescottes)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Attachment #9413330 - Attachment is obsolete: true
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6f51dab4589d [devtools] Stop destroying webextension descriptor on actor destroy r=ochameau,devtools-reviewers

Backed out for causing mochitest failures on browser_aboutdebugging_addons_remote_runtime_close_reopen.js

[task 2024-07-26T14:03:53.533Z] 14:03:53     INFO - TEST-PASS | devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_remote_runtime_close_reopen.js | Inspect button for test-devtools-webextension appeared - 
[task 2024-07-26T14:03:53.534Z] 14:03:53     INFO - Buffered messages logged at 14:02:22
[task 2024-07-26T14:03:53.534Z] 14:03:53     INFO - Console message: [JavaScript Warning: "Storage access automatically granted for origin “[System Principal]” on “[System Principal]”."]
[task 2024-07-26T14:03:53.535Z] 14:03:53     INFO - Console message: Invalid chrome URI (need path): chrome://devtools/
[task 2024-07-26T14:03:53.536Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499 column: 25 source: "display: none !important"}]
[task 2024-07-26T14:03:53.537Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499}]
[task 2024-07-26T14:03:53.537Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/elements/panel.js" line: 62}]
[task 2024-07-26T14:03:53.538Z] 14:03:53     INFO - Buffered messages logged at 14:02:23
[task 2024-07-26T14:03:53.538Z] 14:03:53     INFO - Console message: Invalid chrome URI (need path): chrome://devtools/
[task 2024-07-26T14:03:53.539Z] 14:03:53     INFO - Wait for about:devtools-toolbox tab will be selected
[task 2024-07-26T14:03:53.539Z] 14:03:53     INFO - Wait for about:devtools-toolbox tab to have the expected URL
[task 2024-07-26T14:03:53.540Z] 14:03:53     INFO - Close the toolbox
[task 2024-07-26T14:03:53.540Z] 14:03:53     INFO - Wait for requests to settle
[task 2024-07-26T14:03:53.541Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499 column: 25 source: "display: none !important"}]
[task 2024-07-26T14:03:53.542Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499}]
[task 2024-07-26T14:03:53.543Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/elements/panel.js" line: 62}]
[task 2024-07-26T14:03:53.544Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499 column: 25 source: "display: none !important"}]
[task 2024-07-26T14:03:53.544Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499}]
[task 2024-07-26T14:03:53.545Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/elements/panel.js" line: 62}]
[task 2024-07-26T14:03:53.546Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499 column: 25 source: "display: none !important"}]
[task 2024-07-26T14:03:53.547Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/customElements.js" line: 499}]
[task 2024-07-26T14:03:53.547Z] 14:03:53     INFO - Console message: [JavaScript Error: "Content-Security-Policy: The page’s settings blocked an inline style (style-src-attr) from being applied because it violates the following directive: “default-src chrome: resource:”" {file: "chrome://global/content/elements/panel.js" line: 62}]
[task 2024-07-26T14:03:53.548Z] 14:03:53     INFO - Buffered messages finished
[task 2024-07-26T14:03:53.548Z] 14:03:53     INFO - TEST-UNEXPECTED-FAIL | devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_addons_remote_runtime_close_reopen.js | Test timed out - 
[task 2024-07-26T14:03:53.549Z] 14:03:53     INFO - GECKO(1067) | Completed ShutdownLeaks collections in process 1067
[task 2024-07-26T14:03:53.549Z] 14:03:53     INFO - TEST-START | Shutdown
Flags: needinfo?(jdescottes)

It seems that folding the two approaches together leads to failures on test-verify + debug

Flags: needinfo?(jdescottes)
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/23621642a445 [devtools] Stop destroying webextension descriptor on actor destroy r=ochameau,devtools-reviewers

Backed out for causing dt failures on browser_aboutdebugging_addons_remote_runtime_close_reopen.js.

Flags: needinfo?(jdescottes)
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/27dc9e73c95d [devtools] Stop destroying webextension descriptor on actor destroy r=ochameau,devtools-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 131 Branch
Flags: needinfo?(jdescottes)
Blocks: 1953475
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: