content_script injected >300 times on web page
Reported by
tomac...@gmail.com,
Jul 7 2016
|
||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Steps to reproduce the problem: 1. Install disable HTML5 Autoplay extension 2. Goto this page: 3. Open inspector and go to the extension, find content_script.js and set a breakpoint on the line matching "if (!(play_authorized || play_pending)) ", approx. line 174 What is the expected behavior? Normal breakpoint What went wrong? content_script.js is loaded in an infinite loop and the developer tools opens a new window for each. It also seems to break on the breakpoint (not visibly), because this locks up immediately. It recovers when the breakpoint(s) (it adds multiple breakpoints itself) are removed, but the tabs are still open and must be closed. Did this work before? N/A Chrome version: 51.0.2704.103 Channel: n/a OS Version: OS X 10.11.1 Flash Version: This is listed as a bug with the developer tools, however it is also very likely an issue with extensions.
,
Jul 7 2016
,
Sep 12 2016
,
Dec 2 2016
,
Oct 6 2017
thanks for report! I debugged this one. It looks like on the mentioned page (goo.gl/qf8OjS), content_scripts.js is injected more then 300 times and for each injected script we show separate tab. So it's work as intended in DevTools, we have some ideas how we can merge tabs with same content but we are not working on this now. Routed to extensions to verify that 300 times is reasonable amount of injected scripts.
,
Oct 6 2017
,
Oct 6 2017
As a hyopthetical extension developer, I think it would be important to be able to know how many times a script was injected. I mean in the sense of a notice or warning rather than a lockup. I didn't develop that extension, but I'm guessing that the script has to be re-injected periodically. Only problem here sounds like the breakpoint is hitting on every injected script instead of just the latest.
,
Oct 6 2017
To be clear, this is a script injected through chrome.tabs.executeScript (not an entry in the manifest under "content_scripts"). Injecting a script each time the API method is called is WAI, and sometimes injecting multiple times is necessary. The main bug here is in the extension itself, since it's calling executeScript() far more frequently than is necessary (this is because it injects the script in all frames of the tab every time any navigation is committed anywhere in that tab - which for a tab with tens or hundreds of frames, is a lot). We probably should find a way to throttle injections to some reasonable amount, but we'll probably need to add some metrics to determine what that "reasonable amount" is.
,
Oct 6 2017
That makes sense. I've been having some stalling on Youtube possibly due to that extension. The extension is teribly written, but has some practical use. I hope Google will implement autoplay blocking to keep up with Safari.
,
Oct 6 2017
raymes@ and emilyschechter@, is there any discussion of or appetite for autoplay videos as a content setting? (This would allow users to customize it, and as a bonus, extensions could use the contentSettings API to make this work in a muuuuuch less hacky way!).
,
Oct 8 2017
+mlamouri I think we have an autoplay setting on mobile but I don't think it does the same thing as the extension described.
,
Oct 10 2017
Mobile setting isn't related indeed. We are introducing some content setting to block a tab from making sound but that's slightly different from blocking autoplay.
,
Oct 10
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by tomac...@gmail.com
, Jul 7 2016