@bobfrankston/rmfmail 1.1.139 → 1.1.141

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/app.js CHANGED
@@ -978,14 +978,32 @@ async function openCompose(mode, overrideMsg, overrideAccountId) {
978
978
  init.bodyHtml = forwardBody(msg);
979
979
  init.fromAddress = detectReplyFrom();
980
980
  }
981
- // Store init data for compose window to pick up. sessionStorage is the
982
- // canonical handoff path same origin between parent and iframe; the
983
- // compose IIFE reads it after the editor finishes booting. We also
984
- // postMessage the iframe so it can short-circuit the listen-for-message
985
- // wait if it's already past editor init.
986
- sessionStorage.setItem("composeInit", JSON.stringify(init));
981
+ // Store init data for compose window to pick up. Two parallel paths
982
+ // because sessionStorage propagation to a freshly-loading iframe has
983
+ // intermittently failed under WebView2's custom-protocol host (Bob
984
+ // 2026-05-24: reply-all opened with empty To/Subject; daemon log shows
985
+ // reply-init dump fired correctly but the iframe IIFE saw sessionStorage
986
+ // empty and timed out the wait). postMessage carries the FULL init
987
+ // payload so the iframe can populate even when storage doesn't bridge.
988
+ // sessionStorage remains as the fast-path for iframes that finish
989
+ // loading before postMessage fires.
990
+ const initJson = JSON.stringify(init);
987
991
  try {
988
- frame?.contentWindow?.postMessage({ type: "compose-init-ready" }, "*");
992
+ sessionStorage.setItem("composeInit", initJson);
993
+ }
994
+ catch (e) {
995
+ console.error("[compose] sessionStorage.setItem failed:", e?.message || e);
996
+ }
997
+ const post = () => {
998
+ try {
999
+ frame?.contentWindow?.postMessage({ type: "compose-init", init }, "*");
1000
+ }
1001
+ catch { /* */ }
1002
+ };
1003
+ post();
1004
+ // Iframe may not be loaded yet — re-post on load so the listener exists.
1005
+ try {
1006
+ frame?.addEventListener("load", post, { once: true });
989
1007
  }
990
1008
  catch { /* */ }
991
1009
  }