Last Comment Bug 310109 - XForms model-destruct event doesn't work with fastback
: XForms model-destruct event doesn't work with fastback
Status: RESOLVED FIXED
: fixed1.8.0.2, fixed1.8.1
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: Trunk
: All All
: P1 normal (vote)
: ---
Assigned To: aaronr
: Stephen Pride
Mentors:
: 299258 (view as bug list)
Depends on:
Blocks: 278448
  Show dependency treegraph
 
Reported: 2005-09-26 15:12 PDT by Brian Ryner (not reading)
Modified: 2016-07-15 14:46 PDT (History)
4 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
proposed fix (18.58 KB, patch)
2005-12-12 18:14 PST, aaronr
bugs: review+
doronr: review+
Details | Diff | Splinter Review
patch fixing smaugs comments (17.68 KB, patch)
2005-12-13 12:14 PST, aaronr
no flags Details | Diff | Splinter Review

Description Brian Ryner (not reading) 2005-09-26 15:12:57 PDT
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.
Comment 1 Allan Beaufour 2005-09-27 06:18:56 PDT
(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
Comment 2 aaronr 2005-12-12 18:11:01 PST
*** Bug 299258 has been marked as a duplicate of this bug. ***
Comment 3 aaronr 2005-12-12 18:14:13 PST
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 4 Olli Pettay [:smaug] (vacation Aug 25-28) 2005-12-12 20:04:37 PST
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).
Comment 5 aaronr 2005-12-13 12:14:22 PST
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.
Comment 6 Doron Rosenberg (IBM) 2005-12-13 13:20:46 PST
checked into trunk
Comment 7 aaronr 2006-02-02 17:28:29 PST
checked into MOZILLA_1_8_BRANCH via bug 323691.  Leaving open for now until it gets into 1.8.0
Comment 8 aaronr 2006-07-07 11:53:37 PDT
verified fixed in MOZILLA_1_8_BRANCH

Note You need to log in before you can comment on or make changes to this bug.