sendMessage() communication chain is out of order
Reported by
thd...@gmail.com,
Nov 2 2016
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.28 Safari/537.36 Steps to reproduce the problem: 1. Load test.zip as an unpacked extension 2. Monitor the extension's background page Console tab 3. Go to any web page and monitor its Console as well 4. Click anywhere on the web page What is the expected behavior? After clicking the mouse, a communication is started between the content script (CS) and event page (EP) that goes like this: CS -> EP -> CS -> EP-> CS. The console.log order should be like this: 1. Initiate communication with EP 2. Received initial message from CS; send message back 3. Got message from event page; send response 4. Got response from CS; send response to initial message 5. Got response from EP; communication is complete What went wrong? The console.log order is this: 1. Initiate communication with EP 2. Received initial message from CS; send message back 5. Got response from EP; communication is complete 3. Got message from event page; send response 4. Got response from CS; send response to initial message Did this work before? N/A Does this work in other browsers? N/A Chrome version: 55.0.2883.28 Channel: beta OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Shockwave Flash 23.0 r0 Shouldn't #5 be logged after receiving the response from the #4 callback (eventPage.js line 13)? My gut feeling is the sendMessage() timeout period is too short, so you cannot have a sendReponse() inside a callback, but in this case why is the initial sendMessage() from the CS getting a callback response at all (i.e., #5 should never be logged).
,
Nov 3 2016
unable to reproduce the issue on windows-7 using chrome stable version 54.0.2840.87, canary 56.0.2907.0 and reported Beta version 55.0.2883.28 with below steps 1.opened chrome 2.Loaded test.zip as an unpacked extension 3.Navigated to the the extension's background page Console tab 4.Navigated to web page and clicked on it and not observed the console log please find the attached screenshot for reference and let us know anything missed here to reproduce the issue. Thanks.
,
Nov 7 2016
#2 I think the root cause is my using sendResponse inside a callback of chrome.tabs.sendMessage as mentioned in #1. Please close this.
,
Nov 7 2016
With this said, what is considered the "best practice" way for a content script that is injected in all frames ("all_frames": true in manifest) to communicate to the top frame after a certain JS function is done executing in all the frames? It would be nice to have a serial communication option for this purpose.
,
Nov 7 2016
As per comment #3, closing this issue as won't fix. Please raise a new bug, if still facing issue with chrome further. Thanks..!! |
|||
►
Sign in to add a comment |
|||
Comment 1 by woxxom@gmail.com
, Nov 2 2016