[Laszlo-dev] How should DHTML handle these lzunit smokecheck expected errors?

P T Withington ptw at openlaszlo.org
Wed Nov 8 07:48:30 PST 2006


Yes, there is.  I think I had code in the compiler to deal with this,  
but I disabled it because it made the overhead in debug builds too  
onerous.  Is the browser halting because of the reference to  
undefined (which I thought should be protected already) or because we  
are trying to de-reference undefined (which is the check that I have  
turned off)?

On 2006-11-07, at 23:52 EST, Henry Minsky wrote:

> The code in the Debug portion of the test below causes a fatal  
> error in
> DHTML
>
>    undefined.flooglesnort;
>
> Is there some way we can use evalCarefully in this portion to tally  
> the
> error but not halt
> the DHTML javascript interpereter?
>
>
>
>    <method name="testUndefinedErrors">
>    <![CDATA[
>      expectedError = function(m) {
>          return m.indexOf(arguments.callee.expectedMatch) != -1;
>      }
>      expectedError.toString = function () {
>          return '/.*' + this.expectedMatch + '.*/';
>      }
>
>      expectedError.expectedMatch = "testing";
>      error("testing: 1, 2, 3");
>      assertEquals(1, expectedErrors, "Total number of expected  
> errors");
>
>      expectedError.expectedMatch = "This is a";
>      $reportSourceWarning(0, 0, "This is a test");
>      assertEquals(2, expectedErrors, "Total number of expected  
> errors");
>
>      // These tests only work if debugging is enabled
>      if (Debug) {
>        expectedError.expectedMatch = "flooglesnort";
>        // TODO: [2002-11-16 ptw] below currently signals two errors
>    ===>    undefined.flooglesnort;
>        assertEquals(4, expectedErrors, "Total number of expected  
> errors");
>
>        nonFunction.flooglesnort;
>        assertEquals(5, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "call to undefined function";
>        flooglesnort();
>        assertEquals(6, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "call to non-function";
>        nonFunction();
>        assertEquals(7, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "call to undefined method";
>        nonFunction.flooglesnort();
>        assertEquals(8, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "call to non-method";
>        nonFunction.nonMethod();
>        assertEquals(9, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "undefined variable";
>        this.devnull = flooglesnort;
>        assertEquals(10, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "undefined object";
>        undefined['flooglesnort'];
>        assertEquals(11, expectedErrors, "Total number of expected  
> errors");
>
>        expectedError.expectedMatch = "undefined property";
>        nonFunction[undefined] = 'this is an error';
>        assertEquals(12, expectedErrors, "Total number of expected  
> errors");
>      }
>      ]]>
>    </method>
>
> -- 
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list