Closed Bug 1459743 Opened 6 years ago Closed 6 years ago

Port |Bug 1459245 - Migrate <stringbundle> from XBL binding to Custom Element to prove out the script loading plan for future Custom Elements|

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID
Thunderbird 62.0

People

(Reporter: jorgk-bmo, Assigned: jorgk-bmo)

Details

Attachments

(1 file, 1 obsolete file)

According to bug 1459245 comment #3 we need to load stringbundle.js in all XUL documents.

M-C will do that in MainProcessSingleton.js with this new code, see:
https://reviewboard.mozilla.org/r/241726/diff/2#index_header

    case "document-element-inserted":
      // Set up Custom Elements for XUL windows before anything else happens
      // in the document. Anything loaded here should be considered part of
      // core XUL functionality. Any window-specific elements can be registered
      // via <script> tags at the top of individual documents.
      const doc = subject;
      if (doc.nodePrincipal.isSystemPrincipal &&
          doc.contentType == "application/vnd.mozilla.xul+xml") {
        for (let script of [
          "chrome://global/content/elements/stringbundle.js",
        ]) {
          Services.scriptloader.loadSubScript(script, doc.ownerGlobal);
        }
      }

Aceman, Richad, what's a good spot for this in C-C?
Flags: needinfo?(richard.marti)
Flags: needinfo?(acelists)
Attached patch 1459743-stringbundle.patch (obsolete) — Splinter Review
Aceman dictated me the patch via IRC ;-)
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
Flags: needinfo?(richard.marti)
Flags: needinfo?(acelists)
Attachment #8973871 - Flags: review?(acelists)
Comment on attachment 8973871 [details] [diff] [review]
1459743-stringbundle.patch

Review of attachment 8973871 [details] [diff] [review]:
-----------------------------------------------------------------

Also remove the observer in _dispose().
And how can we test this?
Attachment #8973871 - Flags: feedback+
For testing I applied bug 1459245:
https://hg.mozilla.org/integration/autoland/rev/80fc39b7c5ec

It seems to work, however, M-C forgot to cover the profile manager :-(
JavaScript error: chrome://mozapps/content/profile/profileSelection.js, line 41:
 TypeError: gProfileManagerBundle.getFormattedString is not a function

I also see:
JavaScript error: chrome://global/content/elements/stringbundle.js, line 61: Not
SupportedError: Operation is not supported

This will need to be pushed on the next M-C merge, potentially in the next three hours.
Attachment #8973932 - Flags: review?(acelists)
Attachment #8973871 - Attachment is obsolete: true
Attachment #8973871 - Flags: review?(acelists)
Pushed by frgrahl@gmx.net:
https://hg.mozilla.org/comm-central/rev/b00e830b9e5e
Port bug 1459245: Make sure stringbundle.js is loaded for all XUL documents. r=aceman
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
I still see:
JavaScript error: chrome://global/content/elements/stringbundle.js, line 62: Not Supported
Error: Operation is not supported

Apparently not a problem in FF. Brian suggested that we may not need this code here after all (bug 1459245 comment 25), so I'll investigate.
OK, I added some debug to stringbundle.js 61:
console.trace("in stringbundle.js");
dump(window.location.toString()+"================\n");
customElements.define("stringbundle", MozStringbundle);
dump("after CE ================\n");

and for each XUL document I see:

console.trace: "in stringbundle.js"
chrome://global/content/elements/stringbundle.js 61
file:///C:/mozilla-source/comm-central/obj-x86_64-pc-mingw32/dist/bin/components
/MainProcessSingleton.js 90 observe
chrome://messenger/content/newmailalert.xul================
after CE ================

So that does get called via MainProcessSingleton.js.

I'll back out our patch, not a lot of harm done, the script got loaded twice and we got the error from comment #5.
Comment on attachment 8973932 [details] [diff] [review]
1459743-stringbundle.patch (v2)

Nothing to review, will be backed out.
Attachment #8973932 - Flags: review?(acelists)
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/7ce8558ff198
Backed out changeset b00e830b9e5e for being unnecessary. a=backout DONTBUILD
Target Milestone: --- → Thunderbird 62.0
So <stringbundle>s are working properly now? If so, that's good news since other binding migrations should happen transparently unless if frontend changes are required as part of the migration.
(In reply to Brian Grinstead [:bgrins] from comment #9)
> So <stringbundle>s are working properly now?
Yes, thanks.

Comment #7 indicates, that this has not made it into the product? It is at least not working with daily or current tip. I am verifing this for the addon update guide.

I think this is not needed at all, because calling Services.strings.createBundle(...) is much more simple than adding the stringbundle via overlay and then try to get it via getElementById(...).

I just need a status for the guide.

Hmm, this was done in May 2018, I can't remember a thing. All I can say is that rev b00e830b9e5e was landed in comment #4 and backed out in comment #8.

OK, nothing got fixed here, what was landed was backed out, so this looks like INVALID in the first place.

Resolution: FIXED → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: