~ubuntu-branches/ubuntu/oneiric/moin/oneiric-security

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/classes/fckiecleanup.js

  • Committer: Bazaar Package Importer
  • Author(s): Jamie Strandboge
  • Date: 2010-03-30 12:55:34 UTC
  • mfrom: (0.1.17 sid)
  • Revision ID: james.westby@ubuntu.com-20100330125534-4c2ufc1rok24447l
Tags: 1.9.2-2ubuntu1
* Merge from Debian testing (LP: #521834). Based on work by Stefan Ebner.
  Remaining changes:
 - Remove python-xml from Suggests field, the package isn't anymore in
   sys.path.
 - Demote fckeditor from Recommends to Suggests; the code was previously
   embedded in moin, but it was also disabled, so there's no reason for us
   to pull this in by default currently. Note: This isn't necessary anymore
   but needs a MIR for fckeditor, so postpone dropping this change until
   lucid+1
* debian/rules:
  - Replace hardcoded python2.5 with python* and hardcore python2.6 for ln
* debian/control.in: drop versioned depends on cdbs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 
 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
4
 
 *
5
 
 * == BEGIN LICENSE ==
6
 
 *
7
 
 * Licensed under the terms of any of the following licenses at your
8
 
 * choice:
9
 
 *
10
 
 *  - GNU General Public License Version 2 or later (the "GPL")
11
 
 *    http://www.gnu.org/licenses/gpl.html
12
 
 *
13
 
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
 
 *    http://www.gnu.org/licenses/lgpl.html
15
 
 *
16
 
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
17
 
 *    http://www.mozilla.org/MPL/MPL-1.1.html
18
 
 *
19
 
 * == END LICENSE ==
20
 
 *
21
 
 * FCKIECleanup Class: a generic class used as a tool to remove IE leaks.
22
 
 */
23
 
 
24
 
var     FCKIECleanup = function( attachWindow )
25
 
{
26
 
        // If the attachWindow already have a cleanup object, just use that one.
27
 
        if ( attachWindow._FCKCleanupObj )
28
 
                this.Items = attachWindow._FCKCleanupObj.Items ;
29
 
        else
30
 
        {
31
 
                this.Items = new Array() ;
32
 
 
33
 
                attachWindow._FCKCleanupObj = this ;
34
 
                FCKTools.AddEventListenerEx( attachWindow, 'unload', FCKIECleanup_Cleanup ) ;
35
 
//              attachWindow.attachEvent( 'onunload', FCKIECleanup_Cleanup ) ;
36
 
        }
37
 
}
38
 
 
39
 
FCKIECleanup.prototype.AddItem = function( dirtyItem, cleanupFunction )
40
 
{
41
 
        this.Items.push( [ dirtyItem, cleanupFunction ] ) ;
42
 
}
43
 
 
44
 
function FCKIECleanup_Cleanup()
45
 
{
46
 
        if ( !this._FCKCleanupObj || ( FCKConfig.MsWebBrowserControlCompat && !window.FCKUnloadFlag ) )
47
 
                return ;
48
 
 
49
 
        var aItems = this._FCKCleanupObj.Items ;
50
 
 
51
 
        while ( aItems.length > 0 )
52
 
        {
53
 
 
54
 
                // It is important to remove from the end to the beginning (pop()),
55
 
                // because of the order things get created in the editor. In the code,
56
 
                // elements in deeper position in the DOM are placed at the end of the
57
 
                // cleanup function, so we must cleanup then first, otherwise IE could
58
 
                // throw some crazy memory errors (IE bug).
59
 
                var oItem = aItems.pop() ;
60
 
                if ( oItem )
61
 
                        oItem[1].call( oItem[0] ) ;
62
 
        }
63
 
 
64
 
        this._FCKCleanupObj = null ;
65
 
 
66
 
        if ( CollectGarbage )
67
 
                CollectGarbage() ;
68
 
}