pinned tab `getContainingWindow` always returns nil

If I send a message from a page, I receive it in my App Extension like so:


override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String: Any]?) {
    page.getContainingTab { tab in
        tab.getContainingWindow(completionHandler: { win in
            // win is nil here for pinned tabs
        })
    })
}


As shown in the comment above, the window object for the pinned tab is always returning nil. If the tab is not pinned I get the correct window object as expected.


Is this a bug or behaving as intended?

Replies

This is expected behavior. Since these pinned tabs techincally belong to all your Safari windows, they don't technically have a containing window.