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

Key: LPP-5130
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: Brendan Fagan
Votes: 0
Watchers: 1
Operations

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

resources in DHTML fail with "is not a function'" error

Created: 19/Nov/07 10:16 AM   Updated: 28/Jan/08 11:27 AM
Component/s: Kernel - DHTML
Affects Version/s: RingDing (4.1)
Fix Version/s: RingDing (4.1)

Time Tracking:
Not Specified

Environment:
Firefox 2.0.0.9
OS X 10.4

Severity: Critical
Fixed in Change#: 7,414
Runtime: N/A
Flags: Support
Fix in hand: False


 Description  « Hide
I'm running into an issue with resources. At first, I thought it was just multiframed resources, but after weeding through some of those, I hit a single resource instance.

I consistently get an error of this nature:

'({ptype:"sr",
frames:["diamond/client/skin/gloss/silver/grid/row_mo.png",
"diamond/client/skin/gloss/silver/grid/row_slct.png"], width:6,
height:20}) is not a function'

The section of generated DHTML below is related to the error. The specific line specified by the error is the "(funtion() {" line.

Debug.evalCarefully("../../applib/contacts/style/library.lzx", 161, function () {
return LzResourceLibrary
}, this).gloss_silver_listhilite_rsc = {ptype: "sr", frames: ["diamond/client/skin/gloss/silver/grid/row_mo.png", "diamond/client/skin/gloss/silver/grid/row_slct.png"], width: 6, height: 20}
(function () {
var $lzsc$temp =
/* -*- file: ../../applib/contacts/style/gloss_silver.lzx#7.94 -*- */
function () {
var $1___cssRule$LZ27 = new (Debug.evalCarefully("../../applib/contacts/style/gloss_silver.lzx", 7, function () {
return LzCSSStyleRule
}, this))();
$1___cssRule$LZ27.selector = ["contactswindow", {attrname: "name", attrvalue: "mypanel"}];
$1___cssRule$LZ27.properties = {panelBottomLeftResource: "gloss_silver_panel_botlft_rsc", panelBottomMiddleResource: "gloss_silver_panel_botmid_rsc", panelBottomRightResource: "gloss_silver_panel_botrt_rsc", panelMiddleLeftResource: "gloss_silver_panel_midlft_rsc", panelMiddleMiddleColor: 16777215, panelMiddleRightResource: "gloss_silver_panel_midrt_rsc", panelTopLeftResource: "gloss_silver_panel_toplft_rsc", panelTopMiddleResource: "gloss_silver_panel_topmid_rsc", panelTopRightResource: "gloss_silver_panel_toprt_rsc"}

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
P T Withington - 19/Nov/07 11:05 AM
Potentially another unparser bug.

Can you look at the source file: ../../applib/contacts/style/gloss_silver.lzx#7.94 and see if it is doing something like:

new LzCSSStyleRule();

If it is, you may be able to work around the bug by saying:

new LzCSSStyleRule;

instead. They are equivalent.

It looks to me like the debug annotation that is trying to catch undefined references is confusing the new call into thinking that it is:

(new a)();

rather than:

(new a());

?

P T Withington - 19/Nov/07 11:44 AM
Nope. This code is coming directly from the DHTML writer in the tag compiler. I need to dig...

P T Withington - 27/Nov/07 03:32 PM
Simple test case:

<canvas>
  <script>
    var zot = {};
    zot.rsc = {ptype: "sr", frames: ["diamond/client/skin/gloss/silver/tab/tab_dslct_rt.png", "diamond/client/skin/gloss/silver/tab/tab_slct_rt.png", "diamond/client/skin/gloss/silver/tab/tab_mo_rt.png"], width: 9, height: 25};
    (function () {
    Debug.write("hello");
    })();
  </script>
</canvas>

Works in swf, bombs in dhtml.

Elliot Winard - 28/Nov/07 03:11 PM
simple test case now works but lzmail in webtop shows a different error when compiling to DHTML -
$1.indexOf is not a function
setResource(0)LFCdhtml.js (line 2237)
(no name)(0)LFCdhtml.js (line 4655)
(no name)(Object resource=panelTopLeftResource, Object name=tl $classrootdepth=1)LFCdhtml.js (line 731)
(no name)(panel name: panel __LZUID=__U61 _instanceAttrs=Object, Object name=tl $classrootdepth=1, null, true)LFCdhtml.js (line 692)
nc()LFCdhtml.js (line 86)
(no name)(Object attrs=Object name=view, true)LFCdhtml.js (line 1015)
(no name)([This is the canvas hasdatapath=true datapath=Object, [Object attrs=Object name=text, Object attrs=Object name=mailwindow, Object attrs=Object name=contactswindow, 277 more...], LzView name: gAbout id: gAbout __LZUID=__U60 _instanceAttrs=Object, 3 more...], 500)LFCdhtml.js (line 10961)
(no name)()LFCdhtml.js (line 10934)
(no name)(2625)LFCdhtml.js (line 1679)
__idleupdate()LFCdhtml.js (line 12427)
__update()LFCdhtml.js (line 1721)
[Break on this error] if($1.indexOf("http:")==0||$1.indexOf("https:")==0){

Elliot Winard - 28/Nov/07 03:25 PM
The problem might be LPP-4757. That was a bug that I filed with a workaround back when I did the first & second DHTML passes. I can look into implementing the workaround in the diamond-dhtml branch or you can just fix that one. :)

Elliot Winard - 28/Nov/07 03:25 PM
so i think this particular bug is fixed

P T Withington - 29/Nov/07 05:27 AM
This is a real bug, it only shows up in debug mode. I have a fix out for review with Don.

If you load with debug mode off, or if you have my fix, then you see the next error that you report above, but that is a new bug (so I will split it off).

P T Withington - 29/Nov/07 05:31 AM

P T Withington - 29/Nov/07 09:36 AM
r7414 | ptw | 2007-11-29 12:32:27 -0500 (Thu, 29 Nov 2007) | 38 lines
Changed paths:
   M /openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java

Change 20071129-ptw-o by ptw@dueling-banjos.local on 2007-11-29 12:29:35 EST
    in /Users/ptw/OpenLaszlo/ringding-2
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Don't try to be so cute about using implicit semicolons in
   Javascript compiler

Bugs Fixed:
LPP-5130 'resources in DHTML fail with "is not a function'" error'

Technical Reviewer: dda@ddanderson.com (Message-Id: <E9BECAAE-BA1E-4703-A5CD-EE18EBB925D7@ddanderson.com>)
QA Reviewer: enw (pending)

Details:
   We used to try to be clever and use newlines in place of
   semicolons in our 'compressed' code so that the code was a little
   more human-readable (and debuggable, using the native browser
   debugger). But this cuteness was just broken and caused some
   expressions to not be interpreted as statements (and often to be
   interpreted as function calls). Without a huge amount of work, it
   is difficult to correctly compute where an implicit semicolon can
   be used.

   Instead, we now always end a statement with a semicolon and only
   elide them before the close brace of a block (which is easily
   computable). And, we output blocks a little more compactly,
   actually improving the 'compression' of our Javascript output.

   The primary change is to remove the old heuristic that inserted
   semicolons in between statements in a statement list, and to
   explicitly append one to each statement. Put all the block
   building in one method instead of inlining it all over the place.

Tests:
   smokecheck, test case in bug, lzmail in DHTML now gets past the
   reported error


Mamye Kratt - 28/Jan/08 11:27 AM
(trunk 4 build r7884)
smokecheck and test case in bug run successfully.