Closed
Bug 75745
Opened 24 years ago
Closed 24 years ago
Remove nsIPrompt impls from embedding chrome.
Categories
(Core Graveyard :: Embedding: APIs, defect)
Core Graveyard
Embedding: APIs
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: ccarlen, Assigned: adamlock)
Details
(Whiteboard: want for 0.9 - missing ActiveX testbed impl)
Attachments
(13 files)
7.97 KB,
text/plain
|
Details | |
2.27 KB,
patch
|
Details | Diff | Splinter Review | |
7.56 KB,
patch
|
Details | Diff | Splinter Review | |
58.52 KB,
patch
|
Details | Diff | Splinter Review | |
30.78 KB,
patch
|
Details | Diff | Splinter Review | |
5.22 KB,
patch
|
Details | Diff | Splinter Review | |
18.21 KB,
patch
|
Details | Diff | Splinter Review | |
6.04 KB,
patch
|
Details | Diff | Splinter Review | |
10.48 KB,
patch
|
Details | Diff | Splinter Review | |
11.54 KB,
patch
|
Details | Diff | Splinter Review | |
11.87 KB,
patch
|
Details | Diff | Splinter Review | |
12.12 KB,
patch
|
Details | Diff | Splinter Review | |
14.52 KB,
patch
|
Details | Diff | Splinter Review |
All the embedding samples implement nsIPrompt which is gotten through a
GetInterface on their chrome. This model is going away. Now, the window watcher
supplies all prompts. The window watcher creates an nsIPromptService component
with a contract ID. If an embedding app wants it own native prompt
implemntation, it registers a factory to create the component with that contract
ID, replacing any existing one. What needs to happen is this:
(1) nsDocShellTreeOwner.cpp should not do a GetInterface to the embeddor's
chrome to get an nsIPrompt.
(2) The embedding samples need to move their prompt impls into a separate
component and then register it at startup. Boilerplate code for doing that is
coming up
Reporter | ||
Comment 1•24 years ago
|
||
Reporter | ||
Comment 2•24 years ago
|
||
Reporter | ||
Comment 3•24 years ago
|
||
The first attachment is an empty impl of nsIPromptService. Notice that
nsIPromptService is just like nsIPrompt with the addition of an nsIDomWindow as
the parent. Dan is working on something which will make it easy enough to get
from that DOMWindow to a native window. To make the conversion, just paste the
guts of each nsIPrompt method that you implement in your chrome into
nsIPromptService. Then strip out nsIPrompt from your chrome.
The second diffs are what I had to do in PPEmbed to override the component.
The other thing which needs to happen is to remove/change the code in
nsDocShellTreeOwner's GetInterface. That will be the final flip of the switch.
Updated•24 years ago
|
Target Milestone: --- → mozilla0.9
Comment 4•24 years ago
|
||
So I went ahead and did an implementation of this for gtk and then I thought
about it. I think that by default I'd rather use the default dialogs ( the XUL
ones for now ) by default in the embedding widget. The people who are going to
want to override it are the galeon folks and anyone who wants to remove XUL and
I don't really care about this. I'm just going to attach a patch that
disconnects the EmbedPrompter widget. Is that OK with you guys?
Comment 5•24 years ago
|
||
Comment 6•24 years ago
|
||
absolutely. it's up to the embeddor (the gtk embedding widget in this case).
cool, our new model is already hard at work for us :-).
Reporter | ||
Comment 7•24 years ago
|
||
Cool - that patch makes my life easier. One less native nsIPrompt impl to worry
about in the tree. You still probably need to implement
nsIWebBrowserChrome::ShowAsModal in order for the XUL dialogs to work. The XUL
dialogs are put up by window watcher. Dan, is this right? I don't have my tree
setup right now to run with XUL prompts and see. I could say for sure later
tonight. Anyway, you should have ShowAsModal for the XUL dialogs put up by PSM2.
Conrad/Chris: Yes. The window opening code (in WindowWatcher) notices a modal
window, asks the docshell treeowner for an nsIWebBrowserChrome and calls
ShowAsModal on it. In Mozilla that ends up at an nsXULWindow, which implements
modality. Embedding guys need to implement that, too, for embedded XUL modal
windows to work.
A first approximation on gtk could be modeled after the Mozilla code. Just
fall into a g_main_iteration loop until someone calls
nsIWebBrowserChrome::ExitModalEventLoop.
Reporter | ||
Comment 10•24 years ago
|
||
> Just fall into a g_main_iteration loop until someone calls
> nsIWebBrowserChrome::ExitModalEventLoop
I found in my testing of this that ExitModalEventLoop never happened. What did
happen was the window was just destroyed which, as the API actually says :-), is
also supposed to terminate the modal loop.
Comment 11•24 years ago
|
||
r=valeski on the PPEmbed changes. We need to move nsIPromptService's CID and
contract id in the nsIPromptService.idl though, so they're public.
Comment 12•24 years ago
|
||
hrm...when I tried it it didn't try to pop up a new window and as near as I
could tell it never tried to create it. I'll have to do some more digging.
Comment 13•24 years ago
|
||
r=chak on the mfcembed - with the following requests:
* Remove references to nsIPrompt from README.TXT, BrowserImpl.cpp/h etc.
* Add a couple of comment lines where we define/invoke OverrideComponents() on
what exactly overriding components means - mainly to help current/future users
who're basing their code on mfcembed.
Comment 14•24 years ago
|
||
ok, so where are we on this one?
PPEmbed = r=valeski
mfcEmbed = r=chak
gtkEmbed = r=conrad???
winEmbed = dan's banging on it.
viewer?
bliz, can you sr this when all the above pieces are r'd?
Reporter | ||
Comment 15•24 years ago
|
||
I think that as far as comments go, since PPEmbed & mfcEmbed are example apps,
is this point: mfcEmbed does its overriding in a separate dll: HMODULE overlib =
::LoadLibrary(kComponentsLibname);
whereas PPEmbed does it without a separate dll file. Both are valid and one way
might appeal to some people but not to others. It would unfortunate for somebody
to come across one way and not realize there's another. I'll put comments in
PPEmbed which point to the alternate method used by mfcEmbed and I think
mfcEmbed should do the same.
Chris, how goes the XUL dialog situation?
I also have coming up soon a complete patch for PPEmbed so that it does either
native or XUL dialogs. I didn't attach my native impl component last time.
Comment 16•24 years ago
|
||
I can sr when everyone is all reviewed.
Comment 17•24 years ago
|
||
I've added the comments Chak requested and Conrad suggested. When that patch is
in, the current winEmbed native prompt stuff will be disabled, and is trivially
removed. (Note winEmbed is still broken because, like gtkEmbed, it's having a
hard time posing modal XUL windows.) But I argue that's a different (0.9.1) bug.
(Still wants fixing, of course.) I'm ready to go.
Comment 18•24 years ago
|
||
I don't want to ship 0.9 with broken dialogs. People actually use it.
Reporter | ||
Comment 19•24 years ago
|
||
Reporter | ||
Comment 20•24 years ago
|
||
Alright, here's the updated patch to PPEmbed. It handles, controlled by a
#define, both native prompts with an override, and XUL modal dialogs. I found
something ugly at the end that I hadn't seen until stepping through which caused
me to make quite a bit more change. Basically - problem was I was calling
nsIWebBrowser::SetContainerWindow() *after* calling nsIWebBrowser::Create().
This causes window watcher to have no chrome for my window because, at the point
at which AddWindow() gets called, it doesn't have one. That's changed now.
Another problem - in nsDocShellTreeOwner.cpp, every call to GetInterface() for
an nsIPrompt causes a whole new object to be made. This wasn't the case before
and is not in Seamonkey. Necko requests tons of them and we're making and
destroying a lot more prompts than we used to.
Comment 21•24 years ago
|
||
I'm trying to play with the modality and I can't even get a window to get
created. Do I need to apply a patch somewhere? Where should I start to trace
the code that creates a new window?
Reporter | ||
Comment 22•24 years ago
|
||
Did you apply Dan's patch to nsDocShell.h/.cpp?
Reporter | ||
Comment 23•24 years ago
|
||
Whoops - ignore that. I meant nsDocShellTreeOwner.h/.cpp.
Comment 24•24 years ago
|
||
Not yet. Let me give that a spin.
Reporter | ||
Comment 25•24 years ago
|
||
Chris - hopefully, that'll do it. If so, and we're going to check this in, can
you sr my patch?
Comment 26•24 years ago
|
||
Comment 27•24 years ago
|
||
Argh. So I can't set up ShowAsModal to work because it's usually called from
the event queue processor. The end effect of this is that the event queue is
blocked because it's already being processed so the chrome dialog doesn't ever
finish loading. Suck.
Comment 29•24 years ago
|
||
Correction: Changing QA contact for the Embed API bugs to David Epstein.
QA Contact: mdunn → depstein
Updated•24 years ago
|
Whiteboard: want for 0.9 check again on 4/20
Comment 30•24 years ago
|
||
Comment 31•24 years ago
|
||
NB: the above patch to winEmbed removes its nsIPrompt implementation (unused
anyway, once the previous patch is checked in) and makes ShowAsModal work, which
is what the default Gecko PromptService needs to function. It doesn't make the
dialogs pretty. One of the missing bits is sizing to content, which is slated to
be moved from a private interface to a public one (see bug 69922: slated for 0.9,
but not checked in yet. Obviously no one is worrying about using this one just
yet.)
Status: NEW → ASSIGNED
Comment 32•24 years ago
|
||
For the love of GOD! One of the nice things about our shiny new XP codebase is
that most features need be implemented only once. I'm happy to say it took me
this long to go insane, working on the embedding project, because now most
features need to be implemented five or six times: once for Mozilla and once for
every single bloody embedding testbed. Thanks largely to Christopher and Conrad
for pitching in.
I was just about to gamely go update the viewer app too, when I discovered, as
I should have known, that there are NINE more apps that need updating to support
modal windows. If you were anywhere near me in the last ten minutes, you'd have
gone deaf.
Viewer has never implemented the nsIPrompt methods. If you look, they're all
just stub functions. It's no worse now in the new world, once this patch is
checked in. In fact, it's better. It'll at least open a window containing the
nsIPrompt message. That's more than it's ever done before. I say we're not
breaking Viewer by checking this patch in without first implementing it on
viewer. I'm ready. Let's check in.
Reporter | ||
Comment 33•24 years ago
|
||
PowerPlant code checked in.
Comment 34•24 years ago
|
||
over to blizzard. danm thinks he is done...
chris, do you have code for this?
Assignee: danm → blizzard
Status: ASSIGNED → NEW
Whiteboard: want for 0.9 check again on 4/20 → want for 0.9 -
Comment 35•24 years ago
|
||
Comment 36•24 years ago
|
||
I felt bad about big dumb looking browser-sized alerts in winEmbed, which uses
the default (XUL) nsIPrompt. The above patch fixes that. It should be part of
this bug. Looking for r= approval.
Reporter | ||
Comment 37•24 years ago
|
||
Dan, in WebBrowserChromeUI::SizeTo(), what if the browser is inset significantly
within the window frame? I don't think it will happen with chrome dialogs, but...
Reporter | ||
Comment 38•24 years ago
|
||
Since what I mentioned probably won't happen anyway and it's much better than
what we have, r=ccarlen
Comment 39•24 years ago
|
||
You're right; it's coming through as a SizeBrowserTo and I'm just wrapping in
in a window at that size. It's a safe assumption for chrome windows because I've
made them use a special dialog resource with a browser that takes up the whole
window content area.
I have a real love/hate relationship with the embedding testbeds. Mostly hate.
It doesn't make much sense to me to solve the general problem since the exact
technique will no doubt not be applicable to any actual embedding app, even if
it's based on winEmbed, and winEmbed itself won't suffer unless it picks up a lot
more general polish, anyway.
But the situation is worthy of a comment in the source. I'll do that.
Comment 40•24 years ago
|
||
winEmbed intrinsic sizing code is checked in
Updated•24 years ago
|
Whiteboard: want for 0.9 - → want for 0.9 - have win32 code, need in linux
Comment 41•24 years ago
|
||
Comment 42•24 years ago
|
||
OK, a patch is attached that fixes the problems in the window watcher service,
removes nsIPrompt from the gtk code and implements ShowAsModal.
The only problem is that the XUL dialogs are still coming up with the wrong size.
Comment 43•24 years ago
|
||
Comment 44•24 years ago
|
||
OK, this patch fixes the dialog resizing problems. Turns out that I was
resizing the dialog before it was finished loading. Silly me!
Looking for review and testing.
Reporter | ||
Comment 45•24 years ago
|
||
Looked good until I got to the end. Adding an nsIAppShell to windowwatcher is
not good. I thought the whole point of windowwatcher was to rid embedding apps
of appshell. Can you move that appshell business into your
ShowAsModal/ExitModalLoop? It seems to be a requirement just for you - the other
embedding apps have done this without having to add appshell into windowwatcher.
Comment 46•24 years ago
|
||
This is going to hurt anyone who is doing embedding on linux and it has to be
done anywhere where there is going to be a modal loop. Besides, appshell is
part of the widget library which we will always pull in anyway.
Reporter | ||
Comment 47•24 years ago
|
||
But the question is: is it possible to put it in the embedding code
(ShowAsModal/ExitModalLoop)? If it's at all possible, please move it. It's not
needed on any other platform and, if it can't be moved, at least #ifdef it.
Comment 48•24 years ago
|
||
I suspect that it's not possible to move that code down to the widget code since
you will not get notifications of the XUL loading since the thread event queue
will get pushed and you will never get the dialog.
In any case this is supposed to get XP code and shouldn't be littered with
ifdefs for platform specific differences. At first glance both the Qt port and
the Photon port need to have this implemented too. Even though they are
relatively less important ports they shouldn't be left behind because we don't
want to include a file.
Comment 49•24 years ago
|
||
I dunno why widget/public is considered a harmful embedding API. Can someone
fill me in?
/be
Reporter | ||
Comment 50•24 years ago
|
||
widget/public is not a harmful embedding API. Creating an instance of appshell
and spinning up an event loop with it from within an embedded app is harmful (at
least on Mac). I'll apply the patch and see.
Reporter | ||
Comment 51•24 years ago
|
||
After applying the patch, I get a permanently spinning cursor after the dialog
goes away. Creating the appshell instance has at least this as a side-affect -
not sure at this point what else. It's also a high overhead object to create.
Comment 52•24 years ago
|
||
Why is it a high overhead object? It's just like another widget object.
So, why the spinning cursor? Does something not finish loading? Does the
window dismiss? Does the appshell get destroyed?
For what it's worth this is roughly patterned after:
http://lxr.mozilla.org/seamonkey/source/xpfe/appshell/src/nsXULWindow.cpp#1285
Reporter | ||
Comment 53•24 years ago
|
||
It's high overhead because of this:
http://lxr.mozilla.org/seamonkey/source/widget/src/mac/nsAppShell.cpp#78
-making a new message pump, message sink, and memory cushion.
The spinning cursor seems to be just a cosmetic problem and has to do with the
creation of the msg pump or sink. If you really must do this, I'd have to fix
this problem on Mac.
Point is, ShowAsModal works without this patch on Mac & Windows. Adding this
appshell creation to windowwatcher, which affects all of us, to cover a problem
which exists only on gtk, is wrong (or at least a pain in the ass).
Reporter | ||
Comment 54•24 years ago
|
||
After looking at the permanently spinning cursor on Mac, it can be easily fixed
if need be. I'm testing a patch.
Comment 55•24 years ago
|
||
To your first point: unless we change the nsIWebBrowserChrome interface so that
we can push the event queue before we call ShowAsModal this has to live in the
window watcher code otherwise this won't work on linux.
Let me know about your mac patch. Has anyone tried this on win32 yet?
Comment 56•24 years ago
|
||
It's a peculiarity of the system we use to handle events in gtk that it needs
appshell help when new queues are added. We could consider a lighter weight
appshell for doing just this one thing, or maybe breaking up the initialization
API into two methods (Init before (the current) Spinup, perhaps) that would do
nothing for platforms that don't need this capability.
About the way you've chosen to hook this up, though, Chris; it does make a
dangerous assumption that only the WindowWatcher will ever push an event queue.
There are a couple of other places this is done that could affect even embedding
apps. There's one in nsStringBundle, for instance. That one is scary. But point
is, it would be better to have a generalized algorithm for hooking up
ListenToEventQueue, rather than building it straight into the WindowWatcher this
way.
Maybe another component inside the embedding components DLL that catches event
queue creation and destruction in the same way that AppShellService does in
Mozilla. And then maybe only register that component on platforms that need it.
Comment 57•24 years ago
|
||
Yeah, the more that I think about it the more that I think that this needs to be
generalized outside of the window watcher service. This pattern of modality in
the event queues is used throughout the product so it's something that we should
fix properly. The right place to do that might actually in the app shell
service in the call that pushes the thread event queue.
So what do we do here for now? #ifdef it? I need to make sure that we listen
to the new event queue before we start our document load for the dialog. The
existing interfaces which I am loathe to change don't support it. 0.9 is
waiting on this so we need to find something quick. I'd be OK with doing so
assuming that we open another bug about the other issue.
Comment 58•24 years ago
|
||
Comment 59•24 years ago
|
||
Reporter | ||
Comment 60•24 years ago
|
||
Cool, opening bug 78421 was the thing to do. In the meanwhile, r=ccarlen on
latest patch.
Comment 61•24 years ago
|
||
I don't understand how Java gets along without wonderful ifdefs. With the 0.9
rush and all, it's fine by me.
Comment 62•24 years ago
|
||
I think that Java runs out of process on unix.
Comment 63•24 years ago
|
||
sr=tor
Comment 64•24 years ago
|
||
a= asa@mozilla.org for checkin to 0.9
Comment 65•24 years ago
|
||
Comment 66•24 years ago
|
||
Modal dialogs that are actually modal - imagine that!
sr=tor
Comment 67•24 years ago
|
||
OK, the gtk/linux code is checked in. Is there anything left?
Reporter | ||
Comment 68•24 years ago
|
||
We've got winEmbed, mfcEmbed, PPEmbed, and now gtkWidget. That leaves activex.
CC'ing Adam. I thought he was at some point...
Comment 70•24 years ago
|
||
Oh, does this need to be done for 0.9 or not? I've got my fix in but I don't
know if anyone else has critical-must-fix-for-0.9 items in this bug.
Comment 71•24 years ago
|
||
Oh man. I know what *I* would do if somebody surprised me with a critical 0.9 bug
two weeks after the tree closed for 0.9. Personally, I forgot about activeX. I
think it's important to keep all 96 of the *&#$ embedding test beds updated, but
we might as well bow to reality and give activeX over to 0.9.1. The only problem
with that would come if someone was planning on building on the 0.9 release for
their own activeX embedded widget. I don't know of any such projects (not that
that's very telling). If there are any, I say we make apologetic noises and point
them at the other testbeds for tips.
Whiteboard: want for 0.9 - have win32 code, need in linux → want for 0.9 - missing ActiveX testbed impl
Assignee | ||
Comment 72•24 years ago
|
||
This bug can go in the 0.9.1 pile since it's just me to do now. As long as 0.9
compiles I'm happy for the control to be promptless for the time being.
Target Milestone: mozilla0.9 → mozilla0.9.1
Assignee | ||
Comment 73•24 years ago
|
||
Assignee | ||
Comment 74•24 years ago
|
||
Can I have a review on my patch please?
I've pretty much stuck the old prompting code into the new prompt boiler plate
code. The only thing of note is that I've added a static member to
CMozillaBrowser containing list of all open control instances. This allows the
prompter to search for the correct browser instance from the provided DOM
window.
Reporter | ||
Comment 75•24 years ago
|
||
Looks good. One question though - instead of maintaining your own list of
browser windows when windowwatcher is already doing that, can you just exploit
windowwatcher for this? In my equivalent to GetOwningBrowser, I did something
like this:
LCommander* CPromptService::GetParentCommander(nsIDOMWindow* aDOMWindow)
{
nsCOMPtr<nsIWindowWatcher>
wwatch(do_GetService("@mozilla.org/embedcomp/window-watcher;1"));
if (!wwatch) return nsnull;
nsCOMPtr<nsIWebBrowserChrome> windowChrome;
rv = wwatch->GetChromeForWindow(aDOMWindow, getter_AddRefs(windowChrome));
if (NS_FAILED(rv)) return nsnull;
nsCOMPtr<nsIEmbeddingSiteWindow> window(do_QueryInterface(windowChrome, &rv));
if (NS_FAILED(rv)) return nsnull;
WindowPtr macWindow;
rv = window->GetSiteWindow(&macWindow);
if (NS_FAILED(rv)) return nsnull;
Assuming your nsIEmbeddingSiteWindow::GetSiteWindow() returns an HWND, that
would work.
Comment 76•24 years ago
|
||
+ for (i = 0; i < CMozillaBrowser::sBrowserList.Count(); i++)
+ {
+ CMozillaBrowser *p = (CMozillaBrowser *) CMozillaBrowser::sBrowserList[i];
+ if (p->mWebBrowser)
+ {
+ nsIDOMWindow *domWindow = nsnull;
+ p->mWebBrowser->GetContentDOMWindow(&domWindow);
+ if (domWindow == parent)
+ {
+ NS_RELEASE(domWindow);
+ return p;
+ }
+ NS_RELEASE(domWindow);
+ }
+ }
Why not use nsCOMPtr<> there and use .get() to do the comparison?
Other than that and what conrad mentioned, r/sr=blizzard
Assignee | ||
Comment 77•24 years ago
|
||
I need the web browser object, not the native HWND, so I'm not sure if using
window watcher would be any easier.
I've changed the interface pointer code to smart pointers however.
Reporter | ||
Comment 78•24 years ago
|
||
> I need the web browser object
You're right - looking at what CMozillaBrowser::MessageBox does (which I should
have done before).
r=ccarlen
Assignee | ||
Comment 79•24 years ago
|
||
Thanks guys fix is checked in.
Marking bug FIXED
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 80•24 years ago
|
||
reassigned qa contact to dsirnapalli. He's working with nsIPrompt
QA Contact: depstein → dsirnapalli
Assignee | ||
Comment 81•24 years ago
|
||
If there is someone familiar with the issues still remaining about nsIAuthPrompt
and embedding, could they add an explanation to bug 82516 so I know what I'm
meant to do?
As far as I can tell, no embedding client uses nsIAuthPrompt any more so I'm a
wondering if this bug can be closed.
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•