The current code waits for an error event if an image could not be loaded to convert them to data: URLs. These error events are fired after the load event and there is not mechanism besides waiting to be sure all images have been converted. The background image is already converted manually. This patch moves the conversion process of the other images out of the error event and handles them alongside the background image. We still get CSP errors for the original imap:// urls, but we are now able to set a well defined status, once the content of the editor is fully loaded. This patch also moves all other WebExtension APIs which act on the compose window to use the new compose-editor-content-ready event.
Bug 1997519 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The current code waits for an error event if an image could not be loaded to convert them to data: URLs. These error events are fired after the load event and there is no mechanism besides waiting to be sure all images have been converted. The background image is already converted manually. This patch moves the conversion process of the other images out of the error event and handles them alongside the background image. We still get CSP errors for the original imap:// URLSs, but we are now able to set a well defined status, once the content of the editor is fully loaded. This patch also moves all WebExtension APIs which act on the compose window to use the new compose-editor-content-ready event.
The WebExtension API currently waits for the `compose-editor-ready` event to detect when a compose window is ready. However, certain modifications are still applied after that event, most notably image conversions from mailnews URLs to `data:` URLs. Due to other code changes, the event is now seen too early by WebExtensions. This patch aims to correctly wait until after the image conversion has finished. The current code waits for an error event if an image could not be loaded, in order to convert it to a `data:` URL. These error events are fired after the load event, and there is no mechanism besides "waiting a bit" to ensure all images have been converted. The background image is already converted manually. This patch moves the conversion process of the other images out of the error event and handles them alongside the background image. We still get CSP errors for the original `imap://` URLs, but we are now able to set a well-defined status once the content of the editor is fully loaded. This patch also moves all WebExtension APIs that act on the compose window to use the new `compose-editor-content-ready` event.