Skip to content

Error thrown by content script cleanup logic

Environment

  • OS version: Ubuntu 22.04
  • Browser version: Chrome 117
  • Extension version: next (b54ddb24)
  • Last working version: Adblock Plus 3.19

Steps to reproduce

  1. Trigger an on-page dialog to be shown (e.g. see internal comment).

Observed behavior

Error shown in web page JavaScript console:

Uncaught (in promise) TypeError: Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function callback): Invalid extension id: 'getUnloadClassName'
    at browser-polyfill.js:1181:25
    at new Promise (<anonymous>)
    at wrappedSendMessage (browser-polyfill.js:1178:14)
    at Object.apply (browser-polyfill.js:869:26)
    at prepareElementForUnload (unload-cleanup.ts:3:1)
    at showDialog (frame-manager.ts:62:5)
    at handleMessage (frame-manager.ts:28:1)
    at onMessage (browser-polyfill.js:1093:20)

Additionally, the following warning message is shown in the background page JavaScript console:

Untrusted message received getUnloadClassName

Expected behavior

No error or warning should be shown when an on-page dialog is shown.

Further information

This regression was introduced by #1404 (closed), which does message passing differently from the rest of the extension (e.g. sending non-object messages), and thereby causes the error to be thrown. Furthermore, due to it not using the existing messaging API logic, no restrictions towards safe messages are being enforced. Therefore we should replace the custom message passing code and use the existing APIs for it instead.

Edited by Thomas Greiner
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information