Bug 1531289 Comment 12 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

> assuming there's a public XPCOM way of passing it

Hmm.  I guess there is: nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD.

> I assume, naively, that "all it would take" would be passing the relevant (non-internal) flag here

One would think so....  I just tried it, and the flag makes its way to the channel and thence to , but the tab-closing bit still doesn't happen, because there is no opener so the code at https://searchfox.org/mozilla-central/rev/b2d35912da5b2acecb0274eb113777d344ffb75e/docshell/base/nsDSURIContentListener.cpp#49-62 doesn't end up closing the window.  I guess we need to figure out the "right" behavior here...

> so I have no idea what it does

That part is pretty simple.  All the flag does is cause the "docshell.newWindowTarget" property on the channel to be set to true.  And all that does is that _if_ the channel gets kicked over to the "helper app or download" code it sets mMaybeCloseWindowHelper->SetShouldCloseWindow(true), which lands in that code I linked above.  The idea is to close the useless popup...
> assuming there's a public XPCOM way of passing it

Hmm.  I guess there is: nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD.

> I assume, naively, that "all it would take" would be passing the relevant (non-internal) flag here

One would think so....  I just tried it, and the flag makes its way to the channel and thence to the helper app service, but the tab-closing bit still doesn't happen, because there is no opener so the code at https://searchfox.org/mozilla-central/rev/b2d35912da5b2acecb0274eb113777d344ffb75e/docshell/base/nsDSURIContentListener.cpp#49-62 doesn't end up closing the window.  I guess we need to figure out the "right" behavior here...

> so I have no idea what it does

That part is pretty simple.  All the flag does is cause the "docshell.newWindowTarget" property on the channel to be set to true.  And all that does is that _if_ the channel gets kicked over to the "helper app or download" code it sets mMaybeCloseWindowHelper->SetShouldCloseWindow(true), which lands in that code I linked above.  The idea is to close the useless popup...

Now whether we want that behavior for _all_ addTab consumers or not is an interesting question.

Back to Bug 1531289 Comment 12