History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-4261
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: Guy Rouillier
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Unable to load and unload resources repeatedly - DHTML

Created: 09/Jul/07 09:18 AM   Updated: 30/Jan/08 03:08 PM
Component/s: Components - LZ
Affects Version/s: 4.0.2
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

File Attachments: 1. File LPP-4261.lzx (0.4 kb)

Image Attachments:

1. foo.jpg
(10 kb)

Severity: Minor
Fixed in Change#: 7,261
Runtime: N/A
Fix in hand: False


 Description  « Hide
Please see the following forum discussion for details and suggestions for code changes: http://forum.openlaszlo.org/showthread.php?p=31951.

The basic issue is that, with the DHTML runtime, if an application attempts to load a resource, then unload it, then repeat that process, one error or another will be encountered. If the app does a setResource() followed by an unload(), a subsequent setResource appears to simply do nothing. If the app does a setSource() followed by an unload(), a subsequent setSource() will encounter an error like this:

ERROR: uncaught exception: [Exception... "Node was not found" code: "8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location: "https://localhost/scc2/lps/includes/lfc/LFCdhtml-debug.js Line: 4835"]

Currently, the only way to give the appearance of unloading a resource if you want to load it again is to use setSource() to load it, and then use setSource() to load an *empty* resource (e.g., a gif file with no visual element) in it's place. This can be successfully repeated. This is, obviously, not a very clean solution.
  

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Max Carlson - 16/Aug/07 09:08 PM
Author: max
Date: 2007-08-16 21:07:26 -0700 (Thu, 16 Aug 2007)
New Revision: 6105

Modified:
   openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
Log:
Change 20070816-maxcarlson-h by maxcarlson@plastik on 2007-08-16 19:59:43 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: Fix resource unload/reload in dhtml

New Features:

Bugs Fixed: LPP-4261 - Unable to load and unload resources repeatedly - DHTML

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
    

Tests: See LPP-4261.



Modified: openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-08-17 04:03:24 UTC (rev 6104)
+++ openlaszlo/branches/wafflecone/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-08-17 04:07:26 UTC (rev 6105)
@@ -1438,6 +1438,8 @@
         this.__ImgPool.destroy();
         this.__ImgPool = null;
     }
+ if (this.__LZimg) this.__discardElement(this.__LZimg);
+ this.__LZimg = null;
 }
 
 /**


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Steve O'Sullivan - 19/Oct/07 09:42 AM
Multiple calls to setResource() and unload() only work the first time. Tested r6893 using IE7 and a dhtml compilation of the app.


STEPS:
1. compile script LPP-4261.lzx as dhtml.
2. click on resource button and unload button multiple times
3. click on source button and unload button multiple times

RESULTS:
Only first triggering of setresource() and unload() will have an effect. Subsequent triggerings of those calls will not display and clear a picture. Triggering setSource() and unload() multiple times throws no errors.

EXPECTED:
Triggering setResource() and then an unload() should work as many times as they are triggered.

Max Carlson - 14/Nov/07 11:12 AM
Author: max
Date: 2007-11-14 11:08:10 -0800 (Wed, 14 Nov 2007)
New Revision: 7261

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
   openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
Log:
Change 20071114-maxcarlson-Q by maxcarlson@Roboto on 2007-11-14 10:00:18 PST
    in /Users/maxcarlson/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Allow resources to be reloaded after unload()

New Features:

Bugs Fixed: LPP-4261 - Unable to load and unload resources repeatedly - DHTML

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: LzSprite.js - clear out .reloaded when unload() is called.

LaszloView.lzs - clear out ._reloaded when unload() is called.
    

Tests: See LPP-4261



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-11-14 18:56:47 UTC (rev 7260)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-11-14 19:08:10 UTC (rev 7261)
@@ -1509,6 +1509,7 @@
 }
 
 LzSprite.prototype.unload = function () {
+ this.resource = null;
     if (this.__ImgPool) {
         this.__ImgPool.destroy();
         this.__ImgPool = null;

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-11-14 18:56:47 UTC (rev 7260)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-11-14 19:08:10 UTC (rev 7261)
@@ -2288,6 +2288,7 @@
   * Unloads media loaded with setSource or the source= attribute.
   * */
 function unload ( ){
+ this._resource = null;
     //this function formerly lived on the LzMakeLoad transformer
     this.sprite.unload();
 }


_______________________________________________
Laszlo-checkins mailing list
Laszlo-checkins@openlaszlo.org
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Mamye Kratt - 30/Jan/08 03:08 PM
(trunk 4 local build r7930)
Closed, tested with both the attached file and Max's test in the bug.