I have a Safari Extension and an NPAPI plug-in and am trying to get an identifier for both a browser and tab that is persistent across loads until the window/tab is closed. One of the objects that I use needs to look up a tab by some identifier. On our Windows implementation, they use windowing APIs to get the pointer to the window (to represent the tab) and walk up the parents list to get the top level window (to represent the browser).
Is there anything like this on Mac Safari?
There is no way to get a pointer to the browser's window in any Mac browser that runs plugins out of process (which includes 64-bit Safar), because windows aren't shareable across processes. Moreover, the concept seems deeply flawed on any platform; many browsers allow dragging a tab out of one window and into another. Do you want your plugin to suddenly believe it's in a new page in this case even though the user hasn't even reloaded the page?
I can't think of any way you can track tabs given that the API has no concept of tabs. I'd strongly recommend revisiting this requirement, given that it seems very arbitrary from a user perspective. (For example, if I reload a page, that's the same, but if I close a tab and then immediately re-open it using the browser's version of undo-close-tab, it's not? And as noted above, if I drag a tab between windows, the tab is somehow different?)