-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Provide reporting event for browser's slow extension warnings #456
Comments
May I suggest you change the issue to be just about the reporting portion? While I agree with everything, I do not believe this is the right venue you for the conversation for topics other than the reporting piece. The WECG does not provide documentation, and what actually triggers such a warning is an implementation detail, rather than something that would normally be covered by standards. |
Thanks for the feedback @patrickkettner 👍 , I've updated the issue. |
While this group has not produced documentation and we don't have immediate plans to do so, I should note that that kind of material is within the scope of community group deliverables:
As I see it, the critical question is whether group members are interested in and motivated to work on this kind of deliverable. If so, I think we can make room in the WECG tent for folks to pursue such projects. I'd only caution that our primary focus in the WECG has been building consensus across browsers and specifying a common WebExtensions platform, so there may be limited interest in creating tutorials or other reference documentation. Or to put it another way, if a member says, "I want to create a guide for X," I'm happy to support their efforts. But if someone says, "I think the WECG should make a guide for X," that's going to be a harder sell. |
I'm intrigued by the idea of a performance reporting API. I currently feel that extension performance is notably different from website performance in that a poorly performing site slows down a single origin while a poorly performing extensions can slow down the entire browser. While browser vendors and community members can create reference material that helps extension developers better understand how to leverage existing tools and APIs to monitor and measure extension performance, I think we should consider how the platform itself can help steer developers in the right direction. At the moment I'm imagining an API that allows platform implementers to notify an extension about a variety of conditions, such as a long loop, slow function calls, slow scripts injected into pages, aggregate time of injected script execution, abnormal impact on the user's battery, frequent wakes without work, etc. Such an API could be structured so that it covers the mechanisms used to notify an extension of abnormal conditions, the shape of the events, the format browsers use to identify the relevant file and line number, and other relevant data without being prescriptive about what performance events browsers support. I'm curious how browser reps feel about this general direction. |
Yea, that's definitely an interesting idea. Perhaps if we did add the "bad performance" event I proposed, browser vendors could think of additional situations in which to fire that event. Anything that gives developers something actionable like a stack trace and a brief description sounds good to me. My perspective is mostly as an extension developer. Over the years, I've debugged these issues a few times:
In any case, the more I think about it, the more I think this is a good idea. Showing a warning to the user should be a last resort really. Also making that warning available to developers seems like a minimum, and sharing extra warnings with developers as a proactive/preventative measure like @dotproto suggests would be even better. |
While a good idea, I have some concern with having an API for this.
|
Good question, here's an example of how I see the event being used: In the DuckDuckGo Privacy Essentials browser extension, we attempt to protect the user by blocking requests to tracking scripts, and things like that. Sometimes those protections cause a website to break, at which point the user can disable protections by clicking on the extension's icon and clicking to disable protections in the popup UI. If they do that, they are asked if they'd like to report the website as broken. If they do, they are asked a few questions and a breakage report is sent in to us, which includes relevant details such as which protections were active on that page. If we had this "bad performance" event, the first thing I'd like to do would be to listen for it, and then include details of when it fired with any related breakage reports. It would be hugely useful to have something like a stack trace and a note for performance issues included in those reports. If we saw a spike in breakage reports pointing to the performance of some specific piece of code, the issue would be much easier to address. Another option, which maybe would be more controversial, could be that the API works in a similar way to runtime.setUninstallURL. Perhaps then, the reports could be fired off in a similar way to CSP violation reports.
Yea, that's a good point. I think some of the time the event would be deliverable, depending on the browser and which process had hung or what the warning was related to. That's my guess at least, it would be good to loop in some more browser devs to check that. Perhaps sometimes the event would not be immediately deliverable, but I think the event would still be useful to extension devs even if it fired with a delay. I suppose if we went with the |
Firefox is supportive of this reporting event, probably including the url of the page that triggered it, along with some other metadata that might be useful. We would be happy to propose/prototype a design if other implementers are interested as well. |
Thanks @zombie. Please shout if I can help with that work, best way to reach me is to drop me an email to kzar@kzar.co.uk . Also, it's maybe worth pointing out that even if this event is only implemented for Firefox or a subset of the major browsers, it will still be immediately useful for extension developers. So long as it's possible to check the event exists before adding a listener, we'll be able to put it to use right away. |
An update on this, Dave has been working to contribute a proposal for this API in Firefox bug 1861445. If anyone is interested to try it out, and/or has any feedback, please comment (here or in the patch). |
Changing to supportive for Safari after seeing the patch for Firefox. |
From our discussion last week -- I'm worried about the proposed name of the event being We discussed other alternatives, such as |
That's fair, happy to change the event name to |
… r=zombie When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708
… r=zombie When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708
… r=zombie When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708 UltraBlame original commit: 199b3c24b8b43b8053831d7c287bbe83e43037c4
… r=zombie When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708 UltraBlame original commit: 199b3c24b8b43b8053831d7c287bbe83e43037c4
… r=zombie When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708 UltraBlame original commit: 199b3c24b8b43b8053831d7c287bbe83e43037c4
… r=zombie,robwu When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708
… r=zombie,robwu When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708
… r=zombie,robwu When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708 UltraBlame original commit: 9d33a3994005a05a8fbc4ad307e4bd6fb4ab2a63
… r=zombie,robwu When an extension's content script is very slow and causes a webpage to hang noticeably, a warning banner is displayed to the user. It would be useful to also notify the extension developer when that happens, so that they can address the issue. Let's add a new event runtime.onPerformanceWarning that can be dispatched when the browser needs to warn an extension of runtime performance issues. For now, let's just dispatch that event when the slow extension warning banner is displayed to the user. See also w3c/webextensions#456 Differential Revision: https://phabricator.services.mozilla.com/D194708 UltraBlame original commit: 9d33a3994005a05a8fbc4ad307e4bd6fb4ab2a63
@kzar Is there any reason for specifying the recognized performance warnings in enums exposed on the There is no way to use these values in any meaningful way, because they are emitted as potential event values from the API, and not taken as input. These enums are currently two extra objects on the I can imagine a future use case, of adding a filter to the API to filter for events of interest. That would enable extensions to subscribe to specific warning events without being notified of all warnings, and enable the browser to optimize its implementation when there are differences between the underlying event sources. |
As long as the possible category + severity values are defined in enums, I don't have a strong preference about if they're exposed as Objects under the runtime API or not. That said, my vote would be to keep them exposed as I've found that useful in the past with similar events. To guess at future use cases, yes I suppose you're right that we might add the ability to filter the event and for that having access to the enums would be useful. Also I suppose an extension might take care to check the enums before adding a listener, e.g. to see if the "content_scripts" category is listed first. |
So as a quick update, the I read today that Microsoft are adding extension performance warnings to Edge, is there anyone from Microsoft here that could consider adding support for the |
Background
Browsers sometimes display a warning to the user that one of the browser extensions that they have enabled is slowing down their experience. Browsers seem to trigger such warnings under different circumstances, and there doesn't appear to be much documentation around this, or ways for extension developers to diagnose the performance issues. It would be nice to support extension developers in proactively improving their extension's performance.
Suggestion
onBeforeRequest
event handler) is slow. Perhaps the event could also include a description (e.g. "Slow content script", or "Slow onBeforeRequest handler") to point developers in the right direction?References
"EXTENSION NAME" is slowing down Firefox. To speed up your browser, stop that extension. Learn more <Stop>
This extension is slowing down Google Chrome. You should disable it to restore Google Chrome's performance.
The text was updated successfully, but these errors were encountered: