Hi,

Me again. With flags. Seems my actual karma.

Context: in our implementation, we have a full-screen browser, so we
handle the concept of tabs and popups and so on by creating "sessions"
and switching them to foreground (i.e., gaining the full-screen) and
background (hiding away) as appropriate. It works, somehow.

Implementation: I just use nsIWindowCreator::CreateChromeWindow. When
Gecko says it needs a new "window" because I clicked somewhere and it
would normally opens another tab or window, I check for the flags,
discard some cases (for example CHROME_OPENAS_DIALOG) and eventually
create a new "session". Then I switch the new session to foreground
and start grabbing pixels and refreshing and so on.

Problem: sometimes, after a single click,
nsIWindowCreator::CreateChromeWindow is called more than once, with
same flags, so I cannot distinguish for which of the calls the
relative "session" should gain the foreground, or even should be
created or rejected. For example, in Facebook, when clicking on a
YouTube link, Firefox usually opens a page with an upper frame which
says basically "man, you are watching a YouTube video but you are
still into FaceBook". In the lower part of the page, you see the
YouTube page. In that case, my implementation calls
nsIWindowCreator::CreateChromeWindow THREE times, everytime with same
flags:

1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_WINDOW_BORDERS
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_WINDOW_CLOSE
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_WINDOW_RESIZE
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_MENUBAR
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_TOOLBAR
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_LOCATIONBAR
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_STATUSBAR
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_SCROLLBARS
1245079008 INFO WebSessionsManager :
nsIWebBrowserChrome::CHROME_TITLEBAR
1245079008 INFO WebSessionsManager : nsIWebBrowserChrome::CHROME_EXTRA
1245079008 INFO WebSessionsManager : nsIWebBrowserChrome::CHROME_ALL

and same parent. Using CreateChromeWindow2 is useless, context flags
are 0 and URI is null... so I create 3 sessions, and the wrong one
gains the foreground, video is not rendered etc etc...

how Firefox understand to create JUST ONE tab?

thanks in advance!

PS: writing a browser is a FU**ING HELL!


_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to