Closed Bug 1374779 Opened 7 years ago Closed 7 years ago

Clicking on addbook: link from vCard displayed inline hangs TB

Categories

(Thunderbird :: Message Reader UI, defect)

defect
Not set
critical

Tracking

(thunderbird_esr52 unaffected, thunderbird52 unaffected, thunderbird53 wontfix, thunderbird54 wontfix, thunderbird55 fixed, thunderbird56 fixed)

RESOLVED FIXED
Thunderbird 56.0
Tracking Status
thunderbird_esr52 --- unaffected
thunderbird52 --- unaffected
thunderbird53 --- wontfix
thunderbird54 --- wontfix
thunderbird55 --- fixed
thunderbird56 --- fixed

People

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

References

Details

(Keywords: hang, regression)

Attachments

(3 files)

Attached file attached VCard.eml
Clicking on addbook: link from vCard displayed inline hangs TB.

STR:
Set attachments to display inline.
Import and open attached message.
Click on the vCard link.

Result:
TB hangs, menu unresponsive.

Problem doesn't happen in TB 52 ESR, but does happen in TB 55 and 56.

Alice, can you find the regression, please.
Flags: needinfo?(alice0775)
Where is "vCard link"?
Flags: needinfo?(alice0775)
When hovering the (missing) icon.
Error Console shows
Security Error: Content at mailbox:///C:/Users/fuku/AppData/Roaming/Thunderbird/Profiles/em4ra9pm.gfff/Mail/pop.mail.yahoo.co.jp/Inbox?number=2 may not load or link to chrome://messenger/content/addressbook/abNewCardDialog.xul.
Thanks, Alice!!!

Boris, looks like some of your security changes broke a piece in TB, addbook: links when clicked in a message.

Here's some debug from out content policy code:

=== nsMsgContentPolicy::ShouldLoad: URI=|addbook:add?action=add?vcard=begin%3Avcard%0D%0Aversion%3A3.0%0D%0Afn%3AMeister%0D%0Aemail%3BTYPE%3DWORK%2CPREF%3Ameister%40web.de%0D%0Aend%3Avcard%0D%0A%0D%0A|
=== nsMsgContentPolicy::ShouldLoad: Request Principal Sys/Code/Null Principal: 0/1/0
=== nsMsgContentPolicy::ShouldLoad: CodebasePrincipal=|mailbox:///C:/Users/jorgk/AppData/Roaming/Thunderbird/Profiles/testing.testing/Mail/Local%20Folders/June%202017?number=11|
=== returning (4) 1

My debug code is this:
  if (IsExposedProtocol(aContentLocation))
  {
    *aDecision = nsIContentPolicy::ACCEPT;
    printf("=== returning (4) %d\n", (int) *aDecision); return NS_OK;
  }
and the IsExposedProtocol() function is just returning "accept" (1) for addbook: links.

Alice has found something interesting, see previous comment. I don't know how he did, since for me, when I click, all windows are blocked.

So somehow that content wants to trigger a load on abNewCardDialog.xul which is exactly the dialogue that will prompt you to add the card. Looks like you tightened security there.

So what can we do to resolve this?
Flags: needinfo?(bzbarsky)
I didn't make any security changes in the range linked in comment 4.

> So what can we do to resolve this?

Find the actual changeset that regressed this and ask the people involved in it.  In this case, chances are that's the fix for bug 1182569, given that range.
Flags: needinfo?(ckerschb)
Flags: needinfo?(bugs)
Flags: needinfo?(bzbarsky)
Of course, if I CC'ed Ben Bucksch here, he'd tell us that the UI is conceptually wrong since content shouldn't be able to trigger commands, like he did in bug 1372411 comment #0. However, links have traditionally triggered "commands", like clicking a mailto: link opens a compose window.
That said, given the error message from comment 5, it sounds like the abNewCardDialog.xul load is happening as if triggered by the untrusted "mailbox:///C:/Users/fuku/AppData/Roaming/Thunderbird/Profiles/em4ra9pm.gfff/Mail/pop.mail.yahoo.co.jp/Inbox?number=2" url, and the load gets blocked.  Presumably this is coming from something like nsAbContentHandler::HandleContent doing a window.open in C++ using the content window, not the chrome, as the parent.  If so, changing it to use the chrome window there might help.
Yes, I assume it's coming from the nsAbContentHandler::HandleContent code. Where do I get a chrome window? Secondly, I can't call OpenDialog() on nsIDOMChromeWindow.
> Where do I get a chrome window? 

That depends on the structure of your UI, but presumably if you're running all this in-process you could get the same-type root docshell and then get its parent and then get its window.

> Secondly, I can't call OpenDialog() on nsIDOMChromeWindow.

You don't need an nsIDOMChromeWindow.  You need the nsIDOMWindow for the Thunderbird UI, as opposed to the nsIDOMWindow for the vcard being viewed.
(In reply to Boris Zbarsky [:bz] (if a patch has no decent message, automatic r-) from comment #11)
> That depends on the structure of your UI, but presumably if you're running
> all this in-process you could get the same-type root docshell and then get
> its parent and then get its window.
Could you please write down the function names to achieve this or a link to a sample.

As you know, we TB people are generalists, Jacks of all trades, masters of none. (Recently I did bug 1363281 and I'm still dealing with follow-up bugs, so I think it's fair to say that I know more about encodings than docshell.)
> Could you please write down the function names to achieve this or a link to a sample.

No, because it depends on the exact structure of your chrome, and I don't know what that is.

That said, you could try what I suggested in comment 11 or a modified version: get the docshell from the window (see nsPIDOMWindow::GetDocshell), GetRootTreeItem on the docshell to get the root-most thing, which is presumably system-principaled, do_GetInterface an nsIDOMWindow from that.
Thank you, this works, and I don't think I can find a better reviewer than you.

BTW,
            nsCOMPtr<nsIDOMWindow> window(do_GetInterface(root));
            rv = window->OpenDialog( ...
gave a compile error:
'OpenDialog': is not a member of 'nsIDOMWindow'
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
Flags: needinfo?(ckerschb)
Flags: needinfo?(bugs)
Attachment #8880011 - Flags: review?(bzbarsky)
Comment on attachment 8880011 [details] [diff] [review]
1374779-addbook-link.patch (v1)

r=me
Attachment #8880011 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/comm-central/rev/4e64a09ef23545c60be574f055c892a06a537344
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 56.0
Comment on attachment 8880011 [details] [diff] [review]
1374779-addbook-link.patch (v1)

We need to fix this in the beta version, too, since it already regressed in bug 1182569 in mozilla53.
Attachment #8880011 - Flags: approval-comm-beta+
Blocks: 1375376
Severity: normal → critical
Keywords: hang
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: