Opened 23 months ago

Closed 20 months ago

Last modified 19 months ago

#6183 closed defect (fixed)

Chrome throws "Receiving end does not exist" exception thrown in background page

Reported by: jsonesen Assignee: kzar
Priority: P2 Milestone: Adblock-Plus-3.0.3-for-Chrome-Opera-Firefox
Module: Platform Keywords:
Cc: kzar, sebastian, mjethani Blocked By:
Blocking: Platform: Chrome
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29636640/
https://codereview.adblockplus.org/29697671/

Description (last modified by kzar)

Environment

MacOS High Sierra, Ubuntu 16.04, Chrome 63
Adlbock Plus 3.0.2.1945

(Not reproducible with Firefox 57.)

How to reproduce

  1. Open a console to inspect the extension's background page
  2. Open a new Chrome tab, browse to https://www.reddit.com
  3. Keep refreshing the page

Observed behaviour

The following exception is quite often thrown:

polyfill.js:102 Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.
    at Object.descriptor.value [as sendMessage] (polyfill.js:78)
    at ext.Page.sendMessage (background.js:100)
    at ext.pages.onLoading.addListener.page (filterComposer.js:312)
    at ext._EventTarget._dispatch (common.js:41)
    at Object.browser.tabs.get [as callback] (background.js:170)
    at safeCallbackApply (extensions::uncaught_exception_handler:27)
    at handleResponse (extensions::sendRequest:67)
func.call.result @ polyfill.js:102
sendResponseAndClearCallback @ extensions::messaging:417
disconnectListener @ extensions::messaging:435
EventImpl.dispatchToListener @ extensions::event_bindings:403
publicClassPrototype.(anonymous function) @ extensions::utils:138
EventImpl.dispatch_ @ extensions::event_bindings:387
EventImpl.dispatch @ extensions::event_bindings:409
publicClassPrototype.(anonymous function) @ extensions::utils:138
dispatchOnDisconnect @ extensions::messaging:378

Expected behaviour

The exception is not thrown.

Notes

Change History (21)

comment:1 Changed 23 months ago by kzar

  • Component changed from Unknown to Platform
  • Description modified (diff)
  • Platform changed from Chrome to Unknown / Cross platform

Thanks for filing the issue.

Can you verify if the same happens in Firefox? (Until you check that I've marked the issue as cross platform.)

What makes you think the exception is being thrown only for cached pages? Please could you update the steps for reproduction to demonstrate that?

Are there any other symptoms other than the exception being thrown?

comment:2 Changed 23 months ago by jsonesen

  • Description modified (diff)

No problem, thanks for the quick feedback.

In firefox there is an error thrown Error: Frame not found or missing host permission when navigating to IRCCloud, but this makes me think it is an unrelated issue.

Furthermore, maybe i was misusing cached and rather prerendered is better in that in the Error traceback, the third event from the bottom (which seems to be where the callback resolves after the initial attempt at sending the message in ext/background.js
https://hg.adblockplus.org/adblockpluschrome/file/tip/ext/background.js#l170
the comment describing this callback has to do with chrome's handling of prerendered tabs.

comment:3 Changed 23 months ago by jsonesen

  • Description modified (diff)

comment:4 follow-up: Changed 23 months ago by kzar

If you think the problem's only with prerendered tabs we could attempt to verify that. Please could you try:

  1. Opening a new tab, slowly typing the address in the address bar, hitting enter and seeing if the exception occurs.
  2. Refreshing that page, or loading the page by clicking on a link and confirming the exception doesn't occur.

If the exception appears / doesn't appear consistently it would indicate that you might be right.

comment:5 Changed 23 months ago by jsonesen

  • Description modified (diff)

comment:6 in reply to: ↑ 4 Changed 23 months ago by jsonesen

Replying to kzar:

If you think the problem's only with prerendered tabs we could attempt to verify that. Please could you try:

  1. Opening a new tab, slowly typing the address in the address bar, hitting enter and seeing if the exception occurs.
  2. Refreshing that page, or loading the page by clicking on a link and confirming the exception doesn't occur.

If the exception appears / doesn't appear consistently it would indicate that you might be right.

So, yeah slowly typing "youtube.com" or "irccloud.com" triggers the error but refreshing does not.

comment:7 Changed 23 months ago by kzar

  • Description modified (diff)
  • Platform changed from Unknown / Cross platform to Chrome
  • Summary changed from Navigating to cached pages triggers "Uncaught (in promise) Error" to Chrome throws "Uncaught (in promise)" exception in background page for prerendered tabs

comment:8 Changed 23 months ago by kzar

  • Description modified (diff)

comment:9 Changed 23 months ago by kzar

  • Description modified (diff)
  • Priority changed from Unknown to P2
  • Ready set
  • Summary changed from Chrome throws "Uncaught (in promise)" exception in background page for prerendered tabs to Chrome throws "Receiving end does not exist" exception thrown in background page

comment:10 Changed 23 months ago by sebastian

  • Cc sebastian added; snoack removed

comment:11 Changed 23 months ago by kzar

OK it seems Manish already partially worked around this issue (see this codereview), but for some reason it's sometimes still happening on Chrome.

comment:12 Changed 23 months ago by kzar

  • Description modified (diff)

comment:13 Changed 23 months ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:14 Changed 23 months ago by kzar

  • Owner set to kzar

comment:15 Changed 22 months ago by abpbot

A commit referencing this issue has landed:
Issue 6183 - Reduce "Receiving end does not exist" exceptions

comment:16 Changed 22 months ago by kzar

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Firefox-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:17 Changed 21 months ago by Ross

This no longer seems to occur with prerendered tabs however it still occurs in the background page every time the Block element functionality is used.

ABP 3.0.2.1968
Chrome 64 / Windows 7

comment:18 Changed 20 months ago by kzar

  • Resolution fixed deleted
  • Review URL(s) modified (diff)
  • Status changed from closed to reopened

This no longer seems to occur with prerendered tabs however it still occurs in the background page every time the Block element functionality is used.

Good point, I've opened a review to fix that as well.

comment:19 Changed 20 months ago by abpbot

A commit referencing this issue has landed:
Issue 6183 - Avoid attempting to close the composer popup twice

comment:20 Changed 20 months ago by kzar

  • Resolution set to fixed
  • Status changed from reopened to closed

How's that looking now Ross?

comment:21 Changed 19 months ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Fixed. I haven't seen this exception in at all in recent builds in general browsing or when using the block element functionality.

Block element in Chrome now triggers a different error (#6490) but doesn't break functionality.

ABP 3.0.2.1983
Firefox 53 / Firefox 58 / Windows 7
Chrome 49 / 65 / Windows 7
Chrome 64 / Ubuntu 16.04
Opera 36 / 51 / Windows 7

Note: See TracTickets for help on using tickets.