Closed Bug 1493121 Opened 6 years ago Closed 6 years ago

Unnecessary use of `wrappedJSObject` in JsAccount's factory

Categories

(MailNews Core :: Backend, enhancement)

enhancement
Not set
normal

Tracking

(thunderbird_esr6063+ fixed, thunderbird63 wontfix, thunderbird64 fixed)

RESOLVED FIXED
Thunderbird 64.0
Tracking Status
thunderbird_esr60 63+ fixed
thunderbird63 --- wontfix
thunderbird64 --- fixed

People

(Reporter: neil, Assigned: neil)

Details

Attachments

(1 file)

JsAccount needs to enumerate the delegate's methods in order for the delegator to know which methods are delegated. However, rather than directly accessing the delegate that it just created, it unnecessarily does this indirectly through XPCOM, necessitating the use of `wrappedJSObject` to recover the JS delegate object.
Attached patch Proposed patchSplinter Review
Since `jsDelegate` already exists as a variable, we don't need to retrieve it back from the delegator, and so we don't need to use the `wrappedJSObject` mechanism.
Attachment #9010895 - Flags: review?(jorgk)
Comment on attachment 9010895 [details] [diff] [review]
Proposed patch

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

Thanks Neil, good to see you active again :-)

Sadly I don't know which state JsAccount is currently in. It went bust when M-C changed many things related to nsIURI, so I had to disable some tests, see bug 1447492 and bug 1475166. Since Kent is not active any more, it would be supercalifragilisticexpialidocious if you could adopt that lost child a bit.

I don't know whether your Level 3 right have lapse in the meantime. I prefer to do all landing myself so I can get the timing coordinated with M-C merges.

::: mailnews/jsaccount/modules/JSAccountUtils.jsm
@@ +118,5 @@
>        let delegateList = delegator.methodsToDelegate;
>        Object.keys(delegator).forEach(name => {log.debug("delegator has key " + name);});
>  
>        // jsMethods contains the methods that may be targets of the C++ delegation to JS.
> +      let jsMethods = Object.getPrototypeOf(jsDelegate);

Yes, similar to line 111:
delegateList = Object.getPrototypeOf(jsDelegate).delegateList;
Attachment #9010895 - Flags: review?(jorgk) → review+
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/940a5071df8d
Remove unnecessary use of `wrappedJSObject` in JsAccount's factory. r=jorgk
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 64.0
Comment on attachment 9010895 [details] [diff] [review]
Proposed patch

[Approval Request Comment]
Risk to taking this patch (and alternatives if risky): No risk to Thunderbird. An extension would have to be very weirdly coded (i.e. probably already broken) in order to be affected.
Attachment #9010895 - Flags: approval-comm-esr60?
OK, but what's the benefit of having it in TB 60? Only consumer of JS Account is ExQuilla, right?
We're developing a new extension, which is affected by this.
Oh yes, I get the full picture now. And you're promising not to break ExQuilla. Having the patch on trunk doesn't prove anything since ExQuilla only works to TB 60.
Try run: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=e0e2d86fd8869f3fdd361fe869ce658d376e3b6b (do those JsAccount tests you mentioned somewhere still run on ESR?)
(In reply to neil@parkwaycc.co.uk from comment #8)
> do those JsAccount tests you mentioned somewhere still run on ESR?
You are referring to bug 1447492 and bug 1475166, right.

Without knowing it, you've just fixed bug 1475166. That was a test failure caused by switching to clang-cl at version 63, so that test is still running on ESR and running again on all platforms now.

I switched off test_fooUrl.js in bug 1447492 in late March 2018 during the 61 cycle, so that test is also still running on ESR. That bug has a WIP, I could fix the crash trivially, but then it's downhill from there. Maybe you can take a look.
Attachment #9010895 - Flags: approval-comm-esr60? → approval-comm-esr60+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: