Spun off from bug 293386 comment 10 : There's a problem with the way XForms currently does its model-destruct events. It does them via XTF's DocumentChange notification, which happens when UnbindFromTree is called... after the document has been detached from the window. That means that an event listener on the window won't be able to listen for these events. Given the way this event is defined to work, I think the most straightforward solution is to have XForms listen for unload and dispatch this event from there, when the window is still intact. This will have the effect of disabling fastback for documents containing XForms content. If that's no good, another solution would be to add the unload listener only if model-destruct listeners exist, but that could be quite involved.
(In reply to comment #0) > This will have the effect of disabling fastback for documents containing > XForms content. :( That would be sad. Hmmm, the model-destruct event is defined as: "Dispatched by the processor to advise of imminent shutdown of the XForms Processor, which can occur from user action, or from the load XForms Action, or as a result of form submission." Yes, I guess "shutdown" is not inactive/not shown. > If that's no good, another solution would be to add the unload listener only if > model-destruct listeners exist, but that could be quite involved. Yeah, that sounds a bit tricky. I guess, the best easy fix is to just use "unload" as you say, and then ignore caching for now... hhmmm
*** Bug 299258 has been marked as a duplicate of this bug. ***
Created attachment 205685 [details] [diff] [review] proposed fix changed xforms-model-destruct code to cue off of "unload" event. My patch also changes other places that need to get nsIDOMWindowInternal so that we all go through nsXFormsUtils to do the work. Eliminates a lot of duplication of the same code.
Comment on attachment 205685 [details] [diff] [review] proposed fix >- // We may still be waiting on external documents to load. >- MaybeNotifyCompletion(); >- > return NS_OK; >+ > } Extra newline after return >+nsresult >+nsXFormsUtils::GetWindowFromDocument(nsIDOMDocument *aDoc, >+ nsIDOMWindowInternal **aWindow) Align parameters With those, r=me. This patch should do the trick, although it is unfortunate that we have to use unload (and disable bfcache).
Created attachment 205748 [details] [diff] [review] patch fixing smaugs comments this patch fixes smaug's comments. Doron also caught that I introduced some nsresult rv local variables that I ended up not using. So I cleaned those up, too.
checked into trunk
checked into MOZILLA_1_8_BRANCH via bug 323691. Leaving open for now until it gets into 1.8.0
verified fixed in MOZILLA_1_8_BRANCH